Skip to content

Commit dc05c5c

Browse files
committed
ci: benchmark per-shard builds
1 parent c50892b commit dc05c5c

4 files changed

Lines changed: 27 additions & 161 deletions

File tree

.github/actions/ccache/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ runs:
5858
save: >-
5959
${{ inputs.save == 'true'
6060
&& (github.event_name == 'push'
61-
|| github.event_name == 'schedule'
62-
|| github.event_name == 'workflow_dispatch') }}
61+
|| github.event_name == 'schedule') }}
6362
- name: Export CC/CXX
6463
shell: bash
6564
env:

.github/matrix.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $re
201201
$repository = $argv[5] ?? null;
202202
$normal_ci_experiment = $trigger === 'workflow_dispatch'
203203
&& $repository === 'NickSdot/php__php-src'
204-
&& $branch === 'experiment/ci-build-artifacts';
204+
&& in_array($branch, ['experiment/ci-build-artifacts', 'experiment/ci-local-builds-v2'], true);
205205
$matrix_trigger = $normal_ci_experiment ? 'pull_request' : $trigger;
206206
$nightly = ($trigger === 'schedule' || $trigger === 'workflow_dispatch')
207207
&& !$normal_ci_experiment;

.github/workflows/test-suite.yml

Lines changed: 24 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -52,52 +52,8 @@ jobs:
5252
--asan -x
5353
- name: Extra tests
5454
uses: ./.github/actions/extra-tests
55-
ALPINE_BUILD:
56-
if: ${{ fromJson(inputs.branch).jobs.ALPINE && !inputs.all_variations }}
57-
name: ALPINE_X64_ASAN_DBG_ZTS_BUILD
58-
runs-on: ubuntu-24.04
59-
timeout-minutes: 60
60-
container:
61-
image: 'alpine:3.22'
62-
steps:
63-
- name: git checkout
64-
uses: actions/checkout@v6
65-
with:
66-
ref: ${{ fromJson(inputs.branch).ref }}
67-
- name: apk
68-
uses: ./.github/actions/apk
69-
- name: ccache
70-
uses: ./.github/actions/ccache
71-
with:
72-
name: ALPINE
73-
cc: clang-20
74-
cxx: clang++-20
75-
source_sha: ${{ fromJson(inputs.branch).sha }}
76-
save: true
77-
- name: ./configure
78-
uses: ./.github/actions/configure-alpine
79-
with:
80-
configurationParameters: >-
81-
CFLAGS="-fsanitize=undefined,address -fno-sanitize=function -DZEND_TRACK_ARENA_ALLOC"
82-
LDFLAGS="-fsanitize=undefined,address -fno-sanitize=function"
83-
--enable-debug
84-
--enable-zts
85-
skipSlow: true
86-
- name: make
87-
run: make -j$(/usr/bin/nproc) >/dev/null
88-
- name: Stage PHP installation
89-
run: make install INSTALL_ROOT="$RUNNER_TEMP/php-install-root" >/dev/null
90-
- name: Upload PHP build
91-
uses: ./.github/actions/upload-build-artifact
92-
with:
93-
name: php-build-alpine-${{ join(fromJson(inputs.branch).version, '.') }}
94-
source_sha: ${{ fromJson(inputs.branch).sha }}
9555
ALPINE:
96-
needs: ALPINE_BUILD
97-
if: >-
98-
${{ always()
99-
&& fromJson(inputs.branch).jobs.ALPINE
100-
&& (inputs.all_variations || needs.ALPINE_BUILD.result == 'success') }}
56+
if: ${{ fromJson(inputs.branch).jobs.ALPINE }}
10157
strategy:
10258
fail-fast: false
10359
matrix: ${{ fromJson(inputs.branch).jobs.ALPINE.matrix }}
@@ -122,7 +78,6 @@ jobs:
12278
apk list
12379
echo "::endgroup::"
12480
- name: ccache
125-
if: ${{ inputs.all_variations }}
12681
uses: ./.github/actions/ccache
12782
with:
12883
name: "${{ github.job }}"
@@ -131,7 +86,6 @@ jobs:
13186
source_sha: ${{ fromJson(inputs.branch).sha }}
13287
save: ${{ matrix.test_shard == 1 && 'true' || 'false' }}
13388
- name: ./configure
134-
if: ${{ inputs.all_variations }}
13589
uses: ./.github/actions/configure-alpine
13690
with:
13791
configurationParameters: >-
@@ -141,22 +95,9 @@ jobs:
14195
--enable-zts
14296
skipSlow: true # FIXME: This should likely include slow extensions
14397
- name: make
144-
if: ${{ inputs.all_variations }}
14598
run: make -j$(/usr/bin/nproc) >/dev/null
146-
- name: Download PHP build
147-
if: ${{ !inputs.all_variations }}
148-
uses: ./.github/actions/download-build-artifact
149-
with:
150-
name: php-build-alpine-${{ join(fromJson(inputs.branch).version, '.') }}
151-
source_sha: ${{ fromJson(inputs.branch).sha }}
15299
- name: make install
153-
if: ${{ inputs.all_variations }}
154100
uses: ./.github/actions/install-alpine
155-
- name: Configure installed PHP
156-
if: ${{ !inputs.all_variations }}
157-
run: |
158-
sudo mkdir -p /etc/php.d
159-
sudo chmod 777 /etc/php.d
160101
- name: Test Tracing JIT
161102
uses: ./.github/actions/test-alpine
162103
with:
@@ -169,52 +110,8 @@ jobs:
169110
- name: Extra tests
170111
if: ${{ matrix.test_shard == 1 }}
171112
uses: ./.github/actions/extra-tests
172-
LINUX_X64_ASAN_BUILD:
173-
if: ${{ fromJson(inputs.branch).jobs.LINUX_X64.asan_matrix }}
174-
name: LINUX_X64_ASAN_DBG_ZTS_BUILD
175-
runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }}
176-
timeout-minutes: 60
177-
steps:
178-
- name: git checkout
179-
uses: actions/checkout@v6
180-
with:
181-
ref: ${{ fromJson(inputs.branch).ref }}
182-
- name: apt
183-
uses: ./.github/actions/apt-x64
184-
with:
185-
asan: true
186-
skipSlow: true
187-
- name: ccache
188-
uses: ./.github/actions/ccache
189-
with:
190-
name: LINUX_X64_ASAN_DEBUG_ZTS
191-
source_sha: ${{ fromJson(inputs.branch).sha }}
192-
save: true
193-
- name: ./configure
194-
uses: ./.github/actions/configure-x64
195-
with:
196-
configurationParameters: >-
197-
CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC"
198-
LDFLAGS="-fsanitize=undefined,address"
199-
--enable-debug
200-
--enable-zts
201-
asan: true
202-
skipSlow: true
203-
- name: make
204-
run: make -j$(/usr/bin/nproc) >/dev/null
205-
- name: Stage PHP installation
206-
run: make install INSTALL_ROOT="$RUNNER_TEMP/php-install-root" >/dev/null
207-
- name: Upload PHP build
208-
uses: ./.github/actions/upload-build-artifact
209-
with:
210-
name: php-build-linux-x64-asan-${{ join(fromJson(inputs.branch).version, '.') }}
211-
source_sha: ${{ fromJson(inputs.branch).sha }}
212113
LINUX_X64_ASAN:
213-
needs: LINUX_X64_ASAN_BUILD
214-
if: >-
215-
${{ always()
216-
&& fromJson(inputs.branch).jobs.LINUX_X64.asan_matrix
217-
&& needs.LINUX_X64_ASAN_BUILD.result == 'success' }}
114+
if: ${{ fromJson(inputs.branch).jobs.LINUX_X64.asan_matrix }}
218115
services:
219116
mysql:
220117
image: mysql:8.4
@@ -249,17 +146,26 @@ jobs:
249146
echo "::endgroup::"
250147
- name: Setup Caddy server
251148
uses: ./.github/actions/setup-caddy
252-
- name: Download PHP build
253-
uses: ./.github/actions/download-build-artifact
149+
- name: ccache
150+
uses: ./.github/actions/ccache
254151
with:
255-
name: php-build-linux-x64-asan-${{ join(fromJson(inputs.branch).version, '.') }}
152+
name: LINUX_X64_ASAN_DEBUG_ZTS
256153
source_sha: ${{ fromJson(inputs.branch).sha }}
257-
- name: Configure installed PHP
258-
run: |
259-
sudo mkdir -p /etc/php.d
260-
sudo chmod 777 /etc/php.d
261-
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock | sudo tee /etc/php.d/mysqli.ini
262-
echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock | sudo tee /etc/php.d/pdo_mysql.ini
154+
save: ${{ matrix.test_shard == 1 && 'true' || 'false' }}
155+
- name: ./configure
156+
uses: ./.github/actions/configure-x64
157+
with:
158+
configurationParameters: >-
159+
CFLAGS="-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC"
160+
LDFLAGS="-fsanitize=undefined,address"
161+
--enable-debug
162+
--enable-zts
163+
asan: true
164+
skipSlow: true
165+
- name: make
166+
run: make -j$(/usr/bin/nproc) >/dev/null
167+
- name: make install
168+
uses: ./.github/actions/install-linux
263169
- name: Test Tracing JIT
264170
uses: ./.github/actions/test-linux
265171
with:
@@ -1029,9 +935,6 @@ jobs:
1029935
uses: ./.github/actions/verify-generated-files
1030936
WINDOWS:
1031937
if: ${{ fromJson(inputs.branch).jobs.WINDOWS }}
1032-
permissions:
1033-
actions: read
1034-
contents: read
1035938
strategy:
1036939
fail-fast: false
1037940
matrix: ${{ fromJson(inputs.branch).jobs.WINDOWS.matrix }}
@@ -1065,9 +968,7 @@ jobs:
1065968
with:
1066969
ref: ${{ fromJson(inputs.branch).ref }}
1067970
- name: Get checked-out commit
1068-
if: >-
1069-
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1070-
&& (inputs.all_variations || matrix.test_shard == 1) }}
971+
if: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build }}
1071972
shell: pwsh
1072973
run: |
1073974
$sourceSha = git rev-parse HEAD
@@ -1077,14 +978,11 @@ jobs:
1077978
if: ${{ !fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build }}
1078979
uses: ./.github/actions/setup-windows
1079980
- name: Setup Windows build tools
1080-
if: >-
1081-
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1082-
&& (inputs.all_variations || matrix.test_shard == 1) }}
981+
if: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build }}
1083982
uses: ./.github/actions/setup-windows
1084983
- name: Restore MSVC compiler cache
1085984
if: >-
1086985
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1087-
&& (inputs.all_variations || matrix.test_shard == 1)
1088986
&& !matrix.clang }}
1089987
continue-on-error: true
1090988
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
@@ -1095,9 +993,7 @@ jobs:
1095993
${{ env.SCCACHE_CACHE_RESTORE_PREFIX }}
1096994
${{ env.SCCACHE_CACHE_LEGACY_RESTORE_PREFIX }}
1097995
- name: Build PHP while preparing test databases
1098-
if: >-
1099-
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1100-
&& (inputs.all_variations || matrix.test_shard == 1) }}
996+
if: ${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build }}
1101997
shell: pwsh
1102998
run: .github/scripts/windows/build_with_test_database_setup.ps1
1103999
- name: Build PHP
@@ -1106,44 +1002,15 @@ jobs:
11061002
- name: Save MSVC compiler cache
11071003
if: >-
11081004
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1109-
&& inputs.all_variations
11101005
&& !matrix.clang
11111006
&& matrix.test_shard == 1
11121007
&& (github.event_name == 'push'
1113-
|| github.event_name == 'schedule'
1114-
|| github.event_name == 'workflow_dispatch') }}
1008+
|| github.event_name == 'schedule') }}
11151009
continue-on-error: true
11161010
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
11171011
with:
11181012
path: ${{ runner.temp }}\sccache
11191013
key: ${{ env.SCCACHE_CACHE_KEY }}
1120-
- name: Upload PHP build
1121-
if: >-
1122-
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1123-
&& !inputs.all_variations
1124-
&& matrix.test_shard == 1 }}
1125-
uses: ./.github/actions/upload-build-artifact
1126-
with:
1127-
name: php-build-windows-${{ join(fromJson(inputs.branch).version, '.') }}-${{ fromJson(inputs.branch).jobs.WINDOWS.config.vs_crt_version }}-x64-zts
1128-
source_sha: ${{ fromJson(inputs.branch).sha }}
1129-
- name: Download PHP build while preparing test databases
1130-
if: >-
1131-
${{ fromJson(inputs.branch).jobs.WINDOWS.config.parallel_build
1132-
&& !inputs.all_variations
1133-
&& matrix.test_shard != 1 }}
1134-
shell: pwsh
1135-
env:
1136-
GH_TOKEN: ${{ github.token }}
1137-
PHP_BUILD_ARTIFACT_NAME: php-build-windows-${{ join(fromJson(inputs.branch).version, '.') }}-${{ fromJson(inputs.branch).jobs.WINDOWS.config.vs_crt_version }}-x64-zts
1138-
PHP_BUILD_SOURCE_SHA: ${{ fromJson(inputs.branch).sha }}
1139-
PHP_BUILD_PRODUCER_JOB: WINDOWS_X64_ZTS_1-2
1140-
run: |
1141-
$parameters = @{
1142-
ArtifactName = $env:PHP_BUILD_ARTIFACT_NAME
1143-
SourceSha = $env:PHP_BUILD_SOURCE_SHA
1144-
ProducerJobName = $env:PHP_BUILD_PRODUCER_JOB
1145-
}
1146-
.github/scripts/windows/download_build_with_test_database_setup.ps1 @parameters
11471014
- name: Test
11481015
run: .github/scripts/windows/test.bat
11491016
FREEBSD:

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
if: github.repository == 'php/php-src' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
3838
runs-on: ubuntu-latest
3939
env:
40-
NORMAL_CI_EXPERIMENT: ${{ github.repository == 'NickSdot/php__php-src' && github.event_name == 'workflow_dispatch' && github.ref_name == 'experiment/ci-build-artifacts' }}
40+
NORMAL_CI_EXPERIMENT: ${{ github.repository == 'NickSdot/php__php-src' && github.event_name == 'workflow_dispatch' && (github.ref_name == 'experiment/ci-build-artifacts' || github.ref_name == 'experiment/ci-local-builds-v2') }}
4141
outputs:
4242
all_variations: ${{ steps.set-matrix.outputs.all_variations }}
4343
branches: ${{ steps.set-matrix.outputs.branches }}

0 commit comments

Comments
 (0)