Skip to content

Commit b654f93

Browse files
Run gpu tests if relevant files are changed
Signed-off-by: Keval Morabia <[email protected]>
1 parent dc342eb commit b654f93

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

.github/workflows/_wait_for_checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ jobs:
1818
checks: read
1919
steps:
2020
- name: Wait for checks (PRs only)
21-
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/pull-request/')
21+
if: github.event_name == 'pull_request' || startsWith(github.sha, 'refs/heads/pull-request/')
2222
uses: poseidon/[email protected]
2323
with:
2424
token: ${{ secrets.GITHUB_TOKEN }}
2525
match_pattern: ${{ inputs.match_pattern }}
2626
delay: ${{ inputs.delay }}
2727
- name: No-op for non-PR events
28-
if: github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/pull-request/')
28+
if: github.event_name != 'pull_request' && !startsWith(github.sha, 'refs/heads/pull-request/')
2929
run: echo "Not a pull_request event"

.github/workflows/gpu_tests.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,11 @@ name: GPU tests
33
on:
44
push:
55
branches: ["pull-request/[0-9]+"]
6-
# TODO: paths cannot be used since push happens to copied PR and only latest commit to PR is used
7-
# paths:
8-
# - ".github/workflows/gpu_tests.yml"
9-
# - "modelopt/**"
10-
# - "tests/gpu/**"
11-
# - "pyproject.toml"
12-
# - "setup.py"
13-
# - "tox.ini"
6+
# NOTE: paths cannot be used since push happens to copied PR and only latest commit to PR is used
147

158
# Cancel previous runs if new commit is pushed to the same PR
169
concurrency:
17-
group: ${{ github.workflow }}-${{ github.ref }}
10+
group: ${{ github.workflow }}-${{ github.sha }}
1811
cancel-in-progress: true
1912

2013
jobs:
@@ -47,7 +40,22 @@ jobs:
4740
PIP_CONSTRAINT: "" # Disable pip constraint for upgrading packages
4841
steps:
4942
- uses: actions/checkout@v4
50-
- name: Setup proxy cache
51-
uses: nv-gha-runners/setup-proxy-cache@main
43+
- uses: nv-gha-runners/setup-proxy-cache@main
44+
# Check if relevant files are changed in PR else skip gpu tests
45+
- id: get-pr-info
46+
uses: nv-gha-runners/get-pr-info@main
47+
- name: Check for changes in test-relevant directories
48+
id: changed-tests
49+
uses: step-security/[email protected]
50+
with:
51+
files: |
52+
.github/workflows/gpu_tests.yml
53+
modelopt/**
54+
tests/gpu/**
55+
tox.ini
56+
pyproject.toml
57+
setup.py
58+
base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.ref }}
5259
- name: Run gpu tests
60+
if: steps.changed-tests.outputs.any_changed == 'true'
5361
run: pip install tox-current-env && tox -e py312-cuda12-gpu --current-env

.github/workflows/pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
# Cancel previous runs if new commit is pushed
1010
concurrency:
11-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1212
cancel-in-progress: true
1313

1414
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages

.github/workflows/unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222

2323
# Cancel previous runs if new commit is pushed
2424
concurrency:
25-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
2626
cancel-in-progress: true
2727

2828
jobs:

0 commit comments

Comments
 (0)