|
| 1 | +name: Apple |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - release/* |
| 8 | + pull_request: |
| 9 | + paths: |
| 10 | + - .ci/docker/** |
| 11 | + - .github/workflows/app-build.yml |
| 12 | + - install_requirements.sh |
| 13 | + - backends/apple/** |
| 14 | + - build/build_apple_frameworks.sh |
| 15 | + - build/create_frameworks.sh |
| 16 | + - build/test_ios_ci.sh |
| 17 | + - examples/demo-apps/** |
| 18 | + - extension/apple/** |
| 19 | + - extension/module/** |
| 20 | + workflow_dispatch: |
| 21 | + |
| 22 | +concurrency: |
| 23 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }} |
| 24 | + cancel-in-progress: true |
| 25 | + |
| 26 | +jobs: |
| 27 | + test-demo-ios: |
| 28 | + name: test-demo-ios |
| 29 | + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main |
| 30 | + with: |
| 31 | + runner: macos-latest-xlarge |
| 32 | + python-version: '3.11' |
| 33 | + submodules: 'true' |
| 34 | + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| 35 | + timeout: 90 |
| 36 | + script: | |
| 37 | + WORKSPACE=$(pwd) |
| 38 | + pushd "${WORKSPACE}/pytorch/executorch" |
| 39 | + BUILD_TOOL=cmake |
| 40 | +
|
| 41 | + .ci/scripts/setup-conda.sh |
| 42 | +
|
| 43 | + # Setup MacOS dependencies as there is no Docker support on MacOS atm |
| 44 | + GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ |
| 45 | + .ci/scripts/setup-macos.sh "${BUILD_TOOL}" |
| 46 | +
|
| 47 | + # Build and test iOS Demo App |
| 48 | + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ |
| 49 | + build/test_ios_ci.sh |
| 50 | +
|
| 51 | + popd |
| 52 | +
|
| 53 | + build-frameworks-ios: |
| 54 | + name: build-frameworks-ios |
| 55 | + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main |
| 56 | + with: |
| 57 | + runner: macos-latest-xlarge |
| 58 | + python-version: '3.11' |
| 59 | + submodules: 'true' |
| 60 | + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| 61 | + upload-artifact: executorch.zip |
| 62 | + timeout: 90 |
| 63 | + script: | |
| 64 | + WORKSPACE=$(pwd) |
| 65 | + pushd "${WORKSPACE}/pytorch/executorch" |
| 66 | + BUILD_TOOL=cmake |
| 67 | + VERSION="0.1.0" |
| 68 | + OUTPUT="executorch-${VERSION}" |
| 69 | +
|
| 70 | + .ci/scripts/setup-conda.sh |
| 71 | +
|
| 72 | + # Setup MacOS dependencies as there is no Docker support on MacOS atm |
| 73 | + GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ |
| 74 | + .ci/scripts/setup-macos.sh "${BUILD_TOOL}" |
| 75 | +
|
| 76 | + # Install CoreML Backend Requirements |
| 77 | + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ |
| 78 | + backends/apple/coreml/scripts/install_requirements.sh |
| 79 | +
|
| 80 | + # Install MPS Backend Requirements |
| 81 | + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ |
| 82 | + backends/apple/mps/install_requirements.sh |
| 83 | +
|
| 84 | + # Build iOS Frameworks |
| 85 | + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ |
| 86 | + build/build_apple_frameworks.sh --output="${OUTPUT}" --coreml --mps --portable --xnnpack |
| 87 | +
|
| 88 | + # Bundle iOS Frameworks |
| 89 | + cp LICENSE "${OUTPUT}" |
| 90 | + zip -r "${RUNNER_TEMP}/artifacts/${OUTPUT}.zip" "${OUTPUT}" |
| 91 | +
|
| 92 | + popd |
0 commit comments