6
6
push :
7
7
branches :
8
8
- nightly
9
+ tags :
10
+ # NOTE: Binary build pipelines should only get triggered on release candidate builds
11
+ # Release candidate tags look like: v1.11.0-rc1
12
+ - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
9
13
workflow_dispatch :
14
+ env :
15
+ CHANNEL : " nightly"
10
16
jobs :
11
17
build_wheels :
12
18
name : " Build TorchText M1 wheels"
17
23
steps :
18
24
- name : Checkout repository
19
25
uses : actions/checkout@v2
26
+ - name : Set CHANNEL (only for tagged pushes)
27
+ if : ${{ github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') }}
28
+ run : |
29
+ # reference ends with an RC suffix
30
+ if [[ ${GITHUB_REF_NAME} = *-rc[0-9]* ]]; then
31
+ echo "CHANNEL=test" >> "$GITHUB_ENV"
32
+ fi
20
33
- name : Build TorchText M1 wheel
21
34
shell : arch -arch arm64 bash {0}
22
35
env :
@@ -27,11 +40,16 @@ jobs:
27
40
. ~/miniconda3/etc/profile.d/conda.sh
28
41
set -ex
29
42
. packaging/pkg_helpers.bash
30
- setup_build_version
43
+ # if we are uploading to test channell, our version consist only of the base: 0.x.x - no date string or suffix added
44
+ if [[ $CHANNEL == "test" ]]; then
45
+ setup_base_build_version
46
+ else
47
+ setup_build_version
48
+ fi
31
49
git submodule update --init --recursive
32
50
WHL_NAME=torchtext-${BUILD_VERSION}-cp${PY_VERS/.}-cp${PY_VERS/.}-macosx_11_0_arm64.whl
33
51
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy cmake ninja wheel pkg-config
34
- conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
52
+ conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
35
53
conda run -p ${ENV_NAME} python3 -mpip install delocate
36
54
conda run -p ${ENV_NAME} python3 setup.py bdist_wheel
37
55
export PYTORCH_VERSION="$(conda run -p ${ENV_NAME} python3 -mpip show torch | grep ^Version: | sed 's/Version: *//')"
@@ -46,24 +64,27 @@ jobs:
46
64
. ~/miniconda3/etc/profile.d/conda.sh
47
65
set -ex
48
66
conda create -yp ${ENV_NAME} python=${PY_VERS} numpy
49
- conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/nightly
67
+ conda run -p ${ENV_NAME} python3 -mpip install torch --pre --extra-index-url=https://download.pytorch.org/whl/${CHANNEL}
50
68
conda run -p ${ENV_NAME} python3 -mpip install dist/*.whl
51
69
# Test torch is importable, by changing cwd and running import commands
52
70
conda run --cwd /tmp -p ${ENV_NAME} python3 -c "import torchtext;print('torchtext version is ', torchtext.__version__)"
53
71
conda env remove -p ${ENV_NAME}
54
72
- name : Upload wheel to GitHub
55
- if : ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
73
+ if :
74
+ ${{ github.event_name == 'push' && (github.event.ref == 'ref/heads/nightly' || startsWith(github.event.ref,
75
+ ' refs/tags/' )) }}
56
76
uses : actions/upload-artifact@v3
57
77
with :
58
78
name : torchtext-py${{ matrix.py_vers }}-macos11-m1
59
79
path : dist/
60
80
- name : Upload wheel to S3
61
- if : ${{ github.event_name == 'push' && steps.extract_branch.outputs.branch == 'nightly' }}
81
+ if :
82
+ ${{ github.event_name == 'push' && (github.event.ref == 'ref/heads/nightly' || startsWith(github.event.ref,
83
+ ' refs/tags/' )) }}
62
84
shell : arch -arch arm64 bash {0}
63
85
env :
64
86
AWS_ACCESS_KEY_ID : ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }}
65
87
AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }}
66
- CHANNEL : nightly
67
88
run : |
68
89
for pkg in dist/*; do
69
90
aws s3 cp "$pkg" "s3://pytorch/whl/${CHANNEL}/cpu/" --acl public-read
0 commit comments