20
20
- extension/benchmark/apple/**
21
21
- extension/module/**
22
22
workflow_dispatch :
23
+ schedule :
24
+ - cron : ' 0 10 * * *' # Runs daily at 2 AM PST
23
25
24
26
concurrency :
25
27
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
26
28
cancel-in-progress : true
27
29
28
30
jobs :
31
+ set-version :
32
+ runs-on : ubuntu-22.04
33
+ outputs :
34
+ version : ${{ steps.set_version.outputs.version }}
35
+ steps :
36
+ - name : Set VERSION variable
37
+ id : set_version
38
+ shell : bash
39
+ run : |
40
+ VERSION="0.4.0.$(TZ='PST8PDT' date +%Y%m%d)"
41
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
42
+
29
43
build-demo-ios :
30
44
name : build-demo-ios
31
- # NB: Don't run this on fork PRs because they won't have access to the secret and would fail anyway
32
- if : ${{ !github.event.pull_request.head.repo.fork }}
33
45
uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
34
46
secrets : inherit
35
47
with :
41
53
secrets-env : BUILD_CERTIFICATE_BASE64 EXECUTORCH_DEMO_BUILD_PROVISION_PROFILE_BASE64 KEYCHAIN_PASSWORD
42
54
upload-artifact : ios-apps
43
55
script : |
56
+ set -eux
57
+
44
58
BUILD_TOOL=cmake
45
59
46
60
.ci/scripts/setup-conda.sh
59
73
60
74
# Build and test iOS Demo App
61
75
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
62
- build/test_ios_ci.sh ${ARTIFACTS_DIR_NAME}
76
+ build/test_ios_ci.sh " ${ARTIFACTS_DIR_NAME}"
63
77
64
78
# Upload the test demo app to S3
65
79
upload-demo-ios :
77
91
shell : bash
78
92
working-directory : ${{ runner.temp }}/artifacts/
79
93
run : |
94
+ set -eux
80
95
ls -lah ./
81
96
82
97
- name : Upload the artifacts to S3
@@ -114,6 +129,7 @@ jobs:
114
129
115
130
build-frameworks-ios :
116
131
name : build-frameworks-ios
132
+ needs : set-version
117
133
uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
118
134
with :
119
135
runner : macos-latest-xlarge
@@ -123,8 +139,10 @@ jobs:
123
139
upload-artifact : executorch-frameworks-ios
124
140
timeout : 90
125
141
script : |
142
+ set -eux
143
+
126
144
BUILD_TOOL=cmake
127
- VERSION="latest "
145
+ VERSION="${{ needs.set-version.outputs.version }} "
128
146
FRAMEWORKS=(
129
147
"executorch"
130
148
"backend_coreml"
@@ -173,13 +191,17 @@ jobs:
173
191
174
192
upload-frameworks-ios :
175
193
runs-on : ubuntu-22.04
176
- needs : build-frameworks-ios
194
+ needs : [ build-frameworks-ios, set-version]
177
195
timeout-minutes : 30
196
+ environment : ${{ github.ref == 'refs/heads/main' && 'cherry-pick-bot' || '' }}
178
197
permissions :
179
198
id-token : write
180
- contents : read
199
+ contents : write
181
200
steps :
182
201
- uses : actions/checkout@v3
202
+ with :
203
+ fetch-depth : 0
204
+ token : ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN || secrets.GITHUB_TOKEN }}
183
205
- uses : actions/setup-python@v4
184
206
with :
185
207
python-version : ' 3.11'
@@ -196,15 +218,15 @@ jobs:
196
218
name : executorch-frameworks-ios
197
219
path : ${{ runner.temp }}/frameworks-ios/
198
220
- name : Only push to S3 when running the workflow manually from main branch
199
- if : ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
221
+ if : ${{ ( github.event_name == 'schedule' || github.event_name == ' workflow_dispatch') && github.ref == 'refs/heads/main' }}
200
222
shell : bash
201
223
run : |
202
- set -eux
203
224
echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
204
225
- name : Upload the artifact to ossci-ios S3 bucket
205
226
shell : bash
206
227
run : |
207
228
set -eux
229
+ VERSION="${{ needs.set-version.outputs.version }}"
208
230
209
231
pip install awscli==1.32.18
210
232
@@ -214,15 +236,46 @@ jobs:
214
236
fi
215
237
216
238
for FILENAME in "${RUNNER_TEMP}"/frameworks-ios/*.zip; do
217
- [ -e "${FILENAME}" ] || continue
218
- shasum -a 256 "${FILENAME}"
219
- ${AWS_CMD} "${FILENAME }" s3://ossci-ios/executorch/ --acl public-read
239
+ FRAMEWORK_NAME=$(basename "${FILENAME}" | sed "s/-${VERSION}.zip//")
240
+ CHECKSUM=$( shasum -a 256 "${FILENAME}" | cut -d ' ' -f1)
241
+ echo "${FRAMEWORK_NAME} ${CHECKSUM }" >> "${RUNNER_TEMP}/checksums.txt"
220
242
done
243
+ - name : Update SwiftPM
244
+ shell : bash
245
+ run : |
246
+ set -eux
247
+ VERSION="${{ needs.set-version.outputs.version }}"
248
+ BRANCH="swiftpm-${VERSION}"
249
+
250
+ git checkout swiftpm
251
+
252
+ if git show-ref --verify --quiet refs/heads/${BRANCH}; then
253
+ git checkout "${BRANCH}"
254
+ else
255
+ git checkout -b "${BRANCH}"
256
+ fi
257
+
258
+ [[ -f Package.swift ]] || mv Package.swift.template Package.swift
259
+
260
+ sed -i "s/__VERSION__/${VERSION}/g" Package.swift
261
+
262
+ while read -r FRAMEWORK CHECKSUM; do
263
+ sed -i "s/__SHA256_${FRAMEWORK}__/${CHECKSUM}/g" Package.swift
264
+ done < "${RUNNER_TEMP}/checksums.txt"
265
+
266
+ if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
267
+ git config --global user.name "PyTorch Bot"
268
+ git config --global user.email "[email protected] "
269
+ git add Package.swift
270
+ git commit -m "${VERSION}"
271
+ git push origin "${BRANCH}"
272
+ else
273
+ echo "Draft Package.swift:"
274
+ cat Package.swift
275
+ fi
221
276
222
277
build-benchmark-app :
223
278
name : build-benchmark-app
224
- # NB: Don't run this on fork PRs because they won't have access to the secret and would fail anyway
225
- if : ${{ !github.event.pull_request.head.repo.fork }}
226
279
uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
227
280
secrets : inherit
228
281
with :
@@ -285,5 +338,5 @@ jobs:
285
338
echo "::group::Build ExecuTorch benchmark app"
286
339
mkdir -p extension/benchmark/apple/Benchmark/Models
287
340
${CONDA_RUN} --no-capture-output \
288
- build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
341
+ build/build_apple_llm_demo.sh " ${ARTIFACTS_DIR_NAME}"
289
342
echo "::endgroup::"
0 commit comments