Skip to content

Simplify release flow #29

Simplify release flow

Simplify release flow #29

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
create_draft_release:
if: github.ref_type == 'tag'
permissions:
contents: write
runs-on: ubuntu-20.04
steps:
- name: Create draft release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! gh release list | grep -q ${{ github.ref_name }}; then
gh release create --title ${{ github.ref_name }} --draft ${{ github.ref_name }}
fi
linux:
name: "x86_64-linux-gnu-{cpu,tpu}"
needs: [create_draft_release]
# 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_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
- run: .github/scripts/compile_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: tpu
CC: gcc-9
macos:
name: "x86_64-darwin-cpu"
needs: [create_draft_release]
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_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
CC: gcc-9
macos_arm:
name: "aarch64-darwin-cpu (cross-compiled)"
needs: [create_draft_release]
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_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
XLA_TARGET_PLATFORM: "aarch64-darwin"
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=macos_arm64"
CC: gcc-9
linux_cuda:
name: "x86_64-linux-gnu-${{ matrix.xla_target }}"
needs: [create_draft_release]
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.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_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: ${{ matrix.xla_target }}
linux_arm:
name: "aarch64-linux-gnu-cpu (cross-compiled)"
needs: [create_draft_release]
# 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_and_upload.sh ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
XLA_TARGET: cpu
XLA_TARGET_PLATFORM: "aarch64-linux-gnu"
# Explicitly cross-compile for arm64
BUILD_FLAGS: "--config=elinux_aarch64"
CC: gcc-9