|
34 | 34 | name: Event File |
35 | 35 | path: ${{ github.event_path }} |
36 | 36 |
|
| 37 | + changes: |
| 38 | + name: Detect changed paths |
| 39 | + runs-on: ubuntu-latest |
| 40 | + outputs: |
| 41 | + # Lint warnings are expected in this block |
| 42 | + # https://github.com/dorny/paths-filter/issues/223#issuecomment-2463309889 |
| 43 | + win32: ${{ steps.filter.outputs.win32 || 'false' }} |
| 44 | + gtk: ${{ steps.filter.outputs.gtk || 'false' }} |
| 45 | + cocoa: ${{ steps.filter.outputs.cocoa || 'false' }} |
| 46 | + md: ${{ steps.filter.outputs.md || 'false' }} |
| 47 | + other: ${{ steps.filter.outputs.other || 'false' }} |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v5.0.0 |
| 50 | + with: |
| 51 | + fetch-depth: 0 # so base/ref SHAs are diffable |
| 52 | + - name: Paths filter (PR/Push only) |
| 53 | + if: github.event.pull_request.base |
| 54 | + # dorney/paths-filter is out of date, so use this fork with |
| 55 | + # a specific fix for missing predicate-quantifier in action's |
| 56 | + # inputs |
| 57 | + # https://github.com/dorny/paths-filter/pull/226#issuecomment-2805358761 |
| 58 | + uses: petermetz/paths-filter@5ee2f5d4cf5d7bdd998a314a42da307e2ae1639d |
| 59 | + id: filter |
| 60 | + with: |
| 61 | + predicate-quantifier: 'every' |
| 62 | + filters: | |
| 63 | + win32: |
| 64 | + - '**/win32/**' |
| 65 | + gtk: |
| 66 | + - '**/gtk/**' |
| 67 | + cocoa: |
| 68 | + - '**/cocoa/**' |
| 69 | + md: |
| 70 | + - '**/*.md' |
| 71 | + jenkins: |
| 72 | + - 'Jenkinsfile' |
| 73 | + # "other" = anything not matching the above buckets |
| 74 | + other: |
| 75 | + - '**' |
| 76 | + - '!**/win32/**' |
| 77 | + - '!**/gtk/**' |
| 78 | + - '!**/cocoa/**' |
| 79 | + - '!**/*.md' |
| 80 | + - '!Jenkinsfile' |
| 81 | +
|
37 | 82 | build-linux: |
38 | 83 | name: Build (Linux) |
| 84 | + needs: changes |
| 85 | + # push => always; PR => run if gtk changed OR "other" changed (run-everything case) |
| 86 | + if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.gtk == 'true' || needs.changes.outputs.other == 'true' }} |
39 | 87 | strategy: |
40 | 88 | fail-fast: false |
41 | 89 | matrix: |
|
49 | 97 |
|
50 | 98 | build-windows: |
51 | 99 | name: Build (Windows) |
| 100 | + needs: changes |
| 101 | + # push => always; PR => run if win32 changed OR "other" changed (run-everything case) |
| 102 | + if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.win32 == 'true' || needs.changes.outputs.other == 'true' }} |
52 | 103 | strategy: |
53 | 104 | fail-fast: false |
54 | 105 | matrix: |
|
61 | 112 |
|
62 | 113 | build-macos: |
63 | 114 | name: Build (macOS) |
| 115 | + needs: changes |
| 116 | + # push => always; PR => run if cocoa changed OR "other" changed (run-everything case) |
| 117 | + if: ${{ github.event_name != 'pull_request' || needs.changes.outputs.cocoa == 'true' || needs.changes.outputs.other == 'true' }} |
64 | 118 | strategy: |
65 | 119 | fail-fast: false |
66 | 120 | matrix: |
|
0 commit comments