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-$(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,7 +191,7 @@ 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
176196 permissions :
177197 id-token : write
@@ -182,27 +202,27 @@ jobs:
182202 with :
183203 python-version : ' 3.11'
184204 cache : pip
185- - name : configure aws credentials
186- uses :
aws-actions/[email protected] 187- with :
188- role-to-assume : arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-ios
189- aws-region : us-east-1
205+ # - name: configure aws credentials
206+ # uses: aws-actions/[email protected] 207+ # with:
208+ # role-to-assume: arn:aws:iam::308535385114:role/gha_executorch_upload-frameworks-ios
209+ # aws-region: us-east-1
190210 - name : Download the artifact
191211 uses : actions/download-artifact@v3
192212 with :
193213 # NB: The name here needs to match the upload-artifact name from build-frameworks-ios job
194214 name : executorch-frameworks-ios
195215 path : ${{ runner.temp }}/frameworks-ios/
196216 - 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' }}
217+ if : ${{ ( github.event_name == 'schedule' || github.event_name == ' workflow_dispatch') && github.ref == 'refs/heads/main' }}
198218 shell : bash
199219 run : |
200- set -eux
201220 echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
202221 - name : Upload the artifact to ossci-ios S3 bucket
203222 shell : bash
204223 run : |
205224 set -eux
225+ VERSION="${{ needs.set-version.outputs.version }}"
206226
207227 pip install awscli==1.32.18
208228
@@ -212,10 +232,41 @@ jobs:
212232 fi
213233
214234 for FILENAME in "${RUNNER_TEMP}"/frameworks-ios/*.zip; do
215- [ -e "${FILENAME}" ] || continue
216- shasum -a 256 "${FILENAME}"
217- ${AWS_CMD} "${FILENAME }" s3://ossci-ios/executorch/ --acl public-read
235+ FRAMEWORK_NAME=$(basename "${FILENAME}" | sed "s/-${VERSION}.zip//")
236+ CHECKSUM=$( shasum -a 256 "${FILENAME}" | cut -d ' ' -f1)
237+ echo "${FRAMEWORK_NAME} ${CHECKSUM }" >> "${RUNNER_TEMP}/checksums.txt"
218238 done
239+ - name : Update SwiftPM
240+ shell : bash
241+ run : |
242+ set -eux
243+ VERSION="${{ needs.set-version.outputs.version }}"
244+
245+ git clone https://github.com/pytorch/executorch.git --branch swiftpm --depth 1 "${RUNNER_TEMP}/executorch"
246+ cd "${RUNNER_TEMP}/executorch"
247+ if git show-ref --verify --quiet refs/heads/swiftpm-${VERSION}; then
248+ git checkout "swiftpm-${VERSION}"
249+ else
250+ git checkout -b "swiftpm-${VERSION}"
251+ fi
252+
253+ cp -f Package.swift.template Package.swift
254+ sed -i "s/__VERSION__/${VERSION}/g" Package.swift
255+
256+ while read -r FRAMEWORK CHECKSUM; do
257+ sed -i "s/__SHA256_${FRAMEWORK}__/${CHECKSUM}/g" Package.swift
258+ done < "${RUNNER_TEMP}/checksums.txt"
259+
260+ # if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
261+ git config --global user.name "PyTorch Bot"
262+ git config --global user.email "[email protected] " 263+ git add Package.swift
264+ git commit -m "${VERSION}"
265+ git push origin "swiftpm-${VERSION}"
266+ # else
267+ # echo "Draft Package.swift:"
268+ # cat Package.swift
269+ # fi
219270
220271 build-benchmark-app :
221272 name : build-benchmark-app
@@ -281,5 +332,5 @@ jobs:
281332 echo "::group::Build ExecuTorch benchmark app"
282333 mkdir -p extension/benchmark/apple/Benchmark/Models
283334 ${CONDA_RUN} --no-capture-output \
284- build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
335+ build/build_apple_llm_demo.sh " ${ARTIFACTS_DIR_NAME}"
285336 echo "::endgroup::"
0 commit comments