From 055bb8cc40d54023d20b7d1be99b08473a64d485 Mon Sep 17 00:00:00 2001 From: Yiling-J Date: Wed, 8 Feb 2023 16:47:51 +0800 Subject: [PATCH] add benchmark ci --- .github/workflows/bench.yaml | 48 ++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/bench.yaml diff --git a/.github/workflows/bench.yaml b/.github/workflows/bench.yaml new file mode 100644 index 0000000..13c6d00 --- /dev/null +++ b/.github/workflows/bench.yaml @@ -0,0 +1,48 @@ +--- +name: Benchmarks + +on: + push: + branches: + - main + + +jobs: + benchmarks: + name: "Benchmark theine" + runs-on: "ubuntu-latest" + + steps: + - uses: "actions/checkout@v3" + - uses: "actions/setup-python@v4" + with: + python-version: "3.11" + - name: Install Poetry + uses: abatilo/actions-poetry@v2 + with: + version: 1.3 + - name: Setup Poetry + run: "poetry config virtualenvs.in-project true" + - name: Cache Deps + uses: actions/cache@v2 + id: cached-poetry-dependencies + with: + path: .venv + key: python-3.11-pydeps-${{ hashFiles('**/poetry.lock') }} + - name: "Install Dependencies" + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: "poetry install --no-interaction --no-root" + - name: "Run Lint" + run: "poetry run mypy --ignore-missing-imports ." + - name: "Run Benchmarks" + run: "poetry run pytest benchmarks/benchmark_test.py --benchmark-only --benchmark-json output.json" + - name: "Publish Benchmark Result" + uses: benchmark-action/github-action-benchmark@v1 + with: + name: 'Cacheme Benchmark: theine' + tool: 'pytest' + output-file-path: output.json + github-token: ${{ secrets.BENCH_TOKEN }} + auto-push: true + gh-repository: 'github.com/Yiling-J/cacheme-benchmark' + benchmark-data-dir-path: 'dev/theine'