@@ -9,22 +9,108 @@ run-name: Generate and lint documentation for ${{ github.ref_name }} by @${{ git
99# Required Secrets:
1010# - DOCS_BUILD_REF: Automatic
1111
12+ # Declare default permissions as none.
1213permissions : {}
1314
1415on : # yamllint disable-line rule:truthy
15- push :
16- branches : ["main", "master", "stable"]
17- tags : ["v*"]
18- paths : ["docs/**", ".github/workflows/CI-DOCS.yml", "**/*.md", "README.md", "LICENSE.md"]
19- pull_request :
20- types : [opened, reopened, ready_for_review]
21- branches : ["feature-*", "patch-*", "HOTFIX-*"]
22- paths : ["docs/**", ".github/workflows/CI-DOCS.yml", "**/*.md", "multicast/*.py"]
23- pull_request_target :
24- types : [opened, edited, reopened, ready_for_review]
25- branches : ["main", "master", "stable"]
16+ workflow_run :
17+ workflows : ["CI-MATs"]
18+ types :
19+ - completed
2620
2721jobs :
22+ check_mats :
23+ permissions :
24+ actions : read
25+ pull-requests : read
26+ checks : write
27+ environment : " Documentation"
28+ runs-on : ubuntu-latest
29+ env :
30+ GH_TOKEN : ${{ github.token }}
31+ outputs :
32+ should_run : ${{ steps.check.outputs.should_run }}
33+ trigger_id : ${{ steps.get_trigger_id.outputs.trigger_id }}
34+ build_id : ${{ steps.load_build_info.outputs.build_id }}
35+ build_url : ${{ steps.load_build_info.outputs.build_url }}
36+ build_ref : ${{ steps.load_build_info.outputs.build_ref }}
37+ build_ref_name : ${{ steps.load_build_info.outputs.build_ref_name }}
38+ build_sha : ${{ steps.load_build_info.outputs.build_sha }}
39+ build_artifact_filename : ${{ steps.load_build_info.outputs.build_artifact_filename }}
40+ build_artifact_url : ${{ steps.load_build_info.outputs.build_artifact_url }}
41+ build_artifact_id : ${{ steps.load_build_info.outputs.build_artifact_id }}
42+ build_artifact_digest : ${{ steps.load_build_info.outputs.build_artifact_digest }}
43+ build_environment : ${{ steps.load_build_info.outputs.build_environment }}
44+ mats_environment : ${{ steps.load_build_info.outputs.mats_environment }}
45+ mats_id : ${{ steps.load_build_info.outputs.mats_id }}
46+ mats_url : ${{ steps.load_build_info.outputs.mats_url }}
47+ mats_ref : ${{ steps.load_build_info.outputs.mats_ref }}
48+ mats_ref_name : ${{ steps.load_build_info.outputs.mats_ref_name }}
49+ mats_sha : ${{ steps.load_build_info.outputs.mats_sha }}
50+ mats_success : ${{ steps.load_build_info.outputs.mats_success }}
51+ docs_id : ${{ steps.output_run_id.outputs.docs_id }}
52+ docs_check_url : ${{ steps.output_run_id.outputs.docs_url }}
53+ check_id : ${{ steps.output_docs_check_id.outputs.check-id }}
54+ steps :
55+ - id : check
56+ run : |
57+ if [[ "${{ github.event.workflow_run.conclusion }}" == "success" ]]; then
58+ echo "should_run=true" >> "$GITHUB_OUTPUT"
59+ else
60+ echo "should_run=false" >> "$GITHUB_OUTPUT"
61+ fi
62+ - id : get_trigger_id
63+ if : ${{ (steps.check.outputs.should_run == 'true') && success() }}
64+ run : |
65+ ID_VALUE=$(gh api "${{ github.event.workflow_run.url }}" --jq '.id')
66+ if [[ -n "$ID_VALUE" ]]; then
67+ echo "trigger_id=$ID_VALUE" >> "$GITHUB_OUTPUT"
68+ else
69+ echo "trigger_id=null" >> "$GITHUB_OUTPUT" # Default fallback
70+ fi
71+ - name : " Fetch MATs Info"
72+ if : ${{ (github.repository == 'reactive-firewall/multicast') && success() }}
73+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
74+ with :
75+ path : " multicast-info.txt"
76+ pattern : multicast-info-*
77+ repository : reactive-firewall/multicast
78+ merge-multiple : true
79+ github-token : ${{ env.GH_TOKEN }}
80+ run-id : ${{ steps.get_trigger_id.outputs.trigger_id }}
81+ - name : " move into place"
82+ id : load_build_info
83+ if : ${{ (github.repository == 'reactive-firewall/multicast') && success() }}
84+ run : |
85+ mv -vf "multicast-info.txt/multicast-info.txt" ./"multicast-info-tmp.txt" ;
86+ wait ;
87+ rmdir -v ./"multicast-info.txt"
88+ mv -vf ./"multicast-info-tmp.txt" ./"multicast-info.txt"
89+ cat <"multicast-info.txt" >> "$GITHUB_OUTPUT"
90+ - id : output_run_id
91+ shell : bash
92+ if : ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }}
93+ run : |
94+ printf "docs_url=%s\n" 'https://github.com/reactive-firewall/multicast/actions/runs/${{ github.run_id }}' >> "$GITHUB_OUTPUT"
95+ printf "docs_id=%s\n" ${{ github.run_id }} >> "$GITHUB_OUTPUT"
96+ - name : checkout repository actions for check
97+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
98+ with :
99+ persist-credentials : false
100+ ref : ${{ steps.load_build_info.outputs.build_sha }}
101+ sparse-checkout : ' .github/actions/check-control'
102+ - name : " Queue Tests GitHub Check"
103+ id : output_docs_check_id
104+ uses : ./.github/actions/check-control
105+ with :
106+ name : " CI-DOCS"
107+ title : " Documentation Testing"
108+ status : ' in_progress'
109+ summary : ' Documentation Testing is _Starting_'
110+ sha : ${{ steps.load_build_info.outputs.build_sha }}
111+ workflow-run-id : ${{ steps.output_run_id.outputs.docs_id }}
112+ details-url : ${{ steps.output_run_id.outputs.docs_url }}
113+
28114 DOCS :
29115 permissions :
30116 actions : read
33119 packages : none
34120 pull-requests : read
35121 security-events : none
122+ environment : " Documentation"
123+ if : ${{ !cancelled() && (needs.check_mats.outputs.should_run == 'true') }}
124+ needs : [check_mats]
36125 runs-on : ${{ matrix.os }}
37126 strategy :
38127 matrix :
@@ -43,37 +132,60 @@ jobs:
43132 PYTHON_VERSION : ${{ matrix.python-version }}
44133 LANG : " en_US.utf-8"
45134 LC_CTYPE : " en_US.utf-8"
46- DOCS_BUILD_REF : ${{ github.sha }}
135+ COVERAGE_RCFILE : ./.coveragerc
136+ COV_CORE_SOURCE : ./
137+ COV_CORE_CONFIG : ./.coveragerc
138+ COV_CORE_DATAFILE : ./coverage.xml
139+ CI_BRANCH : ${{ needs.check_mats.outputs.mats_ref_name }}
140+ CI_COMMIT_SHA : ${{ needs.check_mats.outputs.mats_sha }}
141+ BRANCH_NAME : ${{ needs.check_mats.outputs.mats_ref_name }}
142+ VCS_BRANCH_NAME : ${{ needs.check_mats.outputs.build_ref_name }}
143+ VCS_COMMIT_ID : ${{ needs.check_mats.outputs.build_sha }}
144+ DOCS_BUILD_REF : ${{ needs.check_mats.outputs.build_sha }}
145+ outputs :
146+ docs_outcome : ${{ steps.generate_documentation.outcome }}
147+ docs_artifact_url : ${{ steps.upload-documentation.outputs.artifact-url }}
148+ docs_artifact_id : ${{ steps.upload-documentation.outputs.artifact-id }}
149+ docs_artifact_digest : ${{ steps.upload-documentation.outputs.artifact-digest }}
47150 steps :
48- - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
151+ - name : pre-checkout repository for actions
152+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
49153 with :
50154 persist-credentials : false
51- - name : Set up Python ${{ matrix.python-version }}
52- uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
155+ ref : ${{ needs.check_mats.outputs.build_sha }}
156+ sparse-checkout : ' .github/actions/checkout-and-rebuild'
157+ - name : Checkout repository for Documentation with ${{ matrix.python-version }}
158+ id : fetch-build
159+ uses : ./.github/actions/checkout-and-rebuild
53160 with :
161+ sha : ${{ needs.check_mats.outputs.build_sha }}
162+ build-run-id : ${{ needs.check_mats.outputs.build_id }}
54163 python-version : ${{ matrix.python-version }}
55- - name : Fix braindead windows ${{ matrix.python-version }} on ${{ matrix.os }}
56- uses : ./.github/actions/upgrade-windows-pip
57- - name : Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }}
58- run : |
59- pip install --upgrade "pip>=24.3.1" "setuptools>=75.0" "wheel>=0.44" "build>=1.2.1";
60- pip install -r ./requirements.txt ;
61- pip install -r ./tests/requirements.txt || true ;
62- - name : Pre-Clean
63- id : clean-prep
64- run : make -j1 -f Makefile clean ;
65- - name : Pre-build for Python ${{ matrix.python-version }} on ${{ matrix.os }}
66- run : make -j1 -f Makefile build ;
67- if : ${{ success() }}
164+ path : ${{ github.workspace }}
68165 - name : Generate documentation with py${{ matrix.python-version }} on ${{ matrix.os }}
69- run : make -j1 -f Makefile build-docs 2>&1 >> $GITHUB_STEP_SUMMARY ;
166+ id : generate_documentation
167+ run : make -j1 -f Makefile build-docs
70168 if : ${{ !cancelled() }}
169+ - id : prep-doc-part
170+ if : ${{ !cancelled() }}
171+ shell : bash
172+ run : |
173+ if [[ ( -d ./docs/www/ ) ]] ; then
174+ mkdir ./Multicast-Documentation
175+ mkdir ./Multicast-Documentation/${{ runner.os }}-${PYTHON_VERSION}
176+ mkdir ./Multicast-Documentation/${{ runner.os }}-${PYTHON_VERSION}/docs
177+ mv -vf ./docs/www ./Multicast-Documentation/${{ runner.os }}-${PYTHON_VERSION}/docs/www || exit 1
178+ else
179+ exit 1
180+ fi
71181 - name : Upload Docs Artifact with Python ${{ matrix.python-version }} on ${{ matrix.os }}
182+ id : upload-documentation
72183 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
73184 with :
74- name : Multicast-Documentation-${{ github.sha }}-${{ matrix.os }}-${{ matrix.python-version }}
75- path : ./docs/www/
185+ name : Multicast-Documentation-${{ needs.check_mats.outputs.build_sha }}-${{ matrix.os }}-${{ matrix.python-version }}
186+ path : ./Multicast-Documentation
76187 if-no-files-found : ignore
188+ overwrite : true
77189 - name : Post-purge
78190 id : post-uninstall
79191 run : make -j1 -f Makefile purge || true ;
@@ -82,3 +194,108 @@ jobs:
82194 id : post-end
83195 run : make -j1 -f Makefile clean || true ;
84196 if : ${{ !cancelled() }}
197+
198+ DOCS_SUMMARY :
199+ permissions :
200+ actions : read
201+ contents : read
202+ pull-requests : read
203+ checks : write
204+ needs : [check_mats, DOCS]
205+ environment : " Documentation"
206+ runs-on : ubuntu-latest
207+ if : ${{ !cancelled() && (needs.check_mats.outputs.should_run == 'true') && (needs.DOCS.outputs.docs_outcome != 'cancelled') }}
208+ steps :
209+ - name : Download All Artifacts
210+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
211+ with :
212+ path : ${{ github.workspace }}/Multicast-Documentation
213+ pattern : Multicast-Documentation-${{ needs.check_mats.outputs.build_sha }}-*-*
214+ merge-multiple : true
215+ - id : report_status
216+ env :
217+ BUILD_SHA : ${{ needs.check_mats.outputs.build_sha }}
218+ DOCUMENTATION_COMMENT_BODY : ' ${{ github.workspace }}/DOCUMENTATION-Summary-Artifact.txt'
219+ run : |
220+ if [[ "${{ needs.COVERAGE.outputs.coverage_outcome }}" == "success" ]]; then
221+ printf "%s\n\n" "# :book: Documentation Summary" > "${DOCUMENTATION_COMMENT_BODY}"
222+ printf "%s\n" " * :ballot_box_with_check: Generating Documentation Passed" >> "${DOCUMENTATION_COMMENT_BODY}"
223+ printf "%s\n" "documentation_success=true" >> "$GITHUB_OUTPUT"
224+ printf "%s\n" "docs_summary=Generating Documentation Passed" >> "$GITHUB_OUTPUT"
225+ else
226+ printf "%s\n\n" "# Known flaws." > "${DOCUMENTATION_COMMENT_BODY}"
227+ printf "%s\n" "> [!WARNING]" >> "${DOCUMENTATION_COMMENT_BODY}"
228+ printf "%s\n\n" "> This commit has known flaws. Each commit is subject to minimal acceptance testing, and then select commits are subject to extra testing to evaluate release candidates; This commit has been deemed _not ready_ for release." >> "${DOCUMENTATION_COMMENT_BODY}"
229+ printf "%s\n" "documentation_success=false" >> "$GITHUB_OUTPUT"
230+ printf "%s\n" " * :x: Generating Documentation Failed" >> "${DOCUMENTATION_COMMENT_BODY}"
231+ printf "%s\n" "docs_summary=Generating Documentation Unsuccessful" >> "$GITHUB_OUTPUT"
232+ fi
233+ cat <"${DOCUMENTATION_COMMENT_BODY}" >> "$GITHUB_STEP_SUMMARY"
234+ { printf "%s\n" 'docs_text<<EOF'; cat <"${DOCUMENTATION_COMMENT_BODY}"; printf "%s\n" 'EOF'; } >> "$GITHUB_OUTPUT"
235+ - name : " Upload DOCs summary"
236+ id : upload-docs-summary
237+ if : ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }}
238+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
239+ with :
240+ path : ./DOCUMENTATION-Summary-Artifact.txt
241+ name : DOCUMENTATION-COMMENT-BODY-${{ needs.check_mats.outputs.build_sha }}
242+ if-no-files-found : error
243+ compression-level : 3
244+ retention-days : 2
245+ overwrite : true
246+ - name : " Upload DOCs Bundle"
247+ id : upload-docs-bundle
248+ if : ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }}
249+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
250+ with :
251+ path : Multicast-Documentation
252+ name : Multicast-Documentation-${{ needs.check_mats.outputs.build_sha }}-ALL
253+ if-no-files-found : error
254+ compression-level : 9
255+ overwrite : true
256+ - name : checkout repository actions for check
257+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
258+ with :
259+ persist-credentials : false
260+ ref : ${{ needs.check_mats.outputs.build_sha }}
261+ sparse-checkout : ' .github/actions/check-control'
262+ - name : " Compleate DOCs GitHub Check"
263+ id : compleate_docs
264+ if : ${{ (github.repository == 'reactive-firewall/multicast') && always() }}
265+ uses : ./.github/actions/check-control
266+ with :
267+ name : " CI-DOCS"
268+ check-id : ${{ needs.check_mats.outputs.check_id }}
269+ title : " Documentation Testing"
270+ status : ' completed'
271+ conclusion : ${{ needs.COVERAGE.outputs.coverage_outcome }}
272+ summary : ${{ steps.report_status.outputs.docs_summary }}
273+ text : ${{ steps.report_status.outputs.docs_text }}
274+ sha : ${{ needs.check_mats.outputs.build_sha }}
275+ workflow-run-id : ${{ needs.check_mats.outputs.docs_id }}
276+ details-url : ${{ needs.check_mats.outputs.docs_check_url }}
277+
278+ DOCS_REPORT :
279+ permissions :
280+ actions : read
281+ contents : write
282+ needs : [check_mats, DOCS_SUMMARY]
283+ environment : " Documentation"
284+ runs-on : ubuntu-latest
285+ if : ${{ !cancelled() }}
286+ steps :
287+ - name : " Download Status Summary Artifact"
288+ id : download-documentation-summary
289+ if : ${{ !cancelled() && (github.repository == 'reactive-firewall/multicast') }}
290+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
291+ with :
292+ name : DOCUMENTATION-COMMENT-BODY-${{ needs.check_mats.outputs.build_sha }}
293+ github-token : ${{ github.token }}
294+ - name : " DOCs commit comment"
295+ id : documentation-commit-comment
296+ if : ${{ success() && (github.repository == 'reactive-firewall/multicast') }}
297+ uses : peter-evans/commit-comment@5a6f8285b8f2e8376e41fe1b563db48e6cf78c09 # v3.0.0
298+ with :
299+ sha : ${{ needs.check_mats.outputs.build_sha }}
300+ token : ${{ github.token }}
301+ body-path : ' ${{ steps.download-documentation-summary.outputs.download-path }}/DOCUMENTATION-Summary-Artifact.txt'
0 commit comments