Files
pytorch/.github/workflows/_run_android_tests.yml
T
Huy Do 2ee85f9e8b Extend filter logic to remaining CI workflows (#95437)
Per title, this extends CI filter logic to all remaining *smaller* workflows across pull, trunk, and periodic.  These jobs can then be disabled dynamically.  Before this, the filter logic only exists in major platform workflows including linux, windows, macos, and rocm.

* These *smaller* workflows now accept the `test-matrix` input with one the default shard
* `filter-test-configs` logic is added as a filter step

This is needed after https://github.com/pytorch/pytorch/pull/95442 in the event where we need to disable these jobs

### Testing

* Disable https://github.com/pytorch/pytorch/issues/95746 for testing. Confirm in https://github.com/pytorch/pytorch/actions/runs/4299047707/jobs/7493851429 that the job is disabled (skipped)
* Disable https://github.com/pytorch/pytorch/issues/95752 for testing. Confirm in https://github.com/pytorch/pytorch/actions/runs/4299049008/jobs/7512566000 that the job is disabled (skipped). Note that MPS is the special case where it could be triggered by `Mac MPS` or `trunk` workflows.  So disabling MPS would strictly require both to be disabled.  IMO, this is not a big issue as we would only need to disable `trunk` most of the times.  Devs who attach `ciflow/mps` and use `Mac MPS` workflow know what they are doing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95437
Approved by: https://github.com/clee2000
2023-03-03 04:23:21 +00:00

76 lines
2.4 KiB
YAML

name: android-tests
on:
workflow_call:
inputs:
test-matrix:
required: true
type: string
description: |
A JSON description of what configs to run later on.
defaults:
run:
shell: bash -e -l {0}
jobs:
filter:
runs-on: [self-hosted, linux.large]
outputs:
test-matrix: ${{ steps.filter.outputs.test-matrix }}
is-test-matrix-empty: ${{ steps.filter.outputs.is-test-matrix-empty }}
keep-going: ${{ steps.filter.outputs.keep-going }}
steps:
- name: Checkout PyTorch
uses: pytorch/pytorch/.github/actions/checkout-pytorch@master
with:
fetch-depth: 1
submodules: false
- name: Select all requested test configurations
id: filter
uses: ./.github/actions/filter-test-configs
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-matrix: ${{ inputs.test-matrix }}
build-and-test:
needs: filter
# Don't run on forked repos.
if: github.repository_owner == 'pytorch' && needs.filter.outputs.is-test-matrix-empty == 'False'
strategy:
matrix: ${{ fromJSON(needs.filter.outputs.test-matrix) }}
fail-fast: false
runs-on: ${{ matrix.runner }}
steps:
# [see note: pytorch repo ref]
- name: Checkout PyTorch
uses: pytorch/pytorch/.github/actions/checkout-pytorch@master
- 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 }}
- name: Build PyTorch Android
run: |
# 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"
SDKMANAGER="${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager"
echo "y" | ${SDKMANAGER} "ndk;21.4.7075529"
export ANDROID_NDK="${ANDROID_SDK_ROOT}/ndk-bundle"
ln -sfn ${ANDROID_SDK_ROOT}/ndk/21.4.7075529 ${ANDROID_NDK}
echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"}" >> "${GITHUB_ENV}"
${CONDA_RUN} ./scripts/build_pytorch_android.sh x86
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 25
script: ./android/run_tests.sh