14
14
type : string
15
15
secrets :
16
16
PYTORCH_BINARY_AWS_ACCESS_KEY_ID :
17
- required : false
17
+ required : true
18
18
PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY :
19
- required : false
19
+ required : true
20
20
PYPI_TOKEN :
21
21
required : false
22
22
CONDA_PYTORCHBOT_TOKEN :
23
- required : false
23
+ required : true
24
24
25
25
jobs :
26
26
get_release_type :
@@ -34,12 +34,10 @@ jobs:
34
34
steps :
35
35
- name : Get Release Type
36
36
run : |
37
- if [[ ${{ inputs.branch }} == release/* ]]; then
38
- if [[ ${{ inputs.pre_dev_release }} == true ]]; then
39
- RELEASE_TYPE=test
40
- else
41
- RELEASE_TYPE=official
42
- fi
37
+ if [[ ${{ inputs.branch }} == v* ]] && [[ ${{ inputs.pre_dev_release }} == false ]]; then
38
+ RELEASE_TYPE=official
39
+ elif [[ ${{ inputs.branch }} == release/* ]] && [[ ${{ inputs.pre_dev_release }} == true ]]; then
40
+ RELEASE_TYPE=test
43
41
elif [[ ${{ inputs.branch }} == main ]] && [[ ${{ inputs.pre_dev_release }} == true ]]; then
44
42
RELEASE_TYPE=nightly
45
43
else
@@ -52,148 +50,86 @@ jobs:
52
50
echo "::set-output name=type::$RELEASE_TYPE"
53
51
id : get_release_type
54
52
55
- build_test :
53
+ wheel_build_test :
56
54
if : ${{ needs.get_release_type.outputs.type }}
57
55
needs : get_release_type
58
56
runs-on : ${{ matrix.os }}
59
57
strategy :
60
58
fail-fast : false
61
- # TODO: Turn the matrix on after cpp landed
62
59
matrix :
63
60
os :
64
- # - macos-latest
61
+ - macos-latest
65
62
- ubuntu-latest
66
- # - windows-latest
63
+ - windows-latest
67
64
python-version :
68
- # - 3.7
69
- # - 3.8
65
+ - 3.7
66
+ - 3.8
70
67
- 3.9
68
+ - " 3.10"
71
69
steps :
72
70
- name : Setup Python ${{ matrix.python-version }}
73
71
uses : actions/setup-python@v2
74
72
with :
75
73
python-version : ${{ matrix.python-version }}
76
- - name : Install Pre-release/Nightly-release/Official-release PyTorch
77
- run : |
78
- pip3 install numpy
79
- # Add version requirement to PyTorch except nightly release
80
- if [[ ${{ inputs.pytorch_version }} ]]; then
81
- PYTORCH_VERSION=torch==${{ inputs.pytorch_version }}
82
- else
83
- PYTORCH_VERSION=torch
84
- fi
85
-
86
- PIP_CHANNEL=${{ needs.get_release_type.outputs.type }}
87
-
88
- if [[ $PIP_CHANNEL == 'official' ]]; then
89
- pip3 install "$PYTORCH_VERSION"
90
- else
91
- pip3 install --pre "$PYTORCH_VERSION" -f "https://download.pytorch.org/whl/$PIP_CHANNEL/cpu/torch_$PIP_CHANNEL.html"
92
- fi
93
74
- name : Checkout Source Repository
94
75
uses : actions/checkout@v2
95
76
with :
96
77
ref : ${{ inputs.branch }}
97
- - name : Get Hash of the Last Commit from Release
98
- if : |
99
- needs.get_release_type.outputs.type == 'nightly' ||
100
- needs.get_release_type.outputs.type == 'test'
101
- run : |
102
- pip3 install -r requirements.txt
103
- # Using --no-deps here to make sure correct version of PyTorch Core
104
- pip3 install --pre torchdata -f "https://download.pytorch.org/whl/${{ needs.get_release_type.outputs.type }}/cpu/torch_${{ needs.get_release_type.outputs.type }}.html" --no-deps
105
- pushd ~
106
- RELEASE_COMMIT=$(python -c 'import torchdata; print(torchdata.version.git_version)')
107
- echo "::set-output name=hash::$RELEASE_COMMIT"
108
- popd
109
- pip3 uninstall -y torchdata
110
- id : release_commit
111
- - name : Get Hash of the Last Commit from Source
112
- if : |
113
- needs.get_release_type.outputs.type == 'nightly' ||
114
- needs.get_release_type.outputs.type == 'test'
115
- run : |
116
- SOURCE_COMMIT=$(git rev-parse HEAD)
117
- echo "::set-output name=hash::$SOURCE_COMMIT"
118
- id : source_commit
119
- - name : Check if Build New TorchData Wheel
120
- run : |
121
- if [[ ${{ needs.get_release_type.outputs.type }} == 'official' || ( ${{ steps.release_commit.outputs.hash }} != ${{ steps.source_commit.outputs.hash }} ) ]]; then
122
- echo 1 > torchdata_${{ matrix.os }}_${{ matrix.python-version }}_whl.txt
123
- echo "::set-output name=value::true"
124
- else
125
- echo 0 > torchdata_${{ matrix.os }}_${{ matrix.python-version }}_whl.txt
126
- echo "::set-output name=value::false"
127
- fi
128
- id : trigger_build
129
- # The following steps for pre-release will be skipped if the last commit
130
- # from branch is the same as the last commit in release wheel
131
- - name : Build and Install TorchData Wheel
132
- if : steps.trigger_build.outputs.value == 'true'
78
+ - name : Install PyTorch and Build TorchData Wheel
79
+ shell : bash
133
80
env :
81
+ PYTHON_VERSION : ${{ matrix.python-version }}
134
82
PYTORCH_VERSION : ${{ inputs.pytorch_version }}
135
- run : |
136
- pip3 install wheel
137
- if [[ ${{ needs.get_release_type.outputs.type }} == 'nightly' ]]; then
138
- python setup.py bdist_wheel --nightly
139
- else
140
- python setup.py bdist_wheel --release
141
- fi
142
- pip3 install dist/torchdata*.whl
83
+ run : packaging/build_wheel.sh
84
+ - name : Install TorchData Wheel
85
+ shell : bash
86
+ run : pip3 install dist/torchdata*.whl
143
87
- name : Validate TorchData Wheel
144
- if : steps.trigger_build.outputs.value == 'true'
88
+ shell : bash
145
89
run : |
146
90
pip3 install pkginfo
147
91
for pkg in dist/torchdata*.whl; do
148
92
echo "PkgInfo of $pkg:"
149
93
pkginfo $pkg
150
94
done
151
95
- name : Install Test Requirements
152
- if : steps.trigger_build.outputs.value == 'true'
153
96
run : pip3 install expecttest fsspec iopath==0.1.9 numpy pytest rarfile
154
97
- name : Run DataPipes Tests with pytest
155
- if : steps.trigger_build.outputs.value == 'true'
156
98
run :
157
99
pytest --no-header -v test --ignore=test/test_period.py --ignore=test/test_text_examples.py
158
100
--ignore=test/test_audio_examples.py
159
- - name : Upload Wheel and Flag File to Github # Flag File is used to prevent no-file error for download-artifact
101
+ - name : Upload Wheels to Github
160
102
uses : actions/upload-artifact@v2
161
103
with :
162
104
name : torchdata-artifact
163
- path : |
164
- dist/torchdata*.whl
165
- torchdata_*_whl.txt
105
+ path : dist/torchdata*.whl
166
106
167
- upload_wheel :
168
- needs : [get_release_type, build_test]
107
+ wheel_upload :
108
+ if : always() && ${{ needs.get_release_type.outputs.type }}
109
+ needs : [get_release_type, wheel_build_test]
169
110
runs-on : ubuntu-latest
170
- container : continuumio/miniconda3
111
+ outputs :
112
+ upload : ${{ steps.trigger_upload.outputs.value }}
171
113
steps :
172
- - name : Download Wheels from Github
114
+ - name : Download Artifacts from Github
115
+ continue-on-error : true
173
116
uses : actions/download-artifact@v2
174
117
with :
175
118
name : torchdata-artifact
176
- - name : Determine if Uploading is needed
119
+ - name : Determine if Wheel Uploading is needed
177
120
run : |
178
121
upload=false
179
- for txt in torchdata_*_whl.txt; do
180
- v=`cat $txt`
181
- if [ $v -eq 1 ]; then
182
- upload=true
183
- break
184
- fi
122
+ for txt in torchdata*.whl; do
123
+ upload=true
124
+ break
185
125
done
186
126
echo "::set-output name=value::$upload"
187
127
id : trigger_upload
188
128
- name : Display All TorchData Wheels
189
129
if : steps.trigger_upload.outputs.value == 'true'
190
- run : ls -lh
191
- working-directory : dist
192
- - name : Upload Wheels to S3 Storage (Nightly or RC)
193
- if : |
194
- steps.trigger_upload.outputs.value == 'true' &&
195
- ( needs.get_release_type.outputs.type == 'nightly' ||
196
- needs.get_release_type.outputs.type == 'test' )
130
+ run : ls -lh torchdata*.whl
131
+ - name : Upload Wheels to S3 Storage
132
+ if : steps.trigger_upload.outputs.value == 'true'
197
133
env :
198
134
AWS_ACCESS_KEY_ID : ${{ secrets.PYTORCH_BINARY_AWS_ACCESS_KEY_ID }}
199
135
AWS_SECRET_ACCESS_KEY : ${{ secrets.PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY }}
@@ -205,7 +141,7 @@ jobs:
205
141
fi
206
142
pip3 install awscli
207
143
set -x
208
- for pkg in dist/ torchdata*.whl; do
144
+ for pkg in torchdata*.whl; do
209
145
aws s3 cp "$pkg" "$S3_PATH" --acl public-read
210
146
done
211
147
- name : Upload Official Wheels to PYPI
@@ -220,25 +156,91 @@ jobs:
220
156
--username __token__ \
221
157
--password "$PYPI_TOKEN" \
222
158
dist/torchdata*.whl
223
- - name : Upload Wheels to Conda (Nightly or Official)
224
- if : |
225
- steps.trigger_upload.outputs.value == 'true' &&
226
- ( needs.get_release_type.outputs.type == 'nightly' ||
227
- needs.get_release_type.outputs.type == 'official' )
159
+
160
+ conda_build_test :
161
+ if : ${{ needs.get_release_type.outputs.type }}
162
+ needs : get_release_type
163
+ runs-on : ${{ matrix.os }}
164
+ strategy :
165
+ fail-fast : false
166
+ matrix :
167
+ os :
168
+ - macos-latest
169
+ - ubuntu-latest
170
+ - windows-latest
171
+ python-version :
172
+ - 3.7
173
+ - 3.8
174
+ - 3.9
175
+ - " 3.10"
176
+ steps :
177
+ - name : Create Conda Env
178
+ uses : conda-incubator/setup-miniconda@v2
179
+ with :
180
+ python-version : ${{ matrix.python-version }}
181
+ activate-environment : conda_build_env
182
+ - name : Checkout Source Repository
183
+ uses : actions/checkout@v2
184
+ with :
185
+ ref : ${{ inputs.branch }}
186
+ - name : Build TorchData for Conda
187
+ shell : bash -l {0}
188
+ env :
189
+ PYTHON_VERSION : ${{ matrix.python-version }}
190
+ PYTORCH_VERSION : ${{ inputs.pytorch_version }}
191
+ run : |
192
+ conda activate conda_build_env
193
+ conda install -yq conda-build -c conda-forge
194
+ packaging/build_conda.sh
195
+ - name : Upload Conda Package to Github
196
+ uses : actions/upload-artifact@v2
197
+ with :
198
+ name : torchdata-artifact
199
+ path : conda-bld/*/torchdata-*.tar.bz2
200
+
201
+ conda_upload :
202
+ if : always() && ${{ needs.get_release_type.outputs.type }}
203
+ needs : [get_release_type, conda_build_test]
204
+ runs-on : ubuntu-latest
205
+ container : continuumio/miniconda3
206
+ outputs :
207
+ upload : ${{ steps.trigger_upload.outputs.value }}
208
+ steps :
209
+ - name : Download Artifacts from Github
210
+ continue-on-error : true
211
+ uses : actions/download-artifact@v2
212
+ with :
213
+ name : torchdata-artifact
214
+ - name : Determine if Conda Uploading is needed
215
+ run : |
216
+ upload=false
217
+ for pkg in ./*/torchdata-*.tar.bz2; do
218
+ upload=true
219
+ break
220
+ done
221
+ echo "::set-output name=value::$upload"
222
+ id : trigger_upload
223
+ - name : Display All TorchData Conda Package
224
+ if : steps.trigger_upload.outputs.value == 'true'
225
+ run : ls -lh ./*/torchdata-*.tar.bz2
226
+ - name : Build & Upload Wheels to Conda
227
+ if : steps.trigger_upload.outputs.value == 'true'
228
+ shell : bash
228
229
env :
229
230
CONDA_PYTORCHBOT_TOKEN : ${{ secrets.CONDA_PYTORCHBOT_TOKEN }}
230
231
run : |
231
232
conda install -yq anaconda-client
232
- if [ ${{ needs.get_release_type.outputs.type }} == nightly ]; then
233
- CONDA_CHANNEL=pytorch-nightly
234
- else
233
+ if [[ ${{ needs.get_release_type.outputs.type }} == 'official' ]]; then
235
234
CONDA_CHANNEL=pytorch
235
+ else
236
+ CONDA_CHANNEL=pytorch-${{ needs.get_release_type.outputs.type }}
236
237
fi
237
238
set -x
238
- # anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload dist/* tar.bz2 -u "$CONDA_CHANNEL" --label main --no-progress --force
239
+ anaconda -t "${CONDA_PYTORCHBOT_TOKEN}" upload ./*/torchdata-*. tar.bz2 -u "$CONDA_CHANNEL" --label main --no-progress --force
239
240
240
241
build_docs :
241
- needs : [get_release_type, build_test]
242
+ if : always() && ( needs.wheel_upload.outputs.upload == 'true' || needs.conda_upload.outputs.upload == 'true' )
243
+ needs : [get_release_type, wheel_upload, conda_upload]
242
244
runs-on : ubuntu-latest
243
245
steps :
244
246
- name : Setup Python 3.8
@@ -257,35 +259,31 @@ jobs:
257
259
python3 -m pip install setuptools
258
260
python3 -m pip install matplotlib
259
261
sudo apt-get install -y yarn
260
- - name : Install Pre-release/Nightly-release/Official-release PyTorch
262
+ - name : Install PyTorch & TorchData
261
263
run : |
262
264
pip3 install numpy
263
265
# Add version requirement to PyTorch except nightly release
264
- if [[ ${{ inputs.pytorch_version }} ]]; then
265
- PYTORCH_VERSION=torch==${{ inputs.pytorch_version }}
266
- else
266
+ if [[ -z "${{ inputs.pytorch_version }}" ]]; then
267
267
PYTORCH_VERSION=torch
268
+ else
269
+ PYTORCH_VERSION=torch==${{ inputs.pytorch_version }}
268
270
fi
269
271
270
272
PIP_CHANNEL=${{ needs.get_release_type.outputs.type }}
271
-
272
273
if [[ $PIP_CHANNEL == 'official' ]]; then
273
- pip3 install "$PYTORCH_VERSION"
274
+ pip3 install "$PYTORCH_VERSION" -f https://download.pytorch.org/whl/torch_stable.html
274
275
else
275
- pip3 install --pre "$PYTORCH_VERSION" -f "https://download.pytorch.org/whl/$PIP_CHANNEL/cpu/ torch_$PIP_CHANNEL.html"
276
+ pip3 install --pre "$PYTORCH_VERSION" -f "https://download.pytorch.org/whl/$PIP_CHANNEL/torch_$PIP_CHANNEL.html"
276
277
fi
277
278
278
- if [[ ${{ needs.get_release_type.outputs.type }} == 'nightly' ]]; then
279
- python setup.py install --nightly
280
- else
281
- python setup.py install --release
282
- fi
279
+ pip3 install -r requirements.txt
280
+ python3 setup.py install
283
281
- name : Check env
284
282
run : echo `which spinx-build`
285
283
- name : Build the docset
286
284
run : |
287
285
cd ./docs
288
- pip install -r requirements.txt
286
+ pip3 install -r requirements.txt
289
287
make html
290
288
cd ..
291
289
- name : Export Target Folder
0 commit comments