Skip to content

Commit

Permalink
ci: add benchmark pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
woile committed Nov 20, 2024
1 parent 1119302 commit b4ee403
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/bench-release.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
git config --global user.name "GitHub Action"
git add .benchmarks/
git commit -m "bench: bench: add benchmark current release"
git push origin master
2 changes: 1 addition & 1 deletion .github/workflows/bumpversion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/pr-bench.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

# We should restore the cache and remove extra requirements installations after this is resolved https://github.com/actions/setup-python/issues/182

name: Tests

on:
push:
branches: ["master"]
pull_request:
branches: ["*"]
workflow_dispatch:
inputs:
release:
description: 'Release package'
required: true

jobs:
bench_pr:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- 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: Compare benchmark results
run: |
./scripts/bench-compare

0 comments on commit b4ee403

Please sign in to comment.