generated from bitcoin-sv/template
-
-
Notifications
You must be signed in to change notification settings - Fork 1
209 lines (198 loc) · 7.33 KB
/
fortress-completion-report.yml
File metadata and controls
209 lines (198 loc) · 7.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# ------------------------------------------------------------------------------------
# Workflow Completion Report (Reusable Workflow) (GoFortress)
#
# Purpose: Generate a comprehensive workflow completion report for the entire
# workflow run, including timing metrics, test results, job status, and analytics.
#
# This workflow orchestrates sub-workflows that process different aspects of the
# completion report to improve maintainability and enable parallel processing.
#
# Maintainer: @mrz1836
#
# ------------------------------------------------------------------------------------
name: GoFortress (Completion Report)
on:
workflow_call:
inputs:
benchmarks-result:
description: "Benchmarks job result"
required: false
type: string
default: "skipped"
start-epoch:
description: "Workflow start epoch time"
required: false
type: string
default: "0"
start-time:
description: "Workflow start time"
required: false
type: string
default: "unknown"
setup-result:
description: "Setup job result"
required: false
type: string
default: "skipped"
test-magex-result:
description: "Test MAGE-X job result"
required: false
type: string
default: "skipped"
security-result:
description: "Security job result"
required: false
type: string
default: "skipped"
code-quality-result:
description: "Code quality job result"
required: false
type: string
default: "skipped"
pre-commit-result:
description: "Pre-commit checks job result"
required: false
type: string
default: "skipped"
test-suite-result:
description: "Test suite job result"
required: false
type: string
default: "skipped"
release-result:
description: "Result of the release job"
required: false
type: string
default: "skipped"
status-check-result:
description: "Result of the status-check job"
required: false
type: string
default: "skipped"
test-matrix:
description: "Test matrix JSON"
required: false
type: string
default: "[]"
env-json:
description: "JSON string of environment variables"
required: true
type: string
primary-runner:
description: "Primary runner OS"
required: true
type: string
gofortress-version:
description: "GoFortress workflow system version"
required: false
type: string
default: "unknown"
gofortress-released:
description: "GoFortress release date"
required: false
type: string
default: "unknown"
is-fork-pr:
description: "Whether this is a fork PR"
required: false
type: string
default: "false"
fork-security-mode:
description: "Security mode for fork PRs"
required: false
type: string
default: "full"
# Security: Restrict default permissions (jobs must explicitly request what they need)
permissions: {}
jobs:
# ----------------------------------------------------------------------------------
# Initialize Report and Download Artifacts
# ----------------------------------------------------------------------------------
initialize-report:
name: 📊 Initialize Report Data
runs-on: ${{ inputs.primary-runner }}
if: always()
permissions:
contents: read
actions: read
outputs:
timing-data: ${{ steps.calculate-timing.outputs.timing-json }}
steps:
# --------------------------------------------------------------------
# Checkout repository for local actions
# --------------------------------------------------------------------
- name: 📥 Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# --------------------------------------------------------------------
# Parse environment variables
# --------------------------------------------------------------------
- name: 🔧 Parse environment variables
env:
ENV_JSON: ${{ inputs.env-json }}
run: |
echo "📋 Setting environment variables..."
echo "$ENV_JSON" | jq -r 'to_entries | .[] | "\(.key)=\(.value)"' | while IFS='=' read -r key value; do
echo "$key=$value" >> $GITHUB_ENV
done
# --------------------------------------------------------------------
# Calculate timing metrics
# --------------------------------------------------------------------
- name: ⏱️ Calculate Timing Metrics
id: calculate-timing
run: |
# Calculate total duration
START_EPOCH=${{ inputs.start-epoch }}
END_EPOCH=$(date +%s)
TOTAL_DURATION=$((END_EPOCH - START_EPOCH))
TOTAL_MINUTES=$((TOTAL_DURATION / 60))
TOTAL_SECONDS=$((TOTAL_DURATION % 60))
# Store as outputs for later use
echo "total_minutes=$TOTAL_MINUTES" >> $GITHUB_OUTPUT
echo "total_seconds=$TOTAL_SECONDS" >> $GITHUB_OUTPUT
echo "total_duration=$TOTAL_DURATION" >> $GITHUB_OUTPUT
# Create JSON for sub-workflows
echo "timing-json={\"total_minutes\":$TOTAL_MINUTES,\"total_seconds\":$TOTAL_SECONDS,\"total_duration\":$TOTAL_DURATION}" >> $GITHUB_OUTPUT
# ----------------------------------------------------------------------------------
# Process Statistics (Cache, Benchmarks, Coverage, LOC)
# ----------------------------------------------------------------------------------
process-statistics:
name: 📊 Process Statistics
needs: initialize-report
if: always()
permissions:
contents: read
actions: read
uses: ./.github/workflows/fortress-completion-statistics.yml
with:
timing-metrics: ${{ needs.initialize-report.outputs.timing-data }}
env-json: ${{ inputs.env-json }}
# ----------------------------------------------------------------------------------
# Process Test Analysis (Test Results, Fuzz Testing, Configuration)
# ----------------------------------------------------------------------------------
process-tests:
name: 🧪 Process Test Analysis
needs: initialize-report
if: always()
permissions:
contents: read
actions: read
uses: ./.github/workflows/fortress-completion-tests.yml
with:
test-suite-result: ${{ inputs.test-suite-result }}
env-json: ${{ inputs.env-json }}
# ----------------------------------------------------------------------------------
# Finalize Report (Job Summary, Performance Insights, Assembly)
# ----------------------------------------------------------------------------------
finalize-report:
name: ✅ Finalize Report
needs: [initialize-report, process-statistics, process-tests]
if: always()
permissions:
contents: read
actions: read
uses: ./.github/workflows/fortress-completion-finalize.yml
with:
all-inputs: ${{ toJSON(inputs) }}
statistics-report: ${{ needs.process-statistics.outputs.report-section }}
tests-report: ${{ needs.process-tests.outputs.report-section }}
timing-data: ${{ needs.initialize-report.outputs.timing-data }}