-
-
Notifications
You must be signed in to change notification settings - Fork 17
164 lines (134 loc) · 5.32 KB
/
continuous-integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Continuous Integration
on:
push:
branches: [ "develop", "master" ]
pull_request:
branches: [ "develop", "master" ]
permissions:
contents: read
jobs:
compliance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: '8.3'
coverage: none
tools: cs2pr
- name: Validate composer.json and composer.lock
run: composer validate --strict
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Check style and compatibility
id: phpcs
run: composer exec phpcs -- --report-full --report-checkstyle=./phpcs-report.xml
- name: Show PHPCS results in PR
if: ${{ always() && steps.phpcs.outcome == 'failure' }}
run: cs2pr ./phpcs-report.xml
test-latest:
runs-on: ubuntu-latest
needs:
- compliance
services:
mysql:
image: mariadb:11.6.2@sha256:a9547599cd87d7242435aea6fda22a9d83e2c06d16c658ef70d2868b3d3f6a80
env:
MARIADB_USER: wptestuser
MARIADB_PASSWORD: wptestpass
MARIADB_ROOT_PASSWORD: wptestroot
MARIADB_DATABASE: wptest_latest
TZ: Europe/Berlin
ports:
- 3306/tcp
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: '8.3'
coverage: xdebug
extensions: mysqli
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Run unit tests
run: composer exec phpunit
- name: Set up integration test
run: ./bin/install-wp-tests.sh wptest_latest wptestuser wptestpass 127.0.0.1:${{ job.services.mysql.ports['3306'] }} latest true
- name: Run integration tests
run: composer exec phpunit -- -c phpunit-integration.xml
- name: Upload code coverage to Code Climate
uses: paambaati/codeclimate-action@7c100bd1ed15de0bdee476b38ca759d8c94207b5 # v8.0.0
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
with:
coverageLocations: |
${{github.workspace}}/build/logs/clover.xml:clover
${{github.workspace}}/build/logs/clover-integration.xml:clover
- name: Upload code coverage to Codecov (unit)
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: ${{github.workspace}}/build/logs/clover.xml
flags: unit
- name: Upload code coverage to Codecov (integration)
uses: codecov/codecov-action@7f8b4b4bde536c465e797be725718b88c5d95e0e # v5.1.1
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
disable_search: true
files: ${{github.workspace}}/build/logs/clover-integration.xml
flags: integration
test-minimum:
runs-on: ubuntu-latest
needs:
- compliance
services:
mysql:
image: mariadb:11.6.2@sha256:a9547599cd87d7242435aea6fda22a9d83e2c06d16c658ef70d2868b3d3f6a80
env:
MARIADB_USER: wptestuser
MARIADB_PASSWORD: wptestpass
MARIADB_ROOT_PASSWORD: wptestroot
MARIADB_DATABASE: wptest_minimum
TZ: Europe/Berlin
ports:
- 3306/tcp
options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup PHP
id: setup-minimum-php
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1
with:
php-version: '7.1'
coverage: none
extensions: mysqli
- name: Install minimal test requirements
run: |
rm composer.json composer.lock
composer require --dev --no-progress "phpunit/phpunit:^6" "yoast/phpunit-polyfills:1.1.1" "brain/monkey:2.6.1"
- name: Set up integration test
run: ./bin/install-wp-tests.sh wptest_minimum wptestuser wptestpass 127.0.0.1:${{ job.services.mysql.ports['3306'] }} 5.6 true
- name: Run integration tests
run: composer exec phpunit -- -c phpunit-integration.xml --no-coverage