Skip to content

Commit dd36d08

Browse files
committed
feat: initial implement with dependabot + test + update-lock actions.
1 parent 04d57fc commit dd36d08

6 files changed

Lines changed: 116 additions & 7 deletions

File tree

.github/dependabot.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
version: 2
2+
updates:
3+
# Keep GitHub Actions pinned to immutable commit SHAs up-to-date.
4+
# Dependabot opens a PR whenever a newer SHA is available for a pinned action.
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
day: "monday"
10+
labels:
11+
- "dependencies"
12+
13+
# Keep Python runtime dependencies up-to-date within the bounded ranges
14+
# declared in requirements.txt / pyproject.toml.
15+
# Dependabot opens a PR for each package that has a new version available.
16+
# After merging, regenerate requirements-lock.txt by running the
17+
# "Update dependency lock file" workflow (or locally with pip-compile).
18+
- package-ecosystem: "pip"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"
22+
day: "monday"
23+
labels:
24+
- "dependencies"

.github/workflows/tests.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ jobs:
4141
python-version: ${{ matrix.python-version }}
4242

4343
- name: Install runtime + test dependencies
44-
# Only what the tests actually exercise. `pywebview` from
45-
# requirements.txt is the desktop-launcher dep and pulls GTK / Qt
46-
# system packages on Linux — out of scope for the unittest suite.
44+
# Install from the pinned lock file for deterministic dependency
45+
# resolution (closes #47). pytest is added on top — it is not in
46+
# requirements-lock.txt because it is a dev-only dep. pywebview is
47+
# the desktop-launcher dep and pulls GTK / Qt system libraries on
48+
# Linux — intentionally excluded from the CI unittest matrix.
4749
run: |
4850
python -m pip install --upgrade pip
49-
python -m pip install 'flask>=3.0' 'fpdf2>=2.7' 'pytest>=8'
51+
python -m pip install -r requirements-lock.txt
52+
python -m pip install 'pytest>=8,<9'
5053
5154
- name: Run unittest suite
5255
run: python -m unittest discover tests -v
@@ -78,9 +81,12 @@ jobs:
7881
python-version: "3.12"
7982

8083
- name: Install runtime deps + mypy
84+
# Install from the pinned lock file for deterministic resolution,
85+
# then add mypy (dev-only; not in requirements-lock.txt).
8186
run: |
8287
python -m pip install --upgrade pip
83-
python -m pip install 'flask>=3.0' 'fpdf2>=2.7' 'mypy>=1.10'
88+
python -m pip install -r requirements-lock.txt
89+
python -m pip install 'mypy>=1.10,<2'
8490
8591
- name: Run mypy
8692
# No `continue-on-error` — mypy now exits zero on this repo (closes #29),

.github/workflows/update-lock.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Update dependency lock file
2+
3+
on:
4+
# Run every Monday at 08:00 UTC — picks up upstream patch / security
5+
# releases that land within the bounded ranges in requirements.txt.
6+
schedule:
7+
- cron: "0 8 * * 1"
8+
# Allow manual trigger from the Actions tab for ad-hoc refreshes.
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
jobs:
16+
update-lock:
17+
name: Regenerate requirements-lock.txt
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: Install pip-tools
28+
run: python -m pip install pip-tools
29+
30+
- name: Regenerate lock file
31+
run: |
32+
pip-compile requirements.txt \
33+
--output-file requirements-lock.txt \
34+
--no-header \
35+
--annotation-style=line \
36+
--allow-unsafe \
37+
--upgrade
38+
39+
- name: Restore header comment
40+
# pip-compile --no-header omits the auto-generated header line but
41+
# we maintain our own documentation header; restore it if missing.
42+
run: |
43+
HEADER='# Pinned lock file — generated by pip-compile (pip-tools).\n# Install: pip install -r requirements-lock.txt\n# Update: pip-compile requirements.txt --output-file requirements-lock.txt --no-header --annotation-style=line --allow-unsafe\n# Run periodically (e.g. via the "Update dependency lock file" CI workflow) to pick up\n# upstream patch / security releases within the bounded ranges in requirements.txt.'
44+
if ! head -1 requirements-lock.txt | grep -q "^#"; then
45+
printf '%s\n' "$HEADER" | cat - requirements-lock.txt > /tmp/lock.tmp
46+
mv /tmp/lock.tmp requirements-lock.txt
47+
fi
48+
49+
- name: Open PR if lock file changed
50+
uses: peter-evans/create-pull-request@v7
51+
with:
52+
commit-message: "chore: update requirements-lock.txt"
53+
branch: "chore/update-lock-file"
54+
delete-branch: true
55+
title: "chore: update dependency lock file"
56+
body: |
57+
Automated weekly refresh of `requirements-lock.txt`.
58+
59+
Generated by `pip-compile --upgrade` from the bounded specifiers
60+
in `requirements.txt`. Review the diff to confirm no unexpected
61+
major-version jumps before merging.
62+
labels: dependencies

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dependencies = [
2020
"fpdf2>=2.7,<3",
2121
# Security floor: fpdf2 allows Pillow>=8.3.2, so 9.x can still be resolved.
2222
# CVE-2024-28219 (buffer overflow) fixed in Pillow 10.3.0 — https://nvd.nist.gov/vuln/detail/CVE-2024-28219
23-
"pillow>=10.3.0",
23+
"pillow>=10.3.0,<11",
2424
]
2525

2626
[project.optional-dependencies]

requirements-lock.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Pinned lock file — generated by pip-compile (pip-tools).
2+
# Install: pip install -r requirements-lock.txt
3+
# Update: pip-compile requirements.txt --output-file requirements-lock.txt --no-header --annotation-style=line --allow-unsafe
4+
# Run periodically (e.g. via the "Update dependency lock file" CI workflow) to pick up
5+
# upstream patch / security releases within the bounded ranges in requirements.txt.
6+
blinker==1.9.0 # via flask
7+
click==8.4.0 # via flask
8+
colorama==0.4.6 # via click
9+
defusedxml==0.7.1 # via fpdf2
10+
flask==3.1.3 # via -r requirements.txt
11+
fonttools==4.63.0 # via fpdf2
12+
fpdf2==2.8.7 # via -r requirements.txt
13+
itsdangerous==2.2.0 # via flask
14+
jinja2==3.1.6 # via flask
15+
markupsafe==3.0.3 # via flask, jinja2, werkzeug
16+
pillow==10.4.0 # via -r requirements.txt, fpdf2
17+
werkzeug==3.1.8 # via flask

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
# pip install -e ".[desktop]" (+ pywebview for the GUI launcher)
77
flask>=3.0,<4
88
fpdf2>=2.7,<3
9-
pillow>=10.3.0
9+
pillow>=10.3.0,<11
1010
# pywebview is desktop-only — install with: pip install -e ".[desktop]"

0 commit comments

Comments
 (0)