Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamic maven versioning to drive releases using git tags #25

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 68 additions & 22 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
image: maven:3.6.1-jdk-8

variables:
MAVEN_CLI_OPTS: "--show-version"
MAVEN_CLI_OPTS: "--show-version -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd@HH:mm:ss,SSS"
MAVEN_OPTS: "-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Djava.awt.headless=true"

cache:
Expand All @@ -12,59 +12,106 @@ cache:

include:
- template: Code-Quality.gitlab-ci.yml


stages:
- build
- test
- package
- deploy



build:
stage: build
script:
- mvn $MAVEN_CLI_OPTS clean compile install -f system/platform-core
- mvn $MAVEN_CLI_OPTS clean compile install -f system/rest-spring
- mvn $MAVEN_CLI_OPTS clean compile install -f connectors/hazelcast/hazelcast-connector
- mvn $MAVEN_CLI_OPTS clean compile install -f connectors/kafka/kafka-connector
- mvn $MAVEN_CLI_OPTS clean compile install -f system/parent
- mvn $MAVEN_CLI_OPTS clean compile install
cache:
key: $CI_PIPELINE_IID
policy: push # this is the only job that needs to publish to the cache, therefore it is overriding the policy
paths:
- $CI_PROJECT_DIR/.m2/repository

test_and_coverage:


############################
# TEST

.test_and_coverage:
stage: test
script:
- mvn $MAVEN_CLI_OPTS test -f system/platform-core
- ls -la system/platform-core/target/surefire-reports
- cat system/platform-core/target/site/jacoco/index.html
- mv system/platform-core/target/site/jacoco jacoco
needs: ['build']
coverage: '/Total.*?([0-9]{1,3})%/'
artifacts:
reports:
junit:
- system/platform-core/target/surefire-reports/TEST-*.xml
- $CI_PROJECT_DIR/**/target/surefire-reports/TEST-*.xml
paths:
- jacoco
expire_in: 30 days


javadoc:

# just test platform core
# TODO: is it possible to generate coverage report across all modules?
# The current coverage report is only for the platform core submodule
platform_test:
extends: .test_and_coverage
script:
- mvn $MAVEN_CLI_OPTS test -f system/platform-core
- ls -la system/platform-core/target/surefire-reports
- cat system/platform-core/target/site/jacoco/index.html
- mv system/platform-core/target/site/jacoco jacoco


# test all modules
submodules_test:
extends: .test_and_coverage
script:
- mvn $MAVEN_CLI_OPTS test


############################
# Publish

.publish:
stage: deploy
dependencies: ['build', 'submodules_test']
needs: ['build', 'submodules_test']

snapshot:
extends: .publish
script:
- echo "Publish snapshot"
- mvn $MAVEN_CLI_OPTS deploy -s .gitlab_maven_settings.xml -DskipTests

release:
extends: .publish
script:
- echo "Publish release"
- mvn $MAVEN_CLI_OPTS deploy -s .gitlab_maven_settings.xml -DskipTests -Drevision=$CI_COMMIT_TAG
only:
- tags

############################
# JavaDoc

javadoc:
stage: package
script:
dependencies:
- build
needs: ['build']
script:
- mvn $MAVEN_CLI_OPTS javadoc:javadoc -f system/platform-core
- mv system/platform-core/target/site/apidocs apidocs
artifacts:
paths:
- apidocs
expire_in: 30 days

