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 6aa3db9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 93 deletions.
38 changes: 34 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,34 @@ jobs:
poetry config virtualenvs.in-project true
poetry install
- uses: wntrblm/[email protected]
- 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=main
poetry install pytest
- 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.

2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ 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.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 6aa3db9

Please sign in to comment.