chore: separate build and sonar jobs and update actions to latest versions

This commit is contained in:
ClaudiaFang 2026-04-25 04:22:06 +00:00
parent dc3c56dd9e
commit 4e5c95c019

View file

@ -6,28 +6,42 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- run: npm ci
- run: npm run test -- --coverage
- run: npm run build
# Upload coverage for the next job
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage/
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run test -- --coverage
sonar:
name: SonarQube
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download coverage
uses: actions/download-artifact@v4
with:
name: coverage-report
path: coverage/
- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v6.0.0
uses: SonarSource/sonarqube-scan-action@v7.1.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}