Skip to content

Commit 42e894d

Browse files
committed
chore: publish GridForge API docs and fix lean package dependency
1 parent 8d8a273 commit 42e894d

103 files changed

Lines changed: 473 additions & 293 deletions

File tree

Some content is hidden

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

.github/workflows/coverage.yml

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,37 @@ on:
99
branches:
1010
- main
1111

12-
permissions:
13-
contents: read
14-
pages: write
15-
id-token: write
12+
permissions: {}
1613

1714
concurrency:
1815
group: coverage-pages
1916
cancel-in-progress: true
2017

2118
jobs:
2219
coverage:
20+
permissions:
21+
contents: read
22+
if: >
23+
github.event.workflow_run.conclusion == 'success' &&
24+
github.event.workflow_run.event == 'push' &&
25+
github.event.workflow_run.head_branch == 'main' &&
26+
github.event.workflow_run.head_sha == github.sha
2327
runs-on: ubuntu-latest
2428

2529
steps:
2630
- name: Checkout repository
2731
uses: actions/checkout@v6
32+
with:
33+
ref: ${{ github.event.workflow_run.head_sha }}
34+
fetch-depth: 1
35+
persist-credentials: false
2836

2937
- name: Setup .NET
3038
uses: actions/setup-dotnet@v5
3139
with:
32-
dotnet-version: 8.0.x
40+
dotnet-version: |
41+
8.0.x
42+
10.0.x
3343
3444
- name: Cache NuGet packages
3545
uses: actions/cache@v5
@@ -42,8 +52,22 @@ jobs:
4252
- name: Restore dependencies
4353
run: dotnet restore GridForge.slnx --property:Configuration=Release
4454

55+
- name: Build solution
56+
run: dotnet build GridForge.slnx --configuration Release --no-restore
57+
4558
- name: Run tests with coverage
46-
run: dotnet test tests/GridForge.Tests/GridForge.Tests.csproj --configuration Release --no-restore --collect:"XPlat Code Coverage" --settings tests/GridForge.Tests/coverlet.runsettings --results-directory artifacts/coverage
59+
run: dotnet test tests/GridForge.Tests/GridForge.Tests.csproj --configuration Release --no-build --collect:"XPlat Code Coverage" --settings tests/GridForge.Tests/coverlet.runsettings --results-directory artifacts/coverage
60+
61+
- name: Restore local tools
62+
run: dotnet tool restore
63+
64+
- name: Build API documentation
65+
run: |
66+
test -f src/GridForge/bin/Release/net8.0/GridForge.dll
67+
test -f src/GridForge/bin/Release/net8.0/GridForge.xml
68+
dotnet tool run docfx docs/api/docfx.json
69+
test -f docs/api/obj/_site/index.html
70+
test -f docs/api/obj/_site/api/GridForge.html
4771
4872
- name: Install ReportGenerator
4973
run: dotnet tool install --global dotnet-reportgenerator-globaltool
@@ -62,15 +86,46 @@ jobs:
6286
- name: Add coverage summary to job
6387
run: cat artifacts/coverage-report/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY"
6488

89+
- name: Enforce full coverage
90+
shell: pwsh
91+
run: |
92+
$summary = Get-Content -Raw artifacts/coverage-report/Summary.json | ConvertFrom-Json
93+
$coverage = $summary.summary
94+
$uncoveredLines = $coverage.coverablelines - $coverage.coveredlines
95+
$uncoveredBranches = $coverage.totalbranches - $coverage.coveredbranches
96+
$uncoveredMethods = $coverage.totalmethods - $coverage.coveredmethods
97+
if ($uncoveredLines -ne 0 -or $uncoveredBranches -ne 0 -or $uncoveredMethods -ne 0) {
98+
throw "Coverage gate failed: $uncoveredLines uncovered line(s), $uncoveredBranches uncovered branch(es), $uncoveredMethods uncovered method(s)"
99+
}
100+
101+
- name: Assemble Pages site
102+
run: |
103+
mkdir -p artifacts/pages/coverage
104+
cp -a docs/api/obj/_site/. artifacts/pages/
105+
cp -a artifacts/coverage-report/. artifacts/pages/coverage/
106+
test -f artifacts/pages/index.html
107+
test -f artifacts/pages/api/GridForge.html
108+
test -f artifacts/pages/coverage/Summary.json
109+
test -f artifacts/pages/coverage/badge_branchcoverage.svg
110+
65111
- name: Upload coverage artifact
66-
uses: actions/upload-artifact@v4
112+
if: always()
113+
uses: actions/upload-artifact@v7
67114
with:
68115
name: coverage-report
69116
path: artifacts/coverage-report
70117

118+
- name: Upload Pages artifact
119+
uses: actions/upload-pages-artifact@v5
120+
with:
121+
path: artifacts/pages
122+
71123
deploy:
72-
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
73124
needs: coverage
125+
permissions:
126+
contents: read
127+
pages: write
128+
id-token: write
74129
runs-on: ubuntu-latest
75130
environment:
76131
name: github-pages
@@ -80,17 +135,6 @@ jobs:
80135
- name: Configure Pages
81136
uses: actions/configure-pages@v6
82137

83-
- name: Download coverage artifact
84-
uses: actions/download-artifact@v8
85-
with:
86-
name: coverage-report
87-
path: artifacts/coverage-report
88-
89-
- name: Upload Pages artifact
90-
uses: actions/upload-pages-artifact@v5
91-
with:
92-
path: artifacts/coverage-report
93-
94138
- name: Deploy to GitHub Pages
95139
id: deployment
96140
uses: actions/deploy-pages@v5

.github/workflows/sync-wiki.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ jobs:
6060
6161
cd "$wiki_dir"
6262
63+
current_main_sha="$(git ls-remote "https://x-access-token:${WIKI_TOKEN}@github.com/${REPOSITORY}.git" refs/heads/main | cut -f1)"
64+
if [[ "$SYNC_SHA" != "$current_main_sha" ]]; then
65+
echo "Skipping stale wiki sync for ${SYNC_SHA}; main is ${current_main_sha}."
66+
exit 0
67+
fi
68+
6369
git config user.name "github-actions[bot]"
6470
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6571

AGENTS.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The core design goal is to make grid-backed spatial systems scalable without
1515
forcing every consumer to reinvent ownership, snapping, neighbor resolution,
1616
coverage queries, or occupant indexing.
1717

18-
Current priorities:
18+
Priorities:
1919

2020
1. Preserve deterministic behavior across supported target frameworks.
2121
2. Keep runtime APIs anchored to explicit `GridWorld` ownership.
@@ -51,12 +51,12 @@ Read these in order before making non-trivial changes:
5151
pooling, tracing, scanning, registration, or other performance-sensitive
5252
behavior.
5353

54-
When sibling repositories are available, also check their AGENTS/README files
55-
when a change touches shared stack assumptions:
54+
For coordinated stack changes, also check the guidance in the affected
55+
repositories:
5656

57-
- `../FixedMathSharp`
58-
- `../SwiftCollections`
59-
- `../GridForge-Unity`
57+
- [FixedMathSharp](https://github.com/mrdav30/FixedMathSharp)
58+
- [SwiftCollections](https://github.com/mrdav30/SwiftCollections)
59+
- [GridForge-Unity](https://github.com/mrdav30/GridForge-Unity)
6060

6161
## Source Of Truth
6262

@@ -70,6 +70,8 @@ workflow changes:
7070
- [`docs/wiki`](docs/wiki), especially pages covering world ownership, tracing,
7171
scan cells, blockers, occupants, partitions, determinism, testing, and build
7272
workflow.
73+
- [`docs/api`](docs/api) for the DocFX landing page, navigation, and API build
74+
configuration.
7375
- [`AGENTS.md`](AGENTS.md)
7476
- [`src/GridForge/GridForge.csproj`](src/GridForge/GridForge.csproj)
7577
- [`tests/GridForge.Tests`](tests/GridForge.Tests)
@@ -98,8 +100,9 @@ rewrite.
98100
| [`src/GridForge/Utility`](src/GridForge/Utility) | `GridTracer` and `GridForgeLogger` | Tracing changes can affect many systems. |
99101
| [`tests/GridForge.Tests`](tests/GridForge.Tests) | xUnit v3 test project | Mirrors subsystem boundaries. |
100102
| [`tests/GridForge.Benchmarks`](tests/GridForge.Benchmarks) | BenchmarkDotNet project | Covers allocation and throughput-sensitive scenarios. |
101-
| [`docs/wiki`](docs/wiki) | Developer-facing usage and architecture documentation | Keep current with public API and workflow changes. |
102-
| [`.assets/scripts`](.assets/scripts) | Versioned build and release packaging helpers | Used for release archive generation. |
103+
| [`docs/wiki`](docs/wiki) | Developer-facing usage and architecture documentation | Keep aligned with public API and workflow changes. |
104+
| [`docs/api`](docs/api) | DocFX landing page, navigation, and API build configuration | Generated output stays under `docs/api/obj`. |
105+
| [`.assets/scripts`](.assets/scripts) | PowerShell release packaging helpers | Requires `GitVersion.Tool` for versioned archives. |
103106
| [`.github/workflows`](.github/workflows) | CI, coverage, wiki sync, release, and publish automation | Keep workflow names in sync across triggers. |
104107

105108
Ignore generated output when reviewing or editing unless the task is explicitly
@@ -127,13 +130,16 @@ about build artifacts:
127130
- XML documentation: generated for the library project
128131
- Package generation: `GeneratePackageOnBuild` is enabled
129132
- Configurations: `Debug`, `Release`, `ReleaseLean`
133+
- Local prerequisites: the SDK selected by [`global.json`](global.json) and the
134+
runtimes targeted by tests and benchmarks
130135

131136
Package variants:
132137

133138
- `Release` builds the standard `GridForge` package with `MemoryPack`,
134139
`FixedMathSharp`, and `SwiftCollections`.
135140
- `ReleaseLean` builds `GridForge.Lean` with `GRIDFORGE_DISABLE_MEMORYPACK`,
136-
`FixedMathSharp.Lean`, and `SwiftCollections.Lean`.
141+
`FixedMathSharp.Lean`, `SwiftCollections.Lean`, and the annotation-only
142+
`Chronicler.MemoryPackShim` dependency.
137143

138144
Versioning:
139145

@@ -253,8 +259,8 @@ Rules:
253259
Match the surrounding file style instead of imposing a new one.
254260

255261
- Add explicit `using` directives. `ImplicitUsings` is disabled.
256-
- The library project has nullable enabled; tests and benchmarks currently have
257-
nullable disabled. Follow the local project context.
262+
- The library project enables nullable analysis; tests and benchmarks disable
263+
it. Follow the project being edited.
258264
- `.editorconfig` disables implicit `new(...)`; prefer explicit construction.
259265
- Public API surface should have XML documentation.
260266
- Preserve existing `#region` organization in files that already use it.
@@ -276,8 +282,8 @@ dotnet test GridForge.slnx --configuration Debug --no-build
276282
CI validates both `Release` and `ReleaseLean` on Ubuntu and Windows:
277283

278284
```bash
279-
dotnet test GridForge.slnx --configuration Release --no-build
280-
dotnet test GridForge.slnx --configuration ReleaseLean --no-build
285+
dotnet test GridForge.slnx --configuration Release
286+
dotnet test GridForge.slnx --configuration ReleaseLean
281287
```
282288

283289
Run benchmarks when changing pooling, tracing, scan cells, occupant
@@ -362,9 +368,11 @@ GitHub wiki publishing.
362368
- `.github/workflows/publish-nuget.yml` validates release tag version, builds
363369
both package variants, checks for exactly four package artifacts, uploads the
364370
package artifact, and publishes `.nupkg` files to NuGet.
365-
- `.github/workflows/coverage.yml` and `.github/workflows/sync-wiki.yml` depend
366-
on the `build-and-test` workflow name. If the build workflow name changes,
367-
update those triggers and README badges together.
371+
- `.github/workflows/coverage.yml` builds the DocFX site and publishes coverage
372+
beneath `/coverage` in the same GitHub Pages artifact.
373+
- `.github/workflows/sync-wiki.yml` publishes `docs/wiki` to the GitHub Wiki.
374+
Both workflows depend on the `build-and-test` workflow name; update their
375+
triggers and README badges if that name changes.
368376

369377
## Pitfalls To Avoid
370378

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
![GridForge Icon](https://raw.githubusercontent.com/mrdav30/GridForge/main/icon.png)
44

55
[![Build](https://github.com/mrdav30/GridForge/actions/workflows/build-and-test.yml/badge.svg?branch=main)](https://github.com/mrdav30/GridForge/actions/workflows/build-and-test.yml)
6-
[![Coverage](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fmrdav30.github.io%2FGridForge%2FSummary.json&query=%24.summary.linecoverage&suffix=%25&label=coverage&color=brightgreen)](https://mrdav30.github.io/GridForge/)
6+
[![Branch Coverage](https://mrdav30.github.io/GridForge/coverage/badge_branchcoverage.svg)](https://mrdav30.github.io/GridForge/coverage/)
77
[![NuGet](https://img.shields.io/nuget/v/GridForge.svg)](https://www.nuget.org/packages/GridForge)
88
[![NuGet Downloads](https://img.shields.io/nuget/dt/GridForge.svg)](https://www.nuget.org/packages/GridForge)
99
[![License](https://img.shields.io/github/license/mrdav30/GridForge.svg)](https://github.com/mrdav30/GridForge/blob/main/LICENSE)
@@ -212,11 +212,16 @@ identity remains host-owned through `IVoxelOccupant.GlobalId`.
212212

213213
## Documentation
214214

215-
For breaking upgrades, start with the [Migration Guide](docs/MIGRATION.md).
216-
217-
Start with the wiki:
215+
For breaking upgrades, start with the
216+
[Migration Guide](https://github.com/mrdav30/GridForge/blob/main/docs/MIGRATION.md).
218217

218+
- [Documentation site](https://mrdav30.github.io/GridForge/)
219+
- [API reference](https://mrdav30.github.io/GridForge/api/GridForge.html)
219220
- [Wiki Home](https://github.com/mrdav30/GridForge/wiki/Home)
221+
- [Coverage report](https://mrdav30.github.io/GridForge/coverage/)
222+
223+
The wiki includes:
224+
220225
- [Getting Started](https://github.com/mrdav30/GridForge/wiki/Getting-Started)
221226
- [Core Concepts](https://github.com/mrdav30/GridForge/wiki/Core-Concepts)
222227
- [Sparse Grid Storage](https://github.com/mrdav30/GridForge/wiki/Sparse-Grid-Storage)
@@ -230,6 +235,9 @@ The source for those pages lives in [`docs/wiki`](docs/wiki).
230235

231236
## Local Validation
232237

238+
Install the SDK selected by `global.json` and the runtimes targeted by the test
239+
and benchmark projects before running the repository commands.
240+
233241
```bash
234242
dotnet restore GridForge.slnx
235243
dotnet build GridForge.slnx --configuration Debug

docs/api/docfx.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"metadata": [
3+
{
4+
"src": [
5+
{
6+
"files": ["src/GridForge/bin/Release/net8.0/GridForge.dll"],
7+
"src": "../.."
8+
}
9+
],
10+
"dest": "obj/api"
11+
}
12+
],
13+
"build": {
14+
"content": [
15+
{ "files": ["index.md", "toc.yml"] },
16+
{ "files": ["**/*.yml"], "src": "obj/api", "dest": "api" }
17+
],
18+
"output": "obj/_site",
19+
"template": ["default", "modern"],
20+
"globalMetadata": {
21+
"_appName": "GridForge API"
22+
}
23+
}
24+
}

docs/api/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# GridForge Documentation
2+
3+
GridForge provides deterministic rectangular and hex-prism voxel grids for
4+
spatial partitioning, simulation, games, and tooling.
5+
6+
- [Browse the API reference](xref:GridForge)
7+
- [Read the GridForge wiki](https://github.com/mrdav30/GridForge/wiki)
8+
- [Read the migration guide](https://github.com/mrdav30/GridForge/blob/main/docs/MIGRATION.md)
9+
- [View the coverage report](https://mrdav30.github.io/GridForge/coverage/)

docs/api/toc.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
items:
2+
- name: Home
3+
href: index.md
4+
- name: API Reference
5+
href: obj/api/
6+
homepage: obj/api/GridForge.yml
7+
- name: Wiki
8+
href: https://github.com/mrdav30/GridForge/wiki
9+
- name: Migration Guide
10+
href: https://github.com/mrdav30/GridForge/blob/main/docs/MIGRATION.md
11+
- name: Coverage
12+
href: https://mrdav30.github.io/GridForge/coverage/

0 commit comments

Comments
 (0)