From c66460f6408be27bdb872a743926c60d7781ed47 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 17:33:53 -0400 Subject: [PATCH 01/13] test: add generic import test --- tests/__init__.py | 0 tests/test_import.py | 2 ++ 2 files changed, 2 insertions(+) create mode 100644 tests/__init__.py create mode 100644 tests/test_import.py diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_import.py b/tests/test_import.py new file mode 100644 index 0000000..150d14e --- /dev/null +++ b/tests/test_import.py @@ -0,0 +1,2 @@ +def test_module_import(): + import src.scadable From ba151ee72c16127c83604eb4a302497e9021e1d6 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 17:42:17 -0400 Subject: [PATCH 02/13] chore: update pyproject to include dev dependencies --- pyproject.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f4bc0ac..0e96e4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = ["setuptools>=77.0.3"] build-backend = "setuptools.build_meta" + [project] name = "scadable" version = "0.0.1" @@ -18,6 +19,13 @@ license = "Apache-2.0" license-files = [ "LICENSE" ] dependencies = [ ] + +[project.optional-dependencies] +dev = [ + "pytest", +] + + [project.urls] "Homepage" = "https://github.com/scadable/library-python" "Bug Tracker" = "https://github.com/scadable/library-python/issues" \ No newline at end of file From 4698d44b5ca31b60f2676bdedc273818bc7d2360 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 17:48:01 -0400 Subject: [PATCH 03/13] chore: update workflow to run on PR --- .github/workflows/test-project.yml | 60 ++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/test-project.yml diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml new file mode 100644 index 0000000..c94a8d2 --- /dev/null +++ b/.github/workflows/test-project.yml @@ -0,0 +1,60 @@ +name: Scadable Tests + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + push: + branches: + - main + +jobs: + test: + if: github.event.pull_request.draft == false + runs-on: ${{ matrix.os }} + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + os: [ubuntu-latest, macos-latest, windows-latest] + fail-fast: false + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Cache pip + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + ${{ runner.os }}- + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + pip install -e .[dev] + - name: Run tests + run: | + pytest --cov src/scadable --cov-config=.coveragerc --cov-report lcov +# - name: Upload test coverage to coveralls.io +# uses: coverallsapp/github-action@v2 +# env: +# github-token: ${{ secrets.GITHUB_TOKEN }} +# with: +# flag-name: run-${{ matrix.python-version }} +# parallel: true + +# finish: +# needs: test +# if: github.event.pull_request.draft == false +# runs-on: ubuntu-latest +# steps: +# - name: Coveralls Finished +# uses: coverallsapp/github-action@v2 +# env: +# github-token: ${{ secrets.GITHUB_TOKEN }} +# with: +# parallel-finished: true +# carryforward: "run-3.8,run-3.9,run-3.10,run-3.11,run-3.12" From eecd8110f938df941c2d5a6c839857887a3e7f2d Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 17:49:21 -0400 Subject: [PATCH 04/13] bug: fix cache to use v4 --- .github/workflows/test-project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index c94a8d2..42b1e9a 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -24,7 +24,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Cache pip - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} From 9a1b1234aa45453936a27475d2485d0e40523b79 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 17:51:04 -0400 Subject: [PATCH 05/13] bug: upload .coveragerc file --- .coveragerc | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..5840fb8 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = From 0d3c834fb2be13c2aab227bb9c31cc2480aa2ffe Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 17:54:54 -0400 Subject: [PATCH 06/13] bug: add pytest-cov to dev dependencies --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 4f1f09d..14846fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "pytest", + "pytest-cov" ] From 3e40f369a1e3640be604cc317610e383f93ca4a2 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 18:10:44 -0400 Subject: [PATCH 07/13] chore: update to require a coverage minimum of 100 --- .coveragerc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.coveragerc b/.coveragerc index 5840fb8..d0abcda 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,2 +1,5 @@ [run] omit = + +[report] +fail_under = 100 From e1dbe3c4bf058a49dc0e6eac605dab57d55276cc Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 18:22:06 -0400 Subject: [PATCH 08/13] chore: update to fail under 100% --- .github/workflows/test-project.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index 42b1e9a..6c90a59 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -40,11 +40,11 @@ jobs: pytest --cov src/scadable --cov-config=.coveragerc --cov-report lcov # - name: Upload test coverage to coveralls.io # uses: coverallsapp/github-action@v2 -# env: -# github-token: ${{ secrets.GITHUB_TOKEN }} # with: -# flag-name: run-${{ matrix.python-version }} +# flag-name: run-${{ matrix.os }}-${{ matrix.python-version }} # parallel: true + - name: Ensure Code Coverage + run: coverage report # finish: # needs: test @@ -53,8 +53,6 @@ jobs: # steps: # - name: Coveralls Finished # uses: coverallsapp/github-action@v2 -# env: -# github-token: ${{ secrets.GITHUB_TOKEN }} # with: # parallel-finished: true -# carryforward: "run-3.8,run-3.9,run-3.10,run-3.11,run-3.12" +# carryforward: "run-ubuntu-latest-3.9,run-ubuntu-latest-3.10,run-ubuntu-latest-3.11,run-ubuntu-latest-3.12,run-ubuntu-latest-3.13,run-macos-latest-3.9,run-macos-latest-3.10,run-macos-latest-3.11,run-macos-latest-3.12,run-macos-latest-3.13,run-windows-latest-3.9,run-windows-latest-3.10,run-windows-latest-3.11,run-windows-latest-3.12,run-windows-latest-3.13" From 84f460f07aa2b9376cf26b409db5d438467e5839 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 18:22:36 -0400 Subject: [PATCH 09/13] bug: test coverage reports (ROLLBACK LATER) --- tests/test_import.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_import.py b/tests/test_import.py index 150d14e..21e68c4 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -1,2 +1,3 @@ def test_module_import(): - import src.scadable + pass + # import src.scadable From 280eb269ebad31e1523f4864dfe16cd6b58b6a91 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 18:24:33 -0400 Subject: [PATCH 10/13] fix: workflow erroring on tests stage --- .coveragerc | 3 --- .github/workflows/test-project.yml | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.coveragerc b/.coveragerc index d0abcda..5840fb8 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,5 +1,2 @@ [run] omit = - -[report] -fail_under = 100 diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index 6c90a59..6b8eccd 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -44,7 +44,7 @@ jobs: # flag-name: run-${{ matrix.os }}-${{ matrix.python-version }} # parallel: true - name: Ensure Code Coverage - run: coverage report + run: coverage report --fail-under=100 # finish: # needs: test From 522a20d5c5fe83ffdc5e472cc1e793314a10de78 Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 18:25:17 -0400 Subject: [PATCH 11/13] Revert "bug: test coverage reports (ROLLBACK LATER)" This reverts commit 84f460f07aa2b9376cf26b409db5d438467e5839. --- tests/test_import.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_import.py b/tests/test_import.py index 21e68c4..150d14e 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -1,3 +1,2 @@ def test_module_import(): - pass - # import src.scadable + import src.scadable From b61f36517da7ff7e74f8192faad69297bc39d6e5 Mon Sep 17 00:00:00 2001 From: ChristopherLi05 <134167378+ChristopherLi05@users.noreply.github.com> Date: Sat, 13 Sep 2025 18:32:38 -0400 Subject: [PATCH 12/13] Update .github/workflows/test-project.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/test-project.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml index 6b8eccd..85e526c 100644 --- a/.github/workflows/test-project.yml +++ b/.github/workflows/test-project.yml @@ -27,7 +27,7 @@ jobs: uses: actions/cache@v4 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} restore-keys: | ${{ runner.os }}-pip- ${{ runner.os }}- From 77227b1c7b0eb6789a289810627d93a7b99a864a Mon Sep 17 00:00:00 2001 From: Christopher Li <.@.> Date: Sat, 13 Sep 2025 18:34:34 -0400 Subject: [PATCH 13/13] fix: add coverage to dev dependencies --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 14846fe..c0c233e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "pytest", + "coverage", "pytest-cov" ]