Skip to content

Commit 6a4c198

Browse files
feat: add Tailwind CSS pipeline, tag-aware cloning & overhaul CI/CD
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 Large squash commit that wires a proper frontend asset pipeline, modernises the container & release workflows, and expands repository-ingest features to understand Git tags.
1 parent f8d397e commit 6a4c198

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2607
-439
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,43 @@ jobs:
3030
uses: actions/cache@v4
3131
with:
3232
path: ~/.cache/pip
33-
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements*.txt') }}
33+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
3434
restore-keys: |
3535
${{ runner.os }}-pip-
3636
3737
- name: Install dependencies
3838
run: |
39-
pip install --upgrade pip
40-
pip install -r requirements-dev.txt
39+
python -m pip install --upgrade pip
40+
python -m pip install -e ".[dev]"
4141
4242
- name: Run tests
43-
run: |
44-
pytest
43+
run: pytest
4544

4645
# Run pre-commit only on Python 3.13 + ubuntu.
4746
- name: Run pre-commit hooks
4847
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
49-
run: |
50-
pre-commit run --all-files
48+
run: pre-commit run --all-files
49+
50+
frontend:
51+
needs: test # Builds Tailwind CSS only if tests pass
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Node
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: 20
60+
cache: npm
61+
62+
- name: Install Node deps
63+
run: npm ci
64+
65+
- name: Build CSS
66+
run: npm run build:css # Creates src/static/css/site.css
67+
68+
- name: Upload artefact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: static-css
72+
path: src/static/css/site.css

.github/workflows/publish.yml

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,89 @@
1-
name: "Publish to PyPI"
1+
name: Publish to PyPI
22

33
on:
44
release:
5-
types: [created]
6-
workflow_dispatch:
5+
types: [created] # Run when you click “Publish release”
6+
workflow_dispatch: # ... or run it manually from the Actions tab
77

88
permissions:
99
contents: read
1010

