-
Notifications
You must be signed in to change notification settings - Fork 13
199 lines (172 loc) · 5.96 KB
/
ci.yml
File metadata and controls
199 lines (172 loc) · 5.96 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
name: Continuous Integration
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
shellcheck:
name: ShellCheck Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache apt packages
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: ${{ runner.os }}-apt-shellcheck-${{ hashFiles('**/lockfiles') }}
restore-keys: |
${{ runner.os }}-apt-shellcheck-
- name: Install ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Run ShellCheck
run: |
chmod +x .github/scripts/test-shellcheck.sh
./.github/scripts/test-shellcheck.sh
- name: Upload ShellCheck report
if: always()
uses: actions/upload-artifact@v4
with:
name: shellcheck-report
path: shellcheck-report.md
syntax-validation:
name: Bash Syntax Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate syntax
run: |
chmod +x .github/scripts/test-syntax.sh
./.github/scripts/test-syntax.sh
functional-testing:
name: Functional Testing
runs-on: ubuntu-latest
services:
docker:
image: docker:dind
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker
run: |
dockerd &
sleep 10
docker --version
docker info
- name: Run functional tests
run: |
chmod +x .github/scripts/test-functional.sh
./.github/scripts/test-functional.sh
- name: Cleanup test environment
if: always()
run: |
docker stop test-n8n || true
docker rm test-n8n || true
security-scanning:
name: Security Scanning
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install security tools
run: |
sudo apt-get update
sudo apt-get install -y grep
- name: Run security scan
run: |
chmod +x .github/scripts/test-security.sh
./.github/scripts/test-security.sh
- name: Upload security report
if: always()
uses: actions/upload-artifact@v4
with:
name: security-report
path: security-report.md
documentation-validation:
name: Documentation Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate documentation
run: |
chmod +x n8n-manager.sh # Ensure main script is executable
chmod +x .github/scripts/test-docs.sh
./.github/scripts/test-docs.sh
integration-testing:
name: Integration Testing
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up test environment
run: |
sudo apt-get update
sudo apt-get install -y git curl
- name: Debug Workspace (Before Script)
run: |
echo "GITHUB_WORKSPACE is: $GITHUB_WORKSPACE"
echo "Listing $GITHUB_WORKSPACE:"
ls -la $GITHUB_WORKSPACE
echo "Touching $GITHUB_WORKSPACE/integration-report.md"
touch $GITHUB_WORKSPACE/integration-report.md
echo "Listing $GITHUB_WORKSPACE after touch:"
ls -la $GITHUB_WORKSPACE
- name: Run integration tests
run: |
chmod +x install.sh # Ensure root install.sh is executable BEFORE test script copies it
chmod +x .github/scripts/test-integration.sh
./.github/scripts/test-integration.sh
- name: Debug Workspace (After Script)
if: always() # Run this even if the script fails
run: |
echo "Listing $GITHUB_WORKSPACE after script execution:"
ls -la $GITHUB_WORKSPACE
echo "Contents of $GITHUB_WORKSPACE/integration-report.md (if it exists):"
cat $GITHUB_WORKSPACE/integration-report.md || echo "integration-report.md not found by cat command"
- name: Upload integration report
if: always()
uses: actions/upload-artifact@v4
with:
name: integration-report
path: integration-report.md
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [shellcheck, syntax-validation, functional-testing, security-scanning, documentation-validation, integration-testing]
if: always()
steps:
- name: Generate test summary
run: |
echo "# Test Summary" > test-summary.md
echo "" >> test-summary.md
echo "## Results Overview" >> test-summary.md
echo "- ShellCheck: ${{ needs.shellcheck.result }}" >> test-summary.md
echo "- Syntax Validation: ${{ needs.syntax-validation.result }}" >> test-summary.md
echo "- Functional Testing: ${{ needs.functional-testing.result }}" >> test-summary.md
echo "- Security Scanning: ${{ needs.security-scanning.result }}" >> test-summary.md
echo "- Documentation Validation: ${{ needs.documentation-validation.result }}" >> test-summary.md
echo "- Integration Testing: ${{ needs.integration-testing.result }}" >> test-summary.md
echo "" >> test-summary.md
echo "## Overall Status" >> test-summary.md
if [[ "${{ needs.shellcheck.result }}" == "success" && \
"${{ needs.syntax-validation.result }}" == "success" && \
"${{ needs.functional-testing.result }}" == "success" && \
"${{ needs.security-scanning.result }}" == "success" && \
"${{ needs.documentation-validation.result }}" == "success" && \
"${{ needs.integration-testing.result }}" == "success" ]]; then
echo "✅ ALL TESTS PASSED" >> test-summary.md
else
echo "❌ SOME TESTS FAILED" >> test-summary.md
fi
- name: Upload test summary
uses: actions/upload-artifact@v4
with:
name: test-summary
path: test-summary.md