Repository navigation
138 lines (115 loc) · 3.57 KB
/
Copy pathci.yml
File metadata and controls
138 lines (115 loc) · 3.57 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
backend:
name: Backend — Test & Build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
cache: maven
- name: Test y cobertura
run: mvn -B verify
working-directory: backend
- name: Subir reporte JaCoCo
uses: actions/upload-artifact@v7
with:
name: jacoco-report
path: backend/target/site/jacoco/jacoco.xml
frontend:
name: Frontend — Lint, Test & Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '20'
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Instalar dependencias
run: npm ci
working-directory: frontend
- name: Lint
run: npm run lint
working-directory: frontend
- name: Tests con cobertura
run: npm run test:coverage
working-directory: frontend
- name: Build
run: npm run build
working-directory: frontend
- name: Audit production dependencies
run: npm audit --audit-level=high --omit=dev
working-directory: frontend
- name: Subir reporte lcov
uses: actions/upload-artifact@v7
if: always()
with:
name: lcov-report
path: frontend/coverage/lcov.info
security:
name: Security — IaC Scan
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Trivy IaC scan
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: config
scan-ref: .
severity: HIGH,CRITICAL
exit-code: '1'
format: table
sonar:
name: SonarCloud
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [backend, frontend]
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v5
with:
java-version: '21'
distribution: temurin
cache: maven
- name: Descargar reporte JaCoCo
uses: actions/download-artifact@v8
with:
name: jacoco-report
path: backend/target/site/jacoco
- name: Descargar reporte lcov
uses: actions/download-artifact@v8
with:
name: lcov-report
path: frontend/coverage
- name: Ajustar rutas lcov para SonarCloud
run: sed -i 's|^SF:src/|SF:frontend/src/|g' frontend/coverage/lcov.info
- name: Compilar backend y resolver dependencias (para Sonar)
run: mvn -B compile dependency:copy-dependencies -DincludeScope=compile -DoutputDirectory=target/dependency -DskipTests
working-directory: backend
- name: Análisis SonarCloud
uses: SonarSource/sonarqube-scan-action@v8
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Quality Gate
uses: SonarSource/sonarqube-quality-gate-action@v1.2.0
timeout-minutes: 5
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: https://sonarcloud.io
with:
scanMetadataReportFile: .scannerwork/report-task.txt