|
| 1 | +--- |
| 2 | +name: Benchmarking |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +jobs: |
| 8 | + benchmark-baseline: |
| 9 | + name: "Benchmark Baseline" |
| 10 | + |
| 11 | + runs-on: "${{ matrix.operating-system }}" |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + |
| 16 | + matrix: |
| 17 | + operating-system: |
| 18 | + - "ubuntu-22.04" |
| 19 | + |
| 20 | + php-version: |
| 21 | + - "8.1" |
| 22 | + |
| 23 | + steps: |
| 24 | + - # https://github.com/actions/checkout |
| 25 | + name: Checkout Code |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 0 |
| 29 | + ref: "9.1" |
| 30 | + repository: "overtrue/phplint" |
| 31 | + |
| 32 | + - # https://github.com/shivammathur/setup-php |
| 33 | + name: Setup PHP runtime |
| 34 | + uses: shivammathur/setup-php@v2 |
| 35 | + with: |
| 36 | + php-version: "${{ matrix.php-version }}" |
| 37 | + coverage: "none" |
| 38 | + |
| 39 | + - # https://github.com/ramsey/composer-install |
| 40 | + name: Install Composer dependencies |
| 41 | + uses: ramsey/composer-install@v2 |
| 42 | + with: |
| 43 | + composer-options: "--prefer-dist" |
| 44 | + |
| 45 | + - # https://github.com/phpbench/phpbench |
| 46 | + name: Install PHPBench |
| 47 | + run: | |
| 48 | + curl -Ls https://github.com/phpbench/phpbench/releases/download/1.2.15/phpbench.phar -o /usr/local/bin/phpbench |
| 49 | + chmod +x /usr/local/bin/phpbench |
| 50 | +
|
| 51 | + - # https://github.com/phpbench/phpbench |
| 52 | + name: Benchmark baseline |
| 53 | + run: | |
| 54 | + phpbench run tests/Benchmark --tag=${{ matrix.php-version }} |
| 55 | +
|
| 56 | + - # https://github.com/actions/upload-artifact |
| 57 | + name: Upload PHPBench baseline |
| 58 | + uses: actions/upload-artifact@v3 |
| 59 | + with: |
| 60 | + name: "PHPBench-Baseline" |
| 61 | + path: ".phpbench/" |
| 62 | + |
| 63 | + benchmark-report: |
| 64 | + needs: benchmark-baseline |
| 65 | + |
| 66 | + name: "Benchmark Report" |
| 67 | + |
| 68 | + runs-on: "${{ matrix.operating-system }}" |
| 69 | + |
| 70 | + strategy: |
| 71 | + fail-fast: false |
| 72 | + |
| 73 | + matrix: |
| 74 | + operating-system: |
| 75 | + - "ubuntu-22.04" |
| 76 | + |
| 77 | + php-version: |
| 78 | + - "8.3" |
| 79 | + |
| 80 | + steps: |
| 81 | + - # https://github.com/actions/checkout |
| 82 | + name: Checkout Code |
| 83 | + uses: actions/checkout@v4 |
| 84 | + with: |
| 85 | + fetch-depth: 0 |
| 86 | + ref: "9.1" |
| 87 | + repository: "overtrue/phplint" |
| 88 | + |
| 89 | + - # https://github.com/shivammathur/setup-php |
| 90 | + name: Setup PHP runtime |
| 91 | + uses: shivammathur/setup-php@v2 |
| 92 | + with: |
| 93 | + php-version: "${{ matrix.php-version }}" |
| 94 | + coverage: "none" |
| 95 | + |
| 96 | + - # https://github.com/ramsey/composer-install |
| 97 | + name: Install Composer dependencies |
| 98 | + uses: ramsey/composer-install@v2 |
| 99 | + with: |
| 100 | + composer-options: "--prefer-dist" |
| 101 | + |
| 102 | + - # https://github.com/phpbench/phpbench |
| 103 | + name: Install PHPBench |
| 104 | + run: | |
| 105 | + curl -Ls https://github.com/phpbench/phpbench/releases/download/1.2.15/phpbench.phar -o /usr/local/bin/phpbench |
| 106 | + chmod +x /usr/local/bin/phpbench |
| 107 | +
|
| 108 | + - # https://github.com/actions/download-artifact |
| 109 | + name: Retrieve PHPBench baseline results |
| 110 | + uses: actions/download-artifact@v3 |
| 111 | + with: |
| 112 | + name: "PHPBench-Baseline" |
| 113 | + path: ".phpbench/" |
| 114 | + |
| 115 | + - # https://github.com/phpbench/phpbench |
| 116 | + name: Benchmark Reports |
| 117 | + run: | |
| 118 | + phpbench run tests/Benchmark --tag=${{ matrix.php-version }} --ref="8.1" --report=aggregate --report overview --output=html |
| 119 | +
|
| 120 | + - # https://github.com/actions/upload-artifact |
| 121 | + name: Upload PHPBench report |
| 122 | + uses: actions/upload-artifact@v3 |
| 123 | + with: |
| 124 | + name: "PHPBench-Report" |
| 125 | + path: ".phpbench/html/index.html" |
0 commit comments