Skip to content

Fix the 'upload' benchmark workflow (#303) #23

Fix the 'upload' benchmark workflow (#303)

Fix the 'upload' benchmark workflow (#303) #23

Workflow file for this run

name: Benchmark
# Do not run this workflow on pull request since this workflow has permission to modify contents.
on:
push:
branches:
- master
workflow_dispatch: {}
permissions:
# deployments permission to deploy GitHub pages website
contents: write
# contents permission to update benchmark contents in gh-pages branch
deployments: write
jobs:
benchmark:
name: Run benchmark-action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: poetry
- name: Install dependencies
run: poetry install --all-extras
- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Run benchmark
run: |
poetry run pytest --benchmark-only --cov=simple_parsing --cov-report=xml --cov-append --benchmark-json=.benchmark_output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
# Where the output from the benchmark tool is stored
output-file-path: .benchmark_output.json
# # Where the previous data file is stored
external-data-json-path: ./cache/benchmark-master.json
# Use personal access token instead of GITHUB_TOKEN due to https://github.community/t/github-action-not-triggering-gh-pages-upon-push/16096
github-token: ${{ secrets.GITHUB_TOKEN }}
# NOTE: auto-push must be false when external-data-json-path is set since this action
# reads/writes the given JSON file and never pushes to remote
auto-push: false
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '150%'
comment-on-alert: true
# Enable Job Summary for PRs
summary-always: true
# Workflow will fail when an alert happens
fail-on-alert: true
alert-comment-cc-users: '@lebrice'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
env_vars: PLATFORM,PYTHON
name: codecov-umbrella
fail_ci_if_error: false