|
28 | 28 | #
|
29 | 29 | # Required Inputs:
|
30 | 30 | # - 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 |
34 | 34 | #
|
35 | 35 | # Required Secrets:
|
36 | 36 | # - codecov-token: Token for coverage reporting (optional)
|
|
44 | 44 | # test:
|
45 | 45 | # uses: ./.github/workflows/_reusable-test-suite.yaml
|
46 | 46 | # with:
|
47 |
| -# test-types: "unit,integration" |
| 47 | +# test-type: "unit" |
48 | 48 | #
|
49 | 49 | # 2. Custom Configuration:
|
50 | 50 | # jobs:
|
51 | 51 | # test:
|
52 | 52 | # uses: ./.github/workflows/_reusable-test-suite.yaml
|
53 | 53 | # with:
|
54 | 54 | # python-version: "3.11"
|
55 |
| -# test-types: "unit" |
56 |
| -# unit-test-timeout: 15 |
| 55 | +# test-type: "unit" |
| 56 | +# timeout: 15 |
57 | 57 | # secrets:
|
58 | 58 | # codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
59 | 59 | #
|
|
68 | 68 | description: "Python version to use for tests"
|
69 | 69 | type: string
|
70 | 70 | 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)" |
73 | 73 | 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" |
77 | 81 | type: number
|
78 | 82 | default: 10
|
79 |
| - integration-test-timeout: |
80 |
| - description: "Timeout for integration tests (minutes)" |
81 |
| - type: number |
82 |
| - default: 30 |
83 | 83 | secrets:
|
84 | 84 | codecov-token:
|
85 | 85 | required: false
|
86 | 86 | description: "Token for Codecov upload"
|
87 | 87 | outputs:
|
88 | 88 | test-results:
|
89 | 89 | description: "Path to test results artifact"
|
90 |
| - value: ${{ jobs.publish-results.outputs.artifact-path }} |
| 90 | + value: ${{ jobs.test.outputs.artifact-path }} |
91 | 91 |
|
92 | 92 | 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 }} |
97 | 96 | 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" |
113 | 102 |
|
114 |
| - integration-tests: |
115 |
| - if: contains(inputs.test-types, 'integration') |
116 |
| - runs-on: ubuntu-latest |
117 |
| - timeout-minutes: ${{ inputs.integration-test-timeout }} |
118 |
| - steps: |
119 | 103 | - uses: actions/checkout@v4
|
120 |
| - - name: Run integration tests |
| 104 | + - name: Run tests |
121 | 105 | uses: ./.github/actions/pytest
|
122 | 106 | with:
|
123 | 107 | python-version: ${{ inputs.python-version }}
|
124 |
| - test-type: "integration" |
| 108 | + test-type: ${{ inputs.test-type }} |
125 | 109 | 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 |
0 commit comments