From 6c0764d25afc264b849f20526db83cfb1695ccdc Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 11 Jan 2026 05:19:42 +0000 Subject: GitLab CI setup --- .gitignore | 3 +++ .gitlab-ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ REUSE.toml | 7 +++++-- build.sh | 2 +- ci/mvn-settings.xml | 20 ++++++++++++++++++++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 ci/mvn-settings.xml diff --git a/.gitignore b/.gitignore index e98a643..8a401cc 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,6 @@ build/ ### JVM crashes ### hs_err_* + +### GitLab CI ### +/.m2 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..6df673d --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,42 @@ +variables: + M2_REPO: ".m2/repository" + MAVEN_OPTS: "-Dmaven.repo.local=$M2_REPO" + +default: + image: registry.gitlab.com/lv.enes/containers/build-env:latest + cache: + paths: + - .m2/repository + - target/ + +stages: + - lint + - build + - deploy + +pre-commit-job: + stage: lint + script: + - pre-commit run -a + +build-repro-job: + stage: build + cache: + # This job deletes stuff from the maven repository to make sure it's reproducible, don't update the cache + policy: pull + script: + - ./build.sh + +# TODO: Should run owasp plugin but that beast is complaining about too many requests :confused: +build-job: + stage: build + script: + - ./mvnw verify + +deploy-job: + stage: deploy + environment: production + script: + - ./mvnw -s ci/mvn-settings.xml deploy + rules: + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH diff --git a/REUSE.toml b/REUSE.toml index 57eeea1..5134362 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -9,6 +9,9 @@ SPDX-FileCopyrightText = "Apache Software Foundation" [[annotations]] label = "Miscellaneous little shits I put under CC0" -path = ["build.sh", ".gitattributes", ".gitignore", ".pre-commit-config.yaml", ".sdkmanrc"] +path = [ + "build.sh", "ci/mvn-settings.xml", ".gitattributes", ".gitignore", ".gitlab-ci.yml", ".pre-commit-config.yaml", + ".sdkmanrc", +] SPDX-License-Identifier = "CC0-1.0" -SPDX-FileCopyrightText = " 2025 Uko Kokņevičs " +SPDX-FileCopyrightText = " 2025-2026 Uko Kokņevičs " diff --git a/build.sh b/build.sh index 52ae44a..db17021 100755 --- a/build.sh +++ b/build.sh @@ -6,6 +6,6 @@ set -eu ./mvnw dependency:go-offline install -rm -fr ~/.m2/repository/lv/enes/ +rm -fr ${M2_REPO:-~/.m2/repository}/lv/enes/ ./mvnw -o clean ./mvnw -o install diff --git a/ci/mvn-settings.xml b/ci/mvn-settings.xml new file mode 100644 index 0000000..933e3ff --- /dev/null +++ b/ci/mvn-settings.xml @@ -0,0 +1,20 @@ + + + + mvn.enes.lv + ${env.MAVEN_REPO_USER} + ${env.MAVEN_REPO_PASS} + + + mvn.enes.lv-snapshots + ${env.MAVEN_REPO_USER} + ${env.MAVEN_REPO_PASS} + + + nvd.nist.gov + ${env.NVD_NIST_API_KEY} + + + -- cgit v1.2.3