Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: update Sonar #810

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- '**'
tags:
- '*'

jobs:
test-build:
Expand All @@ -17,35 +15,42 @@ jobs:
with:
node-version: 20
- run: yarn
# Run tests & build sonar reports
- run: yarn test:coverage
# Build lib
- run: yarn build
- name: Upload deploy artifact
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage/
- name: Upload deploy artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: build
path: dist/

sonarcloud:
name: SonarCloud Analysis
runs-on: ubuntu-latest
needs: test-build
needs: test-build # Ensure SonarCloud job runs after the test-build job
if: ${{ github.event_name == 'pull_request' }} # Only run SonarCloud on pull requests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage
path: coverage

- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
uses: sonarsource/sonarcloud-github-action@v1.13
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
-Dsonar.pullrequest.branch=${{ github.head_ref }}
-Dsonar.pullrequest.base=${{ github.base_ref }}
21 changes: 8 additions & 13 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
sonar.projectKey=InseeFr_Pogues
sonar.organization=inseefr
sonar.host.url=https://sonarcloud.io

# Project name & version
sonar.projectName=Pogues
sonar.projectVersion=1.2.0

# Path to sources
# # Path to sources
sonar.sources=src
sonar.exclusions=src/**/*.spec.js, jison/**/*, src/**/vtl-suggestions.js, src/**/__mocks__/*
sonar.exclusions=src/**/*.spec.jsx, jison/**/*, src/**/vtl-suggestions.jsx, src/**/__mocks__/*

# Path to tests
sonar.test.inclusions=src/**/*.spec.js
# # Path to tests
sonar.test.inclusions=src/**/*.spec.jsx

# Coverage
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
sonar.coverage.exclusions=src/**/*.spec.js
# # Coverage
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.coverage.exclusions=src/**/*.spec.jsx

# Source encoding
# # Source encoding
sonar.sourceEncoding=UTF-8
Loading