Skip to content

Commit 178ad89

Browse files
committed
Further refactor test suite
Signed-off-by: Samet Akcay <[email protected]>
1 parent 665b4d9 commit 178ad89

File tree

2 files changed

+41
-63
lines changed

2 files changed

+41
-63
lines changed

.github/workflows/_reusable-test-suite.yaml

Lines changed: 26 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#
2929
# Required Inputs:
3030
# - python-version: Python version for tests (default: "3.10")
31-
# - test-types: Types of tests to run (default: "unit,integration")
32-
# - unit-test-timeout: Minutes before timeout (default: 10)
33-
# - integration-test-timeout: Minutes before timeout (default: 30)
31+
# - test-type: Type of test to run (unit/integration/e2e)
32+
# - runner: Runner to use for the tests
33+
# - timeout: Test timeout in minutes
3434
#
3535
# Required Secrets:
3636
# - codecov-token: Token for coverage reporting (optional)
@@ -44,16 +44,16 @@
4444
# test:
4545
# uses: ./.github/workflows/_reusable-test-suite.yaml
4646
# with:
47-
# test-types: "unit,integration"
47+
# test-type: "unit"
4848
#
4949
# 2. Custom Configuration:
5050
# jobs:
5151
# test:
5252
# uses: ./.github/workflows/_reusable-test-suite.yaml
5353
# with:
5454
# python-version: "3.11"
55-
# test-types: "unit"
56-
# unit-test-timeout: 15
55+
# test-type: "unit"
56+
# timeout: 15
5757
# secrets:
5858
# codecov-token: ${{ secrets.CODECOV_TOKEN }}
5959
#
@@ -68,77 +68,42 @@ on:
6868
description: "Python version to use for tests"
6969
type: string
7070
default: "3.10"
71-
test-types:
72-
description: "Types of tests to run (comma-separated: unit,integration)"
71+
test-type:
72+
description: "Type of test to run (unit/integration/e2e)"
7373
type: string
74-
default: "unit,integration"
75-
unit-test-timeout:
76-
description: "Timeout for unit tests (minutes)"
74+
required: true
75+
runner:
76+
description: "Runner to use for the tests"
77+
type: string
78+
default: "ubuntu-latest"
79+
timeout:
80+
description: "Test timeout in minutes"
7781
type: number
7882
default: 10
79-
integration-test-timeout:
80-
description: "Timeout for integration tests (minutes)"
81-
type: number
82-
default: 30
8383
secrets:
8484
codecov-token:
8585
required: false
8686
description: "Token for Codecov upload"
8787
outputs:
8888
test-results:
8989
description: "Path to test results artifact"
90-
value: ${{ jobs.publish-results.outputs.artifact-path }}
90+
value: ${{ jobs.test.outputs.artifact-path }}
9191

9292
jobs:
93-
unit-tests:
94-
if: contains(inputs.test-types, 'unit')
95-
runs-on: ubuntu-latest
96-
timeout-minutes: ${{ inputs.unit-test-timeout }}
93+
test:
94+
runs-on: ${{ inputs.runner }}
95+
timeout-minutes: ${{ inputs.timeout }}
9796
steps:
98-
- uses: actions/checkout@v4
99-
- name: Run unit tests
100-
uses: ./.github/actions/pytest
101-
with:
102-
python-version: ${{ inputs.python-version }}
103-
test-type: "unit"
104-
codecov-token: ${{ secrets.codecov-token }}
105-
- uses: actions/upload-artifact@v4
106-
if: always()
107-
with:
108-
name: unit-test-results
109-
path: |
110-
pytest.xml
111-
coverage.xml
112-
retention-days: 7
97+
- name: Verify GPU availability
98+
if: contains(inputs.runner, 'self-hosted')
99+
shell: bash
100+
run: |
101+
nvidia-smi || echo "::error::No GPU found"
113102
114-
integration-tests:
115-
if: contains(inputs.test-types, 'integration')
116-
runs-on: ubuntu-latest
117-
timeout-minutes: ${{ inputs.integration-test-timeout }}
118-
steps:
119103
- uses: actions/checkout@v4
120-
- name: Run integration tests
104+
- name: Run tests
121105
uses: ./.github/actions/pytest
122106
with:
123107
python-version: ${{ inputs.python-version }}
124-
test-type: "integration"
108+
test-type: ${{ inputs.test-type }}
125109
codecov-token: ${{ secrets.codecov-token }}
126-
- uses: actions/upload-artifact@v4
127-
if: always()
128-
with:
129-
name: integration-test-results
130-
path: |
131-
pytest.xml
132-
coverage.xml
133-
retention-days: 7
134-
135-
publish-results:
136-
needs: [unit-tests, integration-tests]
137-
if: always()
138-
runs-on: ubuntu-latest
139-
outputs:
140-
artifact-path: ${{ steps.merge-results.outputs.artifact-path }}
141-
steps:
142-
- name: Merge test results
143-
id: merge-results
144-
run: echo "artifact-path=test-results" >> $GITHUB_OUTPUT

.github/workflows/pr.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,26 @@ jobs:
5454
python-version: "3.10"
5555

5656
# Test suite job using reusable workflow
57-
tests:
57+
unit-tests:
5858
uses: ./.github/workflows/_reusable-test-suite.yaml
5959
with:
60-
test-types: "unit,integration"
60+
test-type: "unit"
61+
runner: "ubuntu-latest"
62+
timeout: 10
6163
secrets:
6264
codecov-token: ${{ secrets.CODECOV_TOKEN }}
6365

66+
integration-tests:
67+
uses: ./.github/workflows/_reusable-test-suite.yaml
68+
with:
69+
test-type: "integration"
70+
runner: "self-hosted"
71+
timeout: 30
72+
secrets:
73+
codecov-token: ${{ secrets.CODECOV_TOKEN }}
74+
75+
# NOTE: When we have e2e or other tests, we can add them here.
76+
6477
# Security scanning job using reusable workflow
6578
security:
6679
needs: [] # No dependencies, can run in parallel

0 commit comments

Comments
 (0)