Fakultas Ilmu Komputer UI

Commit a0d86ab9 authored by Ahmad Izzudin Alifyandra's avatar Ahmad Izzudin Alifyandra
Browse files

Merge branch 'setup-sonarqube' into 'master'

Setup SonarQube w/ Gitlab CI

See merge request !65
parents 9d299fab 68e6e379
Pipeline #85908 passed with stage
in 7 minutes and 28 seconds
...@@ -8,7 +8,8 @@ npm-debug.* ...@@ -8,7 +8,8 @@ npm-debug.*
*.mobileprovision *.mobileprovision
*.orig.* *.orig.*
web-build/ web-build/
/ios ios/
.scannerwork/
.env .env
jest/coverage jest/coverage
......
# Asumsi:
# 1. Source code telah mengandung berkas konfigurasi sonar-project.properties
# di root folder source code.
# 2. CI job untuk pemanggilan analisis SonarScanner dipanggil sebagai salah
# satu job di stage test.
# Credits: Contoh konfigurasi GitLab CI/CD proyek Kape bagian dari proyek
# kuliah PMPL
# Build:
# image:
# name: node:14
# entrypoint: [""]
# stage: build
# script:
# - yarn
# artifacts:
# paths:
# - node_modules/
# expire_in: 1 day
SonarScanner:
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
stage: test
script:
- npm i -g yarn
- yarn
- yarn upgrade typescript@3.7
- yarn test-ci
- sonar-scanner
-Dsonar.host.url=https://pmpl.cs.ui.ac.id/sonarqube
-Dsonar.login=$SONARQUBE_TOKEN
-Dsonar.branch.name=$CI_COMMIT_REF_NAME
\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"web": "expo start --web", "web": "expo start --web",
"eject": "expo eject", "eject": "expo eject",
"test": "jest --watchAll", "test": "jest --watchAll",
"test-ci": "jest",
"lint": "eslint --ext .tsx --ext .ts src/", "lint": "eslint --ext .tsx --ext .ts src/",
"format": "prettier --check ./src", "format": "prettier --check ./src",
"prepare": "husky install" "prepare": "husky install"
......
# SonarScanner properties file
## Server
sonar.host.url=https://pmpl.cs.ui.ac.id/sonarqube
sonar.login=${env.SONARQUBE_TOKEN}
## Project configuration
sonar.projectKey=${env.SONARQUBE_PROJECT_KEY}
## Path to sources
sonar.sources=src
sonar.exclusions=.github/**, .vscode/**, android/**, assets/**, build/**, ios/**, node_modules/**, scripts/**, **/*test.tsx
#sonar.inclusions=
## Path to tests
sonar.tests=src
# sonar.test.exclusions=
sonar.test.inclusions=**/*.test.tsx, **/*.test.ts
## Source encoding
sonar.sourceEncoding=UTF-8
## Branch analysis
sonar.branch.name=${env.CI_COMMIT_REF_NAME}
sonar.javascript.lcov.reportPaths=jest/coverage/lcov.info
# sonar.testExecutionReportPaths=jest/coverage/clover.xml
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment