Skip to content

Commit 2ebc272

Browse files
author
Guang Yang
committed
Ensure iOS benchmark app build is tested in CI
1 parent 72245c3 commit 2ebc272

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

.github/workflows/apple.yml

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

0 commit comments

Comments
 (0)