phparkitect Benchmark #23
This file contains hidden or 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
| name: phparkitect Benchmark | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Every day at 00:00 UTC | |
| - cron: '0 0 * * *' | |
| jobs: | |
| benchmark: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Check phparkitect/arkitect main SHA | |
| id: sha_check | |
| run: | | |
| current=$(curl -sf "https://api.github.com/repos/phparkitect/arkitect/commits/main" \ | |
| -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | jq -r '.sha') | |
| echo "current=$current" >> "$GITHUB_OUTPUT" | |
| stored=$(cat .phparkitect-sha 2>/dev/null || echo "") | |
| if [[ "$current" == "$stored" ]]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Setup PHP 8.3 | |
| if: steps.sha_check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| tools: composer | |
| coverage: none | |
| - name: Run benchmark | |
| if: steps.sha_check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' | |
| run: bash run.sh | |
| - name: Update README | |
| if: steps.sha_check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' | |
| run: bash update-readme.sh | |
| - name: Commit results | |
| if: steps.sha_check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' | |
| run: | | |
| echo "${{ steps.sha_check.outputs.current }}" > .phparkitect-sha | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add README.md .phparkitect-sha | |
| git diff --cached --quiet || git commit -m "chore: update benchmark results [skip ci]" | |
| git pull --rebase | |
| git push | |
| - name: Upload results | |
| if: steps.sha_check.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: benchmark-results-${{ github.run_id }} | |
| path: results/ | |
| if-no-files-found: error |