Skip to content

Commit 92b1473

Browse files
committed
docs: correctly fill document context
1 parent e99e7d5 commit 92b1473

File tree

4 files changed

+36
-21
lines changed

4 files changed

+36
-21
lines changed

.github/workflows/wc-document-generation.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,27 @@ jobs:
2626
python -m pip install gherkin-official==38.0.0 sbdl==1.21.3
2727
- name: Build & Validate SBDL model
2828
run: sbdl -m compile test/cpp/integration-tests.bats test/cpp/features/*.feature > amp-devcontainer.sbdl
29-
- name: Generate SRS document
30-
run: sbdl -m template-fill --template docs/templates/software-requirements-specification.md.j2 amp-devcontainer.sbdl > software-requirements-specification.md
31-
- name: Generate STP document
32-
run: sbdl -m template-fill --template docs/templates/software-test-plan.md.j2 amp-devcontainer.sbdl > software-test-plan.md
33-
- name: Generate RTM document
34-
run: sbdl -m template-fill --template docs/templates/requirements-traceability-matrix.md.j2 amp-devcontainer.sbdl > requirements-traceability-matrix.md
29+
- name: Create document control context
30+
run: |
31+
set -Eeuo pipefail
32+
33+
cat > document-control.sbdl <<SBDL
34+
#!sbdl
35+
doc_control is aspect {
36+
description is "Document control metadata"
37+
custom:version is "$(jq -r '.["."]' .release-please-manifest.json)"
38+
custom:generated_at is "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
39+
custom:git_sha is "${{ github.sha }}"
40+
custom:git_ref is "${{ github.ref_name }}"
41+
custom:sbdl_version is "$(sbdl --version)"
42+
}
43+
SBDL
44+
- name: 📄 Generate SRS document
45+
run: sbdl -m template-fill --template docs/templates/software-requirements-specification.md.j2 amp-devcontainer.sbdl document-control.sbdl > software-requirements-specification.md
46+
- name: 🧪 Generate STP document
47+
run: sbdl -m template-fill --template docs/templates/software-test-plan.md.j2 amp-devcontainer.sbdl document-control.sbdl > software-test-plan.md
48+
- name: 🧩 Generate RTM document
49+
run: sbdl -m template-fill --template docs/templates/requirements-traceability-matrix.md.j2 amp-devcontainer.sbdl document-control.sbdl > requirements-traceability-matrix.md
3550
- name: 📄 Generate SRS PDF
3651
uses: docker://pandoc/extra:3.9.0.0-ubuntu@sha256:72afa9c8d3300e5f10c9c4330e101725687f2179bffd912fb859c6d2ae85de62
3752
with:

docs/templates/requirements-traceability-matrix.md.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ amp-devcontainer is a set of [devcontainers](https://containers.dev/) tailored t
4040

4141
| Property | Value |
4242
|------------------|----------------------|
43-
| Document version | {{ version }} |
44-
| Generation date | {{ generated_at }} |
45-
| Source revision | {{ git_sha }} |
46-
| Source branch/tag| {{ git_ref }} |
47-
| Model | sbdl {{ sbdl_version }} |
43+
| Document version | {{ sbdl['doc_control']['custom:version'] }} |
44+
| Generation date | {{ sbdl['doc_control']['custom:generated_at'] }} |
45+
| Source revision | {{ sbdl['doc_control']['custom:git_sha'] }} |
46+
| Source branch/tag| {{ sbdl['doc_control']['custom:git_ref'] }} |
47+
| Model | sbdl {{ sbdl['doc_control']['custom:sbdl_version'] }} |
4848

4949
# Traceability Matrix
5050
{%- for aspect_id, aspect in sbdl.items() %}

docs/templates/software-requirements-specification.md.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ The following is out of scope:
5353

5454
| Property | Value |
5555
|------------------|----------------------|
56-
| Document version | {{ version }} |
57-
| Generation date | {{ generated_at }} |
58-
| Source revision | {{ git_sha }} |
59-
| Source branch/tag| {{ git_ref }} |
60-
| Model | sbdl {{ sbdl_version }} |
56+
| Document version | {{ sbdl['doc_control']['custom:version'] }} |
57+
| Generation date | {{ sbdl['doc_control']['custom:generated_at'] }} |
58+
| Source revision | {{ sbdl['doc_control']['custom:git_sha'] }} |
59+
| Source branch/tag| {{ sbdl['doc_control']['custom:git_ref'] }} |
60+
| Model | sbdl {{ sbdl['doc_control']['custom:sbdl_version'] }} |
6161

6262
This document is generated from a formal requirements model defined in [sbdl](https://sbdl.dev) and versioned alongside the source code in Git.
6363
The authoritative source of change history is the [Git log](https://github.com/philips-software/amp-devcontainer/commits/) for the requirements model files.

docs/templates/software-test-plan.md.j2

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ This document covers the following types of tests:
5151

5252
| Property | Value |
5353
|------------------|----------------------|
54-
| Document version | {{ version }} |
55-
| Generation date | {{ generated_at }} |
56-
| Source revision | {{ git_sha }} |
57-
| Source branch/tag| {{ git_ref }} |
58-
| Model | sbdl {{ sbdl_version }} |
54+
| Document version | {{ sbdl['doc_control']['custom:version'] }} |
55+
| Generation date | {{ sbdl['doc_control']['custom:generated_at'] }} |
56+
| Source revision | {{ sbdl['doc_control']['custom:git_sha'] }} |
57+
| Source branch/tag| {{ sbdl['doc_control']['custom:git_ref'] }} |
58+
| Model | sbdl {{ sbdl['doc_control']['custom:sbdl_version'] }} |
5959

6060
This document is generated from a formal requirements model defined in [sbdl](https://sbdl.dev) and versioned alongside the source code in Git.
6161

0 commit comments

Comments
 (0)