summaryrefslogtreecommitdiff
path: root/pse-server/.gitlab-ci.yml
blob: 94048443f9caf42bfb2952e8c89821476b0af7c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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