|
6 | 6 | - opened |
7 | 7 | - synchronize |
8 | 8 | - reopened |
9 | | - # called from rebuild-pull-request-on-label.yml |
10 | | - workflow_call: |
| 9 | + - labeled |
11 | 10 |
|
12 | 11 | concurrency: |
13 | | - # fixed group name (not github.workflow) so that runs triggered by pull_request |
14 | | - # and runs triggered via workflow_call from rebuild-pull-request-on-label.yml |
15 | | - # share the group, otherwise the PR build would run twice in parallel whenever |
16 | | - # a "test *" label is added |
17 | 12 | group: build-pull-request-${{ github.event.pull_request.number }} |
18 | 13 | cancel-in-progress: true |
19 | 14 |
|
20 | 15 | permissions: |
21 | 16 | contents: read |
22 | 17 |
|
23 | 18 | jobs: |
24 | | - common: |
25 | | - uses: ./.github/workflows/build-common.yml |
| 19 | + build: |
| 20 | + # On `labeled` events, only proceed when the added label affects what we |
| 21 | + # build. All other event types (opened, synchronize, reopened) always |
| 22 | + # proceed. |
| 23 | + if: | |
| 24 | + github.event.action != 'labeled' || |
| 25 | + github.event.label.name == 'test native' || |
| 26 | + github.event.label.name == 'test openj9' || |
| 27 | + github.event.label.name == 'test windows' |
| 28 | + uses: ./.github/workflows/reusable-pr-build.yml |
26 | 29 | with: |
27 | | - # it's rare for only the openj9 tests, openj9 smoke variants, or the windows smoke tests to break |
| 30 | + # it's rare for only the openj9 tests, openj9 smoke variants, the windows |
| 31 | + # smoke tests, or the native tests to break, so they are gated by labels. |
| 32 | + # `test native` is applied automatically by .github/labeler.yml when the |
| 33 | + # PR diff touches native-relevant paths; `test openj9` and `test windows` |
| 34 | + # are applied manually. |
| 35 | + skip-native-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test native') }} |
28 | 36 | skip-openj9-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test openj9') }} |
29 | 37 | skip-windows-smoke-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test windows') }} |
30 | | - cache-read-only: true |
31 | | - |
32 | | - test-latest-deps: |
33 | | - uses: ./.github/workflows/reusable-test-latest-deps.yml |
34 | | - with: |
35 | | - cache-read-only: true |
36 | | - |
37 | | - test-native: |
38 | | - uses: ./.github/workflows/reusable-native-tests.yml |
39 | | - with: |
40 | | - skip-native-tests: ${{ !contains(github.event.pull_request.labels.*.name, 'test native') }} |
41 | | - |
42 | | - muzzle: |
43 | | - uses: ./.github/workflows/reusable-muzzle.yml |
44 | | - with: |
45 | | - cache-read-only: true |
46 | | - |
47 | | - # this is not a required check to avoid blocking pull requests if external links break |
48 | | - markdown-check: |
49 | | - # release branches are excluded because the README.md javaagent download link has to be updated |
50 | | - # on release branches before the release download has been published |
51 | | - if: "!startsWith(github.ref_name, 'release/') && !startsWith(github.base_ref, 'release/')" |
52 | | - uses: ./.github/workflows/reusable-link-check.yml |
53 | | - |
54 | | - markdown-lint-check: |
55 | | - uses: ./.github/workflows/reusable-markdown-lint-check.yml |
56 | | - |
57 | | - required-status-check: |
58 | | - needs: |
59 | | - - common |
60 | | - - test-latest-deps |
61 | | - - muzzle |
62 | | - - markdown-lint-check |
63 | | - runs-on: ubuntu-latest |
64 | | - if: always() |
65 | | - steps: |
66 | | - - if: | |
67 | | - needs.common.result != 'success' || |
68 | | - needs.test-latest-deps.result != 'success' || |
69 | | - needs.muzzle.result != 'success' || |
70 | | - needs.markdown-lint-check.result != 'success' |
71 | | - run: exit 1 # fail |
0 commit comments