Issue 883 #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |