Add slack reporting #12
Workflow file for this run
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
# This workflow will run benchmarks with airspeed velocity (asv) for pull requests. | |
# It will compare the performance of the main branch with the performance of the merge | |
# with the new changes and publish a comment with this assessment. | |
name: Run ASV benchmarks for PR | |
on: | |
pull_request: | |
branches: [ main ] | |
env: | |
PYTHON_VERSION: "3.10" | |
WORKING_DIR: ${{ github.workspace }}/benchmarks | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup-python: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cache Python ${{ env.PYTHON_VERSION }} | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: python-${{ env.PYTHON_VERSION }} | |
- name: Set up Python ${{ env.PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "${{ env.PYTHON_VERSION }}" | |
asv-pr: | |
runs-on: ubuntu-latest | |
needs: setup-python | |
permissions: | |
actions: read | |
pull-requests: write | |
defaults: | |
run: | |
working-directory: ${{ env.WORKING_DIR }} | |
steps: | |
- name: Checkout PR branch of the repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Cache Python ${{ env.PYTHON_VERSION }} | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: python-${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
python -m pip install --upgrade pip | |
pip install asv==0.6.1 virtualenv tabulate lf-asv-formatter | |
- name: Get current job logs URL | |
uses: Tiryoh/gha-jobid-action@v0 | |
id: jobs | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
job_name: ${{ github.job }} | |
- name: Create ASV machine config file | |
run: asv machine --machine gh-runner --yes | |
- name: Run 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 | |
env: | |
STEP_URL: "${{ steps.jobs.outputs.html_url }}#step:8:1" | |
- name: Find benchmarks comment | |
uses: peter-evans/find-comment@v2 | |
id: find-comment | |
with: | |
issue-number: ${{ github.event.pull_request.number }} | |
comment-author: 'github-actions[bot]' | |
body-includes: view all benchmarks | |
- name: Create or update benchmarks comment | |
uses: peter-evans/create-or-update-comment@v3 | |
with: | |
comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
issue-number: ${{ github.event.pull_request.number }} | |
body-path: ${{ env.WORKING_DIR }}/output | |
edit-mode: replace |