diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index de8f7e2..ae4cebc 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,17 +1,40 @@ image: tshio/awscli-docker-compose-pipelines:0.0.3 -pipelines: - default: - - step: +definitions: + caches: + sonar: /opt/sonar-scanner/.sonar + + steps: + - step: &sonarqube-analysis + name: SonarQube analysis + image: sonarsource/sonar-scanner-cli:latest + caches: + - sonar + script: + - sonar-scanner + - step: &build + name: Build caches: - - node + - node services: - docker deployment: test script: - npm run docker-build - npm run lint + - docker-compose run -d --name js-container js + - docker exec js-container npm run services-units-coverage + - docker exec js-container npm run integration-tests + - docker cp js-container:/app/coverage . + - docker-compose stop js - npm run units + artifacts: + - coverage/** + +pipelines: + default: + - step: *build + - step: *sonarqube-analysis custom: create-staging: diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..999ba27 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,11 @@ +sonar.projectKey=boilerplate-express +sonar.projectName=express-boilerplate +sonar.organization=thesoftwarehouse +sonar.host.url=${env.SONAR_HOST_URL} +sonar.token=${env.SONAR_TOKEN} +sonar.exclusions=src/migrations/** +sonar.sources=src +sonar.tests=src +sonar.test.inclusions=**/*.spec.ts +sonar.sourceEncoding=UTF-8 +sonar.javascript.lcov.reportPaths=coverage/unit/lcov.info,coverage/integration/lcov.info \ No newline at end of file