11---
2-
32name : Node.js CI Coverage
43
54on : # yamllint disable-line rule:truthy
65 push :
76 branches : ["main"]
87 pull_request :
9- # The branches below must be a subset of the branches above
108 branches : ["main"]
119 workflow_dispatch :
1210
1311jobs :
14- coverage :
15- name : NodeJS CI Coverage
12+ build-and-test :
13+ name : Build, Lint & Test
1614 runs-on : ubuntu-24.04
15+
1716 steps :
1817 - name : Checkout repository
1918 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
@@ -23,23 +22,62 @@ jobs:
2322 - name : Set up Node.js
2423 uses : actions/setup-node@v4
2524 with :
26- node-version : 22 .x
25+ node-version : 24 .x
2726
2827 - name : Install dependencies
2928 run : npm ci --verbose
3029
30+ - name : Lint
31+ run : npm run lint
32+
3133 - name : Run the tests
3234 run : npm run jest:ci -- --coverage
3335
34- - name : Upload coverage reports to Codecov with GitHub Action
36+ # Subir cobertura como artifact para que otros jobs lo usen
37+ - name : Upload coverage artifact
38+ uses : actions/upload-artifact@v4
39+ with :
40+ name : coverage-report
41+ path : coverage # o la carpeta donde jest genera los reportes
42+
43+
44+ codecov :
45+ name : Upload to Codecov
46+ runs-on : ubuntu-24.04
47+ needs : build-and-test
48+
49+ steps :
50+ - name : Download coverage artifact
51+ uses : actions/download-artifact@v4
52+ with :
53+ name : coverage-report
54+ path : coverage
55+
56+ - name : Upload coverage reports to Codecov
3557 uses : codecov/codecov-action@v5
3658 with :
37- token : ${{ secrets.CODECOV_TOKEN }} # required
38- verbose : true # optional (default = false)
59+ token : ${{ secrets.CODECOV_TOKEN }}
60+ verbose : true
61+
62+ sonarqube :
63+ name : Analyze with SonarQube
64+ runs-on : ubuntu-24.04
65+ needs : build-and-test
66+
67+ steps :
68+ - name : Checkout repository
69+ uses : actions/checkout@v5
70+ with :
71+ fetch-depth : 0
72+
73+ - name : Download coverage artifact
74+ uses : actions/download-artifact@v4
75+ with :
76+ name : coverage-report
77+ path : coverage
3978
40- - name : Analyze with SonarQube / SonarCloud
79+ - name : SonarQube Scan
4180 uses : SonarSource/sonarqube-scan-action@master
4281 env :
4382 SONAR_TOKEN : ${{ secrets.SONAR_TOKEN }}
44- # Needed to get PR information, if any
4583 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments