tests #349
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: tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: # for occasional debugging | |
schedule: | |
# Every Sunday at 3 AM | |
- cron: "0 3 * * 0" | |
jobs: | |
linting: | |
# scheduled workflows should not run on forks | |
if: (${{ github.event_name == 'schedule' }} && ${{ github.repository_owner == 'neuroinformatics-unit' }} && ${{ github.ref == 'refs/heads/main' }}) || (${{ github.event_name != 'schedule' }}) | |
runs-on: ubuntu-latest | |
steps: | |
- uses: neuroinformatics-unit/actions/lint@v2 | |
test: | |
needs: [linting] | |
name: ${{ matrix.os }} py${{ matrix.python-version }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# Run all supported Python versions on linux | |
python-version: ["3.9", "3.10", "3.11"] | |
os: [ubuntu-latest] | |
# Include one windows and macos run | |
include: | |
- os: macos-latest | |
python-version: "3.10" | |
- os: windows-latest | |
python-version: "3.10" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pre-commit cookiecutter pyyaml pytest toml | |
- name: Test with pytest | |
run: | | |
pytest | |
- name: Report coverage to codecov | |
uses: codecov/codecov-action@v2 |