diff --git a/.github/workflows/app-build.yml b/.github/workflows/app-build.yml deleted file mode 100644 index 6a5b02b4fc..0000000000 --- a/.github/workflows/app-build.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Build ExecuTorch demo apps - -on: - push: - branches: - - main - - release/* - pull_request: - paths: - - .ci/docker/** - - .github/workflows/app-build.yml - - install_requirements.sh - - backends/apple/** - - build/build_apple_frameworks.sh - - build/test_ios_ci.sh - - examples/demo-apps/** - - extension/module/** - workflow_dispatch: - -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: - test-demo-ios: - name: test-demo-ios - uses: pytorch/test-infra/.github/workflows/macos_job.yml@main - with: - runner: macos-latest-xlarge - python-version: '3.11' - submodules: 'true' - ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} - timeout: 90 - script: | - WORKSPACE=$(pwd) - pushd "${WORKSPACE}/pytorch/executorch" - BUILD_TOOL=cmake - - bash .ci/scripts/setup-conda.sh - # Setup MacOS dependencies as there is no Docker support on MacOS atm - GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} bash .ci/scripts/setup-macos.sh "${BUILD_TOOL}" - # Build and test iOS Demo App - PYTHON_EXECUTABLE=python ${CONDA_RUN} bash build/test_ios_ci.sh - popd diff --git a/.github/workflows/apple.yml b/.github/workflows/apple.yml new file mode 100644 index 0000000000..0a4a06aa70 --- /dev/null +++ b/.github/workflows/apple.yml @@ -0,0 +1,92 @@ +name: Apple + +on: + push: + branches: + - main + - release/* + pull_request: + paths: + - .ci/docker/** + - .github/workflows/app-build.yml + - install_requirements.sh + - backends/apple/** + - build/build_apple_frameworks.sh + - build/create_frameworks.sh + - build/test_ios_ci.sh + - examples/demo-apps/** + - extension/apple/** + - extension/module/** + workflow_dispatch: + +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: + test-demo-ios: + name: test-demo-ios + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main + with: + runner: macos-latest-xlarge + python-version: '3.11' + submodules: 'true' + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + timeout: 90 + script: | + WORKSPACE=$(pwd) + pushd "${WORKSPACE}/pytorch/executorch" + BUILD_TOOL=cmake + + .ci/scripts/setup-conda.sh + + # Setup MacOS dependencies as there is no Docker support on MacOS atm + GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ + .ci/scripts/setup-macos.sh "${BUILD_TOOL}" + + # Build and test iOS Demo App + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ + build/test_ios_ci.sh + + popd + + build-frameworks-ios: + name: build-frameworks-ios + uses: pytorch/test-infra/.github/workflows/macos_job.yml@main + with: + runner: macos-latest-xlarge + python-version: '3.11' + submodules: 'true' + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} + upload-artifact: executorch.zip + timeout: 90 + script: | + WORKSPACE=$(pwd) + pushd "${WORKSPACE}/pytorch/executorch" + BUILD_TOOL=cmake + VERSION="0.1.0" + OUTPUT="executorch-${VERSION}" + + .ci/scripts/setup-conda.sh + + # Setup MacOS dependencies as there is no Docker support on MacOS atm + GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ + .ci/scripts/setup-macos.sh "${BUILD_TOOL}" + + # Install CoreML Backend Requirements + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ + backends/apple/coreml/scripts/install_requirements.sh + + # Install MPS Backend Requirements + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ + backends/apple/mps/install_requirements.sh + + # Build iOS Frameworks + PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \ + build/build_apple_frameworks.sh --output="${OUTPUT}" --coreml --mps --portable --xnnpack + + # Bundle iOS Frameworks + cp LICENSE "${OUTPUT}" + zip -r "${RUNNER_TEMP}/artifacts/${OUTPUT}.zip" "${OUTPUT}" + + popd diff --git a/build/build_apple_frameworks.sh b/build/build_apple_frameworks.sh index 30e36df136..61e7c2725f 100755 --- a/build/build_apple_frameworks.sh +++ b/build/build_apple_frameworks.sh @@ -13,9 +13,9 @@ SOURCE_ROOT_DIR="" OUTPUT="cmake-out" MODE="Release" TOOLCHAIN="" -BUCK2="/tmp/buck2" +BUCK2="buck2" PYTHON=$(which python3) -FLATC="" +FLATC="flatc" IOS_DEPLOYMENT_TARGET="17.0" COREML=OFF MPS=OFF