Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Collect coverage of numba decorated code (#124)
Browse files Browse the repository at this point in the history
* Add a test without numba enabled

* Try global disable-numba variable

* Fix matrix name

* Add numba codecov flag.

* Add test specifically for numba code coverage

* Clean test file and codecov file

* Pass codecov flags

* Use v2 of NI actions

* Only run on main
  • Loading branch information
dstansby authored Apr 21, 2023
1 parent 5b0c97a commit d9b5fc2
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
14 changes: 14 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
comment: false


# Add a numba flag to any files that contain code jit compiled
# with numba. Tests are run without Numba compilation on the main
# branch to collect code coverage, and the carryforward flags are
# used to make sure coverage of these files does not decrease on
# pull requests.
flags:
numba:
paths:
- src/cellfinder_core/detect/filters/plane/tile_walker.py
- src/cellfinder_core/detect/filters/volume/ball_filter.py
- src/cellfinder_core/detect/filters/volume/structure_detection.py
carryforward: true
8 changes: 5 additions & 3 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,26 @@ jobs:
strategy:
matrix:
# Run all supported Python versions on linux
python-version: ["3.8", "3.9", "3.10"]
os: [ubuntu-latest]
# Include one windows and macos run
python-version: ["3.8", "3.9", "3.10"]
# Include one windows, one macos run
include:
- os: macos-latest
python-version: "3.9"
- os: windows-latest
python-version: "3.9"

steps:
- name: Cache tensorflow model
uses: actions/cache@v3
with:
path: "~/.cellfinder"
key: models-${{ hashFiles('~/.cellfinder/**') }}
- uses: neuroinformatics-unit/actions/test@v1.0.4
- uses: neuroinformatics-unit/actions/test@v2
with:
python-version: ${{ matrix.python-version }}


# Run cellfinder tests to make sure cellfinder is still compatible
# with cellfinder-core
test_cellfinder:
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test_numba_off.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test with numba turned off
# These tests are relatively slow (~20 minutes), but are used
# to collect code coverage on areas of code that are otherwise
# optimised by numba.

on:
push:
branches: [ main ]


jobs:
test_numba_disabled:
name: Run tests
runs-on: ubuntu-latest
env:
NUMBA_DISABLE_JIT: "1"

steps:
- name: Cache tensorflow model
uses: actions/cache@v3
with:
path: "~/.cellfinder"
key: models-${{ hashFiles('~/.cellfinder/**') }}
- uses: neuroinformatics-unit/actions/test@v2
with:
python-version: "3.10"
codecov-flags: "numba"
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ deps =
pytest
pytest-cov
pytest-timeout
passenv =
NUMBA_DISABLE_JIT

0 comments on commit d9b5fc2

Please sign in to comment.