1 | name: PHPUnit Tests |
---|
2 | |
---|
3 | on: |
---|
4 | push: |
---|
5 | branches: |
---|
6 | - trunk |
---|
7 | - '3.[7-9]' |
---|
8 | - '[4-9].[0-9]' |
---|
9 | tags: |
---|
10 | - '[0-9]+.[0-9]' |
---|
11 | - '[0-9]+.[0-9].[0-9]+' |
---|
12 | pull_request: |
---|
13 | branches: |
---|
14 | - trunk |
---|
15 | - '3.[7-9]' |
---|
16 | - '[4-9].[0-9]' |
---|
17 | workflow_dispatch: |
---|
18 | # Once weekly On Sundays at 00:00 UTC. |
---|
19 | schedule: |
---|
20 | - cron: '0 0 * * 0' |
---|
21 | |
---|
22 | # Cancels all previous workflow runs for pull requests that have not completed. |
---|
23 | concurrency: |
---|
24 | # The concurrency group contains the workflow name and the branch name for pull requests |
---|
25 | # or the commit hash for any other events. |
---|
26 | group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} |
---|
27 | cancel-in-progress: true |
---|
28 | |
---|
29 | # Disable permissions for all available scopes by default. |
---|
30 | # Any needed permissions should be configured at the job level. |
---|
31 | permissions: {} |
---|
32 | |
---|
33 | jobs: |
---|
34 | # Creates PHPUnit test jobs. |
---|
35 | test-php: |
---|
36 | name: PHP ${{ matrix.php }} |
---|
37 | uses: WordPress/wordpress-develop/.github/workflows/reusable-phpunit-tests-v2.yml@trunk |
---|
38 | permissions: |
---|
39 | contents: read |
---|
40 | secrets: inherit |
---|
41 | if: ${{ github.repository == 'WordPress/wordpress-develop' || github.event_name == 'pull_request' }} |
---|
42 | strategy: |
---|
43 | fail-fast: false |
---|
44 | matrix: |
---|
45 | os: [ ubuntu-latest ] |
---|
46 | php: [ '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ] |
---|
47 | multisite: [ false, true ] |
---|
48 | split_slow: [ false ] |
---|
49 | memcached: [ false ] |
---|
50 | include: |
---|
51 | # Additional "slow" jobs for PHP 5.6. |
---|
52 | - php: '5.6' |
---|
53 | os: ubuntu-latest |
---|
54 | memcached: false |
---|
55 | multisite: false |
---|
56 | split_slow: true |
---|
57 | - php: '5.6' |
---|
58 | os: ubuntu-latest |
---|
59 | memcached: false |
---|
60 | multisite: true |
---|
61 | split_slow: true |
---|
62 | # Include jobs for PHP 7.4 with memcached. |
---|
63 | - php: '7.4' |
---|
64 | os: ubuntu-latest |
---|
65 | memcached: true |
---|
66 | multisite: false |
---|
67 | - php: '7.4' |
---|
68 | os: ubuntu-latest |
---|
69 | memcached: true |
---|
70 | multisite: true |
---|
71 | # Report the results of the PHP 7.4 without memcached job. |
---|
72 | - php: '7.4' |
---|
73 | os: ubuntu-latest |
---|
74 | memcached: false |
---|
75 | multisite: false |
---|
76 | report: true |
---|
77 | with: |
---|
78 | os: ${{ matrix.os }} |
---|
79 | php: ${{ matrix.php }} |
---|
80 | multisite: ${{ matrix.multisite }} |
---|
81 | split_slow: ${{ matrix.split_slow }} |
---|
82 | memcached: ${{ matrix.memcached }} |
---|
83 | phpunit-config: ${{ matrix.multisite && 'tests/phpunit/multisite.xml' || 'phpunit.xml.dist' }} |
---|
84 | report: ${{ matrix.report || false }} |
---|
85 | |
---|
86 | slack-notifications: |
---|
87 | name: Slack Notifications |
---|
88 | uses: WordPress/wordpress-develop/.github/workflows/slack-notifications.yml@trunk |
---|
89 | permissions: |
---|
90 | actions: read |
---|
91 | contents: read |
---|
92 | needs: [ test-php ] |
---|
93 | if: ${{ github.repository == 'WordPress/wordpress-develop' && github.event_name != 'pull_request' && always() }} |
---|
94 | with: |
---|
95 | calling_status: ${{ contains( needs.*.result, 'cancelled' ) && 'cancelled' || contains( needs.*.result, 'failure' ) && 'failure' || 'success' }} |
---|
96 | secrets: |
---|
97 | SLACK_GHA_SUCCESS_WEBHOOK: ${{ secrets.SLACK_GHA_SUCCESS_WEBHOOK }} |
---|
98 | SLACK_GHA_CANCELLED_WEBHOOK: ${{ secrets.SLACK_GHA_CANCELLED_WEBHOOK }} |
---|
99 | SLACK_GHA_FIXED_WEBHOOK: ${{ secrets.SLACK_GHA_FIXED_WEBHOOK }} |
---|
100 | SLACK_GHA_FAILURE_WEBHOOK: ${{ secrets.SLACK_GHA_FAILURE_WEBHOOK }} |
---|
101 | |
---|
102 | failed-workflow: |
---|
103 | name: Failed workflow tasks |
---|
104 | runs-on: ubuntu-latest |
---|
105 | permissions: |
---|
106 | actions: write |
---|
107 | needs: [ slack-notifications ] |
---|
108 | if: | |
---|
109 | always() && |
---|
110 | github.repository == 'WordPress/wordpress-develop' && |
---|
111 | github.event_name != 'pull_request' && |
---|
112 | github.run_attempt < 2 && |
---|
113 | ( |
---|
114 | contains( needs.*.result, 'cancelled' ) || |
---|
115 | contains( needs.*.result, 'failure' ) |
---|
116 | ) |
---|
117 | |
---|
118 | steps: |
---|
119 | - name: Dispatch workflow run |
---|
120 | uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 |
---|
121 | with: |
---|
122 | retries: 2 |
---|
123 | retry-exempt-status-codes: 418 |
---|
124 | script: | |
---|
125 | github.rest.actions.createWorkflowDispatch({ |
---|
126 | owner: context.repo.owner, |
---|
127 | repo: context.repo.repo, |
---|
128 | workflow_id: 'failed-workflow.yml', |
---|
129 | ref: 'trunk', |
---|
130 | inputs: { |
---|
131 | run_id: '${{ github.run_id }}' |
---|
132 | } |
---|
133 | }); |
---|