-
Notifications
You must be signed in to change notification settings - Fork 141
159 lines (156 loc) · 5.47 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: tfra-release
on:
release:
types: [published]
tags:
- v*
push:
branches:
- master
- r*
pull_request:
branches:
- master
- r*
env:
MIN_PY_VERSION: '3.7'
MAX_PY_VERSION: '3.10'
HOROVOD_VERSION: '0.23.0'
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.MAX_PY_VERSION }}
- name: Build wheels
run: |
pip install --default-timeout=1000 -r tools/install_deps/pytest.txt -r tools/install_deps/tensorflow.txt -r requirements.txt
sudo apt install -y redis > /dev/null 2> /dev/null
bash tools/install_deps/install_bazelisk.sh ./
python -m pip install tensorflow-io
python -m pip install --upgrade protobuf==3.20.0
python configure.py
bazel test --local_ram_resources=4096 -c opt -k --test_timeout 300,450,1200,3600 --test_output=errors //tensorflow_recommenders_addons/...
release-wheel:
name: Build release wheels
strategy:
matrix:
# TODO: add back 'windows-latest' when it can be compiled.
os: ['macos-12', 'ubuntu-20.04']
py-version: ['3.7', '3.8', '3.9', '3.10']
tf-version: ['2.8.3', '2.11.0']
tf-need-cuda: ['0', '1']
tf-cuda-version: ['11.2']
tf-cudnn-version: ['8.1']
cpu: ['x86']
exclude:
# excludes cuda on macOS
- os: 'macos-12'
tf-need-cuda: '1'
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: clear cache folder
run: rm -rf /usr/share/dotnet /opt/ghc "/usr/local/share/boost"
- 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.11.0'
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 }}
- name: Setup Bazel
# Ubuntu bazel is run inside of the docker image
if: matrix.os != 'ubuntu-20.04'
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 }}
TF_NEED_CUDA: ${{ matrix.tf-need-cuda }}
TF_CUDA_VERSION: ${{ matrix.tf-cuda-version }}
TF_CUDNN_VERSION: ${{ matrix.tf-cudnn-version }}
NIGHTLY_TIME: ${{ steps.author-date.outputs.result }}
CPU: ${{ matrix.cpu }}
shell: bash
run: |
if [[ "$TF_VERSION" =~ ^2\.(9|10|11)\.[0-9]$ ]] ; then
export HOROVOD_VERSION="0.28.1"
fi
bash .github/workflows/make_wheel_${OS}_${CPU}.sh
- uses: haya14busa/action-cond@v1
id: device
with:
cond: ${{ matrix.tf-need-cuda == '1' }}
if_true: "gpu"
if_false: "cpu"
- uses: actions/upload-artifact@v1
with:
name: ${{ runner.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ steps.device.outputs.value }}-${{ 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:
# TODO: add back 'Windows' when it can be compiled.
os: ['macOS', 'Linux']
py-version: ['3.7', '3.8', '3.9', '3.10']
tf-need-cuda: ['0', '1']
cpu: ['x86']
exclude:
# excludes cuda on macOS
- os: 'macOS'
tf-need-cuda: '1'
fail-fast: false
if: (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release'
steps:
- uses: haya14busa/action-cond@v1
id: device
with:
cond: ${{ matrix.tf-need-cuda == '1' }}
if_true: "gpu"
if_false: "cpu"
- uses: actions/download-artifact@v1
with:
name: ${{ matrix.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ steps.device.outputs.value }}-${{ 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_API_TOKEN }}
upload-dev-container:
name: Upload dev container to DockerHub
needs: [release-wheel, test-with-bazel]
runs-on: ubuntu-20.04
strategy:
matrix:
py-version: ['3.7', '3.8', '3.9', '3.10']
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
export PY_VERSION=${{ matrix.py-version }}
bash .github/workflows/github_build_dev_container.sh
docker push tfra/dev_container:latest-python${{ matrix.py-version }}