Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 67 additions & 10 deletions .github/workflows/apple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,26 @@ on:
- extension/benchmark/apple/**
- extension/module/**
workflow_dispatch:
schedule:
- cron: '0 10 * * *' # Runs daily at 2 AM PST

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
cancel-in-progress: true

jobs:
set-version:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.set_version.outputs.version }}
steps:
- name: Set VERSION variable
id: set_version
shell: bash
run: |
VERSION="0.4.0.$(TZ='PST8PDT' date +%Y%m%d)"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

build-demo-ios:
name: build-demo-ios
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
Expand All @@ -39,6 +53,8 @@ jobs:
secrets-env: BUILD_CERTIFICATE_BASE64 EXECUTORCH_DEMO_BUILD_PROVISION_PROFILE_BASE64 KEYCHAIN_PASSWORD
upload-artifact: ios-apps
script: |
set -eux

BUILD_TOOL=cmake

.ci/scripts/setup-conda.sh
Expand All @@ -57,7 +73,7 @@ jobs:

# Build and test iOS Demo App
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
build/test_ios_ci.sh ${ARTIFACTS_DIR_NAME}
build/test_ios_ci.sh "${ARTIFACTS_DIR_NAME}"

# Upload the test demo app to S3
upload-demo-ios:
Expand All @@ -75,6 +91,7 @@ jobs:
shell: bash
working-directory: ${{ runner.temp }}/artifacts/
run: |
set -eux
ls -lah ./

- name: Upload the artifacts to S3
Expand Down Expand Up @@ -112,6 +129,7 @@ jobs:

build-frameworks-ios:
name: build-frameworks-ios
needs: set-version
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
with:
runner: macos-latest-xlarge
Expand All @@ -121,8 +139,10 @@ jobs:
upload-artifact: executorch-frameworks-ios
timeout: 90
script: |
set -eux

BUILD_TOOL=cmake
VERSION="latest"
VERSION="${{ needs.set-version.outputs.version }}"
FRAMEWORKS=(
"executorch"
"backend_coreml"
Expand Down Expand Up @@ -171,13 +191,17 @@ jobs:

upload-frameworks-ios:
runs-on: ubuntu-22.04
needs: build-frameworks-ios
needs: [build-frameworks-ios, set-version]
timeout-minutes: 30
environment: ${{ github.ref == 'refs/heads/main' && 'cherry-pick-bot' || '' }}
permissions:
id-token: write
contents: read
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PYTORCHBOT_CHERRY_PICK_TOKEN || secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v4
with:
python-version: '3.11'
Expand All @@ -194,15 +218,15 @@ jobs:
name: executorch-frameworks-ios
path: ${{ runner.temp }}/frameworks-ios/
- name: Only push to S3 when running the workflow manually from main branch
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' }}
if: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' }}
shell: bash
run: |
set -eux
echo "UPLOAD_ON_MAIN=1" >> "${GITHUB_ENV}"
- name: Upload the artifact to ossci-ios S3 bucket
shell: bash
run: |
set -eux
VERSION="${{ needs.set-version.outputs.version }}"

pip install awscli==1.32.18

Expand All @@ -212,10 +236,43 @@ jobs:
fi

for FILENAME in "${RUNNER_TEMP}"/frameworks-ios/*.zip; do
[ -e "${FILENAME}" ] || continue
shasum -a 256 "${FILENAME}"
${AWS_CMD} "${FILENAME}" s3://ossci-ios/executorch/ --acl public-read
FRAMEWORK_NAME=$(basename "${FILENAME}" | sed "s/-${VERSION}.zip//")
CHECKSUM=$(shasum -a 256 "${FILENAME}" | cut -d ' ' -f1)
echo "${FRAMEWORK_NAME} ${CHECKSUM}" >> "${RUNNER_TEMP}/checksums.txt"
done
- name: Update SwiftPM
shell: bash
run: |
set -eux
VERSION="${{ needs.set-version.outputs.version }}"
BRANCH="swiftpm-${VERSION}"

git checkout swiftpm

if git show-ref --verify --quiet refs/heads/${BRANCH}; then
git checkout "${BRANCH}"
else
git checkout -b "${BRANCH}"
fi

[[ -f Package.swift ]] || mv Package.swift.template Package.swift

sed -i "s/__VERSION__/${VERSION}/g" Package.swift

while read -r FRAMEWORK CHECKSUM; do
sed -i "s/__SHA256_${FRAMEWORK}__/${CHECKSUM}/g" Package.swift
done < "${RUNNER_TEMP}/checksums.txt"

if [[ "${UPLOAD_ON_MAIN:-0}" == "1" ]]; then
git config --global user.name "PyTorch Bot"
git config --global user.email "[email protected]"
git add Package.swift
git commit -m "${VERSION}"
git push origin "${BRANCH}"
else
echo "Draft Package.swift:"
cat Package.swift
fi

build-benchmark-app:
name: build-benchmark-app
Expand Down Expand Up @@ -281,5 +338,5 @@ jobs:
echo "::group::Build ExecuTorch benchmark app"
mkdir -p extension/benchmark/apple/Benchmark/Models
${CONDA_RUN} --no-capture-output \
build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
build/build_apple_llm_demo.sh "${ARTIFACTS_DIR_NAME}"
echo "::endgroup::"
Loading