1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ devcontainer-test :
11+ runs-on : ubuntu-latest
12+ name : Test Devcontainer Build
13+ steps :
14+ - name : Checkout
15+ uses : actions/checkout@v4
16+
17+ - name : Build and test devcontainer
18+ uses :
devcontainers/[email protected] 19+ with :
20+ imageName : ghcr.io/idvoretskyi/dev
21+ runCmd : |
22+ # Test basic tools are available
23+ which docker
24+ which kubectl
25+ which helm
26+ which gh
27+ which node
28+ which npm
29+ # Test SSH server setup
30+ ls -la /run/sshd
31+ # Test essential packages
32+ curl --version
33+ jq --version
34+
35+ security-scan :
36+ runs-on : ubuntu-latest
37+ name : Security and SBOM Analysis
38+ steps :
39+ - name : Checkout
40+ uses : actions/checkout@v4
41+
42+ - name : Build Docker image for scanning
43+ run : |
44+ docker build -t dev-template:latest .devcontainer/
45+
46+ - name : Run Trivy vulnerability scanner
47+ uses : aquasecurity/trivy-action@master
48+ with :
49+ image-ref : ' dev-template:latest'
50+ format : ' sarif'
51+ output : ' trivy-results.sarif'
52+
53+ - name : Upload Trivy scan results to GitHub Security tab
54+ uses : github/codeql-action/upload-sarif@v3
55+ if : always()
56+ with :
57+ sarif_file : ' trivy-results.sarif'
58+
59+ - name : Generate SBOM
60+ uses : anchore/sbom-action@v0
61+ with :
62+ image : ' dev-template:latest'
63+ format : ' spdx-json'
64+ output-file : ' sbom.spdx.json'
65+
66+ - name : Upload SBOM as artifact
67+ uses : actions/upload-artifact@v4
68+ with :
69+ name : sbom
70+ path : sbom.spdx.json
71+
72+ lint-and-validate :
73+ runs-on : ubuntu-latest
74+ name : Lint and Validate Configuration
75+ steps :
76+ - name : Checkout
77+ uses : actions/checkout@v4
78+
79+ - name : Validate devcontainer.json
80+ uses :
devcontainers/[email protected] 81+ with :
82+ runCmd : devcontainer read-configuration --workspace-folder .
83+
84+ - name : Lint Dockerfile
85+ 86+ with :
87+ dockerfile : .devcontainer/Dockerfile
88+
89+ - name : Validate docker-compose.yml
90+ run : |
91+ docker-compose -f .devcontainer/docker-compose.yml config
92+
93+ - name : Check for secrets
94+ uses : gitleaks/gitleaks-action@v2
95+ env :
96+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments