Skip to content

Issue 883

Issue 883 #18

Workflow file for this run

name: Comment on PR with Benchmarks
on:
pull_request:
branches: [main]
permissions:
contents: read # Read access for repository contents
pull-requests: write # Write access for pull requests
env:
PYTHON_VERSION: "3.10"
WORKING_DIR: ${{ github.workspace }}/benchmarks
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install asv
- name: Create ASV machine config file
run: asv machine --machine gh-runner --yes
- name: Run ASV benchmarks
run: asv run
- name: Compare PR against main
run: |
git remote add upstream https://github.com/${{ github.repository }}.git
git fetch upstream
asv continuous upstream/main HEAD --verbose || true
asv compare upstream/main HEAD --sort ratio --verbose | tee ${{ env.ARTIFACTS_DIR }}/output
- name: Post benchmark results as PR comment
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
header: "Benchmark Results"
path: ${{ env.ARTIFACTS_DIR }}/output