-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (90 loc) · 3.38 KB
/
Copy pathci.yml
File metadata and controls
100 lines (90 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# CI — runs on every PR and push to main
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install tools
run: pip install ruff black
- name: Ruff
run: ruff check src/ tests/
- name: Black
run: black --check src/ tests/
test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: pip install -e . pytest
- name: Test suite
run: pytest -q
- name: Import check
run: python -c "from fluid_provider_sdk import BaseProvider, ApplyResult, ProviderError; print('OK')"
- name: Type stub check
run: python -c "import fluid_provider_sdk; import pathlib; assert (pathlib.Path(fluid_provider_sdk.__file__).parent / 'py.typed').exists(), 'py.typed missing'"
build:
name: Build Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build
run: |
pip install build twine
python -m build
twine check dist/*
- name: Verify packaged typed files and testing helpers
run: |
python - <<'PY'
import tarfile
import zipfile
from pathlib import Path
dist = Path("dist")
wheels = sorted(dist.glob("*.whl"))
sdists = sorted(dist.glob("*.tar.gz"))
assert wheels, "No wheel built"
assert sdists, "No sdist built"
with zipfile.ZipFile(wheels[-1]) as zf:
names = set(zf.namelist())
assert any(name.endswith("fluid_provider_sdk/py.typed") for name in names), "py.typed missing from wheel"
assert any(name.endswith("fluid_provider_sdk/testing/__init__.py") for name in names), "testing package missing from wheel"
assert any(name.endswith("fluid_provider_sdk/testing/fixtures.py") for name in names), "fixtures missing from wheel"
with tarfile.open(sdists[-1], "r:gz") as tf:
names = set(tf.getnames())
assert any(name.endswith("src/fluid_provider_sdk/py.typed") for name in names), "py.typed missing from sdist"
assert any(name.endswith("src/fluid_provider_sdk/testing/__init__.py") for name in names), "testing package missing from sdist"
assert any(name.endswith("src/fluid_provider_sdk/testing/fixtures.py") for name in names), "fixtures missing from sdist"
PY
- name: Smoke test
run: |
python -m venv /tmp/test-install
/tmp/test-install/bin/pip install dist/*.whl
/tmp/test-install/bin/python - <<'PY'
import fluid_provider_sdk
import fluid_provider_sdk.testing
print(fluid_provider_sdk.BaseProvider.__name__)
print(fluid_provider_sdk.testing.ProviderTestHarness.__name__)
PY