-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a8df3d1
commit 3e71901
Showing
2 changed files
with
113 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: Benchmark | ||
#on: | ||
# schedule: | ||
# - cron: "0 2 * * *" | ||
on: [push, pull_request] | ||
permissions: | ||
contents: read | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} | ||
cancel-in-progress: true | ||
jobs: | ||
BENCHMARK: | ||
name: BENCHMARK | ||
if: github.repository == 'php/php-src' || github.event_name == 'pull_request' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Install dependencies | ||
run: | | ||
set -ex | ||
sudo apt-get update | ||
sudo apt-get install gpg | ||
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg | ||
gpg --no-default-keyring --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg --fingerprint | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | ||
sudo apt update | ||
sudo apt install terraform | ||
- name: Checkout php-src | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'php/php-src' | ||
ref: '${{ github.ref }}' | ||
fetch-depth: 100 | ||
path: 'php' | ||
- name: Checkout the benchmark suite | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'kocsismate/php-version-benchmarks' | ||
ref: 'main' | ||
fetch-depth: 1 | ||
path: 'php-version-benchmarks' | ||
- name: Setup benchmark config | ||
run: | | ||
set -e | ||
#cp ./php-version-benchmarks/config/infra/aws/x86_64-metal.ini.dist ./php-version-benchmarks/config/infra/aws/x86_64-metal.ini.dist | ||
cp ./php-version-benchmarks/config/infra/aws/x86_64.ini.dist ./php-version-benchmarks/config/infra/aws/x86_64.ini | ||
sed -i "s/INFRA_DOCKER_REGISTRY=public.ecr.aws\/abcdefgh/INFRA_DOCKER_REGISTRY=${{ secrets.PHP_VERSION_BENCHMARK_DOCKER_REGISTRY }}/g" ./php-version-benchmarks/config/infra/aws/x86_64.ini | ||
cp ./php-version-benchmarks/build/infrastructure/config/aws.tfvars.dist ./php-version-benchmarks/build/infrastructure/config/aws.tfvars | ||
sed -i 's/access_key = ""/access_key = "${{ secrets.PHP_VERSION_BENCHMARK_AWS_ACCESS_KEY }}"/g' ./php-version-benchmarks/build/infrastructure/config/aws.tfvars | ||
sed -i 's/secret_key = ""/secret_key = "${{ secrets.PHP_VERSION_BENCHMARK_AWS_SECRET_KEY }}"/g' ./php-version-benchmarks/build/infrastructure/config/aws.tfvars | ||
cp ./php-version-benchmarks/config/php/master.ini.dist ./php-version-benchmarks/config/php/master1.ini | ||
YESTERDAY="date -d "-2 day 13:00" '+%Y-%m-%d'" | ||
YESTERDAY_SHA="$(cd ./php/ && git --no-pager log --until="$YESTERDAY 23:59:59" -n 1 --pretty='%H')" | ||
sed -i 's/PHP_NAME=/PHP_NAME=PHP - previous master/g' ./php-version-benchmarks/config/php/master1.ini | ||
sed -i 's/PHP_NAME=/PHP_ID=master_previous/g' ./php-version-benchmarks/config/php/master1.ini | ||
sed -i 's/PHP_COMMIT=/PHP_COMMIT=$YESTERDAY_SHA/g' ./php-version-benchmarks/config/php/master1.ini | ||
cp ./php-version-benchmarks/config/php/master.ini.dist ./php-version-benchmarks/config/php/master2.ini | ||
sed -i 's/PHP_COMMIT=/PHP_COMMIT=${{ github.sha }}/g' ./php-version-benchmarks/config/php/master2.ini | ||
cp ./php-version-benchmarks/config/php/master_jit.ini.dist ./php-version-benchmarks/config/php/master2_jit.ini | ||
sed -i 's/PHP_COMMIT=/PHP_COMMIT=${{ github.sha }}/g' ./php-version-benchmarks/config/php/master2_jit.ini | ||
cp ./php-version-benchmarks/config/test/1_laravel.ini.dist ./php-version-benchmarks/config/test/1_laravel.ini | ||
cp ./php-version-benchmarks/config/test/2_symfony_main.ini.dist ./php-version-benchmarks/config/test/2_symfony_main.ini | ||
cp ./php-version-benchmarks/config/test/4_wordpress.ini.dist ./php-version-benchmarks/config/test/4_wordpress.ini | ||
cp ./php-version-benchmarks/config/test/5_bench.php.ini.dist ./php-version-benchmarks/config/test/5_bench.php.ini | ||
cp ./php-version-benchmarks/config/test/6_micro_bench.php.ini.dist ./php-version-benchmarks/config/test/6_micro_bench.php.ini | ||
rm -rf ./php-version-benchmarks/docs/results | ||
- name: Git setup | ||
run: | | ||
git config --global user.name "Benchmark" | ||
git config --global user.email "benchmark@php.net" | ||
- name: Checkout the benchmark results | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kocsismate/php-version-benchmark-results | ||
ssh-key: ${{ secrets.PHP_VERSION_BENCHMARK_RESULTS_DEPLOY_KEY }} | ||
path: 'php-version-benchmarks/docs/results' | ||
- name: Run benchmark | ||
run: ./php-version-benchmarks/benchmark.sh run aws | ||
- name: Store results | ||
if: github.event_name == 'push' | ||
run: | | ||
set -ex | ||
cd ./php-version-benchmarks/docs/results | ||
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 }}@${{ github.sha }}" | ||
git push | ||
- name: Cleanup | ||
if: always() | ||
run: | | ||
set -ex | ||
rm -rf ./php-version-benchmarks/tmp/ | ||
rm -f ./php-version-benchmarks/build/infrastructure/config/*.tfvars | ||
rm -rf ./php-version-benchmarks/build/infrastructure/aws/.terraform/ | ||
rm -rf ./php-version-benchmarks/build/infrastructure/aws/.terraform.lock.hcl | ||
rm -rf ./php-version-benchmarks/build/infrastructure/aws/aws.tfplan | ||
rm -rf ./php-version-benchmarks/build/infrastructure/aws/terraform.tfstate | ||
rm -rf ./php-version-benchmarks/build/infrastructure/aws/terraform.tfstate.backup | ||
rm -f ./php-version-benchmarks/config/infra/aws/*.ini |
Oops, something went wrong.