Skip to content

Merge pull request #171 from Janelia-Trackathon-2023/unit_tests #55

Merge pull request #171 from Janelia-Trackathon-2023/unit_tests

Merge pull request #171 from Janelia-Trackathon-2023/unit_tests #55

name: Benchmark
# Do not run this workflow on pull request since this workflow has permission to modify contents.
on:
push:
branches:
- main
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
benchmark:
name: Report benchmarks on gh-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Retrieve cached data
uses: actions/cache/restore@v4
id: cache_data
with:
path: downloads
key: ${{ hashFiles('scripts/download_test_data.py') }}
- name: Download Samples
if: steps.cache_data.outputs.cache-hit != 'true'
run: |
pip install requests
python scripts/download_test_data.py
- name: Cache sample data
uses: actions/cache/save@v4
if: steps.cache_data.outputs.cache-hit != 'true'
with:
path: downloads
key: ${{ hashFiles('scripts/download_test_data.py') }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache-dependency-path: "pyproject.toml"
cache: "pip"
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -e .[test]
- name: Run benchmark
run: |
pytest tests/bench.py --benchmark-json output.json
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true