pages:
stage: deploy
dependencies:
- test_and_coverage
- platform_test
- javadoc
needs: ['platform_test', 'javadoc']
script:
- mkdir -p public/coverage public/docs
- mv jacoco/* public/coverage
Expand All @@ -73,4 +120,3 @@ pages:
paths:
- public
expire_in: 90 days

18 changes: 18 additions & 0 deletions .gitlab_maven_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Reference: https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd-by-using-maven -->

<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Job-Token</name>
<value>${env.CI_JOB_TOKEN}</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
11 changes: 6 additions & 5 deletions connectors/event-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
<artifactId>event-node</artifactId>

<packaging>jar</packaging>
<version>1.12.65</version>
<version>${revision}</version>
<name>Event Node - Platform-in-a-box</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<groupId>org.platformlambda</groupId>
<artifactId>mercury-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath/>
</parent>

<properties>
<revision>1.12-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hazelcast.version>4.0.1</hazelcast.version>
<java.version>1.8</java.version>
Expand All @@ -39,7 +40,7 @@
<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>rest-spring</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand Down
11 changes: 6 additions & 5 deletions connectors/hazelcast/hazelcast-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
<artifactId>hazelcast-connector</artifactId>

<packaging>jar</packaging>
<version>1.12.65</version>
<version>${revision}</version>
<name>Cloud connector for Hazelcast cluster</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<groupId>org.platformlambda</groupId>
<artifactId>mercury-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath/>
</parent>

<properties>
<revision>1.12-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hazelcast.version>4.0.1</hazelcast.version>
<java.version>1.8</java.version>
Expand All @@ -39,7 +40,7 @@
<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>platform-core</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.hazelcast/hazelcast-client -->
Expand Down
13 changes: 7 additions & 6 deletions connectors/hazelcast/hazelcast-presence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
<groupId>org.platformlambda</groupId>
<artifactId>hazelcast-presence</artifactId>
<packaging>jar</packaging>
<version>1.12.65</version>
<version>${revision}</version>
<name>hazelcast-presence-monitor</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<groupId>org.platformlambda</groupId>
<artifactId>mercury-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath/>
</parent>

<properties>
<revision>1.12-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hazelcast.version>4.0.1</hazelcast.version>
<java.version>1.8</java.version>
Expand All @@ -37,13 +38,13 @@
<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>hazelcast-connector</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>rest-spring</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand Down
11 changes: 6 additions & 5 deletions connectors/kafka/kafka-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
<artifactId>kafka-connector</artifactId>

<packaging>jar</packaging>
<version>1.12.65</version>
<version>${revision}</version>
<name>Cloud connector for Kafka cluster</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<groupId>org.platformlambda</groupId>
<artifactId>mercury-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath/>
</parent>

<properties>
<revision>1.12-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hazelcast.version>4.0.1</hazelcast.version>
<java.version>1.8</java.version>
Expand All @@ -39,7 +40,7 @@
<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>platform-core</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
13 changes: 7 additions & 6 deletions connectors/kafka/kafka-presence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
<groupId>org.platformlambda</groupId>
<artifactId>kafka-presence</artifactId>
<packaging>jar</packaging>
<version>1.12.65</version>
<version>${revision}</version>
<name>kafka-presence-monitor</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<groupId>org.platformlambda</groupId>
<artifactId>mercury-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath/>
</parent>

<properties>
<revision>1.12-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hazelcast.version>4.0.1</hazelcast.version>
<java.version>1.8</java.version>
Expand All @@ -37,13 +38,13 @@
<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>kafka-connector</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>rest-spring</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand Down
11 changes: 6 additions & 5 deletions connectors/kafka/kafka-standalone/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
<artifactId>kafka-standalone</artifactId>

<packaging>jar</packaging>
<version>1.12.65</version>
<version>${revision}</version>
<name>Standalone kafka system for development</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<groupId>org.platformlambda</groupId>
<artifactId>mercury-parent</artifactId>
<version>1.12-SNAPSHOT</version>
<relativePath/>
</parent>

<properties>
<revision>1.12-SNAPSHOT</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hazelcast.version>4.0.1</hazelcast.version>
<java.version>1.8</java.version>
Expand All @@ -39,7 +40,7 @@
<dependency>
<groupId>org.platformlambda</groupId>
<artifactId>platform-core</artifactId>
<version>1.12.65</version>
<version>1.12-SNAPSHOT</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.zookeeper/zookeeper -->
Expand Down
Loading