Skip to content

[WIP] Build against TF2.16 #5130

[WIP] Build against TF2.16

[WIP] Build against TF2.16 #5130

Workflow file for this run

name: addons-release
on:
release:
types: [published]
tags:
- v*
push:
branches:
- master
- r*
pull_request:
branches:
- master
- r*
permissions:
contents: read
env:
MIN_PY_VERSION: '3.9'
MAX_PY_VERSION: '3.12'
jobs:
test-with-bazel:
name: Test with bazel
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ env.MIN_PY_VERSION }}
- name: Build wheels
run: |
pip install --default-timeout=1000 -r tools/install_deps/pytest.txt -r tools/install_deps/tensorflow-cpu.txt -r requirements.txt
bash tools/install_deps/install_bazelisk.sh ./
python configure.py
bazel test -k --test_timeout 300,450,1200,3600 --test_output=errors //tensorflow_addons/...
release-wheel:
name: Test and build release wheels
runs-on: ${{ matrix.os }}
strategy:
matrix:
# To switch on windows-2022/latest, please verify the bazel version:
# https://github.com/bazelbuild/bazel/issues/14232#issuecomment-1011247429
os: ['macos-12', 'ubuntu-20.04']
# Removing windows builds due to broken upstream package https://github.com/tensorflow/tensorflow/issues/61830
# os: ['macos-12', 'windows-2019', 'ubuntu-20.04']
py-version: ['3.9', '3.10', '3.11', '3.12']
tf-version: ['2.14.1', '2.15.1', '2.16.1']
cpu: ['x86']
include:
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.9'
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.10'
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.11'
- os: 'macos-12'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.12'
fail-fast: false
steps:
- uses: actions/github-script@0.3.0
id: author-date
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const commit_details = await github.git.getCommit({owner: context.repo.owner, repo: context.repo.repo, commit_sha: context.sha});
return commit_details.data.author.date
- if: matrix.tf-version != '2.16.1'
shell: bash
run: echo "SKIP_CUSTOM_OP_TESTS=--skip-custom-ops" >> $GITHUB_ENV
- if: github.event_name == 'push'
shell: bash
run: echo "NIGHTLY_FLAG=--nightly" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py-version }}
- if: matrix.os != 'ubuntu-20.04'
name: Setup Bazel
# Ubuntu bazel is run inside of the docker image
run: bash tools/install_deps/install_bazelisk.sh ./
- name: Build wheels
env:
OS: ${{ runner.os }}
PY_VERSION: ${{ matrix.py-version }}
TF_VERSION: ${{ matrix.tf-version }}
NIGHTLY_TIME: ${{ steps.author-date.outputs.result }}
CPU: ${{ matrix.cpu }}
shell: bash
run: bash .github/workflows/make_wheel_${OS}_${CPU}.sh
- uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel
path: wheelhouse
upload-wheels:
name: Publish wheels to PyPi
needs: [release-wheel, test-with-bazel]
runs-on: ubuntu-20.04
strategy:
matrix:
os: ['macOS', 'Linux']
# Removing windows builds due to broken upstream package https://github.com/tensorflow/tensorflow/issues/61830
# os: ['macOS', 'Windows', 'Linux']
py-version: ['3.9', '3.10', '3.11', '3.12']
tf-version: ['2.16.1']
cpu: ['x86']
include:
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.9'
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.10'
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.11'
- os: 'macOS'
cpu: 'arm64'
tf-version: '2.16.1'
py-version: '3.12'
fail-fast: false
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release'
steps:
- uses: actions/download-artifact@v1
with:
name: ${{ matrix.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ matrix.cpu }}-wheel
path: ./dist
- run: |
set -e -x
ls -la dist/
sha256sum dist/*.whl
- uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.pypi_token }}
upload-dev-container:
name: Upload dev container to DockerHub
needs: [release-wheel, test-with-bazel]
runs-on: ubuntu-20.04
env:
PY_VERSION: '3.9'
if: (github.event_name == 'push' && github.ref == 'refs/heads/master')
steps:
- uses: actions/checkout@v2
- run: |
set -e -x
echo ${{ secrets.DOCKER_PW }} | docker login --username ${{ secrets.DOCKER_USER }} --password-stdin
bash .github/workflows/github_build_dev_container.sh
docker push tfaddons/dev_container:latest-gpu