From 8830186baace4ecee761c06710b96bea4cebeb1c Mon Sep 17 00:00:00 2001 From: Huy Do Date: Thu, 27 Aug 2026 18:52:12 -0700 Subject: [PATCH] Move the shared reusable workflows to linux_job_v3 _test_backend, _llm_server, _test_arduino_library, _test_cortex_m_e2e, _test_cortex_m_ops, _test_cadence and _test_riscv. Their docker-image inputs keep taking ci-image:, so callers pass the same values as before. v3 assumes role/arc through OIDC, and a reusable workflow only gets the permissions its caller hands down, so the test-backend-* callers of _test_backend.yml grant id-token: write. Authored with Claude Code. --- .github/workflows/_llm_server.yml | 11 ++++++++--- .github/workflows/_test_arduino_library.yml | 11 ++++++++--- .github/workflows/_test_backend.yml | 14 ++++++++++--- .github/workflows/_test_cadence.yml | 22 ++++++++++++++++----- .github/workflows/_test_cortex_m_e2e.yml | 14 ++++++++++--- .github/workflows/_test_cortex_m_ops.yml | 14 ++++++++++--- .github/workflows/_test_riscv.yml | 14 ++++++++++--- .github/workflows/test-backend-arm.yml | 6 ++++++ .github/workflows/test-backend-coreml.yml | 3 +++ .github/workflows/test-backend-cortex-m.yml | 3 +++ .github/workflows/test-backend-nxp.yml | 3 +++ .github/workflows/test-backend-openvino.yml | 3 +++ .github/workflows/test-backend-qnn.yml | 5 ++++- .github/workflows/test-backend-vulkan.yml | 3 +++ .github/workflows/test-backend-webgpu.yml | 3 +++ .github/workflows/test-backend-xnnpack.yml | 3 +++ 16 files changed, 108 insertions(+), 24 deletions(-) diff --git a/.github/workflows/_llm_server.yml b/.github/workflows/_llm_server.yml index e1ef5a30db9..87e2dc3371d 100644 --- a/.github/workflows/_llm_server.yml +++ b/.github/workflows/_llm_server.yml @@ -10,14 +10,19 @@ on: default: ci-image:executorch-ubuntu-22.04-clang12 jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + linux: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main permissions: id-token: write contents: read with: - runner: linux.2xlarge - docker-image: ${{ inputs.docker-image }} + runner: mt-l-x86iavx512-8-64 + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/${{ inputs.docker-image }}-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: recursive ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: 60 diff --git a/.github/workflows/_test_arduino_library.yml b/.github/workflows/_test_arduino_library.yml index a3e73958463..945cdd30026 100644 --- a/.github/workflows/_test_arduino_library.yml +++ b/.github/workflows/_test_arduino_library.yml @@ -14,15 +14,20 @@ on: default: 90 jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + run: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main permissions: id-token: write contents: read with: job-name: arduino-library - runner: linux.2xlarge - docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk + runner: mt-l-x86iavx512-8-64 + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-arm-sdk-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: 'recursive' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: ${{ inputs.timeout }} diff --git a/.github/workflows/_test_backend.yml b/.github/workflows/_test_backend.yml index 18c70a31531..3af638b04fe 100644 --- a/.github/workflows/_test_backend.yml +++ b/.github/workflows/_test_backend.yml @@ -40,7 +40,7 @@ on: description: 'Runner type for Linux jobs' required: false type: string - default: linux.4xlarge.memory + default: mt-l-x86iavx512-16-128 docker-image: description: 'Docker image for Linux jobs' required: false @@ -48,7 +48,12 @@ on: default: ci-image:executorch-ubuntu-22.04-clang12 jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + test-backend-linux: + needs: docker-image if: ${{ inputs.run-linux }} strategy: fail-fast: false @@ -57,11 +62,14 @@ jobs: suite: [models, operators] exclude: ${{ fromJSON(inputs.exclude) }} - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read with: ref: ${{ inputs.ref }} runner: ${{ inputs.runner-linux }} - docker-image: ${{ inputs.docker-image }} + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/${{ inputs.docker-image }}-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: recursive timeout: ${{ inputs.timeout }} upload-artifact: test-report-${{ inputs.backend }}-${{ matrix.flow }}-${{ matrix.suite }} diff --git a/.github/workflows/_test_cadence.yml b/.github/workflows/_test_cadence.yml index 2e98d21db1c..bc98362a87b 100644 --- a/.github/workflows/_test_cadence.yml +++ b/.github/workflows/_test_cadence.yml @@ -16,7 +16,7 @@ on: description: 'Runner type' required: false type: string - default: linux.8xlarge.memory + default: mt-l-x86iavx512-32-256 ref: description: 'Git ref to checkout' required: false @@ -29,12 +29,20 @@ on: default: 90 jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + test-aot: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read with: job-name: test-aot runner: ${{ inputs.runner }} - docker-image: ${{ inputs.docker-image }} + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/${{ inputs.docker-image }}-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: recursive ref: ${{ inputs.ref }} timeout: ${{ inputs.timeout }} @@ -50,11 +58,15 @@ jobs: python -m pytest backends/cadence/aot/tests/ -v -n auto --reruns 2 --reruns-delay 1 test-ops: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read with: job-name: test-ops runner: ${{ inputs.runner }} - docker-image: ${{ inputs.docker-image }} + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/${{ inputs.docker-image }}-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: recursive ref: ${{ inputs.ref }} timeout: ${{ inputs.timeout }} diff --git a/.github/workflows/_test_cortex_m_e2e.yml b/.github/workflows/_test_cortex_m_e2e.yml index 0510b017723..1957a2b0c56 100644 --- a/.github/workflows/_test_cortex_m_e2e.yml +++ b/.github/workflows/_test_cortex_m_e2e.yml @@ -23,8 +23,16 @@ on: default: 120 jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + run: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read strategy: matrix: model: ${{ fromJSON(inputs.models) }} @@ -32,8 +40,8 @@ jobs: fail-fast: false with: job-name: ${{ matrix.model }}-${{ matrix.target }} - runner: linux.2xlarge.memory - docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk + runner: mt-l-x86iavx512-8-64 + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-arm-sdk-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: 'recursive' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: ${{ inputs.timeout }} diff --git a/.github/workflows/_test_cortex_m_ops.yml b/.github/workflows/_test_cortex_m_ops.yml index a9e2e6180c3..885f5fb64d9 100644 --- a/.github/workflows/_test_cortex_m_ops.yml +++ b/.github/workflows/_test_cortex_m_ops.yml @@ -18,16 +18,24 @@ on: default: 120 jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + run: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read strategy: matrix: target: ${{ fromJSON(inputs.targets) }} fail-fast: false with: job-name: cortex-m-ops-${{ matrix.target }} - runner: linux.2xlarge.memory - docker-image: ci-image:executorch-ubuntu-22.04-arm-sdk + runner: mt-l-x86iavx512-8-64 + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-22.04-arm-sdk-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: 'recursive' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: ${{ inputs.timeout }} diff --git a/.github/workflows/_test_riscv.yml b/.github/workflows/_test_riscv.yml index 223a146e3d8..954cb94d596 100644 --- a/.github/workflows/_test_riscv.yml +++ b/.github/workflows/_test_riscv.yml @@ -37,11 +37,19 @@ on: type: string jobs: + docker-image: + name: Resolve CI docker image + uses: ./.github/workflows/_docker-image.yml + run: - uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main + needs: docker-image + uses: pytorch/test-infra/.github/workflows/linux_job_v3.yml@main + permissions: + id-token: write + contents: read with: - runner: linux.2xlarge - docker-image: ci-image:executorch-ubuntu-24.04-gcc14 + runner: mt-l-x86iavx512-8-64 + docker-image: ${{ needs.docker-image.outputs.docker-registry }}/ci-image:executorch-ubuntu-24.04-gcc14-${{ needs.docker-image.outputs.ci-docker-hash }} submodules: 'recursive' ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: ${{ inputs.timeout }} diff --git a/.github/workflows/test-backend-arm.yml b/.github/workflows/test-backend-arm.yml index d71696ee096..7d844748dac 100644 --- a/.github/workflows/test-backend-arm.yml +++ b/.github/workflows/test-backend-arm.yml @@ -19,6 +19,9 @@ concurrency: jobs: test-arm: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: arm flows: >- @@ -35,6 +38,9 @@ jobs: test-arm-vgf: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: arm-vgf flows: >- diff --git a/.github/workflows/test-backend-coreml.yml b/.github/workflows/test-backend-coreml.yml index 86844ffb559..fca10b619ce 100644 --- a/.github/workflows/test-backend-coreml.yml +++ b/.github/workflows/test-backend-coreml.yml @@ -36,6 +36,9 @@ jobs: contains(needs.changed-files.outputs.changed-files, '.github/workflows/test-backend-coreml.yml') || contains(needs.changed-files.outputs.changed-files, '.github/workflows/_test_backend.yml') uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: coreml # The heavier coreml_static_int8 macOS matrix saturates the shared diff --git a/.github/workflows/test-backend-cortex-m.yml b/.github/workflows/test-backend-cortex-m.yml index 9e9b4cdcaa1..b6cd09d3073 100644 --- a/.github/workflows/test-backend-cortex-m.yml +++ b/.github/workflows/test-backend-cortex-m.yml @@ -49,6 +49,9 @@ jobs: contains(needs.changed-files.outputs.changed-files, '.github/workflows/test-backend-cortex-m.yml') || contains(needs.changed-files.outputs.changed-files, '.github/workflows/_test_backend.yml') uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: cortex_m flows: '["cortex_m"]' diff --git a/.github/workflows/test-backend-nxp.yml b/.github/workflows/test-backend-nxp.yml index fed7ab7d19b..0db7d7efeac 100644 --- a/.github/workflows/test-backend-nxp.yml +++ b/.github/workflows/test-backend-nxp.yml @@ -39,6 +39,9 @@ jobs: contains(needs.changed-files.outputs.changed-files, '.github/workflows/test-backend-nxp.yml') || contains(needs.changed-files.outputs.changed-files, '.github/workflows/_test_backend.yml') uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: nxp flows: '["nxp_neutron_imxrt700_int8_ptq"]' diff --git a/.github/workflows/test-backend-openvino.yml b/.github/workflows/test-backend-openvino.yml index aeeb01e3eb1..cff7f8ba6e9 100644 --- a/.github/workflows/test-backend-openvino.yml +++ b/.github/workflows/test-backend-openvino.yml @@ -21,6 +21,9 @@ concurrency: jobs: test-openvino: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: openvino flows: '["openvino"]' diff --git a/.github/workflows/test-backend-qnn.yml b/.github/workflows/test-backend-qnn.yml index 939b7c36aee..51207d139b3 100644 --- a/.github/workflows/test-backend-qnn.yml +++ b/.github/workflows/test-backend-qnn.yml @@ -19,6 +19,9 @@ concurrency: jobs: test-qnn: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: qnn flows: >- @@ -28,4 +31,4 @@ jobs: ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} timeout: 120 run-linux: true - runner-linux: linux.8xlarge.memory + runner-linux: mt-l-x86iavx512-32-256 diff --git a/.github/workflows/test-backend-vulkan.yml b/.github/workflows/test-backend-vulkan.yml index 80ac3ee73a1..d3c9829dfe8 100644 --- a/.github/workflows/test-backend-vulkan.yml +++ b/.github/workflows/test-backend-vulkan.yml @@ -21,6 +21,9 @@ jobs: # runners. Runs on every PR and nightly. test-vulkan: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: vulkan flows: >- diff --git a/.github/workflows/test-backend-webgpu.yml b/.github/workflows/test-backend-webgpu.yml index 99dae3ee76d..42e958855ac 100644 --- a/.github/workflows/test-backend-webgpu.yml +++ b/.github/workflows/test-backend-webgpu.yml @@ -19,6 +19,9 @@ concurrency: jobs: test-webgpu: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: webgpu flows: '["webgpu"]' diff --git a/.github/workflows/test-backend-xnnpack.yml b/.github/workflows/test-backend-xnnpack.yml index e9f43608b16..c5abb15e837 100644 --- a/.github/workflows/test-backend-xnnpack.yml +++ b/.github/workflows/test-backend-xnnpack.yml @@ -19,6 +19,9 @@ concurrency: jobs: test-xnnpack: uses: ./.github/workflows/_test_backend.yml + permissions: + id-token: write + contents: read with: backend: xnnpack flows: >-