Skip to content

Commit b883ba6

Browse files
authored
CI: Better Benchmark (#92)
* benchmark with codspeed only run benchmark on changes that effect performance * various improvements to src ignore logger init errors * use `lines-changed-only` when getting file changes move helper function to gh-specific API
1 parent 999088d commit b883ba6

26 files changed

+630
-410
lines changed

.config/nextest.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ slow-timeout = "10s"
1515
# This is all tests in tests/ folder + unit test for --extra-args.
1616
default-filter = "kind(test) + test(#*use_extra_args)"
1717

18-
# show wich tests were skipped
18+
# show which tests were skipped
1919
status-level = "skip"
2020

2121
# show log output from each test

.github/workflows/benchmark.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Benchmark
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- cpp-linter/src/
8+
- cpp-linter/benches/
9+
- cpp-linter/Cargo.toml
10+
- Cargo.toml
11+
- Cargo.lock
12+
- .github/workflows/benchmark.yml
13+
tags-ignore: ['*']
14+
pull_request:
15+
branches: [main]
16+
paths:
17+
- cpp-linter/src/
18+
- cpp-linter/benches/
19+
- cpp-linter/Cargo.toml
20+
- Cargo.toml
21+
- Cargo.lock
22+
- .github/workflows/benchmark.yml
23+
# `workflow_dispatch` allows CodSpeed to trigger back-test
24+
# performance analysis in order to generate initial data.
25+
workflow_dispatch:
26+
27+
jobs:
28+
benchmark:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
# using the generated compilation database,
33+
# we will use cpp-linter to scan libgit2 src/libgit2/**.c files.
34+
- name: Checkout libgit2
35+
uses: actions/checkout@v4
36+
with:
37+
repository: libgit2/libgit2
38+
ref: v1.8.1
39+
path: cpp-linter/benches/libgit2
40+
- name: Generate compilation database
41+
working-directory: cpp-linter/benches/libgit2
42+
run: |
43+
mkdir build && cd build
44+
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
45+
- name: Install cargo-binstall
46+
uses: cargo-bins/cargo-binstall@main
47+
- name: Install cargo-codspeed
48+
run: cargo binstall -y cargo-codspeed
49+
- name: Build the benchmark target(s)
50+
run: cargo codspeed build
51+
- name: Run benchmarks
52+
uses: CodSpeedHQ/action@v3
53+
with:
54+
run: cargo codspeed run
55+
token: ${{ secrets.CODSPEED_TOKEN }}

.github/workflows/perf-test.yml

-146
This file was deleted.

.github/workflows/perf_annotate.py

-68
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,4 @@ docs/site
346346
cpp-linter-py/docs/cli_args.rst
347347
lcov.info
348348
coverage.json
349+
cpp-linter/benches/libgit2/

0 commit comments

Comments
 (0)