1- ---
2-
31name : Node.js CI Coverage
42
53on : # yamllint disable-line rule:truthy
64 push :
75 branches : ["main"]
86 pull_request :
9- # The branches below must be a subset of the branches above
107 branches : ["main"]
118 workflow_dispatch :
129
1310jobs :
14- coverage :
15- name : NodeJS CI Coverage
11+ build-and-test :
12+ name : Build, Lint & Test
1613 runs-on : ubuntu-24.04
14+
1715 steps :
1816 - name : Checkout repository
1917 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
@@ -23,23 +21,62 @@ jobs:
2321 - name : Set up Node.js
2422 uses : actions/setup-node@v4
2523 with :
26- node-version : 22 .x
24+ node-version : 24 .x
2725
2826 - name : Install dependencies
2927 run : npm ci --verbose
3028
29+ - name : Lint
30+ run : npm run lint
31+
3132 - name : Run the tests
3233 run : npm run jest:ci -- --coverage
3334
34- - name : Upload coverage reports to Codecov with GitHub Action
35+ # Subir cobertura como artifact para que otros jobs lo usen
36+ - name : Upload coverage artifact
37+ uses : actions/upload-artifact@v4
38+ with :
39+ name : coverage-report
40+ path : coverage # o la carpeta donde jest genera los reportes
41+
42+
43+ codecov :
44+ name : Upload to Codecov
45+ runs-on : ubuntu-24.04
46+ needs : build-and-test
47+
48+ steps :
49+ - name : Download coverage artifact
50+ uses : actions/download-artifact@v4
51+ with :
52+ name : coverage-report
53+ path : coverage
54+
55+ - name : Upload coverage reports to Codecov
3556 uses : codecov/codecov-action@v5
3657 with :
37- token : ${{ secrets.CODECOV_TOKEN }} # required
38- verbose : true # optional (default = false)
58+ token : ${{ secrets.CODECOV_TOKEN }}
59+ verbose : true
60+
61+ sonarqube :
62+ name : Analyze with SonarQube
63+ runs-on : ubuntu-24.04
64+ needs : build-and-test
65+
66+ steps :
67+ - name : Checkout repository
68+ uses : actions/checkout@v5
69+ with :
70+ fetch-depth : 0
71+
72+ - name : Download coverage artifact
73+ uses : actions/download-artifact@v4
74+ with :
75+ name : coverage-report
76+ path : coverage
3977
40- - name : Analyze with SonarQube / SonarCloud
78+ - name : SonarQube Scan
4179 uses : SonarSource/sonarqube-scan-action@master
4280 env :
4381 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
44- # Needed to get PR information, if any
4582 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments