Skip to content

ci: Fix benchmark artifact name #21

ci: Fix benchmark artifact name

ci: Fix benchmark artifact name #21

Workflow file for this run

name: Benchmark Tests
on:
pull_request: ~
# See https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
TERM: xterm
jobs:
main-bench-test:
runs-on: ubuntu-latest
name: Benchmark main branch
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: phar.readonly=0, display_errors=On, error_reporting=-1
tools: composer
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Ensure that the make target is up to date
run: make _vendor_install
- name: Install PHPBench
uses: ramsey/composer-install@v2
with:
working-directory: vendor-bin/phpbench
- name: Ensure that the PHPBench make target is up to date
run: make phpbench_install
- name: Run PHPBench
run: make phpbench_main
- uses: actions/upload-artifact@v3
name: Upload the Benchmark results
with:
name: bench-branch-main-result
path: |
dist/.phpbench/
dist/bench/
pr-bench-test:
runs-on: ubuntu-latest
name: Benchmark PR
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: phar.readonly=0, display_errors=On, error_reporting=-1
tools: composer
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Ensure that the make target is up to date
run: make _vendor_install
- name: Install PHPBench
uses: ramsey/composer-install@v2
with:
working-directory: vendor-bin/phpbench
- name: Ensure that the PHPBench make target is up to date
run: make phpbench_install
- name: Run PHPBench
run: make phpbench
pr-main-bench-test:
runs-on: ubuntu-latest
name: Benchmark PR compared to main
needs: main-bench-test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
ini-values: phar.readonly=0, display_errors=On, error_reporting=-1
tools: composer
coverage: none
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
- name: Ensure that the make target is up to date
run: make _vendor_install
- name: Install PHPBench
uses: ramsey/composer-install@v2
with:
working-directory: vendor-bin/phpbench
- name: Ensure that the PHPBench make target is up to date
run: make phpbench_install
- name: Download the Benchmark results of the main branch
uses: actions/download-artifact@v3
with:
name: bench-branch-main-result
- name: Check history
run: vendor-bin/phpbench/vendor/bin/phpbench log
- name: Run PHPBench for PR branch
run: make phpbench_pr
# This is a "trick", a meta task which does not change, and we can use in
# the protected branch rules as opposed to the tests one above which
# may change regularly.
validate-tests:
name: Benchmark tests status
runs-on: ubuntu-latest
needs:
- main-bench-test
- pr-bench-test
- pr-main-bench-test
if: always()
steps:
- name: Successful run
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Failing run
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1