From 8bacdb1a21ee3f21c6f6901f8d55e9f870e8e00a Mon Sep 17 00:00:00 2001 From: AlexKalll Date: Fri, 17 Oct 2025 19:50:45 +0300 Subject: [PATCH 1/3] feat: Add modules importing tests --- tests/test_imports.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/test_imports.py diff --git a/tests/test_imports.py b/tests/test_imports.py new file mode 100644 index 0000000..ec049a3 --- /dev/null +++ b/tests/test_imports.py @@ -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) From c6e197b386e1251ed43a0784a489b29970d4469e Mon Sep 17 00:00:00 2001 From: AlexKalll Date: Fri, 17 Oct 2025 19:52:22 +0300 Subject: [PATCH 2/3] ci: Add CI Pipline --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6cefc39 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI # Name of the workflow (will show in GitHub Actions tab) + +on: + push: # Run this when you push to main or master branch + branches: [ main, master ] + pull_request: # Also run when a pull request is made + +jobs: + lint-and-test: # One job called "lint-and-test" + runs-on: ubuntu-latest # It runs on a virtual Ubuntu machine + + steps: + - uses: actions/checkout@v4 # Step 1: Download your repo code + + - uses: actions/setup-python@v5 # Step 2: Set up Python + with: + python-version: '3.11' + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install pytest pytest-cov ruff + + - name: Lint (ruff) + run: ruff check . + + - name: Run tests + run: pytest -q --maxfail=1 --disable-warnings --cov=src --cov-report=xml + + - name: Upload coverage.xml + if: always() + uses: actions/upload-artifact@v4 + with: + name: coverage-xml + path: coverage.xml From 3d1eb1ee4a52c7e0bddaeceac0436a5a9fd82996 Mon Sep 17 00:00:00 2001 From: AlexKalll Date: Fri, 17 Oct 2025 20:18:44 +0300 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20simplify=20CI=20=E2=80=94=20remove?= =?UTF-8?q?=20Ruff=20lint=20check=20for=20now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 43 +++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cefc39..c050e9b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,37 +1,34 @@ -name: CI # Name of the workflow (will show in GitHub Actions tab) +name: CI # This is the name of our workflow. -on: - push: # Run this when you push to main or master branch - branches: [ main, master ] - pull_request: # Also run when a pull request is made +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: - lint-and-test: # One job called "lint-and-test" - runs-on: ubuntu-latest # It runs on a virtual Ubuntu machine +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: - - uses: actions/checkout@v4 # Step 1: Download your repo code - - - uses: actions/setup-python@v5 # Step 2: Set up Python + 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' - cache: 'pip' + 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 - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install pytest pytest-cov ruff - - - name: Lint (ruff) - run: ruff check . + 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 + 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() + if: always() # Even if tests fail, upload the coverage report. uses: actions/upload-artifact@v4 with: name: coverage-xml - path: coverage.xml + path: coverage.xml # Save the test coverage report. \ No newline at end of file