-
Notifications
You must be signed in to change notification settings - Fork 133
252 lines (249 loc) · 8.68 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
name: tfra-release
on:
release:
types: [published]
tags:
- v*
push:
branches:
- master
- r*
pull_request:
branches:
- master
- r*
env:
MIN_PY_VERSION: '3.8'
MAX_PY_VERSION: '3.11'
HOROVOD_VERSION: '0.28.1'
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==4.23.4
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-cpu:
name: Build release wheels for CPU
strategy:
matrix:
# TODO: add back 'windows-latest' when it can be compiled.
os: ['ubuntu-20.04']
py-version: ['3.11']
tf-version: ['2.16.2']
tf-need-cuda: ['0']
cpu: ['x86']
exclude:
# excludes cuda on macOS
- tf-version: '2.15.1'
py-version: '3.8'
- tf-version: '2.16.2'
py-version: '3.8'
- os: 'macos-14'
cpu: 'x86'
- os: 'ubuntu-20.04'
cpu: 'arm64'
- os: 'macos-12'
cpu: 'arm64'
- py-version: '3.8'
cpu: 'arm64'
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/[email protected]
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.15.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.tf-version > '2.15.1'
shell: bash
run: |
export TF_USE_LEGACY_KERAS=1
pip install --default-timeout=1000 tf-keras==2.16.0
- 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 }}
NIGHTLY_TIME: ${{ steps.author-date.outputs.result }}
CPU: ${{ matrix.cpu }}
shell: bash
run: |
if [[ "$TF_VERSION" =~ ^2\.(11|12|13|14|15|16)\.[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@v4
with:
name: ${{ runner.os }}-${{ matrix.py-version }}-tf${{ matrix.tf-version }}-${{ steps.device.outputs.value }}-${{ matrix.cpu }}-wheel
path: wheelhouse
release-wheel-gpu:
name: Build release wheels for GPU
needs: [release-wheel-cpu, test-with-bazel]
strategy:
matrix:
# TODO: add back 'windows-latest' when it can be compiled.
os: ['ubuntu-20.04']
py-version: ['3.8', '3.9', '3.10', '3.11']
tf-version: ['2.15.1', '2.16.2']
tf-need-cuda: ['1']
cpu: ['x86']
exclude:
- tf-version: '2.15.1'
py-version: '3.8'
- tf-version: '2.16.2'
py-version: '3.8'
fail-fast: false
runs-on: [self-hosted, Linux, X64]
steps:
- name: clear cache folder
run: rm -rf /usr/share/dotnet /opt/ghc "/usr/local/share/boost"
- uses: actions/[email protected]
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.15.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.tf-version > '2.15.1'
shell: bash
run: |
export TF_USE_LEGACY_KERAS=1
pip install --default-timeout=1000 tf-keras==2.16.0
- 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 }}
NIGHTLY_TIME: ${{ steps.author-date.outputs.result }}
CPU: ${{ matrix.cpu }}
shell: bash
run: |
if [[ "$TF_VERSION" =~ ^2\.(11|12|13|14|15|16)\.[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@v4
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-gpu]
runs-on: ubuntu-20.04
strategy:
matrix:
# TODO: add back 'Windows' when it can be compiled.
os: ['macOS', 'Linux']
py-version: ['3.8', '3.9', '3.10', '3.11']
tf-version: ['2.15.1', '2.16.2']
tf-need-cuda: ['0', '1']
cpu: ['x86', 'arm64']
exclude:
# excludes cuda on macOS
- os: 'macOS'
tf-need-cuda: '1'
- tf-version: '2.15.1'
py-version: '3.8'
- tf-version: '2.16.2'
py-version: '3.8'
- os: 'Linux'
cpu: 'arm64'
- os: 'Linux'
tf-need-cuda: '0'
- py-version: '3.8'
cpu: 'arm64'
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/[email protected]
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/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
upload-dev-container:
name: Upload dev container to DockerHub
needs: [release-wheel-gpu, test-with-bazel]
runs-on: ubuntu-20.04
strategy:
matrix:
py-version: ['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 }}