-
Notifications
You must be signed in to change notification settings - Fork 7
65 lines (55 loc) · 1.77 KB
/
benchmark-report.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
name: Benchmark
# Do not run this workflow on pull request since this workflow has permission to modify contents.
on:
push:
branches:
- main
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
benchmark:
name: Report benchmarks on gh-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Retrieve cached data
uses: actions/cache/restore@v4
id: cache_data
with:
path: downloads
key: ${{ hashFiles('scripts/download_test_data.py') }}
- name: Download Samples
if: steps.cache_data.outputs.cache-hit != 'true'
run: |
pip install requests
python scripts/download_test_data.py
- name: Cache sample data
uses: actions/cache/save@v4
if: steps.cache_data.outputs.cache-hit != 'true'
with:
path: downloads
key: ${{ hashFiles('scripts/download_test_data.py') }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache-dependency-path: "pyproject.toml"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -e .[test]
- name: Run benchmark
run: |
pytest tests/bench.py --benchmark-json output.json
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true