@@ -2,44 +2,98 @@ name: CI
22
33on :
44 push :
5- branches : [main, develop]
5+ branches : [main, develop, 'feature/**', 'bugfix/**' ]
66 pull_request :
77 branches : [main, develop]
88
9+ permissions :
10+ contents : read
11+ security-events : write
12+
913jobs :
10- lint :
11- name : Lint
14+ validate :
15+ name : Validate Configuration
1216 runs-on : ubuntu-latest
1317 steps :
1418 - uses : actions/checkout@v4
15- - name : Validate docker-compose files
19+
20+ - name : Validate Docker Compose files
1621 run : |
1722 for f in docker/docker-compose.*.yml; do
18- echo "Validating \... "
19- docker compose -f "\ " config -q
23+ echo "Validating: $f "
24+ docker compose -f "$f " config -q
2025 done
21- - name : Lint shell scripts
26+
27+ - name : ShellCheck — lab test scripts
2228 run : |
23- sudo apt-get install -y shellcheck
24- shellcheck tests/labs/*.sh docker/entrypoint.sh
29+ sudo apt-get install -y shellcheck -qq
30+ shellcheck tests/labs/*.sh
2531
26- test-lab-01 :
27- name : Lab 01 — Standalone
28- runs-on : ubuntu-latest
29- needs : lint
30- steps :
31- - uses : actions/checkout@v4
32- - name : Run Lab 01
33- run : bash tests/labs/test-lab-03-01.sh
32+ - name : Validate module manifest
33+ run : |
34+ python3 -c "
35+ import sys, re
36+ with open('it-stack-postgresql.yml') as f:
37+ content = f.read()
38+ required = ['module:', 'version:', 'phase:', 'category:', 'ports:']
39+ missing = [k for k in required if k not in content]
40+ if missing:
41+ print('Missing fields:', missing); sys.exit(1)
42+ print('Manifest valid')
43+ "
3444
3545 security-scan :
3646 name : Security Scan
3747 runs-on : ubuntu-latest
38- needs : lint
48+ needs : validate
3949 steps :
4050 - uses : actions/checkout@v4
41- - name : Run Trivy on Dockerfile
42- uses : aquasecurity/trivy-action@master
51+
52+ - name : Trivy — scan Dockerfile
53+ uses : aquasecurity/trivy-action@0.28.0
54+ with :
55+ scan-type : config
56+ scan-ref : .
57+ exit-code : ' 0'
58+ severity : CRITICAL,HIGH
59+
60+ - name : Trivy — SARIF output
61+ uses : aquasecurity/trivy-action@0.28.0
4362 with :
4463 scan-type : config
4564 scan-ref : .
65+ format : sarif
66+ output : trivy-results.sarif
67+
68+ - name : Upload SARIF to GitHub Security
69+ uses : github/codeql-action/upload-sarif@v3
70+ if : always()
71+ with :
72+ sarif_file : trivy-results.sarif
73+
74+ lab-01-smoke :
75+ name : Lab 01 — Smoke Test
76+ runs-on : ubuntu-latest
77+ needs : validate
78+ steps :
79+ - uses : actions/checkout@v4
80+
81+ - name : Start standalone stack
82+ run : docker compose -f docker/docker-compose.standalone.yml up -d
83+
84+ - name : Wait for health
85+ run : |
86+ echo "Waiting for services to be healthy..."
87+ sleep 30
88+ docker compose -f docker/docker-compose.standalone.yml ps
89+
90+ - name : Run Lab 01 test script
91+ run : bash tests/labs/test-lab-01.sh
92+
93+ - name : Collect logs on failure
94+ if : failure()
95+ run : docker compose -f docker/docker-compose.standalone.yml logs
96+
97+ - name : Cleanup
98+ if : always()
99+ run : docker compose -f docker/docker-compose.standalone.yml down -v
0 commit comments