Skip to content

Commit 73d2610

Browse files
Improve CI (#249)
Signed-off-by: Keval Morabia <[email protected]>
1 parent add6912 commit 73d2610

File tree

7 files changed

+130
-93
lines changed

7 files changed

+130
-93
lines changed

.github/codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Allow atmost 5% coverage drop from main branch.
2+
coverage:
3+
status:
4+
project:
5+
default:
6+
target: auto
7+
threshold: 5%
8+
patch: false
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Wait for checks
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
match_pattern:
7+
required: true
8+
type: string
9+
delay:
10+
required: false
11+
type: string
12+
default: 10s
13+
14+
jobs:
15+
wait:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
checks: read
19+
steps:
20+
- name: Wait for checks (PRs only)
21+
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/pull-request/')
22+
uses: poseidon/[email protected]
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
match_pattern: ${{ inputs.match_pattern }}
26+
delay: ${{ inputs.delay }}
27+
- name: No-op for non-PR events
28+
if: github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/pull-request/')
29+
run: echo "Not a pull_request event"

.github/workflows/gpu_tests.yml

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,47 @@ 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.event.pull_request.number }}
10+
group: ${{ github.workflow }}-${{ github.sha }}
1811
cancel-in-progress: true
1912

2013
jobs:
14+
check-file-changes:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
any_changed: ${{ steps.changed-tests.outputs.any_changed }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- id: get-pr-info
21+
uses: nv-gha-runners/get-pr-info@main
22+
- name: Check for changes in test-relevant directories
23+
id: changed-tests
24+
uses: step-security/[email protected]
25+
with:
26+
files: |
27+
.github/workflows/gpu_tests.yml
28+
modelopt/**
29+
tests/gpu/**
30+
tox.ini
31+
pyproject.toml
32+
setup.py
33+
base_sha: ${{ fromJSON(steps.get-pr-info.outputs.pr-info).base.ref }}
34+
wait-checks:
35+
needs: [check-file-changes]
36+
if: needs.check-file-changes.outputs.any_changed == 'true'
37+
uses: ./.github/workflows/_wait_for_checks.yml
38+
permissions:
39+
checks: read
40+
secrets: inherit
41+
with:
42+
match_pattern: '^DCO$|^linux$' # Wait for DCO and Unit tests / linux to pass
43+
delay: 300s
2144
gpu-tests:
45+
needs: [check-file-changes, wait-checks]
46+
if: needs.check-file-changes.outputs.any_changed == 'true'
2247
# Runner list at https://github.com/nv-gha-runners/enterprise-runner-configuration/blob/main/docs/runner-groups.md
2348
runs-on: linux-amd64-gpu-h100-latest-1
2449
timeout-minutes: 60
@@ -30,7 +55,6 @@ jobs:
3055
PIP_CONSTRAINT: "" # Disable pip constraint for upgrading packages
3156
steps:
3257
- uses: actions/checkout@v4
33-
- name: Setup proxy cache
34-
uses: nv-gha-runners/setup-proxy-cache@main
58+
- uses: nv-gha-runners/setup-proxy-cache@main
3559
- name: Run gpu tests
3660
run: pip install tox-current-env && tox -e py312-cuda12-gpu --current-env

.github/workflows/multi_version_unit_tests.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.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/partial_unit_tests.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/unit_tests.yml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ 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:
29-
unit-tests:
29+
check-dco:
30+
uses: ./.github/workflows/_wait_for_checks.yml
31+
permissions:
32+
checks: read
33+
secrets: inherit
34+
with:
35+
match_pattern: '^DCO$'
36+
linux:
37+
needs: [check-dco]
3038
runs-on: ubuntu-latest
3139
timeout-minutes: 30
3240
steps:
@@ -42,8 +50,9 @@ jobs:
4250
token: ${{ secrets.CODECOV_TOKEN }}
4351
fail_ci_if_error: true
4452
verbose: true
45-
unit-tests-windows:
53+
windows:
4654
if: github.event_name == 'pull_request'
55+
needs: [linux]
4756
runs-on: windows-latest
4857
timeout-minutes: 30
4958
steps:
@@ -53,3 +62,48 @@ jobs:
5362
python-version: "3.12"
5463
- name: Run unit tests (without coverage)
5564
run: pip install tox && tox -e py312-torch28-unit
65+
multi-py:
66+
if: github.event_name == 'pull_request'
67+
needs: [linux]
68+
runs-on: ubuntu-latest
69+
timeout-minutes: 30
70+
strategy:
71+
matrix:
72+
py: [10, 11]
73+
steps:
74+
- uses: actions/checkout@v4
75+
- uses: actions/setup-python@v5
76+
with:
77+
python-version: "3.${{ matrix.py }}"
78+
- name: Run unit tests
79+
run: pip install tox && tox -e py3${{ matrix.py }}-torch28-unit
80+
multi-torch:
81+
if: github.event_name == 'pull_request'
82+
needs: [linux]
83+
runs-on: ubuntu-latest
84+
timeout-minutes: 30
85+
strategy:
86+
matrix:
87+
torch: [25, 26, 27]
88+
steps:
89+
- uses: actions/checkout@v4
90+
- uses: actions/setup-python@v5
91+
with:
92+
python-version: "3.12"
93+
- name: Run unit tests
94+
run: pip install tox && tox -e py312-torch${{ matrix.torch }}-unit
95+
partial-install:
96+
if: github.event_name == 'pull_request'
97+
needs: [linux]
98+
runs-on: ubuntu-latest
99+
timeout-minutes: 30
100+
strategy:
101+
matrix:
102+
test-env: [onnx, torch]
103+
steps:
104+
- uses: actions/checkout@v4
105+
- uses: actions/setup-python@v5
106+
with:
107+
python-version: "3.12"
108+
- name: Run unit tests
109+
run: pip install tox && tox -e py312-partial-unit-${{ matrix.test-env }}

0 commit comments

Comments
 (0)