Issue 883 #22
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 --config benchmarks/asv.conf.json | |
- name: Save comparison of PR against main branch | |
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 output | |
python -m lf_asv_formatter --asv_version "$(echo asv --version)" | |
printf "\n\nClick [here]($STEP_URL) to view all benchmarks." >> output | |
mv output ${{ env.ARTIFACTS_DIR }} | |
env: | |
STEP_URL: "${{ steps.jobs.outputs.html_url }}#step:11:1" | |
- name: Upload artifacts (PR number and benchmarks output) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark-artifacts | |
path: ${{ env.ARTIFACTS_DIR }} |