From 60010eeae6e569e1c5cc7c0d6aa57180350d4159 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Tue, 18 Mar 2025 20:57:55 -0700 Subject: [PATCH 1/5] Enable system packages access in hatch default environment This allows access to system libraries such as pcbnew and wxwidgets which can't be installed in a hatch-managed virtual environment --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index fe32394..cd7bf12 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ path = "InteractiveHtmlBom/version.py" pattern = "LAST_TAG = 'v(?P[^']+)'" [tool.hatch.envs.default] +system-packages = true dependencies = ["coverage[toml]>=6.5", "pytest"] [tool.hatch.envs.default.scripts] test = "pytest {args:tests}" From c9eb0caaf816bcc865da0e0d57822bfe8fdbdffe Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Tue, 18 Mar 2025 20:57:28 -0700 Subject: [PATCH 2/5] Create stub tests directory with a module import test --- tests/test_module.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/test_module.py diff --git a/tests/test_module.py b/tests/test_module.py new file mode 100644 index 0000000..231b2aa --- /dev/null +++ b/tests/test_module.py @@ -0,0 +1,2 @@ +def test_module_import(): + import InteractiveHtmlBom # noqa From 3848310481255290dd61d74f4adf084ed3dbf266 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Tue, 18 Mar 2025 21:03:53 -0700 Subject: [PATCH 3/5] Add pytest-sugar --- pyproject.toml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cd7bf12..8c4f22c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,7 +38,11 @@ pattern = "LAST_TAG = 'v(?P[^']+)'" [tool.hatch.envs.default] system-packages = true -dependencies = ["coverage[toml]>=6.5", "pytest"] +dependencies = [ + "coverage[toml]>=6.5", + "pytest", + "pytest-sugar" +] [tool.hatch.envs.default.scripts] test = "pytest {args:tests}" test-cov = "coverage run -m pytest {args:tests}" From a717299979bf072f260cda0053a36ae390b21260 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Tue, 18 Mar 2025 20:38:34 -0700 Subject: [PATCH 4/5] Add CI workflow --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 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..6c06c25 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +--- +name: Test + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + Build: + name: KiCAD ${{ matrix.kicad-version }} + + strategy: + matrix: + os: + - Ubuntu + kicad-version: + - "8.0" + - "9.0" + + runs-on: ${{ matrix.os }}-latest + container: + image: kicad/kicad:${{ matrix.kicad-version }} + options: --user root + + steps: + - name: 💾 Check out repository + uses: actions/checkout@v4 + + - name: 🛠️ Set up build environment + shell: bash + run: | + apt update && apt install -y python3-pip + python3 -m pip install --break-system-packages --upgrade hatch + + - name: 🔥 Test + run: hatch -v run pytest -vv tests + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false From cd75fd16a035444af0ee7e195a930e9ff4d82905 Mon Sep 17 00:00:00 2001 From: Stephen Kent Date: Wed, 19 Mar 2025 18:35:22 -0700 Subject: [PATCH 5/5] Fix CI workflow branch target, remove action emojis --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c06c25..4e05cc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: pull_request: push: branches: - - main + - master workflow_dispatch: jobs: @@ -26,16 +26,16 @@ jobs: options: --user root steps: - - name: 💾 Check out repository + - name: Check out repository uses: actions/checkout@v4 - - name: 🛠️ Set up build environment + - name: Set up build environment shell: bash run: | apt update && apt install -y python3-pip python3 -m pip install --break-system-packages --upgrade hatch - - name: 🔥 Test + - name: Test run: hatch -v run pytest -vv tests concurrency: