2020-03-11 16:35:04 +00:00
|
|
|
#Trying to set up the CI, probably won't work
|
|
|
|
image: gradle:jdk13
|
|
|
|
|
|
|
|
stages:
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- code_quality
|
|
|
|
- deploy
|
|
|
|
|
|
|
|
#Sets up the docker
|
|
|
|
smarthut_deploy:
|
|
|
|
stage: deploy
|
|
|
|
image: docker:latest
|
2020-03-16 13:28:35 +00:00
|
|
|
tags:
|
|
|
|
- dind
|
2020-02-28 08:30:20 +00:00
|
|
|
services:
|
2020-03-11 16:35:04 +00:00
|
|
|
- docker:dind
|
|
|
|
variables:
|
|
|
|
DOCKER_DRIVER: overlay
|
|
|
|
before_script:
|
|
|
|
- docker version
|
|
|
|
- docker info
|
|
|
|
- docker login -u smarthutsm -p $CI_DOCKER_PASS #GiovanniRoberto
|
2020-02-28 08:30:20 +00:00
|
|
|
script:
|
2020-03-18 15:08:49 +00:00
|
|
|
- "docker build -t smarthutsm/smarthut-backend:${CI_COMMIT_BRANCH} --pull ."
|
|
|
|
- "docker push smarthutsm/smarthut-backend:${CI_COMMIT_BRANCH}"
|
2020-03-11 16:35:04 +00:00
|
|
|
after_script:
|
|
|
|
- docker logout
|
2020-03-18 15:08:49 +00:00
|
|
|
only:
|
|
|
|
- dev
|
|
|
|
- master
|
2020-03-11 16:35:04 +00:00
|
|
|
|
|
|
|
#base checks for the code
|
|
|
|
build:
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- gradle clean
|
|
|
|
- gradle assemble
|
2020-02-28 08:30:20 +00:00
|
|
|
artifacts:
|
2020-03-11 16:35:04 +00:00
|
|
|
paths:
|
|
|
|
- build/libs/*.jar
|
|
|
|
expire_in: 1 week
|
|
|
|
|
|
|
|
#Runs the various tests and creates a report on the test coverage
|
|
|
|
test:
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- gradle test
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- build/test-results/test/TEST-*.xml
|
2020-02-28 08:30:20 +00:00
|
|
|
reports:
|
2020-03-11 16:35:04 +00:00
|
|
|
junit: build/test-results/test/TEST-*.xml
|
|
|
|
|
2020-05-07 11:39:08 +00:00
|
|
|
sonarqube:
|
|
|
|
image: gradle:jdk11
|
2020-03-11 16:35:04 +00:00
|
|
|
stage: code_quality
|
2020-05-07 11:39:08 +00:00
|
|
|
only:
|
|
|
|
- dev
|
2020-03-11 16:35:04 +00:00
|
|
|
script:
|
2020-05-07 11:49:32 +00:00
|
|
|
- gradle build jacocoTestReport sonarqube -Dsonar.verbose=true -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_LOGIN -Dsonar.projectKey=$CI_PROJECT_PATH_SLUG -Dsonar.projectName=$CI_PROJECT_PATH_SLUG -Dsonar.scm.disabled=True -Dsonar.coverage.jacoco.xmlReportPaths=./build/reports/jacoco/test/jacocoTestReport.xml
|