Skip to content

Commit

Permalink
ci: add a coverage check at end of unit tests
Browse files Browse the repository at this point in the history
It's currently set to require all new & modified code to be fully
covered. And to allow the current coverage score of 94% in general.
  • Loading branch information
mikix committed Jul 5, 2024
1 parent c8bd81b commit 5a9d2c6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
# while we are still private, don't go crazy with the Python versions as they eat up CI minutes
# Don't go crazy with the Python versions as the test suite is a beast.
# Just test the minimum version we support.
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install .[tests]
- name: Check out MS tool
Expand All @@ -55,7 +55,17 @@ jobs:
- name: Test with pytest
run: |
python -m pytest
python -m pytest --cov-report=xml --cov=cumulus_etl
- name: Generate coverage report
if: github.ref != 'refs/heads/main'
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: .94
thresholdNew: 1
thresholdModified: 1

nlp-regression:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -99,15 +109,14 @@ jobs:
echo "All Good!"
lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install linters
# black is synced with the .pre-commit-hooks version
run: |
python -m pip install --upgrade pip
pip install bandit[toml] pycodestyle pylint 'black >= 24, < 25'
pip install .[dev]
- name: Run pycodestyle
# E203: pycodestyle is a little too rigid about slices & whitespace
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
repos:
- repo: https://github.com/psf/black
# this version is synced with the black mentioned in .github/workflows/ci.yml
rev: 24.3.0
rev: 24.4.2 # keep in rough sync with pyproject.toml
hooks:
- id: black
entry: bash -c 'black "$@"; git add -u' --
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ tests = [
"time-machine",
]
dev = [
"black >= 24, < 25",
"pre-commit"
"bandit[toml]",
"black >= 24, < 25", # keep in rough sync with .pre-commit-config.yaml
"pre-commit",
"pycodestyle",
"pylint",
]

0 comments on commit 5a9d2c6

Please sign in to comment.