-
Notifications
You must be signed in to change notification settings - Fork 667
259 lines (256 loc) · 10.3 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
253
254
255
256
257
258
259
name: Release
on:
push:
branches:
- "release/*"
schedule:
# beijing: 2 am.
# utc: 6 pm.
- cron: "0 18 * * *"
workflow_dispatch:
inputs:
placeholder:
description: "update .github/workflows/release.yml to config your build"
required: false
workflow_call:
inputs:
is_priv:
required: true
type: boolean
branch:
required: false
type: string
default: "main"
secrets:
ONEFLOW_PRIV_ORG:
required: true
ONEFLOW_PRIV_GH_TOKEN:
required: true
ONEFLOW_PRIV_OSS_BUCKET:
required: true
OSS_ACCESS_KEY_ID:
required: true
OSS_ACCESS_KEY_SECRET:
required: true
concurrency:
group: release-${{ github.ref }}-${{ inputs.branch }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
env:
ONEFLOW_SRC: .
jobs:
generate-build-matrix:
name: "Generate build matrix"
runs-on: ubuntu-latest
env:
ONEFLOW_SRC: .
outputs:
matrix: ${{ steps.find-cache.outputs.matrix }}
formatted_date: ${{ steps.date.outputs.formatted_date }}
steps:
- name: Checkout Oneflow-Inc/oneflow
uses: actions/checkout@v2
if: ${{ !inputs.is_priv }}
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Checkout oneflow
uses: actions/checkout@v2
if: ${{ inputs.is_priv }}
with:
ref: ${{ inputs.branch }}
repository: ${{ secrets.ONEFLOW_PRIV_ORG }}/oneflow
token: ${{ secrets.ONEFLOW_PRIV_GH_TOKEN }}
- uses: Oneflow-Inc/get-oneflow/cache-complete/matrix/build@support-cu12
name: Find build cache
id: find-cache
timeout-minutes: 5
with:
delete-cache: ${{ contains(github.event.pull_request.labels.*.name, 'need-clean-ccache') }}
runner-labels: |
self-hosted
linux
release
oneflow-src: ${{ env.ONEFLOW_SRC }}
entries: |
cu122
cu121
cu118
cpu
- name: Get current date
id: date
run: echo "formatted_date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
staging_release:
env:
MANYLINUX_CACHE_DIR: ~/manylinux-cache-dir/release/${{ matrix.entry }}
WHEELHOUSE_DIR: manylinux_wheelhouse
OSS_DIR: branch/${{ github.ref_name }}/${{ matrix.entry }}/${{ github.sha }}
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_SHA: ${{ github.sha }}
ONEFLOW_OSS_BUCKET: oneflow-staging
needs: [generate-build-matrix]
name: Staging Release
timeout-minutes: 180
runs-on: [self-hosted, linux, release]
if: github.repository == 'Oneflow-Inc/oneflow' || inputs.is_priv
strategy:
fail-fast: false
max-parallel: 6
matrix: ${{ fromJson(needs.generate-build-matrix.outputs.matrix) }}
steps:
- name: Fix permissions
run: |
docker run --rm -v $PWD:/p -w /p busybox rm -rf *
- name: Install dependencies
run: |
python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install -U setuptools wheel --user
python3 -m pip install oss2 --user
- name: Checkout Oneflow-Inc/oneflow
uses: actions/checkout@v2
if: ${{ !inputs.is_priv }}
with:
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Checkout private oneflow
uses: actions/checkout@v2
if: ${{ inputs.is_priv }}
with:
ref: ${{ inputs.branch }}
repository: ${{ secrets.ONEFLOW_PRIV_ORG }}/oneflow
token: ${{ secrets.ONEFLOW_PRIV_GH_TOKEN }}
- name: Checkout cutlass_extension
uses: actions/checkout@v2
if: ${{ inputs.is_priv }}
with:
repository: ${{ secrets.ONEFLOW_PRIV_ORG }}/cutlass-extension
token: ${{ secrets.ONEFLOW_PRIV_GH_TOKEN }}
path: cutlass-extension
- name: Set Private env
if: ${{ inputs.is_priv }}
run: |
GITHUB_SHA=$(git rev-parse HEAD)
echo "OSS_DIR=branch/${{ inputs.branch }}/${{ matrix.entry }}/${GITHUB_SHA}" >> $GITHUB_ENV
echo "GITHUB_REF_NAME=${{ inputs.branch }}" >> $GITHUB_ENV
echo "GITHUB_SHA=${GITHUB_SHA}" >> $GITHUB_ENV
echo "ONEFLOW_OSS_BUCKET=${{ secrets.ONEFLOW_PRIV_OSS_BUCKET }}" >> $GITHUB_ENV
- name: Print env
if: ${{ inputs.is_priv }}
run: |
env
- uses: Oneflow-Inc/get-oneflow@support-cu12
name: Build ${{ matrix.entry }}
if: ${{ matrix.entry =='cu118' || startsWith(matrix.entry, 'cu12') }}
with:
cmake-init-cache: ${{ env.ONEFLOW_SRC }}/cmake/caches/ci/release/cu118.cmake
build-script: ${{ env.ONEFLOW_SRC }}/ci/manylinux/build-gcc9.sh
oneflow-src: ${{ env.ONEFLOW_SRC }}
oneflow-build-env: manylinux
wheelhouse-dir: ${{ env.WHEELHOUSE_DIR }}
clear-wheelhouse-dir: true
self-hosted: true
compute-platform: ${{ matrix.entry }}
manylinux-cache-dir: ${{ env.MANYLINUX_CACHE_DIR }}
docker-run-use-system-http-proxy: false
docker-run-use-lld: false
retry-failed-build: true
clean-ccache: true
nightly: ${{ github.event_name == 'schedule' || github.ref == 'refs/heads/release/add_nightly_date_index'}}
nightly-date: ${{ needs.generate-build-matrix.outputs.formatted_date }}
use-nvidia-wheels: ${{ matrix.entry !='cu112' }}
python-versions: |
3.7
3.8
3.9
3.10
- uses: Oneflow-Inc/get-oneflow@support-cu12
name: Build ${{ matrix.entry }}
if: ${{ startsWith(matrix.entry, 'cu') && matrix.entry !='cu118' && !startsWith(matrix.entry, 'cu12') }}
with:
cmake-init-cache: ${{ env.ONEFLOW_SRC }}/cmake/caches/ci/release/cuda.cmake
build-script: ${{ env.ONEFLOW_SRC }}/ci/manylinux/build-gcc9.sh
oneflow-src: ${{ env.ONEFLOW_SRC }}
oneflow-build-env: manylinux
wheelhouse-dir: ${{ env.WHEELHOUSE_DIR }}
clear-wheelhouse-dir: true
self-hosted: true
compute-platform: ${{ matrix.entry }}
manylinux-cache-dir: ${{ env.MANYLINUX_CACHE_DIR }}
docker-run-use-system-http-proxy: false
docker-run-use-lld: false
retry-failed-build: true
clean-ccache: true
nightly: ${{ github.event_name == 'schedule' || github.ref == 'refs/heads/release/add_nightly_date_index'}}
nightly-date: ${{ needs.generate-build-matrix.outputs.formatted_date }}
use-nvidia-wheels: ${{ matrix.entry !='cu112' }}
python-versions: |
3.7
3.8
3.9
3.10
- uses: Oneflow-Inc/get-oneflow@support-cu12
name: Build ${{ matrix.entry }}
if: ${{ matrix.entry =='cpu' }}
with:
cmake-init-cache: ${{ env.ONEFLOW_SRC }}/cmake/caches/ci/release/cpu.cmake
build-script: ${{ env.ONEFLOW_SRC }}/ci/manylinux/build.sh
oneflow-src: ${{ env.ONEFLOW_SRC }}
oneflow-build-env: manylinux
wheelhouse-dir: ${{ env.WHEELHOUSE_DIR }}
clear-wheelhouse-dir: true
self-hosted: true
compute-platform: ${{ matrix.entry }}
manylinux-cache-dir: ${{ env.MANYLINUX_CACHE_DIR }}
docker-run-use-system-http-proxy: false
docker-run-use-lld: false
retry-failed-build: true
clean-ccache: false
nightly: ${{ github.event_name == 'schedule' || github.ref == 'refs/heads/release/add_nightly_date_index'}}
nightly-date: ${{ needs.generate-build-matrix.outputs.formatted_date }}
python-versions: |
3.7
3.8
3.9
3.10
- name: Upload wheel
uses: ./.github/actions/upload_oss
with:
src_path: ${{ env.WHEELHOUSE_DIR }}
oss_dst_path: oss://${{ env.ONEFLOW_OSS_BUCKET }}/${{ env.OSS_DIR }}
oss_access_key_id: ${{ secrets.OSS_ACCESS_KEY_ID }}
oss_access_key_secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
- name: Update pip index
env:
OSS_ACCESS_KEY_ID: ${{ secrets.OSS_ACCESS_KEY_ID }}
OSS_ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
run: |
python3 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
python3 -m pip install oss2 beautifulsoup4 --user
python3 tools/create_pip_index.py --dir_key ${{ env.OSS_DIR }} -b ${{ env.ONEFLOW_OSS_BUCKET }} \
--index_key=branch/${{ env.GITHUB_REF_NAME }}/${{ matrix.entry }}/index.html \
--index_key=branch/${{ env.GITHUB_REF_NAME }}/date/${{ needs.generate-build-matrix.outputs.formatted_date }}/${{ matrix.entry }}/index.html \
--index_key=${{ env.OSS_DIR }}/index.html \
--index_key=commit/${{ env.GITHUB_SHA }}/${{ matrix.entry }}/index.html
- name: Update API docs
if: github.ref == 'refs/heads/master' && matrix.entry == 'cpu' && !inputs.is_priv
env:
READTHEDOCS_TOKEN: ${{ secrets.READTHEDOCS_TOKEN }}
run: |
curl -X POST -d "branches=master" -d "token=${READTHEDOCS_TOKEN}" https://readthedocs.org/api/v2/webhook/oneflow/135376/
pack_src:
name: Pack source code
if: github.ref == 'refs/heads/master' && github.repository == 'Oneflow-Inc/oneflow'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Pack OneFlow source code
env:
OSS_ACCESS_KEY_ID: ${{ secrets.OSS_ACCESS_KEY_ID }}
OSS_ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
run: |
git reset --hard
git clean -f
git archive --prefix oneflow/ --format zip HEAD > oneflow-src.zip
curl http://gosspublic.alicdn.com/ossutil/1.6.19/ossutil64 -o $HOME/ossutil64
chmod 755 $HOME/ossutil64
$HOME/ossutil64 config -e oss-cn-beijing.aliyuncs.com -i ${OSS_ACCESS_KEY_ID} -k ${OSS_ACCESS_KEY_SECRET} -L EN -c $HOME/.ossutilconfig
$HOME/ossutil64 cp --update oneflow-src.zip oss://oneflow-public/oneflow-src.zip