Skip to content

Commit 2298918

Browse files
authored
Merge pull request #17 from ProperDocs/ci
Modernize CI, switch to Ruff for formatting, drop Python 3.8
2 parents 7ff1aac + 596b3b6 commit 2298918

33 files changed

+304
-328
lines changed

.codecov.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/autofix.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ jobs:
66
style:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v4
10-
- name: Setup Python
11-
uses: actions/setup-python@v5
9+
- name: Download source
10+
uses: actions/checkout@v6
11+
- name: Install Python
12+
uses: actions/setup-python@v6
1213
with:
13-
python-version: '3.11'
14-
- name: Install Python dependencies
14+
python-version: '3.13'
15+
- name: Install Hatch
1516
run: |
16-
python -m pip install --upgrade hatch
17+
pip install hatch
18+
- name: Install dependencies
19+
run: |
20+
hatch run style:pip freeze
1721
- name: Fix code style
18-
run: hatch run style:fix --fix-only
22+
run: |
23+
hatch run style:fix --fix-only
1924
- name: Check if any edits are necessary
20-
run: git diff --color --exit-code
25+
run: |
26+
git diff --color --exit-code
2127
- name: Apply automatic fixes using pre-commit-ci-lite
2228
if: failure() && github.event_name == 'pull_request'
23-
uses: pre-commit-ci/lite-action@v1.0.1
29+
uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0

.github/workflows/ci.yml

Lines changed: 63 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,72 +4,92 @@ on:
44
pull_request:
55
schedule:
66
- cron: '0 6 * * 6'
7+
defaults:
8+
run:
9+
shell: bash
710
jobs:
811
test:
912
strategy:
1013
fail-fast: false
1114
matrix:
12-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.9-v7.x']
13-
os: [ubuntu-latest, windows-latest, macos-latest]
1415
include:
15-
- python-version: pypy-3.9-v7.x
16-
py: pypy3
17-
# Just to slim down the test matrix:
18-
exclude:
19-
- python-version: '3.9'
16+
- python: '3.14'
17+
os: ubuntu-latest
18+
- python: '3.14'
19+
os: windows-latest
20+
- python: '3.14'
21+
os: macos-latest
22+
- python: '3.13'
23+
os: ubuntu-latest
24+
- python: '3.13'
25+
os: windows-latest
26+
- python: '3.12'
2027
os: macos-latest
21-
- python-version: '3.9'
28+
- python: '3.12'
29+
os: ubuntu-latest
30+
- python: '3.12'
2231
os: windows-latest
23-
- python-version: '3.10'
32+
- python: '3.11'
33+
os: ubuntu-latest
34+
- python: '3.11'
35+
os: macos-latest
36+
- python: '3.10'
2437
os: ubuntu-latest
25-
- python-version: '3.11'
38+
- python: '3.10'
2639
os: macos-latest
27-
- python-version: '3.11'
40+
- python: '3.9'
2841
os: windows-latest
29-
runs-on: ${{ matrix.os }}
42+
- python: '3.9'
43+
os: ubuntu-latest
44+
versions: minimal
45+
runs-on: ${{matrix.os}}
3046
steps:
31-
- uses: actions/checkout@v4
32-
- name: Setup Python ${{ matrix.python-version }}
33-
uses: actions/setup-python@v5
47+
- name: Download source
48+
uses: actions/checkout@v6
49+
- name: Install Python
50+
uses: actions/setup-python@v6
3451
with:
35-
python-version: ${{ matrix.python-version }}
52+
python-version: ${{matrix.python}}
53+
- name: Pin to lowest versions
54+
if: matrix.versions == 'minimal'
55+
run: |
56+
sed -i -E 's/#min //; s/\b >=([0-9])/ ==\1/' pyproject.toml
57+
- name: Install Hatch
58+
run: |
59+
pip install hatch
3660
- name: Install dependencies
3761
run: |
38-
python -m pip install --upgrade hatch
62+
hatch run test:pip freeze
3963
- name: Run tests
4064
run: |
41-
hatch run +py=${{ matrix.py || matrix.python-version }} test:with-coverage
65+
hatch run +py=${{matrix.python}} test:test
4266
- name: Run integration tests
67+
if: matrix.versions != 'minimal'
4368
run: |
44-
hatch run +py=${{ matrix.py || matrix.python-version }} integration:test
45-
shell: bash
46-
- name: Upload Codecov Results
47-
if: success()
48-
uses: codecov/codecov-action@v3
49-
with:
50-
file: ./coverage.xml
51-
flags: unittests
52-
name: ${{ matrix.os }}/${{ matrix.python-version }}
53-
fail_ci_if_error: false
54-
55-
lint:
69+
hatch run +py=${{matrix.python}} integration:test
70+
style:
5671
runs-on: ubuntu-latest
5772
steps:
58-
- uses: actions/checkout@v4
59-
- name: Setup Python
60-
uses: actions/setup-python@v5
73+
- name: Download source
74+
uses: actions/checkout@v6
75+
- name: Install Python
76+
uses: actions/setup-python@v6
6177
with:
62-
python-version: '3.11'
63-
- name: Install Python dependencies
78+
python-version: '3.13'
79+
- name: Install Hatch
6480
run: |
65-
python -m pip install --upgrade hatch
66-
- name: Setup Node
67-
uses: actions/setup-node@v4
81+
pip install hatch
82+
- name: Install Node
83+
uses: actions/setup-node@v6
6884
with:
69-
node-version: 20
85+
node-version: 24
86+
- name: Install dependencies
87+
run: |
88+
hatch run style:pip freeze
89+
hatch run types:pip freeze
7090
- name: Check with ruff
7191
if: always()
72-
run: hatch run style:lint
92+
run: hatch run style:check
7393
- name: Check with mypy
7494
if: always()
7595
run: hatch run types:check
@@ -86,11 +106,11 @@ jobs:
86106
package:
87107
runs-on: ubuntu-latest
88108
steps:
89-
- uses: actions/checkout@v4
109+
- uses: actions/checkout@v6
90110
- name: Setup Python
91-
uses: actions/setup-python@v5
111+
uses: actions/setup-python@v6
92112
with:
93-
python-version: '3.11'
113+
python-version: '3.13'
94114
- name: Install dependencies
95115
run: pip install -U build
96116
- name: Build package

