12
12
pytorch_version :
13
13
required : true
14
14
type : string
15
+ do-upload :
16
+ required : false
17
+ default : true
18
+ type : boolean
15
19
secrets :
16
20
PYTORCH_BINARY_AWS_ACCESS_KEY_ID :
17
21
required : true
28
32
29
33
jobs :
30
34
get_release_type :
31
- if : inputs.branch != ''
32
35
runs-on : ubuntu-latest
33
36
outputs :
34
37
type : ${{ steps.get_release_type.outputs.type }}
35
38
steps :
36
39
- name : Get Release Type
37
40
run : |
38
- if [[ ${{ inputs.branch }} == v* ]] && [[ ${{ inputs.pre_dev_release }} == false ]]; then
41
+ if [[ " ${{ inputs.branch }}" == v* ]] && [[ ${{ inputs.pre_dev_release }} == false ]]; then
39
42
RELEASE_TYPE=official
40
- elif [[ ${{ inputs.branch }} == release/* ]] && [[ ${{ inputs.pre_dev_release }} == true ]]; then
43
+ elif [[ " ${{ inputs.branch }}" == release/* ]] && [[ ${{ inputs.pre_dev_release }} == true ]]; then
41
44
RELEASE_TYPE=test
42
- elif [[ ${{ inputs.branch }} == main ]] && [[ ${{ inputs.pre_dev_release }} == true ]]; then
43
- RELEASE_TYPE=nightly
44
45
else
45
- echo "Invalid combination of inputs!"
46
- echo " branch: ${{ inputs.branch }}"
47
- echo " pre_dev_release: ${{ inputs.pre_dev_release }}"
48
- exit 1
46
+ RELEASE_TYPE=nightly
49
47
fi
50
48
echo "Release Type: $RELEASE_TYPE"
51
49
echo "::set-output name=type::$RELEASE_TYPE"
@@ -83,19 +81,23 @@ jobs:
83
81
uses : actions/setup-python@v2
84
82
with :
85
83
python-version : ${{ matrix.python-version }}
84
+ - name : Add temp runner environment variables
85
+ shell : bash -l {0}
86
+ run : |
87
+ echo "MINICONDA_INSTALL_PATH_MACOS=${RUNNER_TEMP}/miniconda" >> "${GITHUB_ENV}"
86
88
- name : Install Conda on MacOS
87
89
if : ${{ startsWith( matrix.os, 'macos' ) }}
88
90
shell : bash -l {0}
89
91
run : |
90
- mkdir -p ~/miniconda3
92
+ mkdir -p "${MINICONDA_INSTALL_PATH_MACOS}"
91
93
if ${{ startsWith( matrix.os, 'macos-m1' ) }}; then
92
- curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/ miniconda.sh
94
+ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh"
93
95
else
94
- curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3/ miniconda.sh
96
+ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh"
95
97
fi
96
- bash ~/miniconda3/ miniconda.sh -b -u -p ~/miniconda3
97
- rm -rf ~/miniconda3/ miniconda.sh
98
- echo "$(dirname ~)/$(basename ~)/miniconda3 /bin" >> $GITHUB_PATH
98
+ bash "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh" -b -u -p "${MINICONDA_INSTALL_PATH_MACOS}"
99
+ rm -rf "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh"
100
+ echo "${MINICONDA_INSTALL_PATH_MACOS} /bin" >> $GITHUB_PATH
99
101
- name : Setup Python ${{ matrix.python-version }} on MacOS
100
102
if : ${{ startsWith( matrix.os, 'macos' ) }}
101
103
shell : bash -l {0}
@@ -211,7 +213,7 @@ jobs:
211
213
path : dist/torchdata*.whl
212
214
213
215
wheel_upload :
214
- if : always() && inputs.branch != ''
216
+ if : always() && inputs.branch != '' && inputs.do-upload == true
215
217
needs : [get_release_type, wheel_build_test]
216
218
runs-on : ubuntu-latest
217
219
outputs :
@@ -289,31 +291,36 @@ jobs:
289
291
with :
290
292
ref : ${{ inputs.branch }}
291
293
submodules : recursive
294
+ - name : Add temp runner environment variables
295
+ shell : bash -l {0}
296
+ run : |
297
+ echo "MINICONDA_INSTALL_PATH_MACOS=${RUNNER_TEMP}/miniconda" >> "${GITHUB_ENV}"
298
+ echo "CONDA_ENV_PATH=${RUNNER_TEMP}/conda_build_env" >> "${GITHUB_ENV}"
292
299
- name : Create Conda Env
293
300
if : ${{ ! startsWith( matrix.os, 'macos' ) }}
294
301
uses : conda-incubator/setup-miniconda@v2
295
302
with :
296
303
python-version : ${{ matrix.python-version }}
297
- activate-environment : conda_build_env
304
+ activate-environment : ${{ env.CONDA_ENV_PATH }}
298
305
- name : Install Conda on MacOS
299
306
if : ${{ startsWith( matrix.os, 'macos' ) }}
300
307
shell : bash -l {0}
301
308
run : |
302
- mkdir -p ~/miniconda3
309
+ mkdir -p "${MINICONDA_INSTALL_PATH_MACOS}"
303
310
if ${{ startsWith( matrix.os, 'macos-m1' ) }}; then
304
- curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda3/ miniconda.sh
311
+ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh"
305
312
else
306
- curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o ~/miniconda3/ miniconda.sh
313
+ curl https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh -o "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh"
307
314
fi
308
- bash ~/miniconda3/ miniconda.sh -b -u -p ~/miniconda3
309
- rm -rf ~/miniconda3/ miniconda.sh
310
- echo "$(dirname ~)/$(basename ~)/miniconda3 /bin" >> $GITHUB_PATH
315
+ bash "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh" -b -u -p "${MINICONDA_INSTALL_PATH_MACOS}"
316
+ rm -rf "${MINICONDA_INSTALL_PATH_MACOS}/ miniconda.sh"
317
+ echo "${MINICONDA_INSTALL_PATH_MACOS} /bin" >> $GITHUB_PATH
311
318
- name : Create Conda Env on MacOS
312
319
if : ${{ startsWith( matrix.os, 'macos' ) }}
313
320
shell : bash -l {0}
314
321
run : |
315
322
conda init bash
316
- conda create -y --name conda_build_env python=${{ matrix.python-version }}
323
+ conda create -y -p "${CONDA_ENV_PATH}" python=${{ matrix.python-version }}
317
324
- name : Setup additional system libraries
318
325
if : startsWith( matrix.os, 'ubuntu' )
319
326
run : |
@@ -338,14 +345,14 @@ jobs:
338
345
BUILD_S3 : ${{ steps.build_s3.outputs.value }}
339
346
run : |
340
347
set -ex
341
- conda activate conda_build_env
348
+ conda activate "${CONDA_ENV_PATH}"
342
349
conda install -yq conda-build -c conda-forge
343
350
packaging/build_conda.sh
344
351
conda index ./conda-bld
345
352
- name : Install TorchData Conda Package
346
353
shell : bash -l {0}
347
354
run : |
348
- conda activate conda_build_env
355
+ conda activate "${CONDA_ENV_PATH}"
349
356
if [[ ${{ needs.get_release_type.outputs.type }} == 'official' ]]; then
350
357
CONDA_CHANNEL=pytorch
351
358
else
@@ -355,7 +362,7 @@ jobs:
355
362
- name : Run DataPipes Tests with pytest
356
363
shell : bash -l {0}
357
364
run : |
358
- conda activate conda_build_env
365
+ conda activate "${CONDA_ENV_PATH}"
359
366
pip3 install -r test/requirements.txt
360
367
pytest --no-header -v test --ignore=test/test_period.py --ignore=test/test_text_examples.py --ignore=test/test_audio_examples.py
361
368
- name : Upload Conda Package to Github
@@ -366,7 +373,7 @@ jobs:
366
373
path : conda-bld/*/torchdata-*.tar.bz2
367
374
368
375
conda_upload :
369
- if : always() && inputs.branch != ''
376
+ if : always() && inputs.branch != '' && inputs.do-upload == true
370
377
needs : [get_release_type, conda_build_test]
371
378
runs-on : ubuntu-latest
372
379
container : continuumio/miniconda3
0 commit comments