Skip to content

Commit

Permalink
add benchmark to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz-Alexander-Kern committed Oct 18, 2023
1 parent 66dab87 commit c68f7cd
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,60 @@ jobs:
run: |
source ~/test_env/bin/activate
pytest elephant --doctest-modules --ignore=elephant/test/
# install dependencies and elephant with pip and run tests with pytest
benchmark:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# python versions for elephant: [3.8, 3.9, "3.10", 3.11]
python-version: [3.11]
# OS [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
# do not cancel all in-progress jobs if any matrix job fails
fail-fast: false

steps:
# used to reset cache every month
- name: Get current year-month
id: date
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: '**/requirements.txt'

- name: Cache test_env
uses: actions/cache@v3
with:
path: /home/runner/.benchmarks
# Look to see if there is a cache hit for the corresponding requirements files
# cache will be reset on changes to any requirements or every month
key: ${{ runner.os }}-venv-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/requirements-tests.txt') }}
-${{ hashFiles('**/requirements-extras.txt') }}-${{ hashFiles('**/CI.yml') }}-${{ hashFiles('setup.py') }}
-${{ steps.date.outputs.date }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install coveralls
pip install -r requirements/requirements-tests.txt
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-extras.txt
pip install -e .
- name: List packages
run: |
pip list
python --version
- name: Benchmark with pytest-benchmark
run: |
pytest --benchmark-only --benchmark-compare --benchmark-autosave
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit c68f7cd

Please sign in to comment.