File tree Expand file tree Collapse file tree 4 files changed +158
-2
lines changed Expand file tree Collapse file tree 4 files changed +158
-2
lines changed Original file line number Diff line number Diff line change 5
5
branches :
6
6
- main
7
7
8
+ env :
9
+ UV_CACHE_DIR : " /tmp/.uv-cache"
10
+
8
11
jobs :
9
12
benchmark_with_bencher :
10
13
name : Continuous Benchmarking with Bencher
19
22
- name : Set up Python
20
23
uses : actions/setup-python@v5
21
24
with :
22
- python-version : ${{ matrix.python-version }}
25
+ python-version : 3.12
26
+ - name : Restore uv cache
27
+ uses : actions/cache@v4
28
+ with :
29
+ path : ${{ env.UV_CACHE_DIR }}
30
+ key : uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
31
+ restore-keys : |
32
+ uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
33
+ uv-${{ runner.os }}
23
34
24
35
- uses : bencherdev/bencher@main
25
36
- name : Install tzfpy and test
34
45
--adapter python_pytest \
35
46
--err \
36
47
"pytest --benchmark-json results.json tests/test_bench.py"
48
+
49
+ benchmark_with_codspeed :
50
+ runs-on : ubuntu-latest
51
+ steps :
52
+ - uses : actions/checkout@v4
53
+ - name : Set up uv
54
+ run : curl -LsSf https://astral.sh/uv/install.sh | sh
55
+ - name : Set up Python
56
+ uses : actions/setup-python@v5
57
+ with :
58
+ python-version : 3.12
59
+ - name : Restore uv cache
60
+ uses : actions/cache@v4
61
+ with :
62
+ path : ${{ env.UV_CACHE_DIR }}
63
+ key : uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
64
+ restore-keys : |
65
+ uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
66
+ uv-${{ runner.os }}
67
+
68
+ - name : Install
69
+ run : uv sync
70
+
71
+ - name : Run benchmarks
72
+ uses : CodSpeedHQ/action@v3
73
+ with :
74
+ # token: ${{ secrets.CODSPEED_TOKEN }}
75
+ run : uv run pytest tests/ --codspeed
76
+
77
+ - name : Minimize uv cache
78
+ run : uv cache prune --ci
Original file line number Diff line number Diff line change @@ -43,4 +43,5 @@ dev-dependencies = [
43
43
" pytest-pretty>=1.2.0" ,
44
44
" pytz>=2024.2" ,
45
45
" tzdata>=2024.1" ,
46
+ " pytest-codspeed>=2.2.1" ,
46
47
]
Original file line number Diff line number Diff line change @@ -13,4 +13,4 @@ def _test_tzfpy_random_city():
13
13
14
14
15
15
def test_tzfpy_random_cities (benchmark ):
16
- benchmark . pedantic (_test_tzfpy_random_city , rounds = 20000 , iterations = 10 )
16
+ benchmark (_test_tzfpy_random_city )
You can’t perform that action at this time.
0 commit comments