summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: a8025f13c862bc068fc9801ec9aef10bb32329bf (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
variables:
  XDG_CACHE_HOME: "${CI_PROJECT_DIR}/.cache"
  M2_REPO: "${XDG_CACHE_HOME}/m2/repository"
  MAVEN_OPTS: "-Dmaven.repo.local=${M2_REPO}"
  PRE_COMMIT_HOME: "${XDG_CACHE_HOME}/pre-commit"

default:
  image: registry.gitlab.com/lv.enes/containers/build-env:latest
  cache:
    paths:
      - .cache/
      - target/
      - buildstuffs/target/

stages:
  - cache
  - lint
  - build
  - test
  - deploy

# Can't do this, it tries to fetch buildstuffs which is outdated...
# cache-maven:
#   stage: cache
#   script:
#     - ./mvnw dependency:go-offline

lint-pre-commit:
  stage: lint
  script:
    - pre-commit run -a
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule"

build:
  stage: build
  script:
    - ./mvnw install
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule"

# Currently this one is just dependency-check, it didn't like my requests to populate the cache before, so leaving it
# off for now...
# test-all:
#   stage: test
#   script:
#     - ./mvnw verify -Denv=test

test-libyear:
  stage: test
  script:
   - ./mvnw verify -DmaxLibYears=1

# NOTE: This one always fails when there's an update available
test-pre-commit-update:
  stage: test
  artifacts:
    paths:
      - update.diff
    when: on_failure
  script:
    - pre-commit autoupdate
    - git diff --exit-code | tee update.diff

test-repro:
  stage: test
  cache:
    # This job deletes stuff from the maven repository to make sure the parent is reproducible, don't update the cache
    policy: pull
  script:
    - ./build.sh
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule"

# NOTE: This one never fails on updates, that's left for test-libyear
test-versions-update:
  stage: test
  artifacts:
    paths:
      - update.diff
  script:
    - ./mvnw versions:update-child-modules versions:update-parent versions:update-properties
    - git diff | tee update.diff

deploy:
  stage: deploy
  environment: production
  script:
    - ./mvnw -s ci/mvn-settings.xml deploy
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule"