Skip to content

Commit db23e00

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

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

.github/workflows/gpu_tests.yml

Lines changed: 25 additions & 12 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:
@@ -25,6 +18,26 @@ jobs:
2518
secrets: inherit
2619
with:
2720
match_pattern: '^DCO$'
21+
check-changes:
22+
needs: [wait-dco]
23+
runs-on: ubuntu-latest
24+
outputs:
25+
any_changed: ${{ steps.changed-tests.outputs.any_changed }}
26+
steps:
27+
- id: get-pr-info
28+
uses: nv-gha-runners/get-pr-info@main
29+
- name: Check for changes in test-relevant directories
30+
id: changed-tests
31+
uses: step-security/[email protected]
32+
with:
33+
files: |
34+
.github/workflows/gpu_tests.yml
35+
modelopt/**
36+
tests/gpu/**
37+
tox.ini
38+
pyproject.toml
39+
setup.py
40+
base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.ref }}
2841
wait-unit-tests:
2942
needs: [wait-dco]
3043
uses: ./.github/workflows/_wait_for_checks.yml
@@ -35,7 +48,8 @@ jobs:
3548
match_pattern: '^linux$' # Unit tests / linux
3649
delay: 60s
3750
gpu-tests:
38-
needs: [wait-unit-tests]
51+
needs: [check-changes, wait-unit-tests]
52+
if: needs.check-changes.outputs.any_changed == 'true'
3953
# Runner list at https://github.com/nv-gha-runners/enterprise-runner-configuration/blob/main/docs/runner-groups.md
4054
runs-on: linux-amd64-gpu-h100-latest-1
4155
timeout-minutes: 60
@@ -47,7 +61,6 @@ jobs:
4761
PIP_CONSTRAINT: "" # Disable pip constraint for upgrading packages
4862
steps:
4963
- uses: actions/checkout@v4
50-
- name: Setup proxy cache
51-
uses: nv-gha-runners/setup-proxy-cache@main
64+
- uses: nv-gha-runners/setup-proxy-cache@main
5265
- name: Run gpu tests
5366
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)