-
-
Notifications
You must be signed in to change notification settings - Fork 11
116 lines (96 loc) · 3.56 KB
/
benchmark.yaml
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
115
116
name: Benchmark
on:
workflow_dispatch: {}
pull_request: {}
jobs:
benchmark:
name: Benchmark
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache (rust)
uses: actions/cache@v4
timeout-minutes: 1
continue-on-error: true
if: matrix.os != 'macos-latest' # Cache causes errors on macOS
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-${{ hashFiles('**/Cargo.lock') }}
${{ github.job }}-Linux-${{ hashFiles('rust-toolchain') }}-
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Build pdu
run: |
cargo build --release
echo "$(pwd)/target/release" >> "$GITHUB_PATH"
- name: Install hyperfine
env:
REPO: https://github.com/sharkdp/hyperfine
VERSION: '1.11.0'
run: |
mkdir -p HYPERFINE.tmp
archive_name="hyperfine-v${VERSION}-x86_64-unknown-linux-gnu"
curl -L "${REPO}/releases/download/v${VERSION}/${archive_name}.tar.gz" > tmp.hyperfine.tar.gz
tar xf tmp.hyperfine.tar.gz --directory=HYPERFINE.tmp
chmod +x "HYPERFINE.tmp/${archive_name}/hyperfine"
echo "$(pwd)/HYPERFINE.tmp/${archive_name}" >> "$GITHUB_PATH"
- name: Inspect commands
run: |
which pdu
which hyperfine
hyperfine --version
- name: Prepare directory to be measured
run: |
mkdir -p tmp.sample
curl -L https://github.com/torvalds/linux/archive/refs/tags/v5.12.zip > tmp.sample.zip
unzip tmp.sample.zip -d tmp.sample
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '16.1.0'
- name: Cache (pnpm)
uses: actions/cache@v4
timeout-minutes: 1
continue-on-error: true
with:
path: ~/.pnpm-store/v3
key: pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-${{ matrix.vars.id }}-${{ hashFiles('**/pnpm-lock.yaml') }}
pnpm-${{ matrix.vars.id }}-
pnpm-
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: '7.9.0'
run_install: 'true'
- name: Compile TypeScript
run: |
cd ci/github-actions
pnpm exec tsc
- name: Download released versions of pdu
run: node ci/github-actions/download-released-binaries.js
- name: Compare benchmark of pdu against other versions of itself
run: node ci/github-actions/benchmark.js tmp.sample
- name: Create chart for benchmark reports
run: node ci/github-actions/illustrate-benchmark-reports.js
- name: Upload benchmark reports
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: benchmark-reports
path: tmp.benchmark-report.*
- name: Post generated benchmark reports to pull request as a comment
if: github.event_name == 'pull_request'
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node ci/github-actions/report-benchmark-result-pr.js
- name: Check for performance regressions
run: node ci/github-actions/check-for-performance-regressions.js