|
2 | 2 | # This is the primary test workflow that runs all unit and integration tests. |
3 | 3 | # It is called by the build.yml workflow and can also be triggered independently. |
4 | 4 | # For E2E and browser testing, see e2e-test.yml. |
| 5 | +# |
| 6 | +# All service test jobs run in PARALLEL to minimize total workflow time. |
| 7 | +# Each service has its own isolated test job that can run independently. |
5 | 8 | name: Test |
6 | 9 |
|
7 | 10 | on: |
@@ -37,115 +40,214 @@ permissions: |
37 | 40 | pull-requests: write # Required for coverage report comments |
38 | 41 |
|
39 | 42 | jobs: |
40 | | - python-test: |
| 43 | + # ============================================================================ |
| 44 | + # COMMON/SHARED LIBRARY TESTS - Runs in parallel with all other test jobs |
| 45 | + # ============================================================================ |
| 46 | + test-common: |
41 | 47 | runs-on: ubuntu-latest |
42 | | - timeout-minutes: 20 |
| 48 | + timeout-minutes: 10 |
43 | 49 |
|
44 | 50 | steps: |
45 | 51 | - name: 🔀 Checkout repository |
46 | 52 | uses: actions/checkout@v6 |
| 53 | + |
| 54 | + - name: 🔧 Setup Python and UV |
| 55 | + uses: ./.github/actions/setup-python-uv |
47 | 56 | with: |
48 | | - fetch-depth: 0 # Need full history for diff |
| 57 | + python-version: ${{ env.PYTHON_VERSION }} |
49 | 58 |
|
50 | | - - name: 🔍 Check if tests needed |
51 | | - id: check-tests |
52 | | - if: github.event_name == 'pull_request' |
53 | | - run: | |
54 | | - # Check if any Python files or test files changed |
55 | | - if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qE "\.(py|yaml|yml|toml)$|^tests/"; then |
56 | | - echo "needed=true" >> "$GITHUB_OUTPUT" |
57 | | - echo "✅ Tests needed - Python or config files changed" |
58 | | - else |
59 | | - echo "needed=false" >> "$GITHUB_OUTPUT" |
60 | | - echo "⏭️ No Python or config files changed - tests can be skipped" |
61 | | - fi |
| 59 | + - name: 🔧 Setup Just |
| 60 | + uses: ./.github/actions/setup-just |
62 | 61 |
|
63 | | - - name: ⏭️ Skip remaining steps if not needed |
64 | | - if: github.event_name == 'pull_request' && steps.check-tests.outputs.needed == 'false' |
65 | | - run: | |
66 | | - echo "::notice title=Tests Skipped::No relevant files changed, skipping tests" |
67 | | - exit 0 |
| 62 | + - name: 📦 Install dependencies |
| 63 | + run: just install |
| 64 | + |
| 65 | + - name: 🧪 Run common tests |
| 66 | + run: just test-common |
| 67 | + |
| 68 | + - name: 📊 Upload coverage (common) |
| 69 | + if: always() |
| 70 | + uses: codecov/codecov-action@v5 |
| 71 | + with: |
| 72 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 73 | + files: ./coverage.xml |
| 74 | + flags: common |
| 75 | + name: common-tests |
| 76 | + |
| 77 | + # ============================================================================ |
| 78 | + # DASHBOARD SERVICE TESTS - Runs in parallel with all other test jobs |
| 79 | + # ============================================================================ |
| 80 | + test-dashboard: |
| 81 | + runs-on: ubuntu-latest |
| 82 | + timeout-minutes: 10 |
| 83 | + |
| 84 | + steps: |
| 85 | + - name: 🔀 Checkout repository |
| 86 | + uses: actions/checkout@v6 |
68 | 87 |
|
69 | 88 | - name: 🔧 Setup Python and UV |
70 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
71 | 89 | uses: ./.github/actions/setup-python-uv |
72 | 90 | with: |
73 | 91 | python-version: ${{ env.PYTHON_VERSION }} |
74 | 92 |
|
75 | 93 | - name: 🔧 Setup Just |
76 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
77 | 94 | uses: ./.github/actions/setup-just |
78 | 95 |
|
79 | | - # Test cache (pytest) |
80 | | - - name: 💾 Cache test results |
81 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
82 | | - uses: actions/cache@v5 |
| 96 | + - name: 📦 Install dependencies |
| 97 | + run: just install |
| 98 | + |
| 99 | + - name: 🧪 Run dashboard tests |
| 100 | + run: just test-dashboard |
| 101 | + |
| 102 | + - name: 📊 Upload coverage (dashboard) |
| 103 | + if: always() |
| 104 | + uses: codecov/codecov-action@v5 |
83 | 105 | with: |
84 | | - path: | |
85 | | - .pytest_cache |
86 | | - .coverage |
87 | | - htmlcov |
88 | | - key: ${{ runner.os }}-test-unit-${{ github.sha }} |
89 | | - restore-keys: | |
90 | | - ${{ runner.os }}-test-unit- |
91 | | - ${{ runner.os }}-test- |
| 106 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 107 | + files: ./coverage.xml |
| 108 | + flags: dashboard |
| 109 | + name: dashboard-tests |
| 110 | + |
| 111 | + # ============================================================================ |
| 112 | + # DISCOVERY SERVICE TESTS - Runs in parallel with all other test jobs |
| 113 | + # ============================================================================ |
| 114 | + test-discovery: |
| 115 | + runs-on: ubuntu-latest |
| 116 | + timeout-minutes: 15 |
| 117 | + |
| 118 | + steps: |
| 119 | + - name: 🔀 Checkout repository |
| 120 | + uses: actions/checkout@v6 |
| 121 | + |
| 122 | + - name: 🔧 Setup Python and UV |
| 123 | + uses: ./.github/actions/setup-python-uv |
| 124 | + with: |
| 125 | + python-version: ${{ env.PYTHON_VERSION }} |
| 126 | + |
| 127 | + - name: 🔧 Setup Just |
| 128 | + uses: ./.github/actions/setup-just |
92 | 129 |
|
93 | 130 | - name: 📦 Install dependencies |
94 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
95 | | - run: | |
96 | | - just install |
97 | | - # Install workspace packages |
98 | | - uv pip install -e dashboard |
99 | | - uv pip install -e common |
| 131 | + run: just install |
100 | 132 |
|
101 | | - - name: 🧪 Run unit tests with coverage (excluding E2E) |
102 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
103 | | - run: | |
104 | | - # Run tests with coverage - generates XML, JSON, and terminal reports |
105 | | - just test-cov |
| 133 | + - name: 🧪 Run discovery tests |
| 134 | + run: just test-discovery |
106 | 135 |
|
107 | | - - name: 📋 Process coverage reports |
108 | | - id: coverage-setup |
109 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
110 | | - run: | |
111 | | - jq '{ |
112 | | - total: { |
113 | | - statements: {total: .totals.num_statements, covered: .totals.covered_lines}, |
114 | | - lines: {total: .totals.num_statements, covered: .totals.covered_lines}, |
115 | | - functions: {total: 0, covered: 0}, |
116 | | - branches: {total: 0, covered: 0} |
117 | | - } |
118 | | - }' coverage.json > coverage-summary.json |
119 | | - echo "coverage-exists=true" >> "$GITHUB_OUTPUT" |
120 | | -
|
121 | | - - name: 📊 Upload Python coverage reports |
122 | | - if: github.event_name != 'pull_request' || steps.check-tests.outputs.needed == 'true' |
| 136 | + - name: 📊 Upload coverage (discovery) |
| 137 | + if: always() |
123 | 138 | uses: codecov/codecov-action@v5 |
124 | 139 | with: |
125 | 140 | token: ${{ secrets.CODECOV_TOKEN }} |
126 | | - slug: SimplicityGuy/discogsography |
127 | 141 | files: ./coverage.xml |
128 | | - flags: python |
129 | | - name: python-coverage |
130 | | - fail_ci_if_error: false |
131 | | - disable_search: true # Don't auto-search for coverage files |
132 | | - verbose: false # Reduce output noise |
133 | | - env: |
134 | | - # Disable unnecessary coverage tool detection |
135 | | - CODECOV_GCOV_DISABLE: 1 |
136 | | - CODECOV_XCODE_DISABLE: 1 |
| 142 | + flags: discovery |
| 143 | + name: discovery-tests |
| 144 | + |
| 145 | + # ============================================================================ |
| 146 | + # PYTHON EXTRACTOR TESTS - Runs in parallel with all other test jobs |
| 147 | + # ============================================================================ |
| 148 | + test-pyextractor: |
| 149 | + runs-on: ubuntu-latest |
| 150 | + timeout-minutes: 10 |
| 151 | + |
| 152 | + steps: |
| 153 | + - name: 🔀 Checkout repository |
| 154 | + uses: actions/checkout@v6 |
| 155 | + |
| 156 | + - name: 🔧 Setup Python and UV |
| 157 | + uses: ./.github/actions/setup-python-uv |
| 158 | + with: |
| 159 | + python-version: ${{ env.PYTHON_VERSION }} |
| 160 | + |
| 161 | + - name: 🔧 Setup Just |
| 162 | + uses: ./.github/actions/setup-just |
| 163 | + |
| 164 | + - name: 📦 Install dependencies |
| 165 | + run: just install |
| 166 | + |
| 167 | + - name: 🧪 Run Python extractor tests |
| 168 | + run: just test-pyextractor |
| 169 | + |
| 170 | + - name: 📊 Upload coverage (pyextractor) |
| 171 | + if: always() |
| 172 | + uses: codecov/codecov-action@v5 |
| 173 | + with: |
| 174 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 175 | + files: ./coverage.xml |
| 176 | + flags: pyextractor |
| 177 | + name: pyextractor-tests |
| 178 | + |
| 179 | + # ============================================================================ |
| 180 | + # GRAPHINATOR SERVICE TESTS - Runs in parallel with all other test jobs |
| 181 | + # ============================================================================ |
| 182 | + test-graphinator: |
| 183 | + runs-on: ubuntu-latest |
| 184 | + timeout-minutes: 10 |
| 185 | + |
| 186 | + steps: |
| 187 | + - name: 🔀 Checkout repository |
| 188 | + uses: actions/checkout@v6 |
| 189 | + |
| 190 | + - name: 🔧 Setup Python and UV |
| 191 | + uses: ./.github/actions/setup-python-uv |
| 192 | + with: |
| 193 | + python-version: ${{ env.PYTHON_VERSION }} |
| 194 | + |
| 195 | + - name: 🔧 Setup Just |
| 196 | + uses: ./.github/actions/setup-just |
| 197 | + |
| 198 | + - name: 📦 Install dependencies |
| 199 | + run: just install |
| 200 | + |
| 201 | + - name: 🧪 Run graphinator tests |
| 202 | + run: just test-graphinator |
| 203 | + |
| 204 | + - name: 📊 Upload coverage (graphinator) |
| 205 | + if: always() |
| 206 | + uses: codecov/codecov-action@v5 |
| 207 | + with: |
| 208 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 209 | + files: ./coverage.xml |
| 210 | + flags: graphinator |
| 211 | + name: graphinator-tests |
| 212 | + |
| 213 | + # ============================================================================ |
| 214 | + # TABLEINATOR SERVICE TESTS - Runs in parallel with all other test jobs |
| 215 | + # ============================================================================ |
| 216 | + test-tableinator: |
| 217 | + runs-on: ubuntu-latest |
| 218 | + timeout-minutes: 10 |
| 219 | + |
| 220 | + steps: |
| 221 | + - name: 🔀 Checkout repository |
| 222 | + uses: actions/checkout@v6 |
| 223 | + |
| 224 | + - name: 🔧 Setup Python and UV |
| 225 | + uses: ./.github/actions/setup-python-uv |
| 226 | + with: |
| 227 | + python-version: ${{ env.PYTHON_VERSION }} |
| 228 | + |
| 229 | + - name: 🔧 Setup Just |
| 230 | + uses: ./.github/actions/setup-just |
| 231 | + |
| 232 | + - name: 📦 Install dependencies |
| 233 | + run: just install |
137 | 234 |
|
138 | | - - name: 📊 Coverage Report |
139 | | - if: github.event_name == 'pull_request' && steps.coverage-setup.outputs.coverage-exists == 'true' |
140 | | - uses: slavcodev/coverage-monitor-action@398c4cbbb710e549a8407fdef96ae8b9454d0463 # v1.10.0 |
| 235 | + - name: 🧪 Run tableinator tests |
| 236 | + run: just test-tableinator |
| 237 | + |
| 238 | + - name: 📊 Upload coverage (tableinator) |
| 239 | + if: always() |
| 240 | + uses: codecov/codecov-action@v5 |
141 | 241 | with: |
142 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
143 | | - coverage_path: "coverage-summary.json" |
144 | | - coverage_format: "json-summary" |
145 | | - status_context: "Coverage Report" |
146 | | - comment_context: "Coverage Report" |
| 242 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 243 | + files: ./coverage.xml |
| 244 | + flags: tableinator |
| 245 | + name: tableinator-tests |
147 | 246 |
|
148 | | - rust-test: |
| 247 | + # ============================================================================ |
| 248 | + # RUST EXTRACTOR TESTS - Runs in parallel with all other test jobs |
| 249 | + # ============================================================================ |
| 250 | + test-rustextractor: |
149 | 251 | runs-on: ubuntu-latest |
150 | 252 | timeout-minutes: 15 |
151 | 253 |
|
@@ -208,13 +310,53 @@ jobs: |
208 | 310 | token: ${{ secrets.CODECOV_TOKEN }} |
209 | 311 | slug: SimplicityGuy/discogsography |
210 | 312 | files: ./extractor/rustextractor/lcov.info |
211 | | - flags: rust |
212 | | - name: rust-coverage |
| 313 | + flags: rustextractor |
| 314 | + name: rustextractor-tests |
213 | 315 | fail_ci_if_error: false |
214 | | - disable_search: true # Don't auto-search for coverage files |
215 | | - verbose: false # Reduce output noise |
| 316 | + disable_search: true |
| 317 | + verbose: false |
216 | 318 | env: |
217 | | - # Disable unnecessary coverage tool detection |
218 | 319 | CODECOV_GCOV_DISABLE: 1 |
219 | 320 | CODECOV_XCODE_DISABLE: 1 |
220 | | - CODECOV_PYTHON_DISABLE: 1 # Only lcov.info for Rust |
| 321 | + CODECOV_PYTHON_DISABLE: 1 |
| 322 | + |
| 323 | + # ============================================================================ |
| 324 | + # AGGREGATE RESULTS - Waits for all parallel tests to complete |
| 325 | + # ============================================================================ |
| 326 | + aggregate-results: |
| 327 | + runs-on: ubuntu-latest |
| 328 | + needs: |
| 329 | + - test-common |
| 330 | + - test-dashboard |
| 331 | + - test-discovery |
| 332 | + - test-pyextractor |
| 333 | + - test-graphinator |
| 334 | + - test-tableinator |
| 335 | + - test-rustextractor |
| 336 | + if: always() |
| 337 | + |
| 338 | + steps: |
| 339 | + - name: 📊 Check test results |
| 340 | + run: | |
| 341 | + echo "Test Results Summary:" |
| 342 | + echo " Common: ${{ needs.test-common.result }}" |
| 343 | + echo " Dashboard: ${{ needs.test-dashboard.result }}" |
| 344 | + echo " Discovery: ${{ needs.test-discovery.result }}" |
| 345 | + echo " PyExtractor: ${{ needs.test-pyextractor.result }}" |
| 346 | + echo " Graphinator: ${{ needs.test-graphinator.result }}" |
| 347 | + echo " Tableinator: ${{ needs.test-tableinator.result }}" |
| 348 | + echo " RustExtractor: ${{ needs.test-rustextractor.result }}" |
| 349 | +
|
| 350 | + # Check if any test job failed |
| 351 | + if [[ "${{ needs.test-common.result }}" == "failure" ]] || \ |
| 352 | + [[ "${{ needs.test-dashboard.result }}" == "failure" ]] || \ |
| 353 | + [[ "${{ needs.test-discovery.result }}" == "failure" ]] || \ |
| 354 | + [[ "${{ needs.test-pyextractor.result }}" == "failure" ]] || \ |
| 355 | + [[ "${{ needs.test-graphinator.result }}" == "failure" ]] || \ |
| 356 | + [[ "${{ needs.test-tableinator.result }}" == "failure" ]] || \ |
| 357 | + [[ "${{ needs.test-rustextractor.result }}" == "failure" ]]; then |
| 358 | + echo "❌ One or more test jobs failed" |
| 359 | + exit 1 |
| 360 | + fi |
| 361 | +
|
| 362 | + echo "✅ All test jobs passed!" |
0 commit comments