diff --git a/.github/workflows/bench-release.yml b/.github/workflows/bench-release.yml new file mode 100644 index 0000000..aea0510 --- /dev/null +++ b/.github/workflows/bench-release.yml @@ -0,0 +1,53 @@ +name: Bump version + +on: + push: + branches: + - master + +jobs: + bench_release: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + - name: Setup python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + + - name: Set Cache + uses: actions/cache@v4 + id: cache # name for referring later + with: + path: .venv/ + # The cache key depends on poetry.lock + key: ${{ runner.os }}-cache-${{ hashFiles('poetry.lock') }} + restore-keys: | + ${{ runner.os }}-cache- + ${{ runner.os }}- + + - name: Install Dependencies + # if: steps.cache.outputs.cache-hit != 'true' + run: | + python -m pip install -U pip poetry + poetry --version + poetry config --local virtualenvs.in-project true + poetry install + - name: Benchmark code + run: | + ./scripts/bench-current + - name: Commit benchmark + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + git add .benchmarks/ + git commit -m "bench: bench: add benchmark current release" + git push origin master diff --git a/.github/workflows/bumpversion.yml b/.github/workflows/bumpversion.yml index e2aa8fb..262de20 100644 --- a/.github/workflows/bumpversion.yml +++ b/.github/workflows/bumpversion.yml @@ -7,7 +7,7 @@ on: jobs: bump-version: - if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }} + if: ${{ !startsWith(github.event.head_commit.message, 'bump:') || !startsWith(github.event.head_commit.message, 'bench:') }} runs-on: ubuntu-latest name: "Bump version and create changelog with commitizen" steps: diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index e22b55c..e4920cd 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -17,7 +17,7 @@ on: required: true jobs: - build: + build_test_bench: runs-on: ubuntu-latest strategy: matrix: @@ -57,6 +57,10 @@ jobs: git config --global user.name "GitHub Action" ./scripts/test + - name: Benchmark regression test + run: | + ./scripts/bench-compare + - name: Upload coverage to Codecov uses: codecov/codecov-action@v5.0.2 with: diff --git a/scripts/bench-compare b/scripts/bench-compare index 35ebd10..99e4482 100755 --- a/scripts/bench-compare +++ b/scripts/bench-compare @@ -16,4 +16,4 @@ if [ -d '.venv' ] ; then fi # Commented out until after merge, so there will be date to compare with. -${PREFIX}pytest tests/test_benchmarks.py --benchmark-compare --benchmark-compare-fail=min:5% +# ${PREFIX}pytest tests/test_benchmarks.py --benchmark-compare --benchmark-compare-fail=min:5% diff --git a/tests/conftest.py b/tests/conftest.py index 86b9ec1..e1bbc43 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -226,6 +226,7 @@ def test_my_async_function(aio_benchmark): Notice how the test is synchronous, but the function being tested is asynchronous. """ + async def run_async_coroutine(func, *args, **kwargs): return await func(*args, **kwargs)