forked from Automattic/vip-go-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (150 loc) · 4.94 KB
/
ci.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: CI
on:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
unit-testing:
name: Run unit tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Check out the source code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/[email protected]
with:
coverage: none
php-version: "${{ matrix.php }}"
tools: phpunit:9
env:
fail-fast: 'true'
- name: Configure PHPUnit
run: sed "s:PROJECT_DIR:$(pwd):g" phpunit.xml.dist > phpunit.xml
- name: Run unit tests
run: phpunit --testsuite=unit-tests
env:
VIPGOCI_TESTING_DEBUG_MODE: 'true'
integration-testing:
name: Run integration tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Check out the source code
uses: actions/checkout@v3
- name: Set up PHP 7.4
uses: shivammathur/[email protected]
with:
coverage: none
php-version: "7.4"
- name: Set up PHP 8.0
uses: shivammathur/[email protected]
with:
coverage: none
php-version: "8.0"
- name: Set up PHP 8.1
uses: shivammathur/[email protected]
with:
coverage: none
php-version: "8.1"
- name: Set up PHP 8.2
uses: shivammathur/[email protected]
with:
coverage: none
php-version: "8.2"
tools: phpunit:9
env:
fail-fast: 'true'
- name: Install tools
run: |
./tools-init.sh
rm -rf ~/vip-go-ci-tools/vip-go-ci
- name: Clone vip-go-ci-testing repository
run: |
git clone https://github.com/Automattic/vip-go-ci-testing.git ~/vip-go-ci-tools/vip-go-ci-testing
git -C ~/vip-go-ci-tools/vip-go-ci-testing checkout ap-file-types-test-1 # Need to check this out so branch is known
git -C ~/vip-go-ci-tools/vip-go-ci-testing checkout master # Switch to default
- name: Configure tools
env:
GH_TESTS_TOKEN: ${{ secrets.GH_TESTS_TOKEN }}
run: |
sed "s:/home/phpunit/:${HOME}/:; s:phpcs-php-path=.*:phpcs-php-path=/usr/bin/php7.4:g; s:svg-php-path=.*:svg-php-path=/usr/bin/php8.1:g; s:github-repo-url=.*:github-repo-url=${HOME}/vip-go-ci-tools/vip-go-ci-testing:g;" tests/config.ini.dist > tests/config.ini
rm -f tests/config.ini.dist
echo '[git-secrets]' > tests/config-secrets.ini
echo "github-token=$GH_TESTS_TOKEN" >> tests/config-secrets.ini
echo 'github-skip-write-tests=true' >> tests/config-secrets.ini
sed "s:PROJECT_DIR:$(pwd):g" phpunit.xml.dist > phpunit.xml
- name: Set default PHP version
run: sudo update-alternatives --set php "/usr/bin/php${{ matrix.php }}"
- name: Run integration tests
run: phpunit --testsuite=integration-tests
env:
VIPGOCI_TESTING_DEBUG_MODE: 'true'
- name: Clean up after integration tests
run: |
rm -f tests/config-secrets.ini
e2e-testing:
name: Run E2E tests (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Check out the source code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Ask git to fetch latest branch and other branches
run: git fetch origin latest && git pull
- name: Set up PHP
uses: shivammathur/[email protected]
with:
coverage: none
php-version: "${{ matrix.php }}"
tools: phpunit:9
env:
fail-fast: 'true'
- name: Configure PHPUnit
run: sed "s:PROJECT_DIR:$(pwd):g" phpunit.xml.dist > phpunit.xml
- name: Run E2E tests
run: phpunit --testsuite=e2e-tests
env:
VIPGOCI_TESTING_DEBUG_MODE: 'true'
php-code-compatibility:
name: PHP code compatibility (8.2)
runs-on: ubuntu-latest
steps:
- name: Check out the source code
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/[email protected]
with:
coverage: none
php-version: 8.2
- name: Install tools
run: |
./tools-init.sh
rm -rf ~/vip-go-ci-tools/vip-go-ci
- name: Run PHPCS
run: |
~/vip-go-ci-tools/phpcs/bin/phpcs --runtime-set 'testVersion' '8.2-' --standard=PHPCompatibility,PHPCompatibilityParagonieRandomCompat,PHPCompatibilityParagonieSodiumCompat --ignore="vendor/*" .