-
Notifications
You must be signed in to change notification settings - Fork 127
93 lines (82 loc) · 2.95 KB
/
bench.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
name: Bench
on:
push:
branches: ["main"]
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]
pull_request:
branches: ["main"]
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]
# on:
# workflow_run:
# workflows: [CI]
# types: [completed]
env:
CARGO_PROFILE_BENCH_BUILD_OVERRIDE_DEBUG: true
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
TOOLCHAIN: nightly
jobs:
bench:
name: Benchmark
runs-on: self-hosted
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
defaults:
run:
shell: bash
steps:
- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: $TOOLCHAIN
components: rustfmt
- name: Use sccache
uses: mozilla-actions/[email protected]
- run: |
echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV"
echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV"
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get install -y --no-install-recommends \
git gyp mercurial ninja-build lld python-is-python3 zlib1g-dev libclang-dev \
linux-tools-common linux-tools-generic linux-tools-$(uname -r)
echo "RUSTFLAGS=-C link-arg=-fuse-ld=lld" >> "$GITHUB_ENV"
echo "$HOME/.cargo/bin"
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Checkout and build
uses: actions/checkout@v4
- run: cargo +$TOOLCHAIN bench --features ci,bench --no-run
# Disable turboboost, hyperthreading and use performance governor
- name: Prepare machine
run: |
echo 1 > sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
echo off > sudo tee /sys/devices/system/cpu/smt/control
sudo cpupower frequency-set -g performance
# Pin the benchmark to core 0 and run it at elevated priority.
- name: Benchmark
run: |
sudo nice -n -20 sudo -u "$USER" taskset -c 0 \
cargo +$TOOLCHAIN bench --features ci,bench | tee output.txt
# Enable turboboost, hyperthreading and use powersave governor
- name: Restore machine
run: |
echo 0 > sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
echo on > sudo tee /sys/devices/system/cpu/smt/control
sudo cpupower frequency-set -g powersave
if: success() || failure()
- name: Download previous benchmark results
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
# - name: Store current benchmark results
# uses: benchmark-action/github-action-benchmark@v1
# with:
# tool: 'cargo'
# output-file-path: output.txt
# external-data-json-path: ./cache/benchmark-data.json
# fail-on-alert: true
# github-token: ${{ secrets.GITHUB_TOKEN }}
# comment-on-alert: true
# summary-always: true