| 1 |
name: CodSpeed |
| 2 |
on: |
| 3 |
push: |
| 4 |
branches: |
| 5 |
- master |
| 6 |
pull_request: |
| 7 |
branches: |
| 8 |
- master |
| 9 |
paths: |
| 10 |
- dateparser/** |
| 11 |
- dateparser_data/** |
| 12 |
- tests/benchmarks/** |
| 13 |
- pytest.ini |
| 14 |
- tox.ini |
| 15 |
- pyproject.toml |
| 16 |
- .github/workflows/codspeed.yml |
| 17 |
# Lets CodSpeed trigger a run to collect the initial baseline. |
| 18 |
workflow_dispatch: |
| 19 |
|
| 20 |
# Superseded runs of the same pull request are cancelled. Outside pull requests |
| 21 |
# the group is unique per run, so a master baseline is never cancelled. |
| 22 |
concurrency: |
| 23 |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} |
| 24 |
cancel-in-progress: true |
| 25 |
|
| 26 |
permissions: |
| 27 |
contents: read |
| 28 |
|
| 29 |
jobs: |
| 30 |
benchmarks: |
| 31 |
name: Run benchmarks |
| 32 |
runs-on: ubuntu-latest |
| 33 |
# A reintroduced #1335-style regression makes the benchmarks orders of |
| 34 |
# magnitude slower, so cap the job instead of letting it run for hours. |
| 35 |
timeout-minutes: 30 |
| 36 |
permissions: |
| 37 |
contents: read |
| 38 |
id-token: write |
| 39 |
steps: |
| 40 |
- uses: actions/checkout@v4 |
| 41 |
- name: Set up Python |
| 42 |
uses: actions/setup-python@v5 |
| 43 |
with: |
| 44 |
python-version: "3.13" |
| 45 |
- name: Install dependencies |
| 46 |
run: | |
| 47 |
python -m pip install --upgrade pip |
| 48 |
pip install tox |
| 49 |
tox -e benchmark --notest |
| 50 |
- name: Run benchmarks |
| 51 |
uses: CodSpeedHQ/action@v5 |
| 52 |
with: |
| 53 |
mode: simulation |
| 54 |
# The step above already built the environment, so the measured command |
| 55 |
# only runs pytest instead of packaging and installing again. |
| 56 |
run: tox -e benchmark --skip-pkg-install |