Skip to content

Commit

Permalink
CI: GitHub Action for testing
Browse files Browse the repository at this point in the history
runs pytest on multiple platforms, python versions, through Nox
only runs on PRs, push to main, and manual triggers
  • Loading branch information
JorisVincent committed Feb 29, 2024
1 parent 0ace8c1 commit e199184
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test

on:
push:
# branches: [ main ]
# pull_request:
workflow_dispatch:

jobs:
test:
name: ${{ matrix.os}} / py${{ matrix.python_version }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [Ubuntu, macOS]
python_version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python ${{ matrix.python_version }}
with:
python-version: ${{ matrix.python_version }}
architecture: x64

- name: Install (testing) requirements
run: |
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
- name: Install multyscale to be tested
run: |
pip install .
- name: Run tests for ${{ matrix.python_version }} through nox
run: |
pipx run nox --non-interactive --error-on-missing-interpreter --session "tests-${{ matrix.python_version }}"
7 changes: 7 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import nox


@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12"])
def tests(session):
session.install("-r", "requirements.txt")
session.install(".")
session.run("pytest")


@nox.session(python="3.12")
def lint(session):
# Run the linters (via pre-commit)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.[dev,docs]

0 comments on commit e199184

Please sign in to comment.