Skip to content

Commit e9405e3

Browse files
committed
CI tests: Includes package build and Python compatibility tests
1 parent 309ec2e commit e9405e3

3 files changed

Lines changed: 56 additions & 12 deletions

File tree

.github/workflows/tests.yml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ name: quality checks
1515

1616
jobs:
1717

18-
1918
other-quality-checks:
2019
runs-on: ubuntu-latest
2120
strategy:
@@ -35,26 +34,58 @@ jobs:
3534
- uses: extractions/setup-just@v3
3635
- run: just ${{ matrix.target }}
3736

38-
tests:
37+
38+
build:
39+
runs-on: ubuntu-latest
40+
outputs:
41+
python-versions: >-
42+
${{ steps.baipp.outputs.supported_python_classifiers_json_array }}
43+
44+
steps:
45+
- uses: actions/checkout@v6
46+
with:
47+
ref: ${{ inputs.ref || github.ref }}
48+
- uses: hynek/build-and-inspect-python-package@v2
49+
id: baipp
50+
51+
unit-tests:
52+
needs: ["build"]
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: extractions/setup-just@v3
56+
- uses: actions/download-artifact@v7
57+
with:
58+
name: Packages
59+
path: dist
60+
- run: tar xf dist/*.tar.gz --strip-components=1
61+
- uses: actions/setup-python@v6
62+
with:
63+
cache: pip
64+
python-version: 3.x
65+
- run: just pytest
66+
67+
compatibility-tests:
68+
needs: ["build", "unit-tests"]
3969
runs-on: ubuntu-latest
4070
strategy:
4171
matrix:
42-
python-version:
43-
- "3.9"
44-
- "3.10"
45-
- "3.11"
46-
- "3.12"
47-
- "3.13"
48-
- "3.14"
72+
python-version: ${{ fromJson(needs.build.outputs.python-versions) }}
4973
steps:
50-
- uses: actions/checkout@v5
74+
- uses: actions/checkout@v6
5175
with:
5276
ref: ${{ inputs.ref || github.ref }}
53-
- uses: actions/setup-python@v5
77+
- uses: actions/setup-python@v6
5478
with:
5579
cache: pip
5680
python-version: ${{ matrix.python-version }}
5781
- uses: extractions/setup-just@v3
58-
- run: just pytest
82+
- uses: actions/download-artifact@v7
83+
with:
84+
name: Packages
85+
path: dist
86+
- run: |
87+
rm -r _delb delb
88+
test "$(find dist -name 'delb-existdb-*.whl' | wc -l)" -eq 1
89+
just test-wheel "$(find dist -name 'delb-existdb-*.whl')"
5990
6091
...

Justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ serve-docs:
3333
pipx run hatch run docs:serve
3434

3535
tests: black lint mypy pytest doctest
36+
37+
# run the testsuite against a wheel (installed from $WHEEL_PATH); intended to run on a CI platform
38+
test-wheel $WHEEL_PATH:
39+
pipx run hatch run test-wheel:check

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ coverage-report = """
124124
tests
125125
"""
126126

127+
[tool.hatch.envs.test-wheel]
128+
template = "unit-tests"
129+
skip-install = true
130+
extra-dependencies = [
131+
"delb-existdb @ {root:uri}/{env:WHEEL_PATH}",
132+
]
133+
[tool.hatch.envs.test-wheel.scripts]
134+
check = "python -m pytest tests"
135+
127136

128137
[tool.pytest.ini_options]
129138
filterwarnings = [

0 commit comments

Comments
 (0)