Skip to content

Commit 778ee2b

Browse files
author
Guang Yang
committed
Ensure iOS benchmark app build is tested in CI
1 parent 5c56f96 commit 778ee2b

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/apple.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- install_requirements.sh
1414
- backends/apple/**
1515
- build/build_apple_frameworks.sh
16+
- build/build_apple_llm_demo.sh
1617
- build/create_frameworks.sh
1718
- build/test_ios_ci.sh
1819
- examples/demo-apps/apple_ios/**
@@ -215,3 +216,72 @@ jobs:
215216
shasum -a 256 "${FILENAME}"
216217
${AWS_CMD} "${FILENAME}" s3://ossci-ios/executorch/ --acl public-read
217218
done
219+
220+
build-benchmark-app:
221+
name: build-benchmark-app
222+
uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
223+
needs:
224+
- set-parameters
225+
secrets: inherit
226+
with:
227+
runner: macos-latest-xlarge
228+
python-version: '3.11'
229+
submodules: 'true'
230+
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
231+
upload-artifact: ios-apps
232+
secrets-env: BUILD_CERTIFICATE_BASE64 EXECUTORCH_BENCHMARK_BUILD_PROVISION_PROFILE_BASE64 KEYCHAIN_PASSWORD
233+
timeout: 90
234+
script: |
235+
set -eux
236+
237+
echo "::group::Setting up CI environment"
238+
.ci/scripts/setup-conda.sh
239+
240+
BUILD_TOOL=cmake
241+
# Setup MacOS dependencies as there is no Docker support on MacOS atm
242+
GITHUB_RUNNER=1 PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
243+
.ci/scripts/setup-macos.sh "${BUILD_TOOL}"
244+
export ARTIFACTS_DIR_NAME=artifacts-to-be-uploaded
245+
246+
# Setup Apple certificate for iOS development
247+
BUILD_PROVISION_PROFILE_BASE64="${SECRET_EXECUTORCH_BENCHMARK_BUILD_PROVISION_PROFILE_BASE64}" \
248+
BUILD_CERTIFICATE_BASE64="${SECRET_BUILD_CERTIFICATE_BASE64}" \
249+
KEYCHAIN_PASSWORD="${SECRET_KEYCHAIN_PASSWORD}" \
250+
.ci/scripts/setup-ios.sh
251+
252+
# Install CoreML Backend Requirements
253+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
254+
backends/apple/coreml/scripts/install_requirements.sh
255+
256+
# Install MPS Backend Requirements
257+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
258+
backends/apple/mps/install_requirements.sh
259+
echo "::endgroup::"
260+
261+
echo "::group::Build ExecuTorch iOS frameworks"
262+
FRAMEWORKS=(
263+
"executorch"
264+
"backend_coreml"
265+
"backend_mps"
266+
"backend_xnnpack"
267+
"kernels_custom"
268+
"kernels_optimized"
269+
"kernels_portable"
270+
"kernels_quantized"
271+
)
272+
273+
# Build Release iOS Frameworks
274+
PYTHON_EXECUTABLE=python ${CONDA_RUN} --no-capture-output \
275+
build/build_apple_frameworks.sh --coreml --custom --mps --optimized --portable --quantized --xnnpack
276+
277+
mkdir -p extension/apple/Benchmark/Frameworks
278+
for FRAMEWORK in "${FRAMEWORKS[@]}"; do (
279+
cp -r "cmake-out/${FRAMEWORK}.xcframework" extension/apple/Benchmark/Frameworks/
280+
) done
281+
echo "::endgroup::"
282+
283+
echo "::group::Build ExecuTorch benchmark app"
284+
mkdir -p extension/apple/Benchmark/Models
285+
${CONDA_RUN} --no-capture-output \
286+
build/build_apple_llm_demo.sh ${ARTIFACTS_DIR_NAME}
287+
echo "::endgroup::"

0 commit comments

Comments
 (0)