Skip to content

Release

Release #26

Workflow file for this run

name: Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
# linux x86_64 cpu/tpu
linux:
# We intentionally build on ubuntu 20 to compile against
# an older version of glibc
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archives
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: tpu
CC: gcc-9
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # linux x86_64 cpu musl
# alpine:
# runs-on: ubuntu-20.04
# strategy:
# fail-fast: false
# container: hexpm/elixir:1.13.4-erlang-25.0.2-alpine-3.16.0
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# XLA_TARGET: cpu
# BAZEL_VERSION: "5.3.0"
# BAZEL_SHA256SUM: "ee801491ff0ec3a562422322a033c9afe8809b64199e4a94c7433d4e14e6b921 bazel-5.3.0-dist.zip"
# JAVA_HOME: "/usr/lib/jvm/default-jvm"
# steps:
# - name: Install system packages
# run: |
# apk update && apk upgrade && \
# apk add --no-cache python3 py3-pip python3-dev py3-numpy && \
# apk add --no-cache libstdc++ openjdk11 && \
# apk add --no-cache bash curl git wget && \
# apk add --no-cache musl-dev make libexecinfo libexecinfo-dev && \
# apk add --no-cache coreutils gcc g++ linux-headers unzip zip && \
# apk add --no-cache automake gcc subversion && \
# apk add --no-cache github-cli && \
# DIR=$(mktemp -d) && cd ${DIR} && \
# curl -sLO https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-dist.zip && \
# echo ${BAZEL_SHA256SUM} | sha256sum --check && \
# unzip bazel-${BAZEL_VERSION}-dist.zip && \
# EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" bash ./compile.sh && \
# cp ${DIR}/output/bazel /usr/local/bin/ && \
# rm -rf ${DIR}
# - name: Install hex
# run: mix local.hex --force && mix local.rebar --force
# # Prevent git from checking the repository owner and erroring with "dubious ownership"
# - run: git config --global --add safe.directory '*'
# - uses: actions/checkout@v3
# # Build and upload the archive
# - run: mix deps.get
# - run: .github/scripts/compile_unless_exists.sh
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# XLA_TARGET: cpu
# - run: .github/scripts/upload_archives.sh
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# darwin x86_64 cpu
macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- run: brew install elixir
- run: mix local.hex --force
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# darwin aarch64 cpu (cross-compiled)
macos_arm:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- run: brew install elixir
- run: mix local.hex --force
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=macos_arm64"
CC: gcc-9
- name: Rename archive
run: |
# Ensure tasks are compiled
mix compile
build_archive_dir=$(mix xla.info build_archive_dir)
if [[ -d $build_archive_dir ]]; then
archive_path=$(find $build_archive_dir -type f)
actual_archive_path="${archive_path/x86_64/aarch64}"
echo "$archive_path -> $actual_archive_path"
mv $archive_path $actual_archive_path
fi;
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# linux x86_64 cuda
linux_cuda:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
# Note: we use exact references, because the images may be updated with cuDNN
# version bumps unexpectedly
# - container: nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04
- container: nvidia/cuda@sha256:275d35f7985cfe12dc3e6e40a3df5fff2bb217b1c248f0f70dadaa298d1b938b
xla_target: cuda114
python: "3.9"
# - container: nvidia/cuda:11.8.0-cudnn8-devel-ubuntu20.04
- container: nvidia/cuda@sha256:3e11776b02b6bb3a0e707e68b9b2524e3cfc436d2ca8fb1aef60c999cff5064b
xla_target: cuda118
python: "3.9"
# - container: nvidia/cuda:12.0.0-cudnn8-devel-ubuntu20.04
- container: nvidia/cuda@sha256:c004833aa563c0c1068a9fe3f77d92ce1a07425b1ddc8637ba4f274e63403b26
xla_target: cuda120
python: "3.9"
container: ${{ matrix.container }}
env:
# This env is normally set by default, but we need to mirror it into the container
# ourselves (used by the actions/setup-beam).
ImageOS: ubuntu20
# Set the missing UTF-8 locale, otherwise Elixir warns
LC_ALL: C.UTF-8
# Make sure installing packages (like tzdata) doesn't prompt for configuration
DEBIAN_FRONTEND: noninteractive
steps:
# The base images are minimalistic, so we bring a few necessary system packages
- name: Install system packages
run: |
# We need to install "add-apt-repository" first
apt-get update && apt-get install -y software-properties-common
# Add repository with the latest git version for action/checkout to properly clone the repo
add-apt-repository ppa:git-core/ppa
# We run as root, so sudo is not necessary per se, but some actions (like setup-bazel) make use of it
apt-get update && apt-get install -y ca-certificates curl git sudo unzip wget
# Install GitHub CLI used by our scripts
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
apt-get update && apt-get install -y gh
# Prevent git from checking the repository owner and erroring with "dubious ownership"
- run: git config --global --add safe.directory '*'
# Proceed with the regular steps
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
env:
# Avoid permission errors for /github/home, in this case the directory
# is used for pip cache and is not relevant either way
HOME: /root
- run: python -m pip install --upgrade pip numpy
# Build and upload the archive
- run: mix deps.get
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: ${{ matrix.xla_target }}
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# linux aarch64 cpu (cross-compiled)
linux_arm:
# We intentionally build on ubuntu 20 to compile against
# an older version of glibc
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: "24"
elixir-version: "1.12.3"
# Setup the compilation environment
- uses: abhinavsingh/setup-bazel@v3
with:
version: "5.3.0"
- uses: actions/setup-python@v2
with:
python-version: "3.9"
- run: python -m pip install --upgrade pip numpy
# Build and upload the archives
- run: mix deps.get
# Hide system OpenSSL as suggested in https://github.com/tensorflow/tensorflow/issues/48401#issuecomment-818377995
- run: sudo mv /usr/include/openssl /usr/include/openssl.original
- run: .github/scripts/compile_unless_exists.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=elinux_aarch64"
CC: gcc-9
- name: Rename archive
run: |
# Ensure tasks are compiled
mix compile
build_archive_dir=$(mix xla.info build_archive_dir)
if [[ -d $build_archive_dir ]]; then
archive_path=$(find $build_archive_dir -type f)
actual_archive_path="${archive_path/x86_64/aarch64}"
echo "$archive_path -> $actual_archive_path"
mv $archive_path $actual_archive_path
fi;
- run: .github/scripts/upload_archives.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}