-
Notifications
You must be signed in to change notification settings - Fork 395
188 lines (180 loc) · 6.69 KB
/
pypi-release-pipeline.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
name: PyPI release pipeline
on:
workflow_dispatch:
inputs:
variant-id:
description: "Variant id"
required: true
type: string
deploy:
description: "Deploy to official pypi if true"
required: false
type: boolean
default: false
jobs:
variants:
name: Populate supported AIMET variants
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.final.outputs.value }}
steps:
- name: Torch variants
run: |
if [ "${{ inputs.variant-id }}" == "torch-cpu" ] ; then
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{
"id": "torch-cpu",
"runs-on": "ubuntu-latest",
"VER_PYTHON": "3.10",
"VER_TENSORFLOW": "",
"VER_TORCH": "2.1.2",
"VER_ONNXRUNTIME": "",
"VER_CUDA": "",
"ENABLE_TESTS": "ON",
"BUILD_TARGETS": "all"
}
]')
elif [ "${{ inputs.variant-id }}" == "torch-gpu" ] ; then
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{
"id": "torch-gpu",
"runs-on": "k8s-gpu",
"VER_PYTHON": "3.10",
"VER_TENSORFLOW": "",
"VER_TORCH": "2.1.2",
"VER_ONNXRUNTIME": "",
"VER_CUDA": "12.1.1",
"ENABLE_TESTS": "ON",
"BUILD_TARGETS": "all"
}
]')
elif [ "${{ inputs.variant-id }}" == "onnx-cpu" ] ; then
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{
"id": "onnx-cpu",
"runs-on": "ubuntu-latest",
"VER_PYTHON": "3.10",
"VER_TENSORFLOW": "",
"VER_TORCH": "",
"VER_ONNXRUNTIME": "1.18.1",
"VER_CUDA": "",
"ENABLE_TESTS": "ON",
"BUILD_TARGETS": "all"
}
]')
elif [ "${{ inputs.variant-id }}" == "onnx-gpu" ] ; then
VALUE=$(echo "${VALUE:-"{}"}" | jq -c '.include += [
{
"id": "onnx-gpu",
"runs-on": "k8s-gpu",
"VER_PYTHON": "3.10",
"VER_TENSORFLOW": "",
"VER_TORCH": "",
"VER_ONNXRUNTIME": "1.18.1",
"VER_CUDA": "11.8.0",
"ENABLE_TESTS": "ON",
"BUILD_TARGETS": "all"
}
]')
fi
echo "VALUE=$VALUE" >> $GITHUB_ENV
- name: (Last step) Generate few extra properties for each variant
id: final
run: |
echo "value=$VALUE" >> $GITHUB_OUTPUT
docker-build-image:
name: Docker image ${{ matrix.id }}
runs-on: ubuntu-latest
needs: [ variants ]
strategy:
matrix: ${{ fromJSON(needs.variants.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/docker-build-image
with:
dockerfile: Jenkins/fast-release/Dockerfile.ci
docker-login: ${{ secrets.DOCKER_LOGIN }}
docker-password: ${{ secrets.DOCKER_CREDENTIALS }}
docker-registry: ${{ vars.DOCKER_REGISTRY }}
image-name: "${{ vars.DOCKER_IMAGE }}-${{ inputs.variant-id }}"
image-tag: "release"
build-args: |
VER_PYTHON=${{ matrix.VER_PYTHON }}
VER_CUDA=${{ matrix.VER_CUDA }}
VER_TORCH=${{ matrix.VER_TORCH }}
VER_TENSORFLOW=${{ matrix.VER_TENSORFLOW }}
VER_ONNXRUNTIME=${{ matrix.VER_ONNXRUNTIME }}
call-build-wheels:
name: Call build-wheels
needs: [ variants, docker-build-image ]
uses: ./.github/workflows/build-wheels.yml
with:
variants: ${{ needs.variants.outputs.matrix }}
image-tag: "release"
secrets: inherit
call-run-unit-tests:
name: Run unit tests
needs: [ variants, call-build-wheels ]
uses: ./.github/workflows/run-unit-tests.yml
with:
variants: ${{ needs.variants.outputs.matrix }}
secrets: inherit
call-run-acceptance-tests:
name: Run acceptance tests
needs: [ variants, call-build-wheels, call-run-unit-tests ]
uses: ./.github/workflows/run-acceptance-tests.yml
with:
variants: ${{ needs.variants.outputs.matrix }}
secrets: inherit
publish:
name: Publish the wheel packages
runs-on: k8s-gpu
needs: [ variants, call-build-wheels, call-run-unit-tests, call-run-acceptance-tests ]
env:
DEPLOY: ${{ inputs.deploy }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.variants.outputs.matrix) }}
container:
image: "ubuntu:22.04"
steps:
- uses: actions/download-artifact@v3
with:
name: "${{ matrix.id }}"
path: "downloads"
- run: |
apt-get update
apt-get install python3 python3-pip -y
python3 -m pip install --upgrade pip
python3 -m pip install twine
ls -al downloads/wheelhouse
- name: Push to testpypi
run: |
case $DEPLOY in
(true)
echo "Deploy variable set to true, deploying. . . "
twine upload --verbose --repository testpypi --config-file ~/.pypirc downloads/wheelhouse/*
;;
(false)
echo "Deploy variable is false, deployment for twine upload --verbose --repository pypi --config-file ~/.pypirc downloads/wheelhouse/* will not proceed."
;;
esac
- name: Push to pypi
run: |
case $DEPLOY in
(true)
echo "Deploy variable set to true, deploying. . . "
twine upload --verbose --repository pypi --config-file ~/.pypirc downloads/wheelhouse/*
;;
(false)
echo "Deploy variable is false, deployment for twine upload --verbose --repository pypi --config-file ~/.pypirc downloads/wheelhouse/* will not proceed."
;;
esac
cleanup:
needs: [ variants, docker-build-image, call-build-wheels ]
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.variants.outputs.matrix) }}
steps:
- name: Delete temp docker image
run: curl -k -H "Authorization:Bearer ${{ secrets.DOCKER_CREDENTIALS }}" -X DELETE "https://${{ vars.DOCKER_REGISTRY }}/v2/${{ vars.DOCKER_IMAGE }}-${{ inputs.variant-id }}/manifests/release" || true