@@ -17,6 +17,10 @@ inputs:
17
17
description : ' Cache key prefix for this validation run'
18
18
required : false
19
19
default : ' link-validation'
20
+ timeout :
21
+ description : ' Test timeout in seconds'
22
+ required : false
23
+ default : ' 900'
20
24
21
25
outputs :
22
26
failed :
@@ -44,15 +48,31 @@ runs:
44
48
export GITHUB_ACTIONS=true
45
49
export NODE_OPTIONS="--max-old-space-size=4096"
46
50
47
- # Add timeout to prevent hanging
48
- timeout ${{ inputs.timeout }} node cypress/support/run-e2e-specs.js ${{ inputs.files }} \
51
+ # Set test runner timeout for Hugo shutdown
52
+ export HUGO_SHUTDOWN_TIMEOUT=5000
53
+
54
+ # Add timeout to prevent hanging (timeout command syntax: timeout DURATION COMMAND)
55
+ timeout ${{ inputs.timeout }}s node cypress/support/run-e2e-specs.js ${{ inputs.files }} \
49
56
--spec cypress/e2e/content/article-links.cy.js || {
50
57
exit_code=$?
51
- echo "::error::Link validation failed with exit code $exit_code"
52
58
53
- # Check for specific error patterns
54
- if [ -f hugo.log ]; then
59
+ # Handle timeout specifically
60
+ if [ $exit_code -eq 124 ]; then
61
+ echo "::error::Link validation timed out after ${{ inputs.timeout }} seconds"
62
+ echo "::notice::This may indicate Hugo server startup issues or very slow link validation"
63
+ else
64
+ echo "::error::Link validation failed with exit code $exit_code"
65
+ fi
66
+
67
+ # Check for specific error patterns and logs
68
+ if [ -f /tmp/hugo_server.log ]; then
55
69
echo "::group::Hugo Server Logs"
70
+ cat /tmp/hugo_server.log
71
+ echo "::endgroup::"
72
+ fi
73
+
74
+ if [ -f hugo.log ]; then
75
+ echo "::group::Additional Hugo Logs"
56
76
cat hugo.log
57
77
echo "::endgroup::"
58
78
fi
@@ -63,20 +83,40 @@ runs:
63
83
echo "::endgroup::"
64
84
fi
65
85
86
+ # Show Cypress artifacts if they exist
87
+ if [ -d cypress/screenshots ]; then
88
+ echo "::group::Available Screenshots"
89
+ find cypress/screenshots -name "*.png" -type f 2>/dev/null || echo "No screenshots found"
90
+ echo "::endgroup::"
91
+ fi
92
+
66
93
exit $exit_code
67
94
}
68
95
69
96
- name : Upload logs on failure
70
97
if : failure()
71
98
uses : actions/upload-artifact@v4
72
99
with :
73
- name : validation-logs-${{ inputs.product-name }}
100
+ name : validation-logs-${{ inputs.product-name && inputs.product-name || 'default' }}
74
101
path : |
75
102
hugo.log
103
+ /tmp/hugo_server.log
104
+ if-no-files-found : ignore
76
105
77
- - name : Upload broken links report
106
+ - name : Upload Cypress artifacts on failure
78
107
if : failure()
79
108
uses : actions/upload-artifact@v4
109
+ with :
110
+ name : cypress-artifacts-${{ inputs.product-name && inputs.product-name || 'default' }}
111
+ path : |
112
+ cypress/screenshots
113
+ cypress/videos
114
+ if-no-files-found : ignore
115
+
116
+ - name : Upload broken links report
117
+ if : always()
118
+ uses : actions/upload-artifact@v4
80
119
with :
81
120
name : broken-links-report${{ inputs.product-name && format('-{0}', inputs.product-name) || '' }}
82
- path : /tmp/broken_links_report.json
121
+ path : /tmp/broken_links_report.json
122
+ if-no-files-found : ignore
0 commit comments