-
Notifications
You must be signed in to change notification settings - Fork 59
234 lines (224 loc) · 7.43 KB
/
continuous-integration.yml
File metadata and controls
234 lines (224 loc) · 7.43 KB
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: "Continuous Integration"
on:
pull_request:
push:
permissions:
contents: read
jobs:
unit-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
- windows-latest
php-versions:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: intl, sodium, zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v4
- name: GH token (non-Windows)
if: matrix.operating-system != 'windows-latest'
run: sudo composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: GH token (Windows)
if: matrix.operating-system == 'windows-latest'
run: composer config --global --auth github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
- name: Run PHPUnit on Windows
if: matrix.operating-system == 'windows-latest'
run: vendor/bin/phpunit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run PHPUnit on non-Windows
if: matrix.operating-system != 'windows-latest'
run: sudo vendor/bin/phpunit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bundled-php-extension-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
php-versions:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
steps:
- name: "Purge built-in PHP version"
run: |
echo "libmemcached11 php* hhvm libhashkit2" | xargs -n 1 sudo apt-get purge --assume-yes || true
sudo apt-add-repository --remove ppa:ondrej/php -y
- name: Install platform dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
g++ gcc make autoconf libtool bison re2c pkg-config unzip \
libcurl4-openssl-dev \
liblmdb-dev \
libdb-dev \
libqdbm-dev \
libenchant-2-dev \
libexif-dev \
libgd-dev \
libpng-dev \
libtiff-dev \
libfreetype-dev \
libfreetype6 \
libfontconfig1-dev \
libgmp-dev \
libssl-dev \
libsodium-dev \
libxml2-dev \
libonig-dev \
libldap-dev \
libedit-dev \
libsnmp-dev \
libtidy-dev \
libxslt1-dev \
libsasl2-dev \
libpq-dev \
libsqlite3-dev \
libbz2-dev \
libzip-dev
- name: "Set php-src download URL"
run: |
DIST_URL=`curl -fsSL "https://www.php.net/releases/index.php?json&max=1&version=${{ matrix.php-versions }}" | jq -r '.[].source[]|select(.filename|endswith(".gz")).filename'`
echo "php_src_download_url=https://www.php.net/distributions/$DIST_URL" >> $GITHUB_ENV
- name: "Install PHP ${{ matrix.php-versions }}"
run: |
mkdir -p /tmp/php
mkdir -p /tmp/php.ini.d
cd /tmp/php
echo "Downloading release from ${{ env.php_src_download_url }} ..."
wget -O php.tgz ${{ env.php_src_download_url }}
tar zxf php.tgz
rm php.tgz
ls -l
cd *
ls -l
./buildconf --force
./configure --disable-dom --disable-xml --disable-xmlreader --disable-xmlwriter --disable-json --with-openssl --with-config-file-scan-dir=/tmp/php.ini.d
make -j$(nproc)
sudo make install
cd $GITHUB_WORKSPACE
- uses: actions/checkout@v6
- name: Composer Install
run: composer install --ignore-platform-reqs
- name: Run bundled PHP install test
run: sudo php test/install-bundled-php-exts.php php-config
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
end-to-end-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# Fixes `git describe` picking the wrong tag - see https://github.com/php/pie/issues/307
- run: git fetch --tags --force
# Ensure some kind of previous tag exists, otherwise box fails
- run: git describe --tags HEAD || git tag 0.0.0
- uses: ramsey/composer-install@v4
- name: Run the tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: test/end-to-end/dockerfile-e2e-test.sh
behaviour-tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system:
- ubuntu-latest
php-versions:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# Fixes `git describe` picking the wrong tag - see https://github.com/php/pie/issues/307
- run: git fetch --tags --force
# Ensure some kind of previous tag exists, otherwise box fails
- run: git describe --tags HEAD || git tag 0.0.0
- uses: ramsey/composer-install@v4
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: docker buildx build --file .github/pie-behaviour-tests/Dockerfile --secret id=GITHUB_TOKEN,env=GITHUB_TOKEN --build-arg PHP_VERSION=${{ matrix.php-versions }} -t pie-behat-test .
- name: Run Behat
run: docker run --volume .:/github/workspace pie-behat-test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
coding-standards:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
extensions: intl, sodium, zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v4
- name: Run PHPCS
run: vendor/bin/phpcs
static-analysis:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.5
extensions: intl, sodium, zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v4
- name: Validate the composer configuration
run: composer validate --strict
- name: Run phpstan
run: vendor/bin/phpstan
mutation-testing:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
extensions: intl, sodium, zip
tools: infection
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v6
- uses: ramsey/composer-install@v4
- name: Run infection
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: sudo infection --min-msi=68 --min-covered-msi=68 --threads=max --show-mutations=max --no-progress
build-assets:
needs:
- unit-tests
- coding-standards
- static-analysis
# See build-assets.yml for a list of the permissions and why they are needed
permissions:
contents: read
id-token: write
attestations: write
uses: ./.github/workflows/build-assets.yml