Skip to content

Commit

Permalink
tests: Split up into separate jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
malmeloo committed Sep 2, 2024
1 parent 3facf5c commit b2363f5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 94 deletions.
37 changes: 33 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ on:
push:

jobs:
deploy:
versions:
runs-on: ubuntu-latest

outputs:
py-versions: ${{ steps.supported-versions.outputs.py-versions }}

steps:
- uses: actions/checkout@v4

Expand All @@ -22,7 +25,33 @@ jobs:
poetry config virtualenvs.in-project true
poetry install
- uses: wntrblm/nox@2024.04.15
- id: supported-versions
name: Get supported versions
run: echo "py-versions=$(poetry run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT"

test:
runs-on: ubuntu-latest

needs: versions
strategy:
matrix:
py-version: ${{ fromJson(needs.versions.outputs.py-versions) }}

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.py-version }}"

- name: Install dependencies
run: |
python -m pip install poetry
poetry config virtualenvs.in-project true
# Only install main dependencies
poetry install --only=test
- name: Run unit tests
run: poetry run nox
- name: Run unit tests
run: poetry run pytest
82 changes: 1 addition & 81 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ sphinx = "^7.2.6"
sphinx-autoapi = "^3.2.1"
pyright = "^1.1.374"
ruff = "0.5.6"
nox = "^2024.4.15"
pytest = "^8.3.2"
tomli = "^2.0.1"
nox-poetry = "^1.0.3"

[tool.poetry.group.test.dependencies]
pytest = "^8.3.2"

[tool.pyright]
venvPath = "."
Expand Down
9 changes: 3 additions & 6 deletions noxfile.py → scripts/supported_py_versions.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Configuration file for Nox."""
#!/usr/bin/env python3

import json
from itertools import count
from pathlib import Path
from typing import Generator

import nox_poetry
import tomli
from packaging.specifiers import SpecifierSet
from packaging.version import Version
Expand Down Expand Up @@ -35,7 +35,4 @@ def get_python_versions() -> Generator[str, None, None]:
return


@nox_poetry.session(python=list(get_python_versions()))
def test(session: nox_poetry.Session) -> None:
"""Run unit tests."""
session.run("pytest")
print(json.dumps(list(get_python_versions())))

0 comments on commit b2363f5

Please sign in to comment.