-
Notifications
You must be signed in to change notification settings - Fork 8
219 lines (205 loc) · 6.53 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
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