summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorChristian Kollmann <christian.kollmann@a-sit.at>2020-10-30 09:51:14 +0100
committerChristian Kollmann <christian.kollmann@a-sit.at>2020-10-30 09:51:14 +0100
commitb934e977a8949f966d0fb28cd785abc95c50954c (patch)
treec904d62da6ddf7ca741fe3a6798549c949bf8e13 /.gitlab-ci.yml
parent7e324e9140845d52fa557c5ab2ac0a55b91c3052 (diff)
downloadEAAF-Components-b934e977a8949f966d0fb28cd785abc95c50954c.tar.gz
EAAF-Components-b934e977a8949f966d0fb28cd785abc95c50954c.tar.bz2
EAAF-Components-b934e977a8949f966d0fb28cd785abc95c50954c.zip
Add CI pipeline
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml68
1 files changed, 68 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..2d0e2687
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,68 @@
+image: maven:latest
+
+variables:
+ LC_ALL: "en_US.UTF-8"
+ LANG: "en_US.UTF-8"
+ LANGUAGE: "en_US"
+ LIB_NAME: "eaaf-components"
+ MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true --settings .cisettings.xml"
+ MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true"
+ GIT_SUBMODULE_STRATEGY: recursive
+ GIT_DEPTH: "2"
+ SECURE_LOG_LEVEL: "debug"
+
+include:
+ - template: Dependency-Scanning.gitlab-ci.yml
+ - template: Security/SAST.gitlab-ci.yml
+ - template: Secret-Detection.gitlab-ci.yml
+
+stages:
+ - assemble
+ - test
+ - package
+ - release
+
+cache:
+ paths:
+ - ".m2/repository"
+
+assemble:
+ stage: assemble
+ except:
+ - tags
+ script: |
+ mvn $MAVEN_CLI_OPTS compile test
+ artifacts:
+ when: always
+ reports:
+ junit: "target/surefire-reports/TEST-*.xml"
+
+publishToGitlab:
+ stage: package
+ except:
+ - tags
+ script: |
+ export VERSION=$(mvn -B help:evaluate -Dexpression=project.version -B | grep -v "\[INFO\]" | grep -Po "\d+\.\d+\.\d+((-\w*)+)?")
+ echo "Publishing version $VERSION for $LIB_NAME"
+ mvnw $MAVEN_CLI_OPTS deploy -s .cisettings.xml -P gitlabDeploy
+ echo "VERSION=$VERSION" >> variables.env
+ artifacts:
+ when: always
+ reports:
+ dotenv: variables.env
+
+release:
+ stage: release
+ image: registry.gitlab.com/gitlab-org/release-cli:latest
+ needs:
+ - job: publishToGitlab
+ artifacts: true
+ when: manual
+ only:
+ - master
+ script: |
+ echo "Releasing version $VERSION of $LIB_NAME"
+ release:
+ name: "$VERSION"
+ tag_name: "v$VERSION"
+ description: "$(cat README.md)"