diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..5840fb8 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = diff --git a/.github/workflows/test-project.yml b/.github/workflows/test-project.yml new file mode 100644 index 0000000..85e526c --- /dev/null +++ b/.github/workflows/test-project.yml @@ -0,0 +1,58 @@ +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@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} + 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 +# with: +# flag-name: run-${{ matrix.os }}-${{ matrix.python-version }} +# parallel: true + - name: Ensure Code Coverage + run: coverage report --fail-under=100 + +# finish: +# needs: test +# if: github.event.pull_request.draft == false +# runs-on: ubuntu-latest +# steps: +# - name: Coveralls Finished +# uses: coverallsapp/github-action@v2 +# with: +# parallel-finished: true +# 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" diff --git a/pyproject.toml b/pyproject.toml index 3a6c60d..c0c233e 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,15 @@ license = "Apache-2.0" license-files = [ "LICENSE" ] dependencies = [ ] + +[project.optional-dependencies] +dev = [ + "pytest", + "coverage", + "pytest-cov" +] + + [project.urls] "Homepage" = "https://github.com/scadable/library-python" "Bug Tracker" = "https://github.com/scadable/library-python/issues" \ No newline at end of file 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