diff options
| author | 2026-01-14 22:04:21 +0200 | |
|---|---|---|
| committer | 2026-01-15 20:09:57 +0200 | |
| commit | b68fcec29a5e90ea8c8c8482bdc66f48c79f2954 (patch) | |
| tree | 98e950fef59cef34c0f57377275cb1d8b31d044c | |
| parent | Add libyear-maven-plugin (diff) | |
| download | lv.enes:parent-b68fcec29a5e90ea8c8c8482bdc66f48c79f2954.tar.gz lv.enes:parent-b68fcec29a5e90ea8c8c8482bdc66f48c79f2954.tar.xz lv.enes:parent-b68fcec29a5e90ea8c8c8482bdc66f48c79f2954.zip | |
More CI improvements
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | .gitlab-ci.yml | 72 |
2 files changed, 61 insertions, 13 deletions
| @@ -39,4 +39,4 @@ build/ | |||
| 39 | hs_err_* | 39 | hs_err_* |
| 40 | 40 | ||
| 41 | ### GitLab CI ### | 41 | ### GitLab CI ### |
| 42 | /.m2 | 42 | /.cache |
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6df673d..8ca9feb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml | |||
| @@ -1,42 +1,90 @@ | |||
| 1 | variables: | 1 | variables: |
| 2 | M2_REPO: ".m2/repository" | 2 | XDG_CACHE_HOME: "${CI_PROJECT_DIR}/.cache" |
| 3 | MAVEN_OPTS: "-Dmaven.repo.local=$M2_REPO" | 3 | M2_REPO: "${XDG_CACHE_HOME}/m2/repository" |
| 4 | MAVEN_OPTS: "-Dmaven.repo.local=${M2_REPO}" | ||
| 5 | PRE_COMMIT_HOME: "${XDG_CACHE_HOME}/pre-commit" | ||
| 4 | 6 | ||
| 5 | default: | 7 | default: |
| 6 | image: registry.gitlab.com/lv.enes/containers/build-env:latest | 8 | image: registry.gitlab.com/lv.enes/containers/build-env:latest |
| 7 | cache: | 9 | cache: |
| 8 | paths: | 10 | paths: |
| 9 | - .m2/repository | 11 | - .cache/ |
| 10 | - target/ | 12 | - target/ |
| 13 | - buildstuffs/target/ | ||
| 11 | 14 | ||
| 12 | stages: | 15 | stages: |
| 16 | - cache | ||
| 13 | - lint | 17 | - lint |
| 14 | - build | 18 | - build |
| 19 | - test | ||
| 15 | - deploy | 20 | - deploy |
| 16 | 21 | ||
| 17 | pre-commit-job: | 22 | cache-maven: |
| 23 | stage: cache | ||
| 24 | script: | ||
| 25 | - ./mvnw dependency:go-offline | ||
| 26 | |||
| 27 | lint-pre-commit: | ||
| 18 | stage: lint | 28 | stage: lint |
| 19 | script: | 29 | script: |
| 20 | - pre-commit run -a | 30 | - pre-commit run -a |
| 31 | rules: | ||
| 32 | - if: $CI_PIPELINE_SOURCE != "schedule" | ||
| 21 | 33 | ||
| 22 | build-repro-job: | 34 | build: |
| 23 | stage: build | 35 | stage: build |
| 36 | script: | ||
| 37 | - ./mvnw install | ||
| 38 | rules: | ||
| 39 | - if: $CI_PIPELINE_SOURCE != "schedule" | ||
| 40 | |||
| 41 | # Currently this one is just dependency-check, it didn't like my requests to populate the cache before, so leaving it | ||
| 42 | # off for now... | ||
| 43 | # test-all: | ||
| 44 | # stage: test | ||
| 45 | # script: | ||
| 46 | # - ./mvnw verify -Denv=test | ||
| 47 | |||
| 48 | test-libyear: | ||
| 49 | stage: test | ||
| 50 | script: | ||
| 51 | - ./mvnw verify -DmaxLibYears=1 | ||
| 52 | |||
| 53 | # NOTE: This one always fails when there's an update available | ||
| 54 | test-pre-commit-update: | ||
| 55 | stage: test | ||
| 56 | artifacts: | ||
| 57 | paths: | ||
| 58 | - update.diff | ||
| 59 | when: on_failure | ||
| 60 | script: | ||
| 61 | - pre-commit autoupdate | ||
| 62 | - git diff --exit-code | tee update.diff | ||
| 63 | |||
| 64 | test-repro: | ||
| 65 | stage: test | ||
| 24 | cache: | 66 | cache: |
| 25 | # This job deletes stuff from the maven repository to make sure it's reproducible, don't update the cache | 67 | # This job deletes stuff from the maven repository to make sure the parent is reproducible, don't update the cache |
| 26 | policy: pull | 68 | policy: pull |
| 27 | script: | 69 | script: |
| 28 | - ./build.sh | 70 | - ./build.sh |
| 71 | rules: | ||
| 72 | - if: $CI_PIPELINE_SOURCE != "schedule" | ||
| 29 | 73 | ||
| 30 | # TODO: Should run owasp plugin but that beast is complaining about too many requests :confused: | 74 | # NOTE: This one never fails on updates, that's left for test-libyear |
| 31 | build-job: | 75 | test-versions-update: |
| 32 | stage: build | 76 | stage: test |
| 77 | artifacts: | ||
| 78 | paths: | ||
| 79 | - update.diff | ||
| 33 | script: | 80 | script: |
| 34 | - ./mvnw verify | 81 | - ./mvnw versions:update-child-modules versions:update-parent versions:update-properties |
| 82 | - git diff | tee update.diff | ||
| 35 | 83 | ||
| 36 | deploy-job: | 84 | deploy: |
| 37 | stage: deploy | 85 | stage: deploy |
| 38 | environment: production | 86 | environment: production |
| 39 | script: | 87 | script: |
| 40 | - ./mvnw -s ci/mvn-settings.xml deploy | 88 | - ./mvnw -s ci/mvn-settings.xml deploy |
| 41 | rules: | 89 | rules: |
| 42 | - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH | 90 | - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule" |