Skip to content

Commit 6aaa6a7

Browse files
authored
sync: update 8 files from source repository (#264)
1 parent b0fa23f commit 6aaa6a7

File tree

8 files changed

+80
-142
lines changed

8 files changed

+80
-142
lines changed

.github/actions/cancel-workflow-on-failure/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# ------------------------------------------------------------------------------------
22
# Cancel Workflow On Failure (Composite Action) (GoFortress)
33
#
4+
# NOTE: This action is currently NOT IN USE. It was disabled because GitHub's
5+
# cancel API overwrites the "failed" status with "cancelled" on the job that
6+
# triggered it, making it impossible to identify which job actually failed.
7+
#
8+
# The action is kept for potential future use in scenarios where the trade-off
9+
# (faster cancellation vs clear failure visibility) is acceptable.
10+
#
411
# Purpose: Provide a reusable action that cancels the entire workflow run when
512
# a critical job fails. This prevents wasting CI resources on parallel jobs
613
# that will ultimately be invalidated by an earlier failure.

.github/workflows/fortress-code-quality.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ jobs:
6666
runs-on: ${{ inputs.primary-runner }}
6767
permissions:
6868
contents: read
69-
actions: write # Required for workflow cancellation on failure
7069
steps:
7170
# --------------------------------------------------------------------
7271
# Checkout code (required for local actions)
@@ -270,19 +269,6 @@ jobs:
270269
echo "❌ Go vet detected static analysis issues"
271270
exit 1
272271
273-
# --------------------------------------------------------------------
274-
# Cancel workflow on failure (save CI resources)
275-
# --------------------------------------------------------------------
276-
- name: 🚨 Cancel workflow on failure
277-
if: failure()
278-
uses: ./.github/actions/cancel-workflow-on-failure
279-
with:
280-
reason: "Go vet static analysis failed"
281-
failed-job: "Go Vet Static Analysis"
282-
failed-step: "🔍 Go vet (sequential)"
283-
failure-tool: "go vet"
284-
failure-summary: "Static analysis issues detected"
285-
286272
# ----------------------------------------------------------------------------------
287273
# Lint (Code Linting)
288274
# ----------------------------------------------------------------------------------
@@ -293,7 +279,6 @@ jobs:
293279
runs-on: ${{ inputs.primary-runner }}
294280
permissions:
295281
contents: read
296-
actions: write # Required for workflow cancellation on failure
297282
outputs:
298283
golangci-lint-version: ${{ steps.golangci-lint-version.outputs.version }}
299284
steps:
@@ -572,19 +557,6 @@ jobs:
572557
echo "❌ Lint detected code quality issues"
573558
exit 1
574559
575-
# --------------------------------------------------------------------
576-
# Cancel workflow on failure (save CI resources)
577-
# --------------------------------------------------------------------
578-
- name: 🚨 Cancel workflow on failure
579-
if: failure()
580-
uses: ./.github/actions/cancel-workflow-on-failure
581-
with:
582-
reason: "Code linting (golangci-lint) failed"
583-
failed-job: "Lint Code"
584-
failed-step: "✨ Run golangci-lint"
585-
failure-tool: "golangci-lint"
586-
failure-summary: "Linting issues detected"
587-
588560
# ----------------------------------------------------------------------------------
589561
# YAML/JSON Format Validation (MAGE-X)
590562
# ----------------------------------------------------------------------------------
@@ -594,7 +566,6 @@ jobs:
594566
runs-on: ${{ inputs.primary-runner }}
595567
permissions:
596568
contents: read
597-
actions: write # Required for workflow cancellation on failure
598569
outputs:
599570
yamlfmt-version: ${{ steps.yamlfmt-version.outputs.version }}
600571
steps:
@@ -809,16 +780,3 @@ jobs:
809780
run: |
810781
echo "❌ Format check detected YAML/JSON formatting issues"
811782
exit 1
812-
813-
# --------------------------------------------------------------------
814-
# Cancel workflow on failure (save CI resources)
815-
# --------------------------------------------------------------------
816-
- name: 🚨 Cancel workflow on failure
817-
if: failure()
818-
uses: ./.github/actions/cancel-workflow-on-failure
819-
with:
820-
reason: "YAML/JSON format validation failed"
821-
failed-job: "YAML/JSON Format Validation"
822-
failed-step: "🔍 Check YAML/JSON formatting with MAGE-X"
823-
failure-tool: "yamlfmt"
824-
failure-summary: "Formatting issues detected"

.github/workflows/fortress-pre-commit.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
runs-on: ${{ inputs.primary-runner }}
5555
permissions:
5656
contents: read
57-
actions: write # Required for workflow cancellation on failure
5857
outputs:
5958
pre-commit-version: ${{ steps.pre-commit-version.outputs.version }}
6059
checks-executed: ${{ steps.run-checks.outputs.executed }}
@@ -885,16 +884,3 @@ jobs:
885884
artifact-name: cache-stats-pre-commit
886885
artifact-path: cache-stats-pre-commit.json
887886
retention-days: 1
888-
889-
# --------------------------------------------------------------------
890-
# Cancel workflow on failure (save CI resources)
891-
# --------------------------------------------------------------------
892-
- name: 🚨 Cancel workflow on failure
893-
if: failure()
894-
uses: ./.github/actions/cancel-workflow-on-failure
895-
with:
896-
reason: "Pre-commit checks failed"
897-
failed-job: "Pre-commit Checks"
898-
failed-step: "🚀 Run pre-commit checks"
899-
failure-tool: "go-pre-commit"
900-
failure-summary: "Pre-commit validation failed"

.github/workflows/fortress-security-scans.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ jobs:
7171
if: ${{ inputs.enable-nancy }}
7272
permissions:
7373
contents: read
74-
actions: write # Required for workflow cancellation on failure
7574
steps:
7675
# --------------------------------------------------------------------
7776
# Checkout code (required for local actions)
@@ -259,19 +258,6 @@ jobs:
259258
echo "❌ Nancy detected vulnerabilities in dependencies"
260259
exit 1
261260
262-
# --------------------------------------------------------------------
263-
# Cancel workflow on failure (save CI resources)
264-
# --------------------------------------------------------------------
265-
- name: 🚨 Cancel workflow on failure
266-
if: failure()
267-
uses: ./.github/actions/cancel-workflow-on-failure
268-
with:
269-
reason: "Nancy dependency security check failed"
270-
failed-job: "Ask Nancy (Dependency Checks)"
271-
failed-step: "🔍 Ask Nancy"
272-
failure-tool: "nancy"
273-
failure-summary: "Vulnerabilities detected in dependencies"
274-
275261
# ----------------------------------------------------------------------------------
276262
# Govulncheck (Vulnerability Checks)
277263
# ----------------------------------------------------------------------------------
@@ -281,7 +267,6 @@ jobs:
281267
if: ${{ inputs.enable-govulncheck }}
282268
permissions:
283269
contents: read
284-
actions: write # Required for workflow cancellation on failure
285270
steps:
286271
# --------------------------------------------------------------------
287272
# Checkout code (required for local actions)
@@ -512,19 +497,6 @@ jobs:
512497
echo "❌ Govulncheck detected vulnerabilities in dependencies"
513498
exit 1
514499
515-
# --------------------------------------------------------------------
516-
# Cancel workflow on failure (save CI resources)
517-
# --------------------------------------------------------------------
518-
- name: 🚨 Cancel workflow on failure
519-
if: failure()
520-
uses: ./.github/actions/cancel-workflow-on-failure
521-
with:
522-
reason: "Govulncheck vulnerability scan failed"
523-
failed-job: "Run govulncheck (Vulnerability Scan)"
524-
failed-step: "🔐 Run govulncheck"
525-
failure-tool: "govulncheck"
526-
failure-summary: "Go vulnerabilities detected"
527-
528500
# ----------------------------------------------------------------------------------
529501
# Gitleaks (Secret Scanning)
530502
# ----------------------------------------------------------------------------------
@@ -534,7 +506,6 @@ jobs:
534506
if: ${{ inputs.enable-gitleaks }}
535507
permissions:
536508
contents: read
537-
actions: write # Required for workflow cancellation on failure
538509
steps:
539510
# --------------------------------------------------------------------
540511
# Checkout code (required for local actions)
@@ -657,16 +628,3 @@ jobs:
657628
run: |
658629
echo "❌ Gitleaks detected secrets in the repository"
659630
exit 1
660-
661-
# --------------------------------------------------------------------
662-
# Cancel workflow on failure (save CI resources)
663-
# --------------------------------------------------------------------
664-
- name: 🚨 Cancel workflow on failure
665-
if: failure()
666-
uses: ./.github/actions/cancel-workflow-on-failure
667-
with:
668-
reason: "Gitleaks secret scan failed"
669-
failed-job: "Run Gitleaks (Secret Scan)"
670-
failed-step: "🔍 Run gitleaks scan"
671-
failure-tool: "gitleaks"
672-
failure-summary: "Secrets detected in repository"

.github/workflows/fortress-test-fuzz.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
timeout-minutes: 15 # Fuzz tests have shorter timeout
5959
permissions:
6060
contents: read # Read repository content for testing
61-
actions: write # Required for workflow cancellation on failure
6261
runs-on: ${{ inputs.primary-runner }}
6362

6463
steps:
@@ -260,16 +259,3 @@ jobs:
260259
fuzz-output.log
261260
retention-days: 1
262261
if-no-files-found: ignore
263-
264-
# --------------------------------------------------------------------
265-
# Cancel workflow on failure (save CI resources)
266-
# --------------------------------------------------------------------
267-
- name: 🚨 Cancel workflow on failure
268-
if: failure()
269-
uses: ./.github/actions/cancel-workflow-on-failure
270-
with:
271-
reason: "Fuzz tests failed"
272-
failed-job: "Fuzz Tests"
273-
failed-step: "🧪 Run fuzz tests"
274-
failure-tool: "go test -fuzz"
275-
failure-summary: "Fuzz testing detected issues"

.github/workflows/fortress-test-matrix.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ jobs:
110110
timeout-minutes: 30 # Prevent hung tests
111111
permissions:
112112
contents: read # Read repository content for testing
113-
actions: write # Required for workflow cancellation on failure
114113
strategy:
115114
fail-fast: true
116115
matrix: ${{ fromJSON(inputs.test-matrix) }}
@@ -443,16 +442,3 @@ jobs:
443442
name: coverage-data
444443
path: coverage.txt
445444
retention-days: 1
446-
447-
# --------------------------------------------------------------------
448-
# Cancel workflow on failure (save CI resources)
449-
# --------------------------------------------------------------------
450-
- name: 🚨 Cancel workflow on failure
451-
if: failure()
452-
uses: ./.github/actions/cancel-workflow-on-failure
453-
with:
454-
reason: "Test matrix failed (${{ matrix.name }})"
455-
failed-job: "Test (${{ matrix.name }})"
456-
failed-step: "🧪 Run tests"
457-
failure-tool: "go test"
458-
failure-summary: "Test failures detected on ${{ matrix.os }} Go ${{ matrix.go-version }}"

.github/workflows/fortress-test-suite.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ jobs:
127127
if: inputs.go-tests-enabled == 'true'
128128
permissions:
129129
contents: read
130-
actions: write # Required for workflow cancellation on failure
131130
uses: ./.github/workflows/fortress-test-matrix.yml
132131
with:
133132
env-json: ${{ inputs.env-json }}
@@ -155,7 +154,6 @@ jobs:
155154
if: inputs.go-tests-enabled == 'true' && inputs.fuzz-testing-enabled == 'true'
156155
permissions:
157156
contents: read
158-
actions: write # Required for workflow cancellation on failure
159157
uses: ./.github/workflows/fortress-test-fuzz.yml
160158
with:
161159
env-json: ${{ inputs.env-json }}

.github/workflows/fortress.yml

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ jobs:
170170
needs.setup.outputs.is-fork-pr != 'true'
171171
permissions:
172172
contents: read # Read repository content for security scanning
173-
actions: write # Required for workflow cancellation on failure
174173
uses: ./.github/workflows/fortress-security-scans.yml
175174
with:
176175
env-json: ${{ needs.load-env.outputs.env-json }}
@@ -199,7 +198,6 @@ jobs:
199198
needs.setup.outputs.pre-commit-enabled == 'true'
200199
permissions:
201200
contents: read # Read repository content for pre-commit checks
202-
actions: write # Required for workflow cancellation on failure
203201
uses: ./.github/workflows/fortress-pre-commit.yml
204202
with:
205203
env-json: ${{ needs.load-env.outputs.env-json }}
@@ -220,7 +218,6 @@ jobs:
220218
(needs.warm-cache.result == 'success' || needs.warm-cache.result == 'skipped')
221219
permissions:
222220
contents: read # Read repository content for code quality checks
223-
actions: write # Required for workflow cancellation on failure
224221
uses: ./.github/workflows/fortress-code-quality.yml
225222
with:
226223
env-json: ${{ needs.load-env.outputs.env-json }}
@@ -251,7 +248,7 @@ jobs:
251248
pages: write # Required: Coverage workflow needs to deploy to GitHub Pages
252249
id-token: write # Required: Coverage workflow needs GitHub Pages authentication
253250
statuses: write # Required: Coverage workflow needs to create commit status checks
254-
actions: write # Required: Manage/cancel child test workflows (test matrix & fuzz tests); artifact access only needs actions: read
251+
actions: read # Required: Coverage workflow needs to access artifacts from workflow runs
255252
uses: ./.github/workflows/fortress-test-suite.yml
256253
with:
257254
code-coverage-enabled: ${{ needs.setup.outputs.code-coverage-enabled }}
@@ -321,25 +318,87 @@ jobs:
321318
runs-on: ${{ needs.setup.outputs.primary-runner }}
322319
steps:
323320
# --------------------------------------------------------------------
324-
# Build a summary table for the UI (always runs)
321+
# Build results summary showing job statuses
325322
# --------------------------------------------------------------------
326323
- name: 📊 Build results summary
324+
env:
325+
SETUP_RESULT: ${{ needs.setup.result }}
326+
MAGEX_RESULT: ${{ needs.test-magex.result }}
327+
CACHE_RESULT: ${{ needs.warm-cache.result }}
328+
SECURITY_RESULT: ${{ needs.security.result }}
329+
QUALITY_RESULT: ${{ needs.code-quality.result }}
330+
PRECOMMIT_RESULT: ${{ needs.pre-commit.result }}
331+
TESTS_RESULT: ${{ needs.test-suite.result }}
332+
BENCH_RESULT: ${{ needs.benchmarks.result }}
333+
CACHE_ENABLED: ${{ needs.setup.outputs.cache-warming-enabled }}
334+
PRECOMMIT_ENABLED: ${{ needs.setup.outputs.pre-commit-enabled }}
335+
TESTS_ENABLED: ${{ needs.setup.outputs.go-tests-enabled }}
327336
run: |
328337
{
329338
echo "## 🚦 Workflow Results"
330339
echo ""
331340
echo "| Component | Result | Status |"
332341
echo "|-----------|--------|--------|"
333-
echo "| 🎯 Setup | ${{ needs.setup.result }} | Required |"
334-
echo "| 🪄 MAGE-X | ${{ needs.test-magex.result }} | Required |"
335-
echo "| 💾 Warm Cache | ${{ needs.warm-cache.result }} | ${{ needs.setup.outputs.cache-warming-enabled == 'true' && 'Required' || 'Disabled' }} |"
336-
echo "| 🔒 Security | ${{ needs.security.result }} | Required |"
337-
echo "| 📊 Code Quality | ${{ needs.code-quality.result }} | Required |"
338-
echo "| 🪝 Pre-commit | ${{ needs.pre-commit.result }} | ${{ needs.setup.outputs.pre-commit-enabled == 'true' && 'Required' || 'Skipped' }} |"
339-
echo "| 🧪 Test Suite | ${{ needs.test-suite.result }} | ${{ needs.setup.outputs.go-tests-enabled == 'true' && 'Required' || 'Skipped' }} |"
340-
echo "| 🏃 Benchmarks | ${{ needs.benchmarks.result }} | Optional ⚠️ |"
342+
343+
# Helper function to determine result display
344+
get_result_display() {
345+
local result="$1"
346+
347+
if [[ "$result" == "failure" ]]; then
348+
echo "❌ **FAILED**"
349+
elif [[ "$result" == "cancelled" ]]; then
350+
echo "⏹️ cancelled"
351+
elif [[ "$result" == "skipped" ]]; then
352+
echo "⏭️ skipped"
353+
elif [[ "$result" == "success" ]]; then
354+
echo "✅ success"
355+
else
356+
echo "$result"
357+
fi
358+
}
359+
360+
# Setup
361+
SETUP_DISPLAY=$(get_result_display "$SETUP_RESULT")
362+
echo "| 🎯 Setup | $SETUP_DISPLAY | Required |"
363+
364+
# MAGE-X
365+
MAGEX_DISPLAY=$(get_result_display "$MAGEX_RESULT")
366+
echo "| 🪄 MAGE-X | $MAGEX_DISPLAY | Required |"
367+
368+
# Warm Cache
369+
CACHE_REQ="Disabled"
370+
[[ "$CACHE_ENABLED" == "true" ]] && CACHE_REQ="Required"
371+
CACHE_DISPLAY=$(get_result_display "$CACHE_RESULT")
372+
echo "| 💾 Warm Cache | $CACHE_DISPLAY | $CACHE_REQ |"
373+
374+
# Security
375+
SECURITY_DISPLAY=$(get_result_display "$SECURITY_RESULT")
376+
echo "| 🔒 Security | $SECURITY_DISPLAY | Required |"
377+
378+
# Code Quality
379+
QUALITY_DISPLAY=$(get_result_display "$QUALITY_RESULT")
380+
echo "| 📊 Code Quality | $QUALITY_DISPLAY | Required |"
381+
382+
# Pre-commit
383+
PRECOMMIT_REQ="Skipped"
384+
[[ "$PRECOMMIT_ENABLED" == "true" ]] && PRECOMMIT_REQ="Required"
385+
PRECOMMIT_DISPLAY=$(get_result_display "$PRECOMMIT_RESULT")
386+
echo "| 🪝 Pre-commit | $PRECOMMIT_DISPLAY | $PRECOMMIT_REQ |"
387+
388+
# Test Suite
389+
TESTS_REQ="Skipped"
390+
[[ "$TESTS_ENABLED" == "true" ]] && TESTS_REQ="Required"
391+
TESTS_DISPLAY=$(get_result_display "$TESTS_RESULT")
392+
echo "| 🧪 Test Suite | $TESTS_DISPLAY | $TESTS_REQ |"
393+
394+
# Benchmarks (always optional)
395+
BENCH_DISPLAY=$(get_result_display "$BENCH_RESULT")
396+
echo "| 🏃 Benchmarks | $BENCH_DISPLAY | Optional ⚠️ |"
397+
341398
echo ""
342-
if [[ "${{ needs.benchmarks.result }}" == "failure" ]]; then
399+
400+
# Add explanatory note if benchmarks failed
401+
if [[ "$BENCH_RESULT" == "failure" ]]; then
343402
echo "⚠️ **Note**: Benchmarks failed but are currently non-blocking."
344403
fi
345404
} >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)