-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (146 loc) · 6.08 KB
/
upload.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
name: upload compressed-tensors whl and tar.gz
run-name: ${{ github.actor }} uploading whl/tar.gz from run ${{ inputs.run_id }}
on:
workflow_call:
inputs:
label:
description: "requested runner label (specifies instance)"
type: string
required: true
timeout:
description: "time limit for run in minutes "
type: string
required: true
run_id:
description: "run_id of 'build.yml' run that generated the assets"
type: string
required: true
push_to_pypi:
description: "push asset to public pypi."
type: boolean
default: false
testmo_run_id:
description: "testmo run id"
type: string
default: ''
workflow_dispatch:
inputs:
label:
description: "requested runner label (specifies instance)"
type: string
required: true
timeout:
description: "time limit for run in minutes "
type: string
required: true
run_id:
description: "run_id of 'build.yml' run that generated the assets"
type: string
required: true
push_to_pypi:
description: "push asset to public pypi."
type: boolean
default: false
testmo_run_id:
description: "testmo run id"
type: string
default: ''
jobs:
UPLOAD:
runs-on: ${{ inputs.label }}
timeout-minutes: ${{ fromJson(inputs.timeout) }}
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: install automation components
uses: neuralmagic/nm-actions/actions/install-automation-components@v1.0.0
- name: set python
id: set-python
uses: actions/setup-python@v5
with:
python-version: 3.10.12
- name: complete testmo run
uses: neuralmagic/nm-actions/actions/testmo-run-complete@v1.11.0
if: (success() || failure()) && inputs.testmo_run_id != ''
with:
testmo_url: https://neuralmagic.testmo.net
testmo_token: ${{ secrets.TESTMO_TEST_TOKEN }}
testmo_run_id: ${{ inputs.testmo_run_id }}
# GCP
- name: 'Authenticate to Google Cloud'
id: auth-gcp
uses: google-github-actions/auth@v2.1.3
with:
project_id: ${{ secrets.GCP_PROJECT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_GHA_SA }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
with:
version: '>= 473.0.0'
- name: download assets
uses: neuralmagic/nm-actions/actions/gcp-download-assets@v1.1.0
with:
bucket_source: ${{ secrets.GCP_BUILD_ML_ASSETS2 }}
run_id: ${{ inputs.run_id }}
# GCP
- name: 'Authenticate to Google Cloud'
id: auth-pypi
uses: google-github-actions/auth@v2.1.3
with:
project_id: ${{ secrets.GCP_PROJECT }}
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.NM_PYPI_SA }}
- name: find whl
id: find-asset-whl
uses: neuralmagic/nm-actions/actions/find-asset@v1.1.0
with:
run_id: ${{ inputs.run_id }}
asset_identifier: 'compressed*.whl'
- name: upload whl to "nm-pypi"
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/gcp-upload-asset@v1.1.0
with:
bucket_target: ${{ secrets.GCP_NM_PYPI_DIST }}
asset: ${{ steps.find-asset-whl.outputs.asset }}
- name: find tar.gz
id: find-asset-targz
uses: neuralmagic/nm-actions/actions/find-asset@v1.1.0
with:
run_id: ${{ inputs.run_id }}
asset_identifier: 'compressed*.tar.gz'
- name: upload tar.gz to "nm-pypi"
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/gcp-upload-asset@v1.1.0
with:
bucket_target: ${{ secrets.GCP_NM_PYPI_DIST }}
asset: ${{ steps.find-asset-targz.outputs.asset }}
- name: update "nm-pypi" index
uses: actions/github-script@v6
with:
github-token: ${{ secrets.CICD_GITHUB_PAT }}
script: |
const result = await github.rest.actions.createWorkflowDispatch({
owner: 'neuralmagic',
repo: 'stratus',
workflow_id: 'nm-pypi-update.yml',
ref: 'main'
})
console.log(result)
# publish the wheel file to public pypi
- name: push wheel to pypi.org
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.find-asset-whl.outputs.asset }}
# publish the tar.gz file to public pypi
- name: push wheel to pypi.org
if: ${{ inputs.push_to_pypi }}
uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0
with:
username: ${{ secrets.PYPI_PUBLIC_USER }}
password: ${{ secrets.PYPI_PUBLIC_AUTH }}
whl: ${{ steps.find-asset-targz.outputs.asset }}