Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI # This is the name of our workflow.

on: # This section defines the events that trigger the workflow.
push: # When you push code to the repository.
branches: [ main, master ] # Only trigger on the main or master branch.
pull_request: # When a pull request is opened or updated.

jobs: # All tasks that we want to run are grouped under jobs.
lint-and-test: # The name of our job.
runs-on: ubuntu-latest # This job will run on the latest version of Ubuntu.

steps: # Each job consists of multiple steps.
- uses: actions/checkout@v4 # Step 1: Checkout the code from your repo.

- uses: actions/setup-python@v5 # Step 2: Set up Python environment.
with:
python-version: '3.11' # We’re using Python 3.11.
cache: 'pip' # Cache the dependencies to speed up future runs.

- name: Install dependencies
run: |
python -m pip install --upgrade pip # Upgrade pip.
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi # Install project dependencies.
pip install pytest pytest-cov # Also install testing tools.

- name: Run tests
run: pytest -q --maxfail=1 --disable-warnings --cov=src --cov-report=xml # Step 4: Run tests and measure code coverage.

- name: Upload coverage.xml
if: always() # Even if tests fail, upload the coverage report.
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml # Save the test coverage report.
14 changes: 14 additions & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import importlib

def test_imports():
import streamlit
import numpy
import matplotlib

def test_project_modules_import():
for mod in [
"src.fh_segmentation",
"src.union_find",
"src.image_utils",
]:
importlib.import_module(mod)