Merge pull request #51 from deepray-AI/hotfix #209
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deepray-release | |
on: | |
release: | |
types: [published] | |
tags: | |
- v* | |
push: | |
branches: | |
- main | |
- r* | |
pull_request: | |
branches: | |
- main | |
- r* | |
env: | |
MIN_PY_VERSION: "3.8" | |
MAX_PY_VERSION: "3.10" | |
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: Bazel cache | |
# id: bazel-cache | |
# uses: actions/cache@v2 | |
# env: | |
# version: 4.2.1 | |
# with: | |
# path: | | |
# ~/.cache/bazel | |
# key: ${{ runner.os }}-{{ env.version }}-bazel-cache | |
# - name: Install bazelisk | |
# run: | | |
# curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.1.0/bazelisk-linux-amd64" | |
# mkdir -p "${GITHUB_WORKSPACE}/bin/" | |
# mv bazelisk-linux-amd64 "${GITHUB_WORKSPACE}/bin/bazel" | |
# chmod +x "${GITHUB_WORKSPACE}/bin/bazel" | |
# - 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 | |
# python configure.py | |
# bazel test -k --test_timeout 300,450,1200,3600 --test_output=errors //deepray/... | |
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: ["ubuntu-20.04"] | |
py-version: [ | |
"3.8", | |
"3.9", | |
"3.10", | |
# "3.11" | |
] | |
tf-version: ["2.9.3"] | |
cpu: ["x86"] | |
# include: | |
# - os: 'macos-12' | |
# cpu: 'arm64' | |
# tf-version: '2.9.3' | |
# py-version: '3.8' | |
# - os: 'macos-12' | |
# cpu: 'arm64' | |
# tf-version: '2.9.3' | |
# py-version: '3.9' | |
# - os: 'macos-12' | |
# cpu: 'arm64' | |
# tf-version: '2.9.3' | |
# py-version: '3.10' | |
fail-fast: false | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: false | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- 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.9.3' | |
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 ./ | |
- if: matrix.py-version != '3.11' || matrix.tf-version == '2.9.3' | |
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 | |
- if: matrix.py-version != '3.11' || matrix.tf-version == '2.9.3' | |
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: ["Linux"] | |
py-version: [ | |
"3.8", | |
"3.9", | |
"3.10", | |
# "3.11" | |
] | |
tf-version: ["2.9.1"] | |
cpu: ["x86"] | |
# include: | |
# - os: 'macOS' | |
# cpu: 'arm64' | |
# tf-version: '2.9.3' | |
# py-version: '3.8' | |
# - os: 'macOS' | |
# cpu: 'arm64' | |
# tf-version: '2.9.3' | |
# py-version: '3.9' | |
# - os: 'macOS' | |
# cpu: 'arm64' | |
# tf-version: '2.9.3' | |
# py-version: '3.10' | |
fail-fast: false | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || 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-release-container: | |
name: Upload release container to DockerHub | |
needs: [ | |
release-wheel, | |
# test-with-bazel | |
] | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
py-version: [ | |
"3.8", | |
"3.9", | |
"3.10", | |
# "3.11" | |
] | |
tf-version: ["2.9.3"] | |
fail-fast: false | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
env: | |
PY_VERSION: ${{ matrix.py-version }} | |
TF_VERSION: ${{ matrix.tf-version }} | |
- run: | | |
set -e -x | |
bash tools/build_base_container.sh ${PY_VERSION} ${TF_VERSION} | |
docker push hailinfufu/deepray-release:latest-py${PY_VERSION}-tf${TF_VERSION}-cu116-ubuntu20.04 |