diff --git a/.circleci/config.yml b/.circleci/config.yml index 178aae6..a313486 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: docker: circleci/docker@2.1.1 node: circleci/node@5.0.2 - + sonarcloud: sonarsource/sonarcloud@2.0.0 jobs: generate_schema: executor: @@ -45,14 +45,23 @@ jobs: docker build --network=flexo-mms-test-network -t flexo-mms-test:latest -f Dockerfile-Test . docker run --network=flexo-mms-test-network --name flexo-mms-test-container flexo-mms-test:latest SIG_INT=$? - docker cp flexo-mms-test-container:/application/build/reports/tests /home/circleci/results + docker cp flexo-mms-test-container:/application/build /home/circleci/flexo-mms-layer1-service/build exit "$SIG_INT" - store_artifacts: - path: /home/circleci/results + path: /home/circleci/flexo-mms-layer1-service/build - persist_to_workspace: root: /home/circleci/ paths: - flexo-mms-layer1-service/* + scan: + executor: + name: docker/docker + working_directory: /home/circleci/flexo-mms-layer1-service + steps: + - checkout + - attach_workspace: + at: /home/circleci/flexo-mms-layer1-service + - sonarcloud/scan deploy_snapshot: executor: @@ -132,6 +141,11 @@ workflows: version: 2 build-test-deploy: jobs: + - scan: + requires: + - build_and_test + context: + - SonarCloud - generate_schema: filters: tags: @@ -139,6 +153,11 @@ workflows: context: - DockerHub - build_and_test: + post-steps: + - persist_to_workspace: + root: /home/circleci/flexo-mms-layer1-service + paths: + - build/* requires: - generate_schema filters: diff --git a/README.md b/README.md index c337868..cc3aebb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,11 @@ # Flexo MMS Layer 1 -[![CircleCI](https://circleci.com/gh/Open-MBEE/flexo-mms-layer1-service.svg?style=shield)](https://circleci.com/gh/Open-MBEE/flexo-mms-layer1-service) +[![CircleCI](https://circleci.com/gh/Open-MBEE/flexo-mms-layer1-service.svg?style=shield)](https://circleci.com/gh/Open-MBEE/flexo-mms-layer1-service) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) +
+ SonarCloud + +[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=bugs)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=Open-MBEE_flexo-mms-layer1-service&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=Open-MBEE_flexo-mms-layer1-service) +
This project is currently under development. This document describes how to set up a local dev environment. diff --git a/build.gradle.kts b/build.gradle.kts index 023df2f..6c26470 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,10 +5,21 @@ plugins { kotlin("jvm") version "1.9.20" kotlin("plugin.serialization") version "1.9.20" jacoco + id("org.sonarqube") version "4.4.1.3373" } group = "org.openmbee.flexo.mms" version = "0.1.0-ALPHA" + +sonar { + properties { + property("sonar.projectKey", "Open-MBEE_flexo-mms-layer1-service") + property("sonar.organization", "openmbee") + property("sonar.host.url", "https://sonarcloud.io") + property("sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml") + } +} + application { mainClass.set("io.ktor.server.netty.EngineMain") } @@ -108,4 +119,7 @@ tasks.test { } tasks.jacocoTestReport { dependsOn(tasks.test) // tests are required to run before generating the report + reports { + xml.required.set(true) + } } diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..d48f945 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,4 @@ +sonar.projectKey=Open-MBEE_flexo-mms-layer1-service +sonar.organization=openmbee +sonar.language=kotlin +sonar.coverage.jacoco.xmlReportPaths=build/reports/jacoco/test/jacocoTestReport.xml \ No newline at end of file