From b68fcec29a5e90ea8c8c8482bdc66f48c79f2954 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Wed, 14 Jan 2026 22:04:21 +0200 Subject: More CI improvements --- .gitignore | 2 +- .gitlab-ci.yml | 72 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 8a401cc..908ca94 100644 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,4 @@ build/ hs_err_* ### GitLab CI ### -/.m2 +/.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 @@ variables: - M2_REPO: ".m2/repository" - MAVEN_OPTS: "-Dmaven.repo.local=$M2_REPO" + 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: - - .m2/repository + - .cache/ - target/ + - buildstuffs/target/ stages: + - cache - lint - build + - test - deploy -pre-commit-job: +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-repro-job: +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 it's reproducible, don't update the 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" -# TODO: Should run owasp plugin but that beast is complaining about too many requests :confused: -build-job: - stage: build +# NOTE: This one never fails on updates, that's left for test-libyear +test-versions-update: + stage: test + artifacts: + paths: + - update.diff script: - - ./mvnw verify + - ./mvnw versions:update-child-modules versions:update-parent versions:update-properties + - git diff | tee update.diff -deploy-job: +deploy: stage: deploy environment: production script: - ./mvnw -s ci/mvn-settings.xml deploy rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE != "schedule" -- cgit v1.2.3