Skip to content

Commit

Permalink
CI Test suite for multiple enviroments (epic-open-source#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
diehlbw authored May 30, 2024
1 parent 6413600 commit 49b4815
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 13 deletions.
77 changes: 68 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:
permissions: "read-all"

jobs:
run-linting:
name: linting via pre-commit
linting:
name: Linting
runs-on: ubuntu-latest

steps:
Expand All @@ -18,16 +18,16 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.10"
- name: Install pre-commit
run: |
pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit steps
run: |
pre-commit run --all-files
run-tests:
name: tests via pytest
test-coverage:
name: Coverage py3.10
runs-on: ubuntu-latest

steps:
Expand All @@ -36,17 +36,76 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.10"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .[dev,audit]
- name: Run tests
run: |
pytest .
- name: Upload coverage
coverage run -m pytest
- name: Generate report
run: |
coverage xml
coverage report
- name: Generate html
if: failure()
run: |
coverage html
- name: Upload report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-data
path: coverage/coverage.xml
path: coverage/*
if-no-files-found: error
test-packaging:
name: Test packaging
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
python -m twine check dist/*
test-versions:
# Limit matrix to after base is passing
needs: [test-coverage, linting, test-packaging]
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
os:
- ubuntu-latest
- windows-latest
- macos-latest
include:
- experimental: false

name: Test python-${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -e .[dev,audit]
- name: Run tests
run: |
pytest
9 changes: 5 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ all =
audit =
aequitas>=1.0.0
dev =
coverage>=7.5.1
autopep8>=1.3.5
pytest-cov>=2.5.1
pytest-json>=0.4.0
pytest>=5.1.1
traitlets>=5.1.1
Expand All @@ -71,15 +71,13 @@ docs =


[tool:pytest]
addopts = --cov-config=setup.cfg --cov=seismometer --cov-report=term --cov-report=html --cov-report=xml:coverage/coverage.xml
testpaths = tests
json_report = coverage/test-report.json
jsonapi = True
filterwarnings =
ignore::UserWarning
ignore::PendingDeprecationWarning

[coverage:run]
source = seismometer
branch = True

[coverage:report]
Expand All @@ -90,6 +88,9 @@ omit =
[coverage:html]
directory = coverage/html-report

[coverage:xml]
output = coverage/coverage.xml

[tool:isort]
line_length = 119
profile = black
Expand Down

0 comments on commit 49b4815

Please sign in to comment.