-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (84 loc) · 2.47 KB
/
ci.yml
File metadata and controls
90 lines (84 loc) · 2.47 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
name: ci
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
security-events: write
packages: write
id-token: write
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
service: [api, worker]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
- name: go mod tidy
working-directory: services/${{ matrix.service }}
run: go mod tidy
- name: go vet
working-directory: services/${{ matrix.service }}
run: go vet ./...
- name: go test
working-directory: services/${{ matrix.service }}
run: go test -race -count=1 ./...
helm-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azure/setup-helm@v4
- run: helm lint deploy/helm/postgres deploy/helm/api deploy/helm/worker
terraform-fmt:
runs-on: ubuntu-latest
strategy:
matrix:
env: [local, cloud]
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
- run: terraform -chdir=infra/terraform/${{ matrix.env }} fmt -check
- run: terraform -chdir=infra/terraform/${{ matrix.env }} init -backend=false
- run: terraform -chdir=infra/terraform/${{ matrix.env }} validate
build-scan:
runs-on: ubuntu-latest
needs: [test, helm-lint]
strategy:
matrix:
service: [api, worker]
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
context: services/${{ matrix.service }}
load: true
tags: devsecops-platform-${{ matrix.service }}:ci
- name: Trivy image scan
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: devsecops-platform-${{ matrix.service }}:ci
severity: CRITICAL,HIGH
exit-code: "1"
ignore-unfixed: true
- name: Trivy SARIF
if: always()
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: devsecops-platform-${{ matrix.service }}:ci
format: sarif
output: trivy-${{ matrix.service }}.sarif
severity: CRITICAL,HIGH
ignore-unfixed: true
- uses: github/codeql-action/upload-sarif@v3
if: always()
with:
sarif_file: trivy-${{ matrix.service }}.sarif
category: ${{ matrix.service }}