Skip to content

Commit 02c985d

Browse files
committed
chore(ci): build wheelhouse, use uv for venv and runs, cache wheels & pre-commit, add workflow_dispatch and pages deploy
1 parent aee4992 commit 02c985d

File tree

5 files changed

+321
-73
lines changed

5 files changed

+321
-73
lines changed

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "pip"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "github-actions"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
- package-ecosystem: "github-pre-commit"
12+
directory: "/"
13+
schedule:
14+
interval: "weekly"

.github/workflows/ci.yaml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Tests and checks
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Cache pip
28+
uses: actions/cache@v4
29+
with:
30+
path: |
31+
~/.cache/pip
32+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
33+
restore-keys: |
34+
${{ runner.os }}-pip-${{ matrix.python-version }}-
35+
36+
- name: Cache pip wheels & pre-commit
37+
uses: actions/cache@v4
38+
with:
39+
path: |
40+
~/.cache/pip/wheels
41+
.wheelhouse
42+
~/.cache/pre-commit
43+
key: ${{ runner.os }}-pip-wheels-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pip-wheels-${{ matrix.python-version }}-
46+
47+
- name: Install build tools and uv
48+
run: |
49+
python -m pip install --upgrade pip setuptools wheel
50+
pip install uv
51+
52+
- name: Build wheelhouse for project and dev deps
53+
run: |
54+
# Build wheels for the project and development extras into .wheelhouse
55+
# This will be fast when the cache is warm.
56+
python -m pip wheel -w .wheelhouse "[dev]" || python -m pip wheel -w .wheelhouse ".[dev]"
57+
58+
- name: Create venv (uv)
59+
run: |
60+
# create a fresh .venv using uv
61+
uv venv
62+
63+
- name: Install project dev dependencies into venv from wheelhouse
64+
run: |
65+
# Install using only the local wheels for reproducibility / speed
66+
uv pip install --no-index --find-links .wheelhouse "[dev]" || uv pip install --no-index --find-links .wheelhouse ".[dev]"
67+
68+
- name: Run ruff (via uv)
69+
run: uv run ruff check .
70+
71+
- name: Check formatting with Black (via uv)
72+
run: uv run python -m black --check .
73+
74+
- name: Run mypy (via uv)
75+
run: uv run python -m mypy .
76+
77+
- name: Run pre-commit hooks (all files) via uv
78+
run: |
79+
uv run pre-commit install
80+
uv run pre-commit run --all-files
81+
82+
- name: Run tests (with coverage) via uv
83+
run: |
84+
uv run pytest -q --cov=python_project_deployment --cov-report=xml:coverage.xml --cov-report=html:htmlcov
85+
86+
- name: Upload coverage xml
87+
uses: actions/upload-artifact@v4
88+
with:
89+
name: coverage-xml
90+
path: coverage.xml
91+
92+
- name: Upload coverage HTML
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: coverage-html
96+
path: htmlcov
97+
98+
- name: Build Sphinx docs via uv
99+
run: |
100+
uv run python -m sphinx -b html docs docs/_build/html || true
101+
102+
- name: Upload docs artifact
103+
uses: actions/upload-artifact@v4
104+
with:
105+
name: docs-html
106+
path: docs/_build/html
107+
108+
deploy-docs:
109+
name: Publish docs to GitHub Pages
110+
runs-on: ubuntu-latest
111+
needs: test
112+
# Only deploy on pushes to main (avoid publishing from PRs)
113+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
114+
steps:
115+
- name: Checkout
116+
uses: actions/checkout@v4
117+
118+
- name: Download docs artifact
119+
uses: actions/download-artifact@v4
120+
with:
121+
name: docs-html
122+
path: docs/_build/html
123+
124+
- name: Upload pages artifact
125+
uses: actions/upload-pages-artifact@v1
126+
with:
127+
path: docs/_build/html
128+
129+
- name: Deploy to GitHub Pages
130+
uses: actions/deploy-pages@v1
131+
with: {}

pyproject.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "README.md"
1010
requires-python = ">=3.10"
1111
license = {text = "MIT"}
1212
authors = [
13-
{name = "Magic Man", email = "magicman@example.com"},
13+
{name = "Magic Man", email = "deleterious420+PythonProjectDeployment@gmail.com"},
1414
]
1515
keywords = ["scaffolding", "template", "python", "package", "project"]
1616
classifiers = [
@@ -43,8 +43,8 @@ dev = [
4343
scaffold-python = "python_project_deployment.cli:main"
4444

4545
[project.urls]
46-
Homepage = "https://github.com/magicman/python-project-deployment"
47-
Repository = "https://github.com/magicman/python-project-deployment"
46+
Homepage = "https://github.com/Magic-Man-us/PythonProjectDeployment"
47+
Repository = "https://github.com/Magic-Man-us/PythonProjectDeployment"
4848

4949
[tool.hatch.build.targets.wheel]
5050
packages = ["python_project_deployment"]
@@ -54,12 +54,12 @@ testpaths = ["tests"]
5454
addopts = "--cov=python_project_deployment --cov-report=term-missing --cov-report=html"
5555

5656
[tool.black]
57-
line-length = 88
58-
target-version = ['py310']
57+
line-length = 100
58+
target-version = ['py313']
5959

6060
[tool.isort]
6161
profile = "black"
62-
line_length = 88
62+
line_length = 100
6363

6464
[tool.mypy]
6565
python_version = "3.10"
@@ -68,6 +68,9 @@ warn_unused_configs = true
6868
disallow_untyped_defs = true
6969

7070
[tool.ruff]
71-
line-length = 88
71+
line-length = 100
7272
target-version = "py310"
73+
74+
[tool.ruff.lint]
7375
select = ["E", "F", "I", "N", "W", "B", "C4"]
76+
per-file-ignores = {"tests/*" = ["S101", "S108"]}

0 commit comments

Comments
 (0)