Commit 20933aec authored by Pascal Grimaud's avatar Pascal Grimaud

Add Jenkins and GitLab

parent 99e6134e
Pipeline #7648 failed
image: jhipster/jhipster:v5.7.0
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- .maven/
stages:
- build
- test
- analyze
- package
- release
- deploy
before_script:
- export MAVEN_USER_HOME=`pwd`/.maven
- ./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v10.13.0 -DnpmVersion=6.4.1 -Dmaven.repo.local=$MAVEN_USER_HOME
- ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dmaven.repo.local=$MAVEN_USER_HOME
maven-compile:
stage: build
script:
- ./mvnw compile -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
paths:
- target/classes/
- target/generated-sources/
expire_in: 1 day
maven-test:
stage: test
script:
- ./mvnw test -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
reports:
junit: target/surefire-reports/TEST-*.xml
paths:
- target/test-results
expire_in: 1 day
frontend-test:
stage: test
script:
# You should use default argument instead: 'test'
# See documentation at https://www.jhipster.tech/setting-up-ci/
# - ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.npm.arguments='test' -Dmaven.repo.local=$MAVEN_USER_HOME
- ./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.npm.arguments='test' -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
reports:
junit: target/test-results/jest/TESTS-*.xml
paths:
- target/test-results
expire_in: 1 day
maven-package:
stage: package
script:
- ./mvnw verify -Pprod -DskipTests -Dmaven.repo.local=$MAVEN_USER_HOME
artifacts:
paths:
- target/*.war
expire_in: 1 day
# Uncomment the following line to use gitlabs container registry. You need to adapt the REGISTRY_URL in case you are not using gitlab.com
#docker-push:
# image: docker:latest
# services:
# - docker:dind
# variables:
# REGISTRY_URL: registry.gitlab.com
# DOCKER_HOST: tcp://docker:2375
# DOCKER_DRIVER: overlay2
# IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
# stage: release
# dependencies:
# - maven-package
# before_script:
# - docker info
# - cp target/*.war src/main/docker
# script:
# - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $REGISTRY_URL
# - docker build -f src/main/docker/Dockerfile -t $IMAGE_TAG src/main/docker
# - docker push $IMAGE_TAG
#!/usr/bin/env groovy
node {
stage('checkout') {
checkout scm
}
stage('check java') {
sh "java -version"
}
stage('clean') {
sh "chmod +x mvnw"
sh "./mvnw clean"
}
stage('install tools') {
sh "./mvnw com.github.eirslett:frontend-maven-plugin:install-node-and-npm -DnodeVersion=v10.13.0 -DnpmVersion=6.4.1"
}
stage('npm install') {
sh "./mvnw com.github.eirslett:frontend-maven-plugin:npm"
}
stage('backend tests') {
try {
sh "./mvnw test"
} catch(err) {
throw err
} finally {
junit '**/target/surefire-reports/TEST-*.xml'
}
}
stage('frontend tests') {
try {
sh "./mvnw com.github.eirslett:frontend-maven-plugin:npm -Dfrontend.npm.arguments='test'"
} catch(err) {
throw err
} finally {
junit '**/target/test-results/jest/TESTS-*.xml'
}
}
stage('packaging') {
sh "./mvnw verify -Pprod -DskipTests"
archiveArtifacts artifacts: '**/target/*.war', fingerprint: true
}
}
version: '2'
services:
jenkins:
image: jenkins:latest
ports:
- 49001:8080
- 50000:50000
# uncomment for docker in docker
#privileged: true
#volumes:
# enable persistent volume (warning: make sure that the local jenkins_home folder is created)
#- ~/volumes/jenkins_home:/var/jenkins_home
# mount docker sock and binary for docker in docker (only works on linux)
#- /var/run/docker.sock:/var/run/docker.sock
#- /usr/bin/docker:/usr/bin/docker
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment