Skip to content

Commit 4a1aa98

Browse files
authored
Reduce windows CI (pytorch#19945)
Reduces windows CI by enabling path filters on PRs and sampling on main push. See related pytorch#19919
1 parent 47b71d8 commit 4a1aa98

3 files changed

Lines changed: 68 additions & 3 deletions

File tree

.github/workflows/cuda-windows.yml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,36 @@ concurrency:
2222
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
2323
cancel-in-progress: false
2424

25+
permissions:
26+
contents: read
27+
2528
jobs:
29+
changed-files:
30+
name: Get changed files
31+
uses: ./.github/workflows/_get-changed-files.yml
32+
with:
33+
include-push-diff: true
34+
35+
run-decision:
36+
name: CI run decision
37+
uses: ./.github/workflows/_ci-run-decision.yml
38+
2639
export-model-cuda-windows-artifact:
2740
name: export-model-cuda-windows-artifact
28-
# Skip this job if the pull request is from a fork (HuggingFace secrets are not available)
29-
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
41+
# Skip this job if the pull request is from a fork (HuggingFace secrets are not available).
42+
# Path-filtered on push: mirrors the workflow-level pull_request `paths:`
43+
# filter so push commits that don't touch CUDA-relevant paths skip
44+
# this job on non-sampled commits. See _ci-run-decision.yml for
45+
# the sampling policy.
46+
needs: [changed-files, run-decision]
47+
if: |
48+
(github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request') &&
49+
(
50+
contains(needs.changed-files.outputs.changed-files, 'backends/cuda') ||
51+
contains(needs.changed-files.outputs.changed-files, 'backends/aoti') ||
52+
contains(needs.changed-files.outputs.changed-files, '.github/workflows/cuda-windows.yml') ||
53+
needs.run-decision.outputs.is-full-run == 'true'
54+
)
3055
uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main
3156
permissions:
3257
id-token: write
@@ -114,7 +139,20 @@ jobs:
114139
115140
test-model-cuda-windows-e2e:
116141
name: test-model-cuda-windows-e2e
117-
needs: export-model-cuda-windows-artifact
142+
# Same path filter as the export job above. Also explicitly gated
143+
# on the export job succeeding — when needs: jobs are *skipped*
144+
# (e.g. fork PR), GitHub still evaluates this if:, so without the
145+
# explicit success-check this job would run and then fail trying
146+
# to download an artifact that was never produced.
147+
needs: [changed-files, export-model-cuda-windows-artifact, run-decision]
148+
if: |
149+
needs.export-model-cuda-windows-artifact.result == 'success' &&
150+
(
151+
contains(needs.changed-files.outputs.changed-files, 'backends/cuda') ||
152+
contains(needs.changed-files.outputs.changed-files, 'backends/aoti') ||
153+
contains(needs.changed-files.outputs.changed-files, '.github/workflows/cuda-windows.yml') ||
154+
needs.run-decision.outputs.is-full-run == 'true'
155+
)
118156
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
119157
strategy:
120158
fail-fast: false

.github/workflows/trunk.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,10 @@ jobs:
10371037
docker-image: ci-image:executorch-ubuntu-22.04-clang12
10381038

10391039
test-models-windows:
1040+
needs: run-decision
1041+
if: |
1042+
github.event_name == 'pull_request' ||
1043+
needs.run-decision.outputs.is-full-run == 'true'
10401044
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
10411045
strategy:
10421046
fail-fast: false

.github/workflows/windows-msvc.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,32 @@ concurrency:
1717
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
1818
cancel-in-progress: true
1919

20+
permissions:
21+
contents: read
22+
2023
jobs:
24+
changed-files:
25+
name: Get changed files
26+
uses: ./.github/workflows/_get-changed-files.yml
27+
with:
28+
include-push-diff: true
29+
30+
run-decision:
31+
name: CI run decision
32+
uses: ./.github/workflows/_ci-run-decision.yml
33+
2134
build-windows-msvc:
2235
name: build-windows-msvc
36+
needs: [changed-files, run-decision]
37+
# Path-filtered: mirrors the workflow-level pull_request `paths:`
38+
# filter above, so push commits that don't touch these paths skip
39+
# this job on non-sampled commits. See _ci-run-decision.yml for
40+
# the sampling policy.
41+
if: |
42+
contains(needs.changed-files.outputs.changed-files, '.ci/docker/ci_commit_pins/pytorch.txt') ||
43+
contains(needs.changed-files.outputs.changed-files, '.ci/scripts/') ||
44+
contains(needs.changed-files.outputs.changed-files, '.github/workflows/windows-msvc.yml') ||
45+
needs.run-decision.outputs.is-full-run == 'true'
2346
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main
2447
with:
2548
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

0 commit comments

Comments
 (0)