.github/workflows/deploy-docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy docs
2+
on:
3+
push:
4+
pull_request:
5+
schedule:
6+
- cron: '0 6 * * 6'
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Download source
12+
uses: actions/checkout@v6
13+
- name: Install Python
14+
uses: actions/setup-python@v6
15+
with:
16+
python-version: '3.13'
17+
- name: Install dependencies
18+
run: pip install --no-deps -r requirements/requirements-docs.txt && pip install .
19+
- name: Build site
20+
run: properdocs build --strict
21+
- name: Upload to GitHub Pages
22+
uses: actions/upload-pages-artifact@v4
23+
with:
24+
path: site
25+
deploy:
26+
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
27+
needs: build
28+
permissions:
29+
pages: write
30+
id-token: write
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Deploy to GitHub Pages
34+
id: deployment
35+
uses: actions/deploy-pages@v4
36+
environment:
37+
name: github-pages
38+
url: ${{ steps.deployment.outputs.page_url }}

.github/workflows/deploy-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
id-token: write
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@v6
1313
- name: Setup Python
14-
uses: actions/setup-python@v5
14+
uses: actions/setup-python@v6
1515
with:
16-
python-version: '3.11'
16+
python-version: '3.13'
1717
- name: Install dependencies
1818
run: pip install -U build
1919
- name: Build package

.github/workflows/docs.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
55
[![PyPI Version][pypi-v-image]][pypi-v-link]
66
[![Build Status][GHAction-image]][GHAction-link]
7-
[![Coverage Status][codecov-image]][codecov-link]
87

98
ProperDocs is a **fast**, **simple** and **downright gorgeous** static site
109
generator that's geared towards building project documentation. Documentation
@@ -58,8 +57,6 @@ Everyone interacting in the ProperDocs project's codebases, issue trackers, and
5857
discussion forums is expected to follow the [PyPA Code of Conduct].
5958

6059
<!-- Badges -->
61-
[codecov-image]: https://codecov.io/github/properdocs/properdocs/coverage.svg?branch=master
62-
[codecov-link]: https://codecov.io/github/properdocs/properdocs?branch=master
6360
[pypi-v-image]: https://img.shields.io/pypi/v/properdocs.svg
6461
[pypi-v-link]: https://pypi.org/project/properdocs/
6562
[GHAction-image]: https://github.com/properdocs/properdocs/actions/workflows/ci.yml/badge.svg

properdocs/__main__.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313
import click
1414

15-
from properdocs import replacement # noqa: F401
16-
from properdocs import __version__, config, utils
15+
from properdocs import (
16+
__version__,
17+
config,
18+
replacement, # noqa: F401
19+
utils,
20+
)
1721

1822
if sys.platform.startswith("win"):
1923
try:
@@ -122,16 +126,13 @@ def __del__(self):
122126
reload_help = "Enable the live reloading in the development server (this is the default)"
123127
no_reload_help = "Disable the live reloading in the development server."
124128
serve_dirty_help = "Only re-build files that have changed."
125-
serve_clean_help = (
126-
"Build the site without any effects of `properdocs serve` - pure `properdocs build`, then serve."
127-
)
129+
serve_clean_help = "Build the site without any effects of `properdocs serve` - pure `properdocs build`, then serve."
128130
commit_message_help = (
129131
"A commit message to use when committing to the "
130132
"GitHub Pages remote branch. Commit {sha} and ProperDocs {version} are available as expansions"
131133
)
132134
remote_branch_help = (
133-
"The remote branch to commit to for GitHub Pages. This "
134-
"overrides the value specified in config"
135+
"The remote branch to commit to for GitHub Pages. This overrides the value specified in config"
135136
)
136137
remote_name_help = (
137138
"The remote name to commit to for GitHub Pages. This overrides the value specified in config"
@@ -243,7 +244,7 @@ def callback(ctx, param, value):
243244
__version__,
244245
'-V',
245246
'--version',
246-
message=f'%(prog)s, version %(version)s from { PKG_DIR } (Python { PYTHON_VERSION })',
247+
message=f'%(prog)s, version %(version)s from {PKG_DIR} (Python {PYTHON_VERSION})',
247248
)
248249
@common_options
249250
@color_option

properdocs/commands/build.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import logging
55
import os
66
import time
7-
from typing import TYPE_CHECKING, Sequence
7+
from collections.abc import Sequence
8+
from typing import TYPE_CHECKING
89
from urllib.parse import urljoin, urlsplit
910

1011
import jinja2
@@ -16,8 +17,10 @@
1617
from properdocs.structure.files import File, Files, InclusionLevel, get_files, set_exclusions
1718
from properdocs.structure.nav import Navigation, get_navigation
1819
from properdocs.structure.pages import Page
19-
from properdocs.utils import DuplicateFilter # noqa: F401 - legacy re-export
20-
from properdocs.utils import templates
20+
from properdocs.utils import (
21+
DuplicateFilter, # noqa: F401 - legacy re-export
22+
templates,
23+
)
2124

2225
if TYPE_CHECKING:
2326
from properdocs.config.defaults import ProperDocsConfig

0 commit comments

Comments
 (0)