11+
# ── Build the Tailwind CSS bundle ───────────────────────────────
1112
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/” ────────────
1239
release-build:
40+
needs: frontend-build
1341
runs-on: ubuntu-latest
42+
1443
steps:
1544
- uses: actions/checkout@v4
16-
- uses: actions/setup-python@v5
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
1754
with:
1855
python-version: "3.13"
19-
- name: Build package
56+
cache: pip
57+
cache-dependency-path: pyproject.toml
58+
59+
- name: Install build backend
2060
run: |
21-
pip install build
2261
python -m build
23-
- uses: actions/upload-artifact@v4
62+
python -m pip install twine
63+
twine check dist/*
64+
ls -R dist/ # List the contents of the dist directory
65+
66+
- name: Upload dist artefact
67+
uses: actions/upload-artifact@v4
2468
with:
2569
name: dist
2670
path: dist/
2771

72+
# ── Publish to PyPI (only if “dist/” succeeded) ─────────────────
2873
pypi-publish:
29-
needs: [release-build]
74+
needs: release-build
3075
runs-on: ubuntu-latest
31-
environment: pypi
76+
environment: pypi # Creates the “pypi” environment in repo-settings
77+
3278
permissions:
33-
id-token: write
79+
id-token: write # OIDC token for trusted publishing
80+
3481
steps:
3582
- uses: actions/download-artifact@v4
3683
with:
3784
name: dist
3885
path: dist/
86+
3987
- uses: pypa/gh-action-pypi-publish@release/v1
88+
with:
89+
verbose: true

.github/workflows/scorecard.yml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,39 @@
11
name: OSSF Scorecard
22
on:
3-
# For Branch-Protection check. Only the default branch is supported. See
4-
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
53
branch_protection_rule:
6-
# To guarantee Maintained check is occasionally updated. See
7-
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
84
schedule:
95
- cron: '33 11 * * 2'
106
push:
11-
branches: [ "main" ]
7+
branches: [ main ]
128

13-
# Declare default permissions as read only.
14-
permissions: read-all
9+
permissions: read-all # Default for the whole workflow
10+
11+
concurrency: # (optional) avoid overlapping runs
12+
group: scorecard-${{ github.ref }}
13+
cancel-in-progress: true
1514

1615
jobs:
1716
analysis:
1817
name: Scorecard analysis
1918
runs-on: ubuntu-latest
2019
permissions:
21-
# Needed to upload the results to code-scanning dashboard.
22-
security-events: write
23-
# Needed to publish results and get a badge (see publish_results below).
24-
id-token: write
20+
security-events: write # upload SARIF to code-scanning
21+
id-token: write # publish results for the badge
2522

2623
steps:
27-
- name: "Checkout code"
28-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
24+
- name: Checkout
25+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
2926
with:
3027
persist-credentials: false
3128

32-
- name: "Run analysis"
33-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
29+
- name: Run Scorecard
30+
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736
3431
with:
3532
results_file: results.sarif
3633
results_format: sarif
34+
publish_results: true # enables the public badge
3735

38-
# Public repositories:
39-
# - Publish results to OpenSSF REST API for easy access by consumers
40-
# - Allows the repository to include the Scorecard badge.
41-
# - See https://github.com/ossf/scorecard-action#publishing-results.
42-
publish_results: true
43-
44-
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
45-
# format to the repository Actions tab.
46-
47-
# Upload the results to GitHub's code scanning dashboard (optional).
48-
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
49-
- name: "Upload to code-scanning"
36+
- name: Upload to code-scanning
5037
uses: github/codeql-action/upload-sarif@v3
5138
with:
5239
sarif_file: results.sarif

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ cython_debug/
170170
# JavaScript tooling
171171
node_modules/
172172

173+
# CSS
174+
src/static/css/site.css
175+
173176
# Project specific
174177
history.txt
175178
cleanup.py

.pre-commit-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ repos:
2929
# Python
3030
- id: check-docstring-first
3131
description: "Check a common error of defining a docstring after code."
32-
- id: requirements-txt-fixer
33-
description: "Sort entries in requirements.txt."
3432

3533
- repo: https://github.com/MarcoGorelli/absolufy-imports
3634
rev: v0.3.1

CONTRIBUTING.md

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,110 @@
11
# Contributing to Gitingest
22

3-
Thanks for your interest in contributing to Gitingest! 🚀 Gitingest aims to be friendly for first time contributors, with a simple Python and HTML codebase. We would love your help to make it even better. If you need any help while working with the code, please reach out to us on [Discord](https://discord.com/invite/zerRaGK9EC).
3+
Thanks for your interest in contributing to **Gitingest** 🚀 Our goal is to keep the codebase friendly to first-time contributors.
4+
If you ever get stuck, reach out on [Discord](https://discord.com/invite/zerRaGK9EC).
5+
6+
---
47

58
## How to Contribute (non-technical)
69

7-
- **Create an Issue**: If you find a bug or have an idea for a new feature, please [create an issue](https://github.com/cyclotruc/gitingest/issues/new) on GitHub. This will help us track and prioritize your request.
8-
- **Spread the Word**: If you like Gitingest, please share it with your friends, colleagues, and on social media. This will help us grow the community and make Gitingest even better.
9-
- **Use Gitingest**: The best feedback comes from real-world usage! If you encounter any issues or have ideas for improvement, please let us know by [creating an issue](https://github.com/cyclotruc/gitingest/issues/new) on GitHub or by reaching out to us on [Discord](https://discord.com/invite/zerRaGK9EC).
10+
- **Create an Issue** – found a bug or have a feature idea?
11+
[Open an issue](https://github.com/cyclotruc/gitingest/issues/new).
12+
- **Spread the Word** – tweet, blog, or tell a friend.
13+
- **Use Gitingest** – real-world usage gives the best feedback. File issues or ping us on [Discord](https://discord.com/invite/zerRaGK9EC) with anything you notice.
14+
15+
---
1016

1117
## How to submit a Pull Request
1218

13-
1. Fork the repository.
19+
> **Prereqs**: The project uses **Python 3.9+** and `pre-commit` for development.
20+
> If you plan to touch the frontend, you’ll also need **Node ≥18** (for Tailwind).
21+
22+
1. **Fork** the repository.
1423

15-
2. Clone the forked repository:
24+
2. **Clone** your fork:
1625

1726
```bash
1827
git clone https://github.com/cyclotruc/gitingest.git
1928
cd gitingest
2029
```
2130

22-
**Note**: To contribute, ensure you have **Python 3.9 or newer** installed, as some of the `pre-commit` hooks (e.g. `pyupgrade`) require Python 3.9+.
23-
24-
3. Set up the development environment and install dependencies:
31+
3. **Set up the dev environment**:
2532

2633
```bash
2734
python -m venv .venv
2835
source .venv/bin/activate
29-
pip install -r requirements-dev.txt
36+
pip install -e ".[dev]"
3037
pre-commit install
3138
```
3239

33-
4. Create a new branch for your changes:
40+
4. **Create a branch** for your changes:
3441

35-
```bash
36-
git checkout -S -b your-branch
37-
```
42+
```bash
43+
git checkout -b your-branch
44+
```
3845

39-
5. Make your changes. Make sure to add corresponding tests for your changes.
46+
5. **Make your changes** (and add tests when relevant).
4047

41-
6. Stage your changes:
48+
6. **Stage** the changes:
4249

43-
```bash
44-
git add .
45-
```
50+
```bash
51+
git add .
52+
```
4653

47-
7. Run the tests:
54+
7. **Run the backend test suite**:
4855

4956
```bash
5057
pytest
5158
```
5259

53-
8. Run the local web server
60+
8. **If you edited templates or CSS** rebuild Tailwind:
5461

55-
1. Navigate to src folder
56-
57-
``` bash
58-
cd src
59-
```
60-
61-
2. Run the local web server:
62+
```bash
63+
# one-time install
64+
npm ci
6265

63-
``` bash
64-
uvicorn server.main:app
65-
```
66+
# build once
67+
npm run build:css
6668

67-
3. Open your browser and navigate to `http://localhost:8000` to see the app running.
69+
# or watch & rebuild on every save
70+
npm run dev:css
71+
```
6872

69-
9. Confirm that everything is working as expected. If you encounter any issues, fix them and repeat steps 6 to 8.
73+
*Skip this step if your PR only touches Python code.*
7074

71-
10. Commit your changes (signed):
75+
9. **Run the local server** to sanity-check:
7276

73-
All commits to Gitingest must be [GPG-signed](https://docs.github.com/en/authentication/managing-commit-signature-verification) so that the project can verify the authorship of every contribution. You can either configure Git globally with:
77+
```bash
78+
cd src
79+
uvicorn server.main:app
80+
```
7481

75-
```bash
76-
git config --global commit.gpgSign true
77-
```
82+
Open [http://localhost:8000](http://localhost:8000) to confirm everything works.
7883

79-
or pass the `-S` flag as shown below.
84+
10. **Commit** (signed):
8085

8186
```bash
8287
git commit -S -m "Your commit message"
8388
```
8489

85-
If `pre-commit` raises any issues, fix them and repeat steps 6 to 9.
90+
If *pre-commit* complains, fix the problems and repeat **6 – 9**.
8691

87-
11. Push your changes:
92+
11. **Push** your branch:
8893

8994
```bash
9095
git push origin your-branch
9196
```
9297

93-
12. Open a pull request on GitHub. Make sure to include a detailed description of your changes.
98+
12. **Open a pull request** on GitHub with a clear description.
99+
100+
13. **Iterate** on any review feedback—update your branch and repeat **6 – 12** as needed.
101+
102+
*(Optional) Invite a maintainer to your branch for easier collaboration.*
103+
104+
---
105+
106+
## CSS & build artefacts
94107

95-
13. Wait for the maintainers to review your pull request. If there are any issues, fix them and repeat steps 6 to 12.
108+
- **Do not commit `src/static/css/site.css`.** The CI pipeline runs `npm run build:css` during the container/image build, so the artefact is produced automatically.
96109

97-
*(Optional) Invite project maintainer to your branch for easier collaboration.*
110+
- When developing locally you may run the build yourself (see step 8) so you can preview the styles.

0 commit comments

Comments
 (0)