Merge pull request #662 from flexion/renovate/codecov-codecov-action-5.x #168
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: Benchmark | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
benchmark: | |
name: Check performance regeression. | |
runs-on: ubuntu-latest | |
permissions: | |
# deployments permission to deploy GitHub pages website | |
deployments: write | |
# contents permission to update benchmark contents in gh-pages branch | |
contents: write | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
disable-sudo: true | |
egress-policy: audit | |
disable-telemetry: false | |
allowed-endpoints: > | |
files.pythonhosted.org:443 | |
github.com:443 | |
pypi.org:443 | |
api.github.com:443 | |
- name: Checkout main branch | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
clean: true | |
- name: Setup Python | |
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 | |
with: | |
python-version: "3.11" | |
# This is a hack until pipx fixes the absolute path bug | |
# present in 1.5.0 | |
# See also https://github.com/pypa/pipx/issues/1331 | |
# Hopefully the next release in Sprint 2024 will resolve this and | |
# pipx will be able to find the constraints file again | |
- name: Upgrade pipx | |
run: | | |
pip install pipx==1.4.3 | |
python -m pipx ensurepath | |
pipx --version | |
# End of pipx hack | |
- name: Upgrade pip | |
run: | | |
pip install --constraint=.github/workflows/constraints.txt pip | |
pip --version | |
- name: Upgrade pip in virtual environments | |
shell: python | |
run: | | |
import os | |
import pip | |
with open(os.environ["GITHUB_ENV"], mode="a") as io: | |
print(f"VIRTUALENV_PIP={pip.__version__}", file=io) | |
- name: Install Poetry | |
run: | | |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry | |
poetry --version | |
- name: Install Nox | |
run: | | |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox | |
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry poetry-plugin-export | |
nox --version | |
- name: Run benchmark with nox | |
run: nox -s benchmark | |
- name: Store benchmark result in github.io | |
uses: benchmark-action/github-action-benchmark@4de1bed97a47495fc4c5404952da0499e31f5c29 # tag=v1 | |
with: | |
name: Pytest-Benchmark Benchmark | |
tool: "pytest" | |
output-file-path: benchmark-output.json | |
github-token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
auto-push: true | |
alert-threshold: "130%" | |
comment-on-alert: true | |
fail-on-alert: true |