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:
|
#Trying to set up the CI, probably won't work
|
||||||
image: docker:stable
|
image: gradle:jdk13
|
||||||
variables:
|
|
||||||
DOCKER_DRIVER: overlay2
|
stages:
|
||||||
allow_failure: true
|
- build
|
||||||
|
- test
|
||||||
|
- code_quality
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
#Sets up the docker
|
||||||
|
smarthut_deploy:
|
||||||
|
stage: deploy
|
||||||
|
image: docker:latest
|
||||||
services:
|
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:
|
script:
|
||||||
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
|
- "docker build -t smarthutsm/smarthut:${CI_COMMIT_BRANCH} --pull ."
|
||||||
- docker run
|
- "docker push smarthutsm/smarthut:${CI_COMMIT_BRANCH}"
|
||||||
--env SOURCE_CODE="$PWD"
|
after_script:
|
||||||
--volume "$PWD":/code
|
- docker logout
|
||||||
--volume /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
|
|
||||||
|
#base checks for the code
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- gradle clean
|
||||||
|
- gradle assemble
|
||||||
artifacts:
|
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:
|
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 {
|
plugins {
|
||||||
id 'org.springframework.boot' version '2.2.4.RELEASE'
|
id 'org.springframework.boot' version '2.2.4.RELEASE'
|
||||||
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
||||||
|
id "de.aaschmid.cpd" version "3.1"
|
||||||
id 'java'
|
id 'java'
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'ch.usi.inf.sa4.sanmarinoes.'
|
group = 'ch.usi.inf.sa4.sanmarinoes'
|
||||||
version = '0.0.1-SNAPSHOT'
|
version = '0.0.1-SNAPSHOT'
|
||||||
sourceCompatibility = "11"
|
sourceCompatibility = '11'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
jcenter()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final'
|
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 'org.springframework.boot:spring-boot-starter'
|
||||||
|
|
||||||
implementation 'com.sun.mail:javax.mail:1.6.2'
|
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-data-jpa'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-security'
|
implementation 'org.springframework.boot:spring-boot-starter-security'
|
||||||
|
@ -28,6 +31,7 @@ dependencies {
|
||||||
compile 'io.springfox:springfox-swagger-ui:2.9.2'
|
compile 'io.springfox:springfox-swagger-ui:2.9.2'
|
||||||
compile "org.springframework.boot:spring-boot-configuration-processor"
|
compile "org.springframework.boot:spring-boot-configuration-processor"
|
||||||
|
|
||||||
|
|
||||||
implementation('org.springframework.boot:spring-boot-starter-web') {
|
implementation('org.springframework.boot:spring-boot-starter-web') {
|
||||||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-json'
|
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
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
|
||||||
|
|
Loading…
Reference in a new issue