-
Notifications
You must be signed in to change notification settings - Fork 67
62 lines (60 loc) · 2.22 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
name: Benchmark
on:
push:
branches:
- master
jobs:
benchmarks:
name: "Benchmark time & memory"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set Up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
python -m pip install -e .[test,benchmark,docs]
- name: Run Benchmark for time
run: pytest --benchmark-json output.json -k _time tests/benchmarks
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Extract benchmark data
run: python .github/scripts/extract_benchmark_data.py output.json output_action.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
# What benchmark tool the output.txt came from
tool: 'customSmallerIsBetter'
# Where the output from the benchmark tool is stored
output-file-path: output_action.json
# Where the previous data file is stored
# external-data-json-path: ./cache/benchmark-data.json
# Workflow will fail when an alert happens
fail-on-alert: true
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '150%'
comment-on-alert: true
comment-always: false
auto-push: true
gh-pages-branch: "benchmarks"
benchmark-data-dir-path: "docs/bench"
alert-comment-cc-users: '@danwos'
- name: Run Benchmark for memory
run: pytest --benchmark-json output.json -k _memory tests/benchmarks
- name: Create memory flamegraph
run: memray flamegraph -o mem_out.html mem_out.bin
- name: Publish memory flamegraph
run: |
git checkout benchmarks
cp mem_out.html docs/memory.html
git add docs/memory.html
git -c "user.name=Sphinx-Needs CI" -c "user.email=ci@sphinx-needs.com" commit -m "memory.html update"
- name: Push changes
run: git push origin benchmarks