Benchmark Test With Pytest #1011
This file contains hidden or 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 Test With Pytest | |
| on: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| deployments: write | |
| packages: write | |
| jobs: | |
| benchmark: | |
| name: Run pytest-benchmark benchmark | |
| runs-on: [ubuntu-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.12 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| - name: Download test data | |
| run: | | |
| gh release download \ | |
| --pattern 'OTCamera19_FR20_2023-05-24_06-00-00_11-45-00.zip' \ | |
| --pattern 'OTCamera19_FR20_2023-05-24_00-00-00.zip' \ | |
| -R platomo/OpenTrafficCam-testdata -D tests/data | |
| env: | |
| GH_TOKEN: ${{ secrets.PLATOMO_OTC_TESTDATA_ACCESS }} | |
| - name: Unzip test data | |
| run: | | |
| cd tests/data | |
| unzip ./\*.zip | |
| rm ./*.zip | |
| cd .. | |
| - name: Install the project | |
| shell: bash | |
| run: uv sync --locked --dev | |
| - name: Run benchmark tests | |
| run: uv run pytest ./tests/benchmark --benchmark-json output.json | |
| - name: Store benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: Python Benchmark with pytest-benchmark | |
| tool: "pytest" | |
| output-file-path: output.json | |
| auto-push: true | |
| alert-threshold: "200%" | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| comment-on-alert: true | |
| fail-on-alert: true |