Skip to content

Commit

Permalink
update tox and github actions configs to handle multi-os test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
cahna committed Dec 24, 2023
1 parent a6f0f9d commit e3933bf
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/actions/setup-poetry-env/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ inputs:
runs:
using: "composite"
steps:
- name: Set up python
- name: Set up python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
Expand All @@ -24,7 +24,7 @@ runs:
with:
virtualenvs-in-project: ${{ inputs.cached-venv }}

- name: get repository name
- name: "Set env vars"
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
shell: bash

Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ jobs:
- typecheck
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
platform:
- ubuntu-latest
- macos-latest
- windows-latest
python-version: ['3.10', '3.11']
fail-fast: true
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.platform }}
steps:
- name: Check out
uses: actions/checkout@v4
Expand All @@ -82,6 +85,13 @@ jobs:
- name: Test with tox
run: tox
env:
PLATFORM: ${{ matrix.platform }}

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

check-docs:
needs:
Expand Down
43 changes: 29 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
[tox]
min_version = 2.0
isolated_build = true
envlist = py310, py311, lint
envlist = py{310,311}-{linux,win32,darwin}
skip_missing_interpreters = true

[gh-actions]
description = GH actions config
python =
3.10: py310
3.11: py311

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: darwin
windows-latest: win32

[testenv]
description = Run tests & generate coverage report
passenv = PYTHON_VERSION
allowlist_externals = poetry, mypy
commands =
poetry install -v
poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
poetry run coverage report -m
poetry run mypy hitfactorpy

[testenv:lint]
allowlist_externals = black, flake8
platform =
allowlist_externals =
poetry
python
linux,darwin,win32: echo
; deps =
; linux:
; darwin:
; win32:
commands_pre =
python -c 'import sys; print("Setup tests for " + sys.platform)'
linux: echo "Linux test setup"
darwin: echo "MacOS test setup"
win32: echo "Windows test setup"
commands =
black hitfactorpy tests
flake8 hitfactorpy tests
extras =
lint
linux,darwin,win32:
poetry install -v
poetry run pytest tests --cov --cov-config=pyproject.toml --cov-report=xml
poetry run coverage report -m

0 comments on commit e3933bf

Please sign in to comment.