Skip to content

Commit

Permalink
add codespeed
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Sep 15, 2024
1 parent 34df3bc commit 96aec8c
Show file tree
Hide file tree
Showing 3 changed files with 156 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/Bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

env:
UV_CACHE_DIR: "/tmp/.uv-cache"

jobs:
benchmark_with_bencher:
name: Continuous Benchmarking with Bencher
Expand All @@ -20,6 +23,14 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- uses: bencherdev/bencher@main
- name: Install tzfpy and test
Expand All @@ -34,3 +45,34 @@ jobs:
--adapter python_pytest \
--err \
"pytest --benchmark-json results.json tests/test_bench.py"
benchmark_with_codspeed:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Restore uv cache
uses: actions/cache@v4
with:
path: ${{ env.UV_CACHE_DIR }}
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install
run: uv sync

- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: uv run pytest tests/ --codspeed

- name: Minimize uv cache
run: uv cache prune --ci
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ dev-dependencies = [
"pytest-pretty>=1.2.0",
"pytz>=2024.2",
"tzdata>=2024.1",
"pytest-codspeed>=2.2.1",
]
Loading

0 comments on commit 96aec8c

Please sign in to comment.