Skip to content

Commit e4e35cf

Browse files
committed
Merge branch 'PHP-8.5'
* PHP-8.5: Move benchmarking job to nightly
2 parents 643a4b2 + 14be9c4 commit e4e35cf

File tree

4 files changed

+117
-107
lines changed

4 files changed

+117
-107
lines changed

.github/nightly_matrix.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ function get_current_version(): array {
4646
return [$major, $minor];
4747
}
4848

49-
function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) {
49+
function select_jobs($repository, $trigger, $nightly, $labels, $php_version, $ref, $all_variations) {
5050
$no_jobs = in_array('CI: No jobs', $labels, true);
5151
$all_jobs = in_array('CI: All jobs', $labels, true) || $nightly;
5252
$test_alpine = in_array('CI: Alpine', $labels, true);
53+
$test_benchmarking = in_array('CI: Benchmarking', $labels, true);
5354
$test_community = in_array('CI: Community', $labels, true);
5455
$test_coverage = in_array('CI: COVERAGE', $labels, true);
5556
$test_freebsd = in_array('CI: FreeBSD', $labels, true);
@@ -67,6 +68,13 @@ function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) {
6768
if (version_compare($php_version, '8.4', '>=') && ($all_jobs || !$no_jobs || $test_alpine)) {
6869
$jobs['ALPINE'] = true;
6970
}
71+
if (version_compare($php_version, '8.4', '>=')
72+
&& !$nightly
73+
&& ($all_jobs || !$no_jobs || $test_benchmarking)
74+
// push trigger is restricted to official repository.
75+
&& ($repository === 'php/php-src' || $trigger === 'pull_request')) {
76+
$jobs['BENCHMARKING'] = true;
77+
}
7078
if ($all_jobs || $test_community) {
7179
$jobs['COMMUNITY']['matrix'] = version_compare($php_version, '8.4', '>=')
7280
? ['type' => ['asan', 'verify_type_inference']]
@@ -162,9 +170,11 @@ function select_jobs($nightly, $labels, $php_version, $ref, $all_variations) {
162170
$nightly = $trigger === 'schedule' || $trigger === 'workflow_dispatch';
163171
$all_variations = $nightly || in_array('CI: All variations', $labels, true);
164172

173+
$repository = $argv[5] ?? null;
174+
165175
foreach ($branches as &$branch) {
166176
$php_version = $branch['version'][0] . '.' . $branch['version'][1];
167-
$branch['jobs'] = select_jobs($nightly, $labels, $php_version, $branch['ref'], $all_variations);
177+
$branch['jobs'] = select_jobs($repository, $trigger, $nightly, $labels, $php_version, $branch['ref'], $all_variations);
168178
$branch['config']['ubuntu_version'] = version_compare($php_version, '8.5', '>=') ? '24.04' : '22.04';
169179
}
170180

.github/workflows/nightly.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,3 +964,106 @@ jobs:
964964
configurationParameters: >-
965965
--${{ matrix.zts && 'enable' || 'disable' }}-zts
966966
runExtraTests: true
967+
BENCHMARKING:
968+
name: BENCHMARKING
969+
if: ${{ fromJson(inputs.branch).jobs.BENCHMARKING }}
970+
runs-on: ubuntu-${{ fromJson(inputs.branch).config.ubuntu_version }}
971+
timeout-minutes: 50
972+
steps:
973+
- name: git checkout
974+
uses: actions/checkout@v6
975+
with:
976+
fetch-depth: 0
977+
# ASLR can cause a lot of noise due to missed sse opportunities for memcpy
978+
# and other operations, so we disable it during benchmarking.
979+
- name: Disable ASLR
980+
run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
981+
- name: apt
982+
run: |
983+
set -x
984+
sudo apt-get update
985+
sudo apt-get install \
986+
bison \
987+
libgmp-dev \
988+
libonig-dev \
989+
libsqlite3-dev \
990+
openssl \
991+
re2c \
992+
valgrind
993+
- name: ccache
994+
uses: ./.github/actions/ccache
995+
with:
996+
name: "${{ github.job }}"
997+
- name: ./configure
998+
run: |
999+
set -x
1000+
./buildconf --force
1001+
./configure \
1002+
--disable-debug \
1003+
--enable-mbstring \
1004+
--enable-option-checking=fatal \
1005+
--enable-sockets \
1006+
--enable-werror \
1007+
--prefix=/usr \
1008+
--with-config-file-scan-dir=/etc/php.d \
1009+
--with-gmp \
1010+
--with-mysqli=mysqlnd \
1011+
--with-openssl \
1012+
--with-pdo-sqlite \
1013+
--with-valgrind
1014+
- name: make
1015+
run: make -j$(/usr/bin/nproc) >/dev/null
1016+
- name: make install
1017+
run: |
1018+
set -x
1019+
sudo make install
1020+
sudo mkdir -p /etc/php.d
1021+
sudo chmod 777 /etc/php.d
1022+
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
1023+
echo opcache.enable=1 >> /etc/php.d/opcache.ini
1024+
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
1025+
- name: Setup
1026+
run: |
1027+
git config --global user.name "Benchmark"
1028+
git config --global user.email "benchmark@php.net"
1029+
sudo service mysql start
1030+
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress"
1031+
mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;"
1032+
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;"
1033+
- name: git checkout benchmarking-data
1034+
uses: actions/checkout@v6
1035+
with:
1036+
repository: php/benchmarking-data
1037+
ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }}
1038+
path: benchmark/repos/data
1039+
- name: Benchmark
1040+
run: php benchmark/benchmark.php true
1041+
- name: Store result
1042+
if: github.event_name == 'push'
1043+
run: |
1044+
set -x
1045+
cd benchmark/repos/data
1046+
git pull --autostash
1047+
if [ -e ".git/MERGE_HEAD" ]; then
1048+
echo "Merging, can't proceed"
1049+
exit 1
1050+
fi
1051+
git add .
1052+
if git diff --cached --quiet; then
1053+
exit 0
1054+
fi
1055+
git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}"
1056+
git push
1057+
- name: Show diff
1058+
if: github.event_name == 'pull_request'
1059+
run: |-
1060+
set -x
1061+
php benchmark/generate_diff.php \
1062+
${{ github.sha }} \
1063+
$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \
1064+
> $GITHUB_STEP_SUMMARY
1065+
- uses: actions/upload-artifact@v6
1066+
with:
1067+
name: profiles
1068+
path: ${{ github.workspace }}/benchmark/profiles
1069+
retention-days: 30

.github/workflows/push.yml

Lines changed: 1 addition & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- uses: actions/checkout@v6
4343
- name: Generate Matrix
4444
id: set-matrix
45-
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.ref }}" '${{ toJSON(github.event.pull_request.labels) }}'
45+
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.ref }}" '${{ toJSON(github.event.pull_request.labels) }}' "${{ github.repository }}"
4646
PUSH:
4747
needs: GENERATE_MATRIX
4848
name: ${{ matrix.branch.ref }}
@@ -55,106 +55,3 @@ jobs:
5555
all_variations: ${{ needs.GENERATE_MATRIX.outputs.all_variations == 'true' }}
5656
branch: ${{ toJSON(matrix.branch) }}
5757
secrets: inherit
58-
BENCHMARKING:
59-
name: BENCHMARKING
60-
if: github.repository == 'php/php-src' || github.event_name == 'pull_request'
61-
runs-on: ubuntu-24.04
62-
timeout-minutes: 50
63-
steps:
64-
- name: git checkout
65-
uses: actions/checkout@v6
66-
with:
67-
fetch-depth: 0
68-
# ASLR can cause a lot of noise due to missed sse opportunities for memcpy
69-
# and other operations, so we disable it during benchmarking.
70-
- name: Disable ASLR
71-
run: echo 0 | sudo tee /proc/sys/kernel/randomize_va_space
72-
- name: apt
73-
run: |
74-
set -x
75-
sudo apt-get update
76-
sudo apt-get install \
77-
bison \
78-
libgmp-dev \
79-
libonig-dev \
80-
libsqlite3-dev \
81-
openssl \
82-
re2c \
83-
valgrind
84-
- name: ccache
85-
uses: ./.github/actions/ccache
86-
with:
87-
name: "${{ github.job }}"
88-
- name: ./configure
89-
run: |
90-
set -x
91-
./buildconf --force
92-
./configure \
93-
--disable-debug \
94-
--enable-mbstring \
95-
--enable-option-checking=fatal \
96-
--enable-sockets \
97-
--enable-werror \
98-
--prefix=/usr \
99-
--with-config-file-scan-dir=/etc/php.d \
100-
--with-gmp \
101-
--with-mysqli=mysqlnd \
102-
--with-openssl \
103-
--with-pdo-sqlite \
104-
--with-valgrind
105-
- name: make
106-
run: make -j$(/usr/bin/nproc) >/dev/null
107-
- name: make install
108-
run: |
109-
set -x
110-
sudo make install
111-
sudo mkdir -p /etc/php.d
112-
sudo chmod 777 /etc/php.d
113-
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
114-
echo opcache.enable=1 >> /etc/php.d/opcache.ini
115-
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
116-
- name: Setup
117-
run: |
118-
git config --global user.name "Benchmark"
119-
git config --global user.email "benchmark@php.net"
120-
sudo service mysql start
121-
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress"
122-
mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;"
123-
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;"
124-
- name: git checkout benchmarking-data
125-
uses: actions/checkout@v6
126-
with:
127-
repository: php/benchmarking-data
128-
ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }}
129-
path: benchmark/repos/data
130-
- name: Benchmark
131-
run: php benchmark/benchmark.php true
132-
- name: Store result
133-
if: github.event_name == 'push'
134-
run: |
135-
set -x
136-
cd benchmark/repos/data
137-
git pull --autostash
138-
if [ -e ".git/MERGE_HEAD" ]; then
139-
echo "Merging, can't proceed"
140-
exit 1
141-
fi
142-
git add .
143-
if git diff --cached --quiet; then
144-
exit 0
145-
fi
146-
git commit -m "Add result for ${{ github.repository }}@${{ github.sha }}"
147-
git push
148-
- name: Show diff
149-
if: github.event_name == 'pull_request'
150-
run: |-
151-
set -x
152-
php benchmark/generate_diff.php \
153-
${{ github.sha }} \
154-
$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) \
155-
> $GITHUB_STEP_SUMMARY
156-
- uses: actions/upload-artifact@v6
157-
with:
158-
name: profiles
159-
path: ${{ github.workspace }}/benchmark/profiles
160-
retention-days: 30

.github/workflows/root.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
nightly-
3232
- name: Generate Matrix
3333
id: set-matrix
34-
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.head_ref || github.ref_name }}" '[]'
34+
run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.head_ref || github.ref_name }}" '[]' "${{ github.repository }}"
3535
NIGHTLY:
3636
needs: GENERATE_MATRIX
3737
name: ${{ matrix.branch.ref }}

0 commit comments

Comments
 (0)