Skip to content

Commit 69d5106

Browse files
committed
test+docs
1 parent 7f19e16 commit 69d5106

File tree

16 files changed

+837
-20
lines changed

16 files changed

+837
-20
lines changed

.github/workflows/docs.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Docs (GitHub Pages)
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
paths:
7+
- "README.md"
8+
- "includes/**"
9+
- "tests/**"
10+
- "docs/**"
11+
- "mkdocs.yml"
12+
- "scripts/generate-mkdocs-material.sh"
13+
- ".github/workflows/docs.yml"
14+
workflow_dispatch:
15+
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
concurrency:
22+
group: pages
23+
cancel-in-progress: true
24+
25+
jobs:
26+
build:
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: "3.12"
37+
38+
- name: Install MkDocs
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install mkdocs mkdocs-material pymdown-extensions
42+
43+
- name: Generate Docs Material
44+
run: ./scripts/generate-mkdocs-material.sh
45+
46+
- name: Build Site
47+
run: mkdocs build --strict
48+
49+
- name: Upload Pages Artifact
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: ./site
53+
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
runs-on: ubuntu-latest
59+
needs: build
60+
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

.github/workflows/php.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP Composer
1+
name: PHP Tests
22

33
on:
44
push:
@@ -10,31 +10,33 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
build:
14-
13+
test:
1514
runs-on: ubuntu-latest
1615

1716
steps:
1817
- uses: actions/checkout@v4
1918

20-
- name: Cache Composer packages
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: '8.3'
23+
tools: composer:v2
24+
coverage: none
25+
26+
- name: Get Composer cache directory
2127
id: composer-cache
22-
uses: actions/cache@v3
28+
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
29+
30+
- name: Cache Composer downloads
31+
uses: actions/cache@v4
2332
with:
24-
path: vendor
25-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
33+
path: ${{ steps.composer-cache.outputs.dir }}
34+
key: ${{ runner.os }}-php83-composer-${{ hashFiles('composer.json', 'composer.lock') }}
2635
restore-keys: |
27-
${{ runner.os }}-php-
36+
${{ runner.os }}-php83-composer-
2837
2938
- name: Install dependencies
30-
run: composer install --prefer-dist --no-progress
31-
32-
- name: Test
33-
run: ./includes/vendor/phpunit/phpunit/phpunit tests
34-
35-
36-
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
37-
# Docs: https://getcomposer.org/doc/articles/scripts.md
39+
run: composer install --prefer-dist --no-interaction --no-progress
3840

39-
# - name: Run test suite
40-
# run: composer run-script test
41+
- name: Run tests
42+
run: composer test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ composer.lock
66

77
.DS_Store
88
**/.DS_Store
9+
site/

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,8 @@
2424
"require-dev": {
2525
"overtrue/phplint": "^5.3",
2626
"phpunit/phpunit": "^9.5"
27+
},
28+
"scripts": {
29+
"test": "phpunit tests"
2730
}
2831
}

docs/architecture/routing.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Request Routing
2+
3+
Routing is handled in `public_html/index.php` by mapping URL segments to files inside `includes/modules/`.
4+
5+
## Lifecycle Summary
6+
7+
1. Bootstrap Composer autoload and Smarty.
8+
2. Parse request path into a module key and key/value parameters.
9+
3. Resolve module file from `includes/modules/*.php`.
10+
4. Include shared boot logic from `includes/header.php`.
11+
5. Execute module and render Smarty templates.
12+
13+
## Route Resolution Rules
14+
15+
- Missing module defaults to `main/main`.
16+
- If `includes/database_info.php` is missing, routing is forced to `setup`.
17+
- If route points to a folder (example: `grid`), runtime attempts `includes/modules/grid/grid.php`.
18+
19+
## Data Passed To Modules
20+
21+
- Parsed path pairs are stored in `$GET`.
22+
- Current module path is tracked in `$GET['currentPage']`.
23+
- Template variables are assembled in `$tVars` and rendered at the end of the request.

docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Secret Republic V3 Documentation
2+
3+
This documentation is generated from project sources, with material extracted from `README.md`, `includes/`, and `tests/`.
4+
5+
## Repository Snapshot
6+
7+
- PHP modules discovered: **79**
8+
- PHP class files discovered: **24**
9+
- Constants/config files discovered: **7**
10+
- PHPUnit test files discovered: **4**
11+
12+
## What Is Included
13+
14+
- README-based project documentation and setup notes
15+
- Routing and request lifecycle notes from `public_html/index.php`
16+
- Auto-generated module/class/constants/test inventories
17+
18+
## Next Steps
19+
20+
- Use the navigation sidebar to explore generated references.
21+
- Update code and rerun `./scripts/generate-mkdocs-material.sh`.

0 commit comments

Comments
 (0)