1
0
mirror of https://github.com/php/php-src.git synced 2026-04-08 00:22:52 +02:00

Add benchmarking to CI

Closes GH-11068
This commit is contained in:
Ilija Tovilo
2023-04-06 19:29:34 +02:00
parent 5823955c78
commit afbc71d88d
6 changed files with 356 additions and 0 deletions

View File

@@ -215,3 +215,95 @@ jobs:
run: .github/scripts/windows/build.bat
- name: Test
run: .github/scripts/windows/test.bat
BENCHMARKING:
name: BENCHMARKING
runs-on: ubuntu-22.04
steps:
- name: git checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: apt
run: |
set -x
sudo apt-get update
sudo apt-get install \
bison \
libonig-dev \
libsqlite3-dev \
openssl \
re2c \
valgrind
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: "${{github.job}}-${{hashFiles('main/php_version.h')}}"
append-timestamp: false
- name: ./configure
run: |
set -x
./buildconf --force
./configure \
--disable-debug \
--enable-mbstring \
--enable-opcache \
--enable-option-checking=fatal \
--enable-sockets \
--enable-werror \
--prefix=/usr \
--with-config-file-scan-dir=/etc/php.d \
--with-mysqli=mysqlnd \
--with-openssl \
--with-pdo-sqlite \
--with-valgrind
- name: make
run: make -j$(/usr/bin/nproc) >/dev/null
- name: make install
run: |
set -x
sudo make install
sudo mkdir -p /etc/php.d
sudo chmod 777 /etc/php.d
echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini
echo zend_extension=opcache.so >> /etc/php.d/opcache.ini
echo opcache.enable=1 >> /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
- name: Setup
run: |
git config --global user.name "Benchmark"
git config --global user.email "benchmark@php.net"
sudo service mysql start
mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS wordpress"
mysql -uroot -proot -e "CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress'; FLUSH PRIVILEGES;"
mysql -uroot -proot -e "GRANT ALL PRIVILEGES ON *.* TO 'wordpress'@'localhost' WITH GRANT OPTION;"
- name: git checkout benchmarking-data
uses: actions/checkout@v3
with:
repository: php/benchmarking-data
ssh-key: ${{ secrets.BENCHMARKING_DATA_DEPLOY_KEY }}
path: benchmark/repos/data
- name: Benchmark
run: php benchmark/benchmark.php true
- name: Store result
if: github.event_name == 'push'
run: |
set -x
cd benchmark/repos/data
git pull --autostash
if [ -e ".git/MERGE_HEAD" ]; then
echo "Merging, can't proceed"
exit 1
fi
git add .
if git diff --cached --quiet; then
exit 0
fi
git commit -m "Add result for ${{ github.repository }}@${{ steps.determine-commit.outputs.sha }}"
git push
- name: Show diff
if: github.event_name == 'pull_request'
run: >-
php benchmark/generate_diff.php
${{ github.event.pull_request.head.sha }}
$(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})
> $GITHUB_STEP_SUMMARY