Skip to content

Commit

Permalink
test: use codespeed for continues benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Oct 26, 2024
1 parent 148d444 commit 13dd6fa
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 36 deletions.
31 changes: 31 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
groups:
# Specify a name for the group, which will be used in pull request titles
# and branch names
dependencies:
# Define patterns to include dependencies in the group (based on
# dependency name)
patterns:
- "*" # A wildcard that matches all dependencies in the package
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
groups:
# Specify a name for the group, which will be used in pull request titles
# and branch names
dependencies:
# Define patterns to include dependencies in the group (based on
# dependency name)
patterns:
- "*" # A wildcard that matches all dependencies in the package
39 changes: 39 additions & 0 deletions .github/workflows/codespeed.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Bench

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
benchmark:
name: Continuous Benchmarking with CodSpeed
runs-on: ubuntu-latest
steps:
- name: Collect Workflow Telemetry
uses: runforesight/workflow-telemetry-action@v2
with:
comment_on_pr: false
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install
run: |
uv build --config-setting profile==profiling
- name: Run benchmarks
uses: CodSpeedHQ/action@v3
with:
run: uv run pytest tests/ --codspeed

- name: Minimize uv cache
run: uv cache prune --ci
41 changes: 6 additions & 35 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,6 @@ on:
branches: ["main"]

jobs:
coverage-perf:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- run: make bench

- name: Upload coverage reports to Codecov
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}
- name: Continuous Benchmark
uses: benchmark-action/github-action-benchmark@v1.14.0
if: ${{ github.ref == 'refs/heads/main' }}
with:
name: cyeva Benchmark
tool: "pytest"
output-file-path: output.json
github-token: ${{ secrets.OPS_ACTIONS_CI_TOKEN }}
gh-repository: "github.com/caiyunapp/cyeva"
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: false
benchmark-data-dir-path: "performance/"
alert-comment-cc-users: "@clarmy"

Test:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -64,3 +29,9 @@ jobs:
with:
enable-cache: true
- run: make all
- name: Upload coverage reports to Codecov
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,6 @@ dmypy.json
.DS_Store
.vscode
*.ipynb
_build
_build

output.json
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dev-dependencies = [
"pytest-cov>=5.0.0",
"pytest-benchmark>=4.0.0",
"pytest-memray>=1.7.0; sys_platform != 'win32'",
"pytest-codspeed>=2.2.1",
]
package = true

Expand Down
90 changes: 90 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 13dd6fa

Please sign in to comment.