Skip to content

Commit 0e553b2

Browse files
authored
Add a test runner fixes and CI workflow (#501)
* 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 * Create stub tests directory with a module import test * Add pytest-sugar * Add CI workflow * Fix CI workflow branch target, remove action emojis
1 parent c9d63d4 commit 0e553b2

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Test
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
workflow_dispatch:
10+
11+
jobs:
12+
Build:
13+
name: KiCAD ${{ matrix.kicad-version }}
14+
15+
strategy:
16+
matrix:
17+
os:
18+
- Ubuntu
19+
kicad-version:
20+
- "8.0"
21+
- "9.0"
22+
23+
runs-on: ${{ matrix.os }}-latest
24+
container:
25+
image: kicad/kicad:${{ matrix.kicad-version }}
26+
options: --user root
27+
28+
steps:
29+
- name: Check out repository
30+
uses: actions/checkout@v4
31+
32+
- name: Set up build environment
33+
shell: bash
34+
run: |
35+
apt update && apt install -y python3-pip
36+
python3 -m pip install --break-system-packages --upgrade hatch
37+
38+
- name: Test
39+
run: hatch -v run pytest -vv tests
40+
41+
concurrency:
42+
group: ${{ github.workflow }}-${{ github.ref }}
43+
cancel-in-progress: false

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ path = "InteractiveHtmlBom/version.py"
3737
pattern = "LAST_TAG = 'v(?P<version>[^']+)'"
3838

3939
[tool.hatch.envs.default]
40-
dependencies = ["coverage[toml]>=6.5", "pytest"]
40+
system-packages = true
41+
dependencies = [
42+
"coverage[toml]>=6.5",
43+
"pytest",
44+
"pytest-sugar"
45+
]
4146
[tool.hatch.envs.default.scripts]
4247
test = "pytest {args:tests}"
4348
test-cov = "coverage run -m pytest {args:tests}"

tests/test_module.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def test_module_import():
2+
import InteractiveHtmlBom # noqa

0 commit comments

Comments
 (0)