.gitlab-ci.yml updated + add JUnit

Took 9 minutes
This commit is contained in:
Molzonas 2025-08-26 13:05:47 +02:00
parent baea760e74
commit 1f4176eec4
2 changed files with 58 additions and 19 deletions

View File

@ -1,22 +1,54 @@
# You can override the included template(s) by including variable overrides
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
# Secret Detection customization: https://docs.gitlab.com/user/application_security/secret_detection/pipeline/configure
# Dependency Scanning customization: https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#customizing-the-dependency-scanning-settings
# Container Scanning customization: https://docs.gitlab.com/ee/user/application_security/container_scanning/#customizing-the-container-scanning-settings
# Note that environment variables can be set in several places
# See https://docs.gitlab.com/ee/ci/variables/#cicd-variable-precedence
:stages:
- test
:sast:
:stage: test
:include:
- :template: Security/SAST.gitlab-ci.yml
stages: stages:
- test - test
- secret-detection - release
image: maven:3.9.8-eclipse-temurin-21
variables: variables:
SECRET_DETECTION_ENABLED: 'true' MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
secret_detection:
stage: secret-detection cache:
include: key: ${CI_COMMIT_REF_SLUG}
- template: Security/Secret-Detection.gitlab-ci.yml paths:
- .m2/repository
# MVN TEST + JUNIT REPORT
test:
stage: test
script:
- mvn -B -ntp test
artifacts:
when: always
reports:
junit:
- target/surefire-reports/*.xml
- target/failsafe-reports/*.xml
paths:
- target/surefire-reports
- target/failsafe-reports
rules:
- if: $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_TAG
# COMPILATION + RELEASE GENERATION
release:
stage: release
needs: ["test"]
script:
- mvn -B -ntp -DskipTests package
- JAR=$(ls target/*-with-dependencies.jar 2>/dev/null || ls target/*.jar | head -n1)
- cp "$JAR" "target/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.jar"
artifacts:
paths:
- target/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.jar
release:
name: "Release ${CI_COMMIT_TAG}"
tag_name: "${CI_COMMIT_TAG}"
description: |
New release : ${CI_COMMIT_TAG}.
Commit : ${CI_COMMIT_SHA}
assets:
links:
- name: "${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.jar"
url: "${CI_JOB_URL}/artifacts/raw/target/${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.jar"
rules:
- if: $CI_COMMIT_TAG

View File

@ -96,5 +96,12 @@
<version>3.10.2</version> <version>3.10.2</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>