-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 2.23 KB
/
benchmark.yml
File metadata and controls
66 lines (57 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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