Skip to content

Commit ea30a0e

Browse files
feat: add Tailwind CSS pipeline, tag-aware cloning & overhaul CI/CD (#352)
Frontend * introduce Tailwind CSS (package.json, tailwind.config.js, input CSS) * build site.css on-the-fly (removed tracked artefact; added .gitignore) * new favicon/icon assets & template cleanup * split JS into modular files Docker * replace single-stage image with 3-stage build • css-builder (Node 20 alpine) → compiles Tailwind • python-builder installs project with PEP 621 metadata • runtime image copies site-packages + compiled CSS, runs as uid 1000 CI/CD * ci.yml: cache by pyproject.toml, install with `pip -e .[dev]` * new frontend job builds/archives CSS after tests * publish.yml: build CSS first, then wheel/sdist; trusted OIDC upload * tidy scorecard workflow Core library * clone.py, parser & utils now resolve tags in addition to branches/commits * fallback branch/tag discovery when `git ls-remote` fails * compat\_func.py back-ports Path.readlink / str.removesuffix for Py 3.8 Tooling & docs * add `[dev]` extra, drop requirements-dev.txt & its pre-commit fixer * refreshed CONTRIBUTING.md with Node/Tailwind instructions * updated tests for new tag logic
1 parent 7b0b390 commit ea30a0e

26 files changed

+2274
-296
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ updates:
1010
dependency-type: "development"
1111
update-types: ["minor", "patch"]
1212

13+
# ─── Node (npm) ───────────────────────────────
14+
- package-ecosystem: "npm"
15+
directory: "/"
16+
schedule: { interval: "weekly" }
17+
labels: [ "dependencies", "npm" ]
18+
cooldown: # wait before opening PRs
19+
semver-major-days: 30
20+
semver-minor-days: 7
21+
semver-patch-days: 3
22+
1323
# ─── GitHub Actions ───────────────────────────
1424
- package-ecosystem: "github-actions"
1525
directory: "/"

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,27 @@ jobs:
4848
- name: Run pre-commit hooks
4949
uses: pre-commit/action@v3.0.1
5050
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
51+
52+
frontend:
53+
needs: test # Builds Tailwind CSS only if tests pass
54+
runs-on: ubuntu-latest
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Set up Node
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: 20
62+
cache: npm
63+
64+
- name: Install Node deps
65+
run: npm ci
66+
67+
- name: Build CSS
68+
run: npm run build:css # Creates src/static/css/site.css
69+
70+
- name: Upload artefact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: static-css
74+
path: src/static/css/site.css

.github/workflows/publish.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [created] # Run when you click “Publish release”
6+
workflow_dispatch: # ... or run it manually from the Actions tab
7+
8+
permissions:
9+
contents: read
10+
11+
# ── Build the Tailwind CSS bundle ───────────────────────────────
12+
jobs:
13+
frontend-build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: npm
24+
cache-dependency-path: package-lock.json
25+
26+
- name: Install deps + build Tailwind
27+
run: |
28+
npm ci
29+
npm run build:css
30+
31+
- name: Upload built CSS
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: frontend-assets
35+
path: src/static/css/site.css
36+
if-no-files-found: error
37+
38+
# ── Build wheel/sdist (needs CSS) and upload “dist/” ────────────
39+
release-build:
40+
needs: frontend-build
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- uses: actions/checkout@v4
45+
46+
# Grab site.css produced above
47+
- uses: actions/download-artifact@v4
48+
with:
49+
name: frontend-assets
50+
path: src/static/css/
51+
52+
- name: Set up Python 3.13
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: "3.13"
56+
cache: pip
57+
cache-dependency-path: pyproject.toml
58+
59+
- name: Install build backend
60+
run: |
61+
python -m pip install --upgrade pip
62+
python -m pip install build twine
63+
python -m build
64+
twine check dist/*
65+
- name: Upload dist artefact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: dist
69+
path: dist/
70+
71+
# ── Publish to PyPI (only if “dist/” succeeded) ─────────────────
72+
pypi-publish:
73+
needs: release-build
74+
runs-on: ubuntu-latest
75+
environment: pypi # Creates the “pypi” environment in repo-settings
76+
77+
permissions:
78+
id-token: write # OIDC token for trusted publishing
79+
80+
steps:
81+
- uses: actions/download-artifact@v4
82+
with:
83+
name: dist
84+
path: dist/
85+
86+
- uses: pypa/gh-action-pypi-publish@release/v1
87+
with:
88+
verbose: true

.github/workflows/scorecard.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
push:
77
branches: [ main ]
88

9-
permissions: read-all
9+
permissions: read-all # Default for the whole workflow
1010

11-
concurrency: # avoid overlapping runs
11+
concurrency: # (optional) avoid overlapping runs
1212
group: scorecard-${{ github.ref }}
1313
cancel-in-progress: true
1414

@@ -27,7 +27,7 @@ jobs:
2727
persist-credentials: false
2828

2929
- name: Run Scorecard
30-
uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde
30+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736
3131
with:
3232
results_file: results.sarif
3333
results_format: sarif

.gitignore

Lines changed: 172 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,185 @@
1-
# Operating-system
2-
.DS_Store
3-
Thumbs.db
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
45

5-
# Editor / IDE settings
6-
.vscode/
7-
!.vscode/launch.json
8-
.idea/
9-
*.swp
6+
# C extensions
7+
*.so
108

11-
# Python virtual-envs & tooling
12-
.venv*/
13-
.python-version
14-
__pycache__/
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
1524
*.egg-info/
25+
.installed.cfg
1626
*.egg
17-
.ruff_cache/
27+
MANIFEST
1828

19-
# Test artifacts & coverage
20-
.pytest_cache/
29+
tmp/*
30+
31+
# PyInstaller
32+
# Usually these files are written by a python script from a template
33+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
34+
*.manifest
35+
*.spec
36+
37+
# Installer logs
38+
pip-log.txt
39+
pip-delete-this-directory.txt
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
2145
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
2249
coverage.xml
23-
htmlcov/
50+
*.cover
51+
*.py,cover
52+
.hypothesis/
53+
.pytest_cache/
54+
cover/
2455

25-
# Build, distribution & docs
26-
build/
27-
dist/
28-
*.wheel
56+
# Translations
57+
*.mo
58+
*.pot
2959

60+
# Django stuff:
61+
*.log
62+
local_settings.py
63+
db.sqlite3
64+
db.sqlite3-journal
3065

66+
# Flask stuff:
67+
instance/
68+
.webassets-cache
3169

32-
# Logs & runtime output
33-
*.log
34-
logs/
35-
*.tmp
36-
tmp/
70+
# Scrapy stuff:
71+
.scrapy
72+
73+
# Sphinx documentation
74+
docs/_build/
75+
76+
# PyBuilder
77+
.pybuilder/
78+
target/
79+
80+
# Jupyter Notebook
81+
.ipynb_checkpoints
82+
83+
# IPython
84+
profile_default/
85+
ipython_config.py
86+
87+
# pyenv
88+
# For a library or package, you might want to ignore these files since the code is
89+
# intended to run in multiple environments; otherwise, check them in:
90+
# .python-version
3791

38-
# Project-specific files
92+
# pipenv
93+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
95+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
96+
# install all needed dependencies.
97+
#Pipfile.lock
98+
99+
# poetry
100+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
101+
# This is especially recommended for binary packages to ensure reproducibility, and is more
102+
# commonly ignored for libraries.
103+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
104+
#poetry.lock
105+
106+
# pdm
107+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
108+
#pdm.lock
109+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110+
# in version control.
111+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
112+
.pdm.toml
113+
.pdm-python
114+
.pdm-build/
115+
116+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117+
__pypackages__/
118+
119+
# Celery stuff
120+
celerybeat-schedule
121+
celerybeat.pid
122+
123+
# SageMath parsed files
124+
*.sage.py
125+
126+
# Environments
127+
.env
128+
.venv
129+
.venv*
130+
env/
131+
venv/
132+
ENV/
133+
env.bak/
134+
venv.bak/
135+
.python-version
136+
137+
# Spyder project settings
138+
.spyderproject
139+
.spyproject
140+
141+
# Rope project settings
142+
.ropeproject
143+
144+
# mkdocs documentation
145+
/site
146+
147+
# mypy
148+
.mypy_cache/
149+
.dmypy.json
150+
dmypy.json
151+
152+
# Pyre type checker
153+
.pyre/
154+
155+
# pytype static type analyzer
156+
.pytype/
157+
158+
# Cython debug symbols
159+
cython_debug/
160+
161+
# PyCharm
162+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
163+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164+
# and can be added to the global gitignore or merged into this file. For a more nuclear
165+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
166+
#.idea/
167+
.vscode/settings.json
168+
.DS_Store
169+
170+
# JavaScript tooling
171+
node_modules/
172+
173+
# CSS
174+
src/static/css/site.css
175+
176+
# Project specific
39177
history.txt
40-
digest.txt
178+
cleanup.py
179+
Caddyfile
180+
181+
# ignore default output directory
182+
tmp/*
183+
184+
# Gitingest
185+
digest.txt

0 commit comments

Comments
 (0)