Skip to content

TEST PR DO NOT MERGE Benchmark test #10

TEST PR DO NOT MERGE Benchmark test

TEST PR DO NOT MERGE Benchmark test #10

Workflow file for this run

# 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. It then publishes a comment with this assessment by triggering
# the publish-benchmarks-pr workflow.
# Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/.
name: Run benchmarks for PR
on:
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
env:
PYTHON_VERSION: "3.10"
ASV_VERSION: "0.6.4"
WORKING_DIR: ${{github.workspace}}/benchmarks
ARTIFACTS_DIR: ${{github.workspace}}/artifacts
jobs:
asv-pr:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{env.WORKING_DIR}}
steps:
- name: Set up Python ${{env.PYTHON_VERSION}}
uses: actions/setup-python@v5
with:
python-version: ${{env.PYTHON_VERSION}}
- name: Checkout PR branch of the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Display Workflow Run Information
run: |
echo "Workflow Run ID: ${{github.run_id}}"
- name: Install dependencies
run: pip install "asv[virtualenv]==${{env.ASV_VERSION}}" lf-asv-formatter
- name: Make artifacts directory
run: mkdir -p ${{env.ARTIFACTS_DIR}}
- name: Save pull request number
run: echo ${{github.event.pull_request.number}} > ${{env.ARTIFACTS_DIR}}/pr
- name: Get current job logs URL
uses: Tiryoh/gha-jobid-action@v1
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: 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 "$(asv --version | awk '{print $2}')"
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:10:1
- name: Generate dashboard HTML
run: |
asv show
asv publish
- name: Move the readme into the HTML directory.
run: |
cp ${{github.workspace}}/README.md ${{env.WORKING_DIR}}/_html/README.md
- name: LS the directories 1
run: |
ls -l ${{env.WORKING_DIR}}/_html/
- name: LS the directories 2
run: |
ls -l ${{env.WORKING_DIR}}
- name: LS the directories 3
run: |
ls -l ${{github.workspace}}
- name: Deploy to Github pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: ${{env.WORKING_DIR}}/_html