57 lines
1.3 KiB
YAML
57 lines
1.3 KiB
YAML
# https://about.gitlab.com/blog/2016/12/14/continuous-delivery-of-a-spring-boot-application-with-gitlab-ci-and-kubernetes/
|
|
|
|
services:
|
|
- mariadb:latest
|
|
|
|
variables:
|
|
MYSQL_DATABASE: "demo"
|
|
MYSQL_ROOT_PASSWORD: "dbpass"
|
|
MYSQL_USER: "pse"
|
|
MYSQL_PASSWORD: "PSEsq1702!mdb"
|
|
SPRING_DATASOURCE_URL: "jdbc:mariadb://mariadb:3306/demo"
|
|
|
|
stages:
|
|
- deploy
|
|
- build
|
|
- test
|
|
# - package
|
|
|
|
checkstyle:
|
|
image: maven:3.8-eclipse-temurin-17-alpine
|
|
stage: test
|
|
script:
|
|
- "mvn checkstyle:check"
|
|
allow_failure: true
|
|
|
|
spring-test:
|
|
image: maven:3.8-eclipse-temurin-17-alpine
|
|
stage: test
|
|
script:
|
|
- "apk update && apk add mysql-client"
|
|
- "mvn test"
|
|
|
|
pages:
|
|
image: maven:3.8-eclipse-temurin-17-alpine
|
|
script:
|
|
- "apk update && apk add mysql-client"
|
|
- "mkdir -p public/{checkstyle,surefire}"
|
|
- "mvn checkstyle:checkstyle"
|
|
- "mv target/site/* public/checkstyle"
|
|
- "mvn surefire-report:report"
|
|
- "mv target/site/* public/surefire"
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
|
|
# https://stackoverflow.com/questions/37403120/gitlab-ci-docker-executor-how-to-setup-mysql-service
|
|
maven-build:
|
|
image: maven:3.8-eclipse-temurin-17-alpine
|
|
stage: build
|
|
script:
|
|
- "mvn package -B -DskipTests"
|
|
artifacts:
|
|
paths:
|
|
- target/*.jar
|