Merge pull request #754 from sir-gon/develop #162
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Node.js CI Coverage | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
name: Build, Lint & Test | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Install dependencies | |
run: npm ci --verbose | |
- name: Lint | |
run: npm run lint | |
- name: Run the tests | |
run: npm run jest:ci -- --coverage | |
# Subir cobertura como artifact para que otros jobs lo usen | |
- name: Upload coverage artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-report | |
path: coverage # o la carpeta donde jest genera los reportes | |
codecov: | |
name: Upload to Codecov | |
runs-on: ubuntu-24.04 | |
needs: build-and-test | |
steps: | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v5 | |
with: | |
name: coverage-report | |
path: coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
sonarqube: | |
name: Analyze with SonarQube | |
runs-on: ubuntu-24.04 | |
needs: build-and-test | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- name: Download coverage artifact | |
uses: actions/download-artifact@v5 | |
with: | |
name: coverage-report | |
path: coverage | |
- name: SonarQube Scan | |
uses: SonarSource/sonarqube-scan-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |