Skip to content

Commit c3298aa

Browse files
hoverkraft-bot[bot]neilime
authored andcommitted
docs:(golden-paths): separate single app from multi apps for GitHub CI
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent ce18071 commit c3298aa

File tree

111 files changed

+1185
-888
lines changed

Some content is hidden

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

111 files changed

+1185
-888
lines changed

.devcontainer/devcontainer.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"name": "Node.js & TypeScript",
3-
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm",
2+
"name": "public-docs",
3+
"image": "mcr.microsoft.com/devcontainers/base:debian",
44
"features": {
5-
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
5+
"ghcr.io/devcontainers/features/node:1": {},
6+
"ghcr.io/devcontainers/features/docker-in-docker:2": {
7+
"moby": false
8+
}
69
},
710
"forwardPorts": [3000],
811
"customizations": {
@@ -29,6 +32,9 @@
2932
"args": ["lighthouse-mcp"]
3033
}
3134
}
35+
},
36+
"settings": {
37+
"terminal.integrated.defaultProfile.linux": "zsh"
3238
}
3339
}
3440
}

.github/actions/prepare-docs/__tests__/documentation-preparer.test.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,39 @@ describe("DocumentationPreparer", () => {
200200
expect(content).toContain("title: Actions");
201201
});
202202

203+
it("does not create a fallback _index when the bundle already contains index.md", async () => {
204+
mockFs({
205+
"/workspace": {
206+
artifact: {
207+
"README.md": "# Example\n\nMain page",
208+
actions: {
209+
checkout: {
210+
"README.md": "# Checkout\n\nDetails",
211+
},
212+
},
213+
},
214+
site: {
215+
docs: {},
216+
static: {},
217+
},
218+
},
219+
});
220+
221+
const options = createOptions();
222+
const preparer = new DocumentationPreparer(options);
223+
const result = await preparer.run();
224+
225+
expect(result.processedFiles).toContain("index.md");
226+
expect(result.processedFiles).not.toContain("_index.md");
227+
expect(fs.existsSync(path.join(options.outputPath, "index.md"))).toBe(true);
228+
expect(fs.existsSync(path.join(options.outputPath, "_index.md"))).toBe(
229+
false,
230+
);
231+
expect(options.core.info).not.toHaveBeenCalledWith(
232+
"Generated default index page for documentation bundle.",
233+
);
234+
});
235+
203236
it("fails fast when the source repository slug is invalid", async () => {
204237
mockFs({
205238
"/workspace": {

.github/actions/prepare-docs/lib/artifact/index-page-writer.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const path = require("path");
55
const { DEFAULT_INDEX_FILE } = require("../constants");
66
const { formatTitleFromSlug } = require("../utils/path-utils");
77

8+
const ROOT_INDEX_FILE = "index.md";
9+
810
function ensureIndexPage({
911
core,
1012
outputPath,
@@ -13,7 +15,10 @@ function ensureIndexPage({
1315
sourceRepository,
1416
syncTimestamp,
1517
}) {
16-
if (processedFiles.includes(DEFAULT_INDEX_FILE)) {
18+
if (
19+
processedFiles.includes(DEFAULT_INDEX_FILE) ||
20+
processedFiles.includes(ROOT_INDEX_FILE)
21+
) {
1722
return;
1823
}
1924

.github/actions/resolve-docs-target/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Responsibilities:
5555
| **Input** | **Description** | **Required** | **Default** |
5656
| ------------------ | ----------------------------------------------------- | ------------ | ----------- |
5757
| **`github-token`** | GitHub token used to authenticate repository queries. | **true** | - |
58-
| **`repository`** | Repository slug in the form owner/repo. | **true** | - |
58+
| **`repository`** | Repository slug in the form owner/repository. | **true** | - |
5959

6060
<!-- inputs:end -->
6161
<!-- secrets:start -->

.github/actions/resolve-docs-target/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ inputs:
1313
description: GitHub token used to authenticate repository queries.
1414
required: true
1515
repository:
16-
description: Repository slug in the form owner/repo.
16+
description: Repository slug in the form `owner/repo`.
1717
required: true
1818

1919
outputs:

.github/workflows/sync-docs-dispatcher.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ your-project/
5959

6060
### Complete Integration Example
6161

62-
For a full example of integrating this workflow into your CI pipeline, see the [Examples](#examples) section below.
62+
For a full example of integrating this workflow into your CI pipeline, see the [Usage](#usage) section below.
6363

6464
### Key Integration Points
6565

Makefile

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,36 @@ help: ## Show help message
88

99
include .env
1010

11-
prepare: ## Prepare stack to run
12-
npm --prefix application install
13-
npm --prefix .github/actions/generate-docs install
14-
npm --prefix .github/actions/prepare-docs install
15-
npm --prefix .github/actions/inject-docs install
16-
npm --prefix .github/actions/resolve-docs-target install
11+
setup: ## Install npm dependencies for all package.json files under actions/
12+
@echo "Installing npm dependencies for all packages..."
13+
$(call run_npm_for_packages,install)
1714

1815
start: ## Start application in dev mode
1916
npm --prefix application run start
2017

18+
npm-audit-fix: ## Execute npm audit fix
19+
@echo "Running npm audit fix for all packages..."
20+
$(call run_npm_for_packages,audit fix)
21+
2122
lint: ## Run linters
2223
npm --prefix application run lint -- $(filter-out $@,$(MAKECMDGOALS))
2324
$(call run_linter,)
2425

2526
lint-fix: ## Run linters
2627
npm --prefix application run lint:fix
27-
npm --prefix application audit fix
28-
npm --prefix .github/actions/generate-docs audit fix
29-
npm --prefix .github/actions/prepare-docs audit fix
30-
npm --prefix .github/actions/inject-docs audit fix
31-
npm --prefix .github/actions/resolve-docs-target audit fix
3228
$(MAKE) linter-fix
3329

3430
build: ## Build libs and applications
3531
npm --prefix application run build
3632

3733
test: ## Run tests
38-
npm --prefix application run test:ci
39-
npm --prefix .github/actions/generate-docs run test:ci
40-
npm --prefix .github/actions/prepare-docs run test:ci
41-
npm --prefix .github/actions/inject-docs run test:ci
42-
npm --prefix .github/actions/resolve-docs-target run test:ci
34+
@echo "Running tests for all packages..."
35+
$(call run_npm_for_packages,run test:ci)
4336

4437
ci: ## Run tests in CI mode
45-
$(MAKE) prepare
38+
$(MAKE) setup
4639
$(MAKE) lint-fix
40+
$(MAKE) npm-audit-fix || true
4741
$(MAKE) build
4842
$(MAKE) test
4943

@@ -68,22 +62,26 @@ define run_linter
6862
-e IGNORE_GITIGNORED_FILES=true \
6963
-e VALIDATE_TYPESCRIPT_PRETTIER=false \
7064
-e VALIDATE_TYPESCRIPT_ES=false \
71-
-e VALIDATE_CSS=false \
65+
-e VALIDATE_CSS=false \
7266
$(1) \
7367
-v $$VOLUME \
7468
--rm \
7569
$$LINTER_IMAGE
7670
endef
7771

78-
define docker-compose
79-
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.$(1).yml $(2)
80-
endef
81-
82-
define open-in-browser
83-
@if command -v x-www-browser &> /dev/null ; then x-www-browser $(1); \
84-
elif command -v xdg-open &> /dev/null ; then xdg-open $(1); \
85-
elif command -v open &> /dev/null ; then open $(1); \
86-
elif command -v start &> /dev/null ; then start $(1); fi;
72+
define run_npm_for_packages
73+
@set -eu; \
74+
overall_status=0; \
75+
packages="$$(find application .github/actions -type f -name package.json -not -path '*/node_modules/*' -print | sort)"; \
76+
for pkg in $$packages; do \
77+
pkg_dir="$$(dirname "$$pkg")"; \
78+
echo "---"; \
79+
echo "npm $(1) in $$pkg_dir"; \
80+
if ! npm --prefix "$$pkg_dir" $(1); then \
81+
overall_status=1; \
82+
fi; \
83+
done; \
84+
exit $$overall_status
8785
endef
8886

8987
#############################

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The portal aggregates technical guides, project overviews, and methodology notes
1414
- **Projects** — Directory of open-source projects managed by Hoverkraft (`application/docs/projects/`)
1515
- Project docs are stored under category folders: `application/docs/projects/<category>/<project>/`.
1616
- Categories follow the rules in `.github/actions/resolve-docs-target/lib/repository-categorizer.js` (via `RepositoryCategorizer`).
17-
- **⚠️ Project documentation must be syncronized from project repositories.** See [Documentation Aggregation System](##documentation-aggregation-system)
17+
- **⚠️ Project documentation must be syncronized from project repositories.** See [Documentation Aggregation System](#documentation-aggregation-system)
1818
- **Internal notes** — Keep internal or implementation-specific documentation concise in this root readme; `application/docs/` is limited to public-facing content.
1919

2020
## Site Structure

application/.eslintrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports = {
2+
root: true,
23
parser: "@typescript-eslint/parser",
34
parserOptions: {
45
ecmaVersion: "latest",
@@ -7,5 +8,25 @@ module.exports = {
78
jsx: true,
89
},
910
},
11+
plugins: ["n"],
1012
extends: ["plugin:@docusaurus/recommended"],
13+
settings: {
14+
react: {
15+
version: "detect",
16+
},
17+
},
18+
rules: {
19+
"react/react-in-jsx-scope": "off",
20+
"n/no-missing-import": [
21+
"error",
22+
{
23+
tryExtensions: [".js", ".jsx", ".ts", ".tsx"],
24+
allowModules: [
25+
"@docusaurus/useDocusaurusContext",
26+
"@theme/Heading",
27+
"@theme/Layout",
28+
],
29+
},
30+
],
31+
},
1132
};

application/docs/methodology/best-practices/ci-cd/cicd-release-management.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Predictable, low-stress deployments. If deployments are scary, you'll do them le
1414

1515
### Pipeline Stages
1616

17-
```
17+
```text
1818
┌──────────┐ ┌────────┐ ┌──────────┐ ┌────────┐ ┌────────┐
1919
│ Commit │──▶│ Lint │──▶│ Test │──▶│ Build │──▶│ Deploy │
2020
└──────────┘ └────────┘ └──────────┘ └────────┘ └────────┘
@@ -57,7 +57,7 @@ Predictable, low-stress deployments. If deployments are scary, you'll do them le
5757
- **Feature branches**: Short-lived (< 2 days)
5858
- **No long-lived branches**: Merge daily
5959

60-
```
60+
```text
6161
main ──●────●────●────●────●──▶
6262
\ / / /
6363
feature1 ●─────┘ /
@@ -87,7 +87,7 @@ feature2 ●────┘
8787

8888
### Deployment Pipeline
8989

90-
```
90+
```text
9191
PR Created
9292
9393
CI Runs (lint, test, build)
@@ -221,7 +221,7 @@ Follow [Semantic Versioning](https://semver.org/): `MAJOR.MINOR.PATCH`
221221

222222
Use conventional commit messages to automate versioning:
223223

224-
```
224+
```text
225225
feat: add user profile endpoint → MINOR bump
226226
fix: resolve null pointer exception → PATCH bump
227227
feat!: remove deprecated API → MAJOR bump
@@ -246,7 +246,7 @@ feat!: remove deprecated API → MAJOR bump
246246
247247
### Environment Progression
248248
249-
```
249+
```text
250250
Developer Laptop
251251
252252
CI (ephemeral)
@@ -311,7 +311,7 @@ After deploying to production:
311311

312312
Run two identical production environments:
313313

314-
```
314+
```text
315315
┌─────────┐ ┌─────────┐
316316
│ Blue │◀─────▶│ Green │
317317
│ (Live) │ │(Standby)│
@@ -333,7 +333,7 @@ Run two identical production environments:
333333

334334
Gradually shift traffic to new version:
335335

336-
```
336+
```text
337337
V1: ███████████ 90%
338338
V2: ██ 10%
339339
@@ -357,7 +357,3 @@ V2: ███████████ 100%
357357
- [Accelerate - Nicole Forsgren](https://itrevolution.com/product/accelerate/)
358358
- [Release It! - Michael Nygard](https://pragprog.com/titles/mnee2/release-it-second-edition/)
359359
- [Site Reliability Engineering - Google](https://sre.google/books/)
360-
361-
```
362-
363-
```

0 commit comments

Comments
 (0)