|
1 | 1 | name: Android |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
7 | | - - release/* |
8 | | - tags: |
9 | | - - ciflow/android/* |
10 | | - pull_request: |
11 | | - paths: |
12 | | - - .ci/docker/** |
13 | | - - .github/workflows/android.yml |
14 | | - - build/*android*.sh |
15 | | - - install_requirements.sh |
16 | | - - examples/demo-apps/android/** |
17 | | - - extension/android/** |
18 | | - - extension/benchmark/android/** |
19 | | - - extension/module/** |
| 4 | + workflow_call: |
20 | 5 | workflow_dispatch: |
21 | 6 |
|
22 | 7 | concurrency: |
23 | | - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }} |
| 8 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} |
24 | 9 | cancel-in-progress: true |
25 | 10 |
|
26 | 11 | jobs: |
| 12 | + check_path: |
| 13 | + name: Check whether the affected path needs to be validated by this CI |
| 14 | + runs-on: ubuntu-22.04 |
| 15 | + outputs: |
| 16 | + should_run: ${{ steps.check-path.outputs.should_run }} |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + fetch-depth: '0' |
| 21 | + - uses: actions/setup-python@v4 |
| 22 | + with: |
| 23 | + python-version: '3.10' |
| 24 | + - name: Check path |
| 25 | + id: check-path |
| 26 | + env: |
| 27 | + GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} |
| 28 | + GITHUB_PR_BASE: ${{ github.base_ref }} |
| 29 | + GITHUB_PR_HEAD: ${{ github.head_ref }} |
| 30 | + run: | |
| 31 | + if [ -z "$GITHUB_PR_NUMBER" ]; then |
| 32 | + # It's not for a PR, but pushed to a branch in pull.yml, or dispatch. Always run. |
| 33 | + echo "::set-output should_run=1" |
| 34 | + return 0 |
| 35 | + fi |
| 36 | + if [ -z "$GITHUB_PR_BASE" ] || [ -z "$GITHUB_PR_HEAD" ] ; then |
| 37 | + # Seems like not a well-formed PR |
| 38 | + echo "::set-output should_run=1" |
| 39 | + return 0 |
| 40 | + fi |
| 41 | + git diff --name-only "$GITHUB_PR_BASE" "$GITHUB_PR_HEAD" > modified_files |
| 42 | + cat >> matcher<< EOF |
| 43 | + .ci/docker/ |
| 44 | + .github/workflows/android.yml |
| 45 | + build/.*android.*.sh |
| 46 | + install_requirements.sh |
| 47 | + examples/demo-apps/android |
| 48 | + extension/android |
| 49 | + extension/benchmark/android |
| 50 | + extension/module |
| 51 | + EOF |
| 52 | + echo "::set-output should_run=$(python .github/scripts/check_path_match.py modified_files matcher)" |
| 53 | +
|
27 | 54 | build-llm-demo: |
28 | 55 | name: build-llm-demo |
29 | 56 | uses: pytorch/test-infra/.github/workflows/linux_job.yml@main |
| 57 | + if: ${{ steps.check_path.outputs.should_run }} == '1' |
30 | 58 | with: |
31 | 59 | runner: linux.2xlarge |
32 | 60 | docker-image: executorch-ubuntu-22.04-clang12-android |
|
0 commit comments