2020 - extension/benchmark/apple/**
2121 - extension/module/**
2222 workflow_dispatch :
23+ schedule :
24+ - cron : ' 0 10 * * *' # Runs daily at 2 AM PST
2325
2426concurrency :
2527 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
2628 cancel-in-progress : true
2729
2830jobs :
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+
2943 build-demo-ios :
3044 name : build-demo-ios
3145 uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
3953 secrets-env : BUILD_CERTIFICATE_BASE64 EXECUTORCH_DEMO_BUILD_PROVISION_PROFILE_BASE64 KEYCHAIN_PASSWORD
4054 upload-artifact : ios-apps
4155 script : |
56+ set -eux
57+
4258 BUILD_TOOL=cmake
4359
4460 .ci/scripts/setup-conda.sh
5773
5874 # Build and test iOS Demo App
5975 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
60- build/test_ios_ci.sh ${ARTIFACTS_DIR_NAME}
76+ build/test_ios_ci.sh " ${ARTIFACTS_DIR_NAME}"
6177
6278 # Upload the test demo app to S3
6379 upload-demo-ios :
7591 shell : bash
7692 working-directory : ${{ runner.temp }}/artifacts/
7793 run : |
94+ set -eux
7895 ls -lah ./
7996
8097 - name : Upload the artifacts to S3
@@ -112,6 +129,7 @@ jobs:
112129
113130 build-frameworks-ios :
114131 name : build-frameworks-ios
132+ needs : set-version
115133 uses : pytorch/test-infra/.github/workflows/macos_job.yml@main
116134 with :
117135 runner : macos-latest-xlarge
@@ -121,8 +139,10 @@ jobs:
121139 upload-artifact : executorch-frameworks-ios
122140 timeout : 90
123141 script : |
142+ set -eux
143+
124144 BUILD_TOOL=cmake
125- VERSION="latest "
145+ VERSION="${{ needs.set-version.outputs.version }} "
126146 FRAMEWORKS=(
127147 "executorch"
128148 "backend_coreml"
@@ -171,13 +191,17 @@ jobs:
171191
172192 upload-frameworks-ios :
173193 runs-on : ubuntu-22.04
174- needs : build-frameworks-ios
194+ needs : [ build-frameworks-ios, set-version]
175195 timeout-minutes : 30
196+ environment : ${{ github.ref == 'refs/heads/main' && 'cherry-pick-bot' || '' }}
176197 permissions :
177198 id-token : write
178- contents : read
199+ contents : write
179200 steps :
180201 - uses : actions/checkout@v3
202+ with :
203+ fetch-depth : 0
204+ token : ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN || secrets.GITHUB_TOKEN }}
181205 - uses : actions/setup-python@v4
182206 with :
183207 python-version : ' 3.11'
@@ -194,15 +218,15 @@ jobs:
194218 name : executorch-frameworks-ios
195219 path : ${{ runner.temp }}/frameworks-ios/
196220 - name : Only push to S3 when running the workflow manually from main branch
197- 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' }}
198222 shell : bash
199223 run : |
200- set -eux
201224 echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
202225 - name : Upload the artifact to ossci-ios S3 bucket
203226 shell : bash
204227 run : |
205228 set -eux
229+ VERSION="${{ needs.set-version.outputs.version }}"
206230
207231 pip install awscli==1.32.18
208232
@@ -213,9 +237,44 @@ jobs:
213237
214238 for FILENAME in "${RUNNER_TEMP}"/frameworks-ios/*.zip; do
215239 [ -e "${FILENAME}" ] || continue
216- shasum -a 256 "${FILENAME}"
240+ FRAMEWORK_NAME=$(basename "${FILENAME}" | sed "s/-${VERSION}.zip//")
241+ CHECKSUM=$(shasum -a 256 "${FILENAME}" | cut -d ' ' -f1)
242+ echo "${FRAMEWORK_NAME} ${CHECKSUM}" >> "${RUNNER_TEMP}/checksums.txt"
217243 ${AWS_CMD} "${FILENAME}" s3://ossci-ios/executorch/ --acl public-read
218244 done
245+ - name : Update SwiftPM
246+ shell : bash
247+ run : |
248+ set -eux
249+ VERSION="${{ needs.set-version.outputs.version }}"
250+ BRANCH="swiftpm-${VERSION}"
251+
252+ git checkout swiftpm
253+
254+ if git show-ref --verify --quiet refs/heads/${BRANCH}; then
255+ git checkout "${BRANCH}"
256+ else
257+ git checkout -b "${BRANCH}"
258+ fi
259+
260+ [[ -f Package.swift ]] || mv Package.swift.template Package.swift
261+
262+ sed -i "s/__VERSION__/${VERSION}/g" Package.swift
263+
264+ while read -r FRAMEWORK CHECKSUM; do
265+ sed -i "s/__SHA256_${FRAMEWORK}__/${CHECKSUM}/g" Package.swift
266+ done < "${RUNNER_TEMP}/checksums.txt"
267+
268+ if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
269+ git config --global user.name "PyTorch Bot"
270+ git config --global user.email "[email protected] " 271+ git add Package.swift
272+ git commit -am "${VERSION}"
273+ git push -f origin "${BRANCH}"
274+ else
275+ echo "Draft Package.swift:"
276+ cat Package.swift
277+ fi
219278
220279 build-benchmark-app :
221280 name : build-benchmark-app
@@ -281,5 +340,5 @@ jobs:
281340 echo "::group::Build ExecuTorch benchmark app"
282341 mkdir -p extension/benchmark/apple/Benchmark/Models
283342 ${CONDA_RUN} --no-capture-output \
284- build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
343+ build/build_apple_llm_demo.sh " ${ARTIFACTS_DIR_NAME}"
285344 echo "::endgroup::"
0 commit comments