1010 tags :
1111 - ciflow/nightly/*
1212 pull_request :
13+ # Fork PRs, Meta exports from personal forks included. pull_request_target
14+ # always runs this file from the default branch, so the paths filter below only
15+ # affects fork PRs.
1316 pull_request_target :
14- types : [labeled]
17+ types : [opened, synchronize, reopened]
18+ paths :
19+ - backends/cadence/**
20+ - examples/cadence/**
21+ - .ci/scripts/setup-xtensa-tools.sh
22+ - .ci/scripts/build-cadence-xtensa.sh
23+ - .ci/scripts/test-cadence-xtensa.sh
1524 workflow_dispatch :
1625
1726concurrency :
1827 group : ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.ref_type == 'branch' && github.sha }}
1928 cancel-in-progress : true
2029
30+ # Every job runs on the same paths. Same-repo PRs use pull_request, which reads
31+ # the PR's own workflow AND code -- so CI changes, new test jobs, code, and tests
32+ # are all validated pre-merge. Fork PRs can't get credentials (OIDC) there, so
33+ # fork PRs whose author has contributed before (CONTRIBUTOR or above) run on
34+ # pull_request_target instead. The CPU jobs hold no AWS credentials on any path
35+ # (contents: read only), so linux_job_v3's role/arc never reaches fork code; only
36+ # the Xtensa jobs assume a role, the Cadence artifacts one. The run condition is
37+ # inlined per job (GitHub Actions has no YAML anchors and env is unavailable in
38+ # job-level if), so keep the copies in sync.
2139jobs :
40+ # Resolves the image inline rather than through the shared _docker-image.yml,
41+ # which checks out the PR head: actions/checkout refuses that for fork code on
42+ # pull_request_target. There the image comes from the base branch (github.sha),
43+ # which also keeps a fork from picking the image it runs in. Same-repo PRs read
44+ # their own head, as _docker-image.yml does, so .ci/docker changes are tested.
2245 docker-image :
2346 name : Resolve CI docker image
24- uses : ./.github/workflows/_docker-image.yml
47+ if : >-
48+ github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
49+ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
50+ (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
51+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association))
52+ runs-on : ubuntu-latest
53+ permissions :
54+ contents : read
55+ outputs :
56+ image : ${{ steps.hash.outputs.image }}
57+ steps :
58+ - uses : actions/checkout@v4
59+ with :
60+ ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
61+ persist-credentials : false
62+ - id : hash
63+ run : |
64+ set -eu
65+ CI_DOCKER_HASH="$(git rev-parse HEAD:.ci/docker)"
66+ echo "image=308535385114.dkr.ecr.us-east-1.amazonaws.com/executorch/ci-image:executorch-ubuntu-22.04-clang12-${CI_DOCKER_HASH}" >> "$GITHUB_OUTPUT"
2567
26- # Same-repo PRs run on pull_request, which reads the PR's own workflow AND code
27- # -- so CI changes, new test jobs, code, and tests are all validated pre-merge.
28- # Fork PRs can't get credentials (OIDC) on pull_request, so Meta-exported forks
29- # (labeled CLA Signed + meta-exported) run on pull_request_target instead. The
30- # run condition is inlined per job (GitHub Actions has no YAML anchors and env
31- # is unavailable in job-level if), so keep the copies in sync.
3268 cpu-build :
3369 needs : docker-image
3470 if : >-
3571 github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
3672 (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
3773 (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
38- contains(github.event.pull_request.labels.*.name, 'CLA Signed') && contains( github.event.pull_request.labels.*.name, 'meta-exported' ))
74+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association ))
3975 uses : pytorch/test-infra/.github/workflows/linux_job_v3.yml@main
4076 permissions :
41- id-token : write
4277 contents : read
4378 with :
4479 job-name : build
4580 runner : mt-l-x86iavx512-8-64
46- docker-image : ${{ needs.docker-image.outputs.docker-registry }}/ci- image:executorch-ubuntu-22.04-clang12-${{ needs.docker-image.outputs.ci-docker-hash }}
81+ docker-image : ${{ needs.docker-image.outputs.image }}
4782 submodules : recursive
4883 ref : ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
4984 timeout : 90
@@ -61,66 +96,74 @@ jobs:
6196 cp cmake-out/backends/cadence/cadence_runner "${RUNNER_ARTIFACT_DIR}/"
6297
6398 cpu-test :
64- needs : cpu-build
99+ needs : [docker-image, cpu-build]
65100 if : >-
66101 github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
67102 (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
68103 (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
69- contains(github.event.pull_request.labels.*.name, 'CLA Signed') && contains( github.event.pull_request.labels.*.name, 'meta-exported' ))
104+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association ))
70105 permissions :
71- id-token : write
72106 contents : read
73107 uses : ./.github/workflows/_test_cadence.yml
74108 with :
109+ docker-image : ${{ needs.docker-image.outputs.image }}
75110 ref : ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
76111
77112 # Cross-compile cadence_executor_runner for each Cadence Xtensa core, one job
78113 # per backend so they show as separate lines (no matrix grouping). Shared logic
79114 # lives in _xtensa_build.yml. fusion_g3 is omitted until the upstream fusion_g3
80115 # <-> nnlib-FusionG3 API skew is fixed (its runner does not link).
81116 hifi-build :
117+ needs : docker-image
82118 if : >-
83119 github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
84120 (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
85121 (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
86- contains(github.event.pull_request.labels.*.name, 'CLA Signed') && contains( github.event.pull_request.labels.*.name, 'meta-exported' ))
122+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association ))
87123 permissions :
88124 id-token : write
89125 contents : read
90126 uses : ./.github/workflows/_xtensa_build.yml
91127 with :
92128 backend : hifi4
93129 ref : ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
130+ docker-image : ${{ needs.docker-image.outputs.image }}
131+ allow-fork-checkout : ${{ github.event_name == 'pull_request_target' }}
94132
95133 # Op-level gtest tests on the Xtensa ISS, mirroring cpu-build -> cpu-test. The
96134 # op tests are a self-contained cross-compile (the gtests need exceptions and
97135 # RTTI that the runner build disables), so this does not consume hifi-build's
98136 # artifact; needs: hifi-build only to fail fast when the backend cannot build.
99137 hifi-op-test :
100- needs : hifi-build
138+ needs : [docker-image, hifi-build]
101139 if : >-
102140 github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
103141 (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
104142 (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
105- contains(github.event.pull_request.labels.*.name, 'CLA Signed') && contains( github.event.pull_request.labels.*.name, 'meta-exported' ))
143+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association ))
106144 permissions :
107145 id-token : write
108146 contents : read
109147 uses : ./.github/workflows/_xtensa_test.yml
110148 with :
111149 backend : hifi4
112150 ref : ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
151+ docker-image : ${{ needs.docker-image.outputs.image }}
152+ allow-fork-checkout : ${{ github.event_name == 'pull_request_target' }}
113153
114154 vision-build :
155+ needs : docker-image
115156 if : >-
116157 github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' ||
117158 (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) ||
118159 (github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.full_name != github.repository &&
119- contains(github.event.pull_request.labels.*.name, 'CLA Signed') && contains( github.event.pull_request.labels.*.name, 'meta-exported' ))
160+ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR", "CONTRIBUTOR"]'), github.event.pull_request.author_association ))
120161 permissions :
121162 id-token : write
122163 contents : read
123164 uses : ./.github/workflows/_xtensa_build.yml
124165 with :
125166 backend : vision
126167 ref : ${{ (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.head.sha || github.sha }}
168+ docker-image : ${{ needs.docker-image.outputs.image }}
169+ allow-fork-checkout : ${{ github.event_name == 'pull_request_target' }}
0 commit comments