-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (72 loc) · 2.12 KB
/
ci.yml
File metadata and controls
93 lines (72 loc) · 2.12 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
name: CI
on:
pull_request:
push:
branches:
- main
permissions:
contents: read
defaults:
run:
shell: bash
jobs:
test:
name: Build and test
runs-on: ubuntu-24.04
env:
IMPORT_NAME: src_py_lib
PYTHON_VERSION: "3.11"
UV_VERSION: "0.11.7"
steps:
- name: Check out code
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
- name: Install uv
run: |
python -m pip install --upgrade pip
python -m pip install "uv==${UV_VERSION}"
- name: Validate lockfile
run: uv lock --check
- name: Lint Markdown
run: npx --yes markdownlint-cli2
- name: Lint Python
run: uv run --frozen ruff check .
- name: Check Python formatting
run: uv run --frozen ruff format --check .
- name: Type check
run: uv run --frozen pyright
- name: Run tests
run: uv run --frozen python -m unittest discover -s tests
- name: Smoke test source checkout import
run: |
uv run --frozen python - <<'PY'
import os
import src_py_lib
if src_py_lib.__name__ != os.environ["IMPORT_NAME"]:
raise SystemExit(f"unexpected import name: {src_py_lib.__name__}")
PY
- name: Build wheel
run: uv build --wheel --out-dir dist --no-create-gitignore
- name: Smoke test installed wheel
run: |
python -m venv build/ci-venv
. build/ci-venv/bin/activate
python -m pip install --upgrade pip
python -m pip install dist/*.whl
python - <<'PY'
import os
import src_py_lib
if src_py_lib.__name__ != os.environ["IMPORT_NAME"]:
raise SystemExit(f"unexpected import name: {src_py_lib.__name__}")
PY
- name: Upload wheel artifact
uses: actions/upload-artifact@v7
with:
name: src-py-lib-wheel
path: dist/*.whl