Add compile and test steps
@@ -9,12 +9,52 @@ workflow:
when: never
stages:
+ - compile
+ - test
- analyze
- package
include:
- template: Security/SAST.gitlab-ci.yml
+variables:
+ MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository"
+ CACHE_KEY: oec-cache
+
+compile:
+ stage: compile
+ image: public.docker.ecsec.de/ecsec/tools/oec-linux-installer:latest
+ tags:
+ - "linux"
+ cache:
+ key: "$CACHE_KEY"
+ paths:
+ - .m2/repository/
+ policy: pull-push
+ script:
+ - MAVEN_OPTS=$MAVEN_OPTS mvn clean compile
+ rules:
+ - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(-rc.\d+)?$/
+ - if: $CI_MERGE_REQUEST_IID
+ - if: $CI_COMMIT_BRANCH == "master"
+
+test:
+ stage: test
+ image: public.docker.ecsec.de/ecsec/tools/oec-linux-installer:latest
+ tags:
+ - "linux"
+ cache:
+ key: "$CACHE_KEY"
+ paths:
+ - .m2/repository/
+ policy: pull-push
+ script:
+ - MAVEN_OPTS=$MAVEN_OPTS mvn verify
+ rules:
+ - if: $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+(-rc.\d+)?$/
+ - if: $CI_MERGE_REQUEST_IID
+ - if: $CI_COMMIT_BRANCH == "master"
+
# 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/ee/user/application_security/secret_detection/#customizing-settings
