Added an initial pipeline for the continous integration
This commit is contained in:
parent
046010d1d8
commit
9daa9a8a42
5 changed files with 72 additions and 18 deletions
|
@ -1,17 +1,60 @@
|
|||
code_quality:
|
||||
image: docker:stable
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay2
|
||||
allow_failure: true
|
||||
#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
|
||||
services:
|
||||
- docker:stable-dind
|
||||
- docker:dind
|
||||
variables:
|
||||
DOCKER_DRIVER: overlay
|
||||
before_script:
|
||||
- docker version
|
||||
- docker info
|
||||
- docker login -u smarthutsm -p $CI_DOCKER_PASS #GiovanniRoberto
|
||||
script:
|
||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
||||
- docker run
|
||||
--env SOURCE_CODE="$PWD"
|
||||
--volume "$PWD":/code
|
||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
||||
- "docker build -t smarthutsm/smarthut:${CI_COMMIT_BRANCH} --pull ."
|
||||
- "docker push smarthutsm/smarthut:${CI_COMMIT_BRANCH}"
|
||||
after_script:
|
||||
- docker logout
|
||||
|
||||
|
||||
#base checks for the code
|
||||
build:
|
||||
stage: build
|
||||
script:
|
||||
- gradle clean
|
||||
- gradle assemble
|
||||
artifacts:
|
||||
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
|
||||
reports:
|
||||
codequality: gl-code-quality-report.json
|
||||
junit: build/test-results/test/TEST-*.xml
|
||||
|
||||
#Runs a quality check on the code and creates a report on the codes
|
||||
code_quality:
|
||||
stage: code_quality
|
||||
script:
|
||||
- gradle cpdCheck
|
||||
artifacts:
|
||||
paths:
|
||||
- build/reports/cpd/cpdCheck.xml
|
||||
#create a report on the quality of the code
|
||||
expose_as: 'Code Quality Report'
|
||||
|
|
8
Dockerfile
Normal file
8
Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
|||
FROM openjdk:13-jdk-alpine
|
||||
ENV DB_URL ""
|
||||
ENV DB_USER ""
|
||||
ENV DB_PASS ""
|
||||
ARG JAR_FILE=build/libs/smarthut*.jar
|
||||
COPY ${JAR_FILE} app.jar
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["java","-jar","/app.jar"]
|
10
build.gradle
10
build.gradle
|
@ -1,21 +1,24 @@
|
|||
plugins {
|
||||
id 'org.springframework.boot' version '2.2.4.RELEASE'
|
||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||
id "de.aaschmid.cpd" version "3.1"
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group = 'ch.usi.inf.sa4.sanmarinoes.'
|
||||
group = 'ch.usi.inf.sa4.sanmarinoes'
|
||||
version = '0.0.1-SNAPSHOT'
|
||||
sourceCompatibility = "11"
|
||||
sourceCompatibility = '11'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
|
||||
compile "org.springframework.boot:spring-boot-starter-websocket"
|
||||
|
||||
implementation 'org.springframework.boot:spring-boot-starter'
|
||||
|
||||
implementation 'com.sun.mail:javax.mail:1.6.2'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
|
||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||
|
@ -28,6 +31,7 @@ dependencies {
|
|||
compile 'io.springfox:springfox-swagger-ui:2.9.2'
|
||||
compile "org.springframework.boot:spring-boot-configuration-processor"
|
||||
|
||||
|
||||
implementation('org.springframework.boot:spring-boot-starter-web') {
|
||||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-json'
|
||||
}
|
||||
|
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,5 @@
|
|||
#Thu Feb 20 21:04:58 CET 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||
|
|
Loading…
Reference in a new issue