Skip to content

Commit

Permalink
Build frameworks.
Browse files Browse the repository at this point in the history
Summary: .

Reviewed By: huydhn

Differential Revision: D54791338
  • Loading branch information
shoumikhin authored and facebook-github-bot committed Mar 13, 2024
1 parent e807a75 commit 67707db
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ios-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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/build_ios.sh
- build/create_frameworks.sh
- 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:
build-ios:
name: build-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: ios-frameworks
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 iOS Frameworks
PYTHON_EXECUTABLE=python ${CONDA_RUN} bash build/build_ios.sh --output "${RUNNER_TEMP}/artifacts/ExecuTorch.zip"
popd
43 changes: 43 additions & 0 deletions build/build_ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

set -e

say() {
echo -e "\033[1m\n\t** $1 **\n\033[0m"
}

OUTPUT="ExecuTorch.zip"

for arg in "$@"; do
case $arg in
--output=*)
OUTPUT="${arg#*=}"
;;
*)
echo "Invalid argument: $arg"
exit 1
;;
esac
done

mkdir -p "$(dirname "$OUTPUT")"

say "Installing CoreML Backend Requirements"

./backends/apple/coreml/scripts/install_requirements.sh

say "Installing MPS Backend Requirements"

./backends/apple/mps/install_requirements.sh

say "Building Frameworks"

./build/build_apple_frameworks.sh --buck2="$(which buck2)" --flatc="$(which flatc)" --coreml --mps --portable --xnnpack
cp LICENSE cmake-out
zip -r "$OUTPUT" cmake-out
rm -rf cmake-out

0 comments on commit 67707db

Please sign in to comment.