Skip to content

Commit a569210

Browse files
committed
CI: Add C4 diagram generation
1 parent 77baa56 commit a569210

10 files changed

Lines changed: 100 additions & 835 deletions

.github/workflows/ci.yml

Lines changed: 57 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: CI - Tests and Architecture Validation
22

33
on:
44
push:
@@ -8,27 +8,73 @@ on:
88

99
jobs:
1010
test:
11+
name: Run Tests
1112
runs-on: ubuntu-latest
1213

1314
steps:
14-
- uses: actions/checkout@v3
15+
- name: Checkout code
16+
uses: actions/checkout@v4
1517

16-
- name: Set up Python
17-
uses: actions/setup-python@v4
18+
- name: Set up Python 3.12
19+
uses: actions/setup-python@v5
1820
with:
19-
python-version: '3.11'
21+
python-version: '3.12'
2022

2123
- name: Install dependencies
2224
run: |
2325
python -m pip install --upgrade pip
2426
pip install -r requirements.txt
27+
pip install pytest pytest-cov
2528
26-
- name: Run tests
29+
- name: Run tests with coverage
2730
run: |
28-
pytest tests/ -v --tb=short
31+
pytest tests/ -v --cov=app --cov-report=term-missing
32+
33+
validate-architecture:
34+
name: Validate C4 Annotations
35+
runs-on: ubuntu-latest
36+
needs: test
37+
38+
steps:
39+
- name: Checkout notes-api
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Python 3.12
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: '3.12'
46+
47+
- name: Install c4-literate-python
48+
run: |
49+
# For now, install from local path or git repo
50+
# Replace with: pip install c4-literate-python
51+
# once published to PyPI
52+
pip install git+https://github.com/ChristosDev75/c4-literate-python.git@main
53+
54+
- name: Validate C4 annotations
55+
run: |
56+
c4-literate validate .
2957
30-
- name: Test API startup
58+
- name: Generate architecture diagrams
3159
run: |
32-
timeout 10 uvicorn app.main:app --host 0.0.0.0 --port 8000 &
33-
sleep 5
34-
curl -f http://localhost:8000/ || exit 1
60+
mkdir -p docs/architecture
61+
c4-literate tangle . -o docs/architecture/workspace.dsl
62+
63+
- name: Upload generated DSL
64+
uses: actions/upload-artifact@v4
65+
with:
66+
name: architecture-diagrams
67+
path: docs/architecture/workspace.dsl
68+
retention-days: 90
69+
70+
- name: Comment PR with artifact link
71+
if: github.event_name == 'pull_request'
72+
uses: actions/github-script@v7
73+
with:
74+
script: |
75+
github.rest.issues.createComment({
76+
issue_number: context.issue.number,
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
body: '✅ Architecture diagrams generated successfully! Download the artifact to view with Structurizr Lite.'
80+
})
File renamed without changes.
File renamed without changes.

C4_ANNOTATION_SCHEMA.md

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

0 commit comments

Comments
 (0)