|
1 | | -name: CI |
| 1 | +name: Tests and Coverage |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | # allows us to run workflows manually |
|
21 | 21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
22 | 22 |
|
23 | 23 | jobs: |
| 24 | + filter-changes: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + outputs: |
| 27 | + source_changed: ${{ steps.filter.outputs.source_changed }} |
| 28 | + steps: |
| 29 | + - name: Check out the repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + - name: Examine changed files |
| 32 | + id: filter |
| 33 | + uses: dorny/paths-filter@668c092af3649c4b664c54e4b704aa46782f6f7c # latest master commit, not released yet |
| 34 | + with: |
| 35 | + filters: | |
| 36 | + source_changed: |
| 37 | + - '!docs/**' |
| 38 | + - '!**/*.md' |
| 39 | + predicate-quantifier: 'every' |
24 | 40 | main: |
| 41 | + needs: filter-changes |
| 42 | + if: ${{ needs.filter-changes.outputs.source_changed == 'true' }} |
25 | 43 | runs-on: ubuntu-22.04 |
26 | 44 | strategy: |
27 | 45 | matrix: |
@@ -205,12 +223,33 @@ jobs: |
205 | 223 | flag-name: C++ and Python |
206 | 224 | path-to-lcov: coverage.lcov |
207 | 225 |
|
208 | | - finish: |
209 | | - needs: main |
| 226 | + coverage: |
| 227 | + needs: [filter-changes, main] |
| 228 | + if: ${{ always() }} |
210 | 229 | runs-on: ubuntu-latest |
211 | 230 | steps: |
212 | 231 | - name: Coveralls Finished |
| 232 | + if: ${{ needs.filter-changes.outputs.source_changed == 'true' }} |
213 | 233 | uses: coverallsapp/github-action@v2 |
214 | 234 | with: |
215 | 235 | github-token: ${{ secrets.GITHUB_TOKEN }} |
216 | 236 | parallel-finished: true |
| 237 | + |
| 238 | + ci-pass: |
| 239 | + needs: [filter-changes, main, coverage] |
| 240 | + name: Check CI status |
| 241 | + if: ${{ always() }} |
| 242 | + runs-on: ubuntu-latest |
| 243 | + steps: |
| 244 | + - name: Check CI status |
| 245 | + run: | |
| 246 | + if [[ "${{ needs.filter-changes.outputs.source_changed }}" == "false" ]]; then |
| 247 | + echo "Documentation-only change - CI skipped successfully" |
| 248 | + exit 0 |
| 249 | + fi |
| 250 | + if [[ "${{ needs.main.result }}" == "success" && "${{ needs.coverage.result }}" == "success" ]]; then |
| 251 | + echo "CI passed" |
| 252 | + exit 0 |
| 253 | + fi |
| 254 | + echo "CI failed" |
| 255 | + exit 1 |
0 commit comments