-
Notifications
You must be signed in to change notification settings - Fork 1
114 lines (93 loc) · 3.27 KB
/
benchmark.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: benchmark
env:
ARCH: x86_64-linux
AWS_ACCESS_KEY_ID: ${{ vars.LPD_PERF_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.LPD_PERF_AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: ${{ vars.LPD_PERF_AWS_BUCKET }}
AWS_REGION: ${{ vars.LPD_PERF_AWS_REGION }}
on:
push:
branches:
- main
paths:
- "src/**/*.zig"
- "src/*.zig"
pull_request:
# By default GH trigger on types opened, synchronize and reopened.
# see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
# Since we skip the job when the PR is in draft state, we want to force CI
# running when the PR is marked ready_for_review w/o other change.
# see https://github.com/orgs/community/discussions/25722#discussioncomment-3248917
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
paths:
- "src/**/*.zig"
- "src/*.zig"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
benchmark:
name: benchmark
# Don't run the CI with draft PR.
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
container:
image: ghcr.io/lightpanda-io/zig-v8:0.12.1
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# docker blocks io_uring syscalls by default now.
# see https://github.com/tigerbeetle/tigerbeetle/pull/1995
# see https://github.com/moby/moby/pull/46762
options: "--security-opt seccomp=unconfined"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_CI_PAT }}
submodules: true
- name: install v8
run: |
mkdir -p vendor/v8/${{env.ARCH}}/debug
ln -s /usr/local/lib/libc_v8.a vendor/v8/${{env.ARCH}}/debug/libc_v8.a
mkdir -p vendor/v8/${{env.ARCH}}/release
ln -s /usr/local/lib/libc_v8.a vendor/v8/${{env.ARCH}}/release/libc_v8.a
- run: zig build -Doptimize=ReleaseSafe -Dengine=v8
- name: run benchmark
run: |
./zig-out/bin/zig-js-runtime-bench > benchmark.txt
cat benchmark.txt
- name: json output
run: ./zig-out/bin/zig-js-runtime-bench --json > benchmark.json
- name: write commit
run: |
echo "${{github.sha}}" > commit.txt
- name: upload artifact
uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: |
benchmark.txt
benchmark.json
commit.txt
# configure the retention policy: 10 days on PR and 150 on main.
retention-days: ${{ github.event_name == 'pull_request' && 10 || 90 }}
perf-fmt:
name: perf-fmt
needs: benchmark
# Don't execute on PR
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
container:
image: ghcr.io/lightpanda-io/perf-fmt:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: download artifact
uses: actions/download-artifact@v3
with:
name: benchmark-results
- name: format and send json result
run: /perf-fmt bench-jsruntime ${{ github.sha }} benchmark.json