tests for scperturb
#6
This file contains 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: Unit tests (fast suite) | |
on: | |
push: | |
branches: [main, dev] | |
pull_request: | |
branches: [main, dev] | |
types: [ opened, synchronize, reopened, ready_for_review ] | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -e {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [3.9, 3.10, 3.11] | |
os: [ubuntu-latest, macos-latest] | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@main | |
- uses: tlylt/install-graphviz@v1 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Install library | |
run: poetry install --no-interaction | |
- name: Tests and coverage | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
pytest -v --cov --color=yes --durations=0 | |
- name: Tests | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
pytest -v --cov --color=yes --durations=0 | |
- name: Upload coverage reports to Codecov | |
if: ${{ github.event_name == 'push' }} | |
env: | |
CODECOV_NAME: ${{ matrix.python }}-${{ matrix.os }} | |
run: | | |
curl -Os https://uploader.codecov.io/latest/linux/codecov | |
chmod +x codecov | |
./codecov --no-color --required -F fast -t ${{ secrets.CODECOV_TOKEN }} |