forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Reland] Add a workflow to release Android binaries (pytorch#110976)
This adds 2 jobs to build PyTorch Android with and without lite interpreter: * Keep the list of currently supported ABI armeabi-v7a, arm64-v8a, x86, x86_64 * Pass all the test on emulator * Run an the test app on emulator and my Android phone `arm64-v8a` without any issue  * Run on AWS https://us-west-2.console.aws.amazon.com/devicefarm/home#/mobile/projects/b531574a-fb82-40ae-b687-8f0b81341ae0/runs/5fce6818-628a-4099-9aab-23e91a212076 Pull Request resolved: pytorch#110976 Approved by: https://github.com/atalman
- Loading branch information
1 parent
a771fde
commit 53c1dca
Showing
9 changed files
with
131 additions
and
12 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,17 +41,25 @@ jobs: | |
strategy: | ||
matrix: ${{ fromJSON(needs.filter.outputs.test-matrix) }} | ||
fail-fast: false | ||
# NB: This job can only run on GitHub Linux runner atm. This is an ok thing though | ||
# because that runner is ephemeral and could access upload secrets | ||
runs-on: ${{ matrix.runner }} | ||
env: | ||
# GitHub runner installs Android SDK on this path | ||
ANDROID_ROOT: /usr/local/lib/android | ||
ANDROID_NDK_VERSION: '21.4.7075529' | ||
BUILD_LITE_INTERPRETER: ${{ matrix.use_lite_interpreter }} | ||
# 4 of them are supported atm: armeabi-v7a, arm64-v8a, x86, x86_64 | ||
SUPPORT_ABI: '${{ matrix.support_abi }}' | ||
steps: | ||
# [see note: pytorch repo ref] | ||
- name: Checkout PyTorch | ||
uses: pytorch/pytorch/.github/actions/checkout-pytorch@main | ||
|
||
- name: Setup miniconda | ||
uses: pytorch/test-infra/.github/actions/setup-miniconda@main | ||
with: | ||
python-version: 3.8 | ||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }} | ||
environment-file: .github/requirements/conda-env-${{ runner.os }}-${{ runner.arch }}.txt | ||
|
||
- name: Install NDK | ||
uses: nick-fields/[email protected] | ||
|
@@ -60,12 +68,12 @@ jobs: | |
max_attempts: 3 | ||
retry_wait_seconds: 90 | ||
command: | | ||
set -eux | ||
# Install NDK 21 after GitHub update | ||
# https://github.com/actions/virtual-environments/issues/5595 | ||
ANDROID_ROOT="/usr/local/lib/android" | ||
ANDROID_SDK_ROOT="${ANDROID_ROOT}/sdk" | ||
ANDROID_NDK="${ANDROID_SDK_ROOT}/ndk-bundle" | ||
ANDROID_NDK_VERSION="21.4.7075529" | ||
SDKMANAGER="${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager" | ||
# NB: This step downloads and installs NDK, thus it could be flaky. | ||
|
@@ -86,8 +94,10 @@ jobs: | |
- name: Build PyTorch Android | ||
run: | | ||
set -eux | ||
echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"}" >> "${GITHUB_ENV}" | ||
${CONDA_RUN} ./scripts/build_pytorch_android.sh x86 | ||
${CONDA_RUN} ./scripts/build_pytorch_android.sh "${SUPPORT_ABI}" | ||
- name: Run tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Build Android binaries | ||
|
||
on: | ||
push: | ||
branches: | ||
- nightly | ||
tags: | ||
# NOTE: Binary build pipelines should only get triggered on release candidate builds | ||
# Release candidate tags look like: v1.11.0-rc1 | ||
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | ||
paths: | ||
- .github/workflows/build-android-binaries.yml | ||
- .github/workflows/_run_android_tests.yml | ||
- android/** | ||
pull_request: | ||
paths: | ||
- .github/workflows/build-android-binaries.yml | ||
- .github/workflows/_run_android_tests.yml | ||
- android/** | ||
# NB: We can use this workflow dispatch to test and build the binaries manually | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
android-build-test: | ||
name: android-build-test | ||
uses: ./.github/workflows/_run_android_tests.yml | ||
with: | ||
test-matrix: | | ||
{ include: [ | ||
{ config: 'default', | ||
shard: 1, | ||
num_shards: 1, | ||
runner: 'ubuntu-20.04-16x', | ||
use_lite_interpreter: 1, | ||
support_abi: 'armeabi-v7a,arm64-v8a,x86,x86_64', | ||
}, | ||
{ config: 'default', | ||
shard: 1, | ||
num_shards: 1, | ||
runner: 'ubuntu-20.04-16x', | ||
use_lite_interpreter: 0, | ||
support_abi: 'armeabi-v7a,arm64-v8a,x86,x86_64', | ||
}, | ||
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters