diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml new file mode 100644 index 00000000..ef54c631 --- /dev/null +++ b/.github/workflows/codspeed.yml @@ -0,0 +1,43 @@ +name: CodSpeed + +on: + push: + branches: [ master ] + pull_request: + branches: [ '*' ] + # Allow CodSpeed to trigger backtest performance analysis to generate + # the initial baseline data. + workflow_dispatch: + +permissions: + contents: read + id-token: write # Required for OpenID Connect authentication with CodSpeed + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + benchmarks: + name: Run benchmarks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 # Needed for setuptools_scm + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Install package and benchmark dependencies + run: | + python -m pip install uv + uv pip install --system . pytest-codspeed + + - name: Run benchmarks + uses: CodSpeedHQ/action@v4 + with: + mode: simulation + run: pytest benchmarks/test_build.py benchmarks/test_lp_write.py benchmarks/test_matrices.py --quick --codspeed diff --git a/README.md b/README.md index 870bbfb4..22b29e8e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![Tests](https://github.com/PyPSA/linopy/actions/workflows/test.yml/badge.svg)](https://github.com/PyPSA/linopy/actions/workflows/test.yml) [![doc](https://readthedocs.org/projects/linopy/badge/?version=latest)](https://linopy.readthedocs.io/en/latest/) [![codecov](https://codecov.io/gh/PyPSA/linopy/branch/master/graph/badge.svg?token=TT4EYFCCZX)](https://codecov.io/gh/PyPSA/linopy) +[![CodSpeed](https://img.shields.io/endpoint?url=https://codspeed.io/badge.json)](https://app.codspeed.io/PyPSA/linopy?utm_source=badge)