Skip to content

Commit

Permalink
Update Github workflow to run test matrix using tox
Browse files Browse the repository at this point in the history
  • Loading branch information
ebram96 committed Jan 14, 2024
1 parent 9335c79 commit 4837f55
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit Tests, Test Coverage, and Pre-Commit Hooks
name: CI

on:
pull_request:
Expand All @@ -10,27 +10,49 @@ on:
- closed

jobs:
build:
setup:
runs-on: ubuntu-latest
outputs:
main-python-version: "3.12"
steps:
- uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
python-version: ${{ outputs.main-python-version }}

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Dependencies
run: |
pip install -e .
pip install -r requirements.txt
pre-commit install
- name: Run Unit Tests
test-main-python:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Unit Tests
run: coverage run -m pytest -s tests

- name: Test Coverage
run: coverage report --fail-under=96

- name: Run Pre-Commit Hooks
run: pre-commit run --all-files
- name: Pre-Commit Hooks
run: |
pre-commit install
pre-commit run --all-files
test-matrix:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Run Test Matrix
run: tox run --skip-env ${{ outputs.main-python-version }}
4 changes: 3 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ envlist =

[testenv]
deps = -r requirements.txt
commands = pytest -s tests
commands =
pytest -s tests
pre-commit run mypy --all-files

0 comments on commit 4837f55

Please sign in to comment.