Skip to content
Open
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
61 changes: 61 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Version: 1.5.0 (Using https://semver.org/)
# Updated: 2020-03-09
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
# See http://EditorConfig.org for more information about .editorconfig files.

##########################################
# Common Settings
##########################################

# This file is the top-most EditorConfig file
root = true

# All Files
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80

##########################################
# File Extension Settings
##########################################

# XML Configuration Files
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
indent_size = 2

# JSON Files
[*.{json,json5,webmanifest}]
indent_size = 2

# YAML Files
[*.{yml,yaml}]
indent_size = 2

# Markdown Files
[*.md]
max_line_length = off
trim_trailing_whitespace = false

# Web Files
[*.{htm,html,js,jsm,ts,tsx,css,sass,scss,less,svg,vue}]
indent_size = 2

# Batch Files
[*.{cmd,bat}]
end_of_line = crlf

# Bash Files
[*.sh]
end_of_line = lf

# Java Files
[*.java]
indent_size = 4
max_line_length = 120
continuation_indent_size = 8
116 changes: 116 additions & 0 deletions .github/workflows/maven-java-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Maven CI for Java for Feature/Bugfix Branch

on:
push:
branches-ignore:
- 'develop'
- 'release/*'
- 'master'
- 'hotfix/*'
- 'support/*'

jobs:
maven-build-test-verify:
name: Maven test, package and deploy Java project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
cache: 'maven'
- name: Maven version
run: mvn -version
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Check out from version control
uses: actions/checkout@v2
- name: Cache Maven dependencies
uses: actions/cache@v1
env:
cache-name: cache-maven-dependencies
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-${{ env.cache-name }}-
${{ runner.os }}-m2-
${{ runner.os }}-
- name: Get Maven Project information
id: maven-project-info
run: |
echo "$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=PACKAGING::$(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=SONAR_HOST_URL::$(mvn help:evaluate -Dexpression=sonar.host.url -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=SONAR_PROJECT_KEY::$(mvn help:evaluate -Dexpression=sonar.projectKey -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Get Branche name
id: get-branche-name
run: |
echo "::set-output name=BRANCHE_NAME::${GITHUB_REF#refs/heads/}"
- name: Set Release Candidate Mode (branche == (release/*|hotfix/*))
id: set-release-candidate-mode
if: startsWith( steps.get-branche-name.outputs.BRANCHE_NAME, 'release/' ) || ( startsWith( steps.get-branche-name.outputs.BRANCHE_NAME, 'hotfix/' ) )
run: |
echo "::set-output name=CREATE_RC::true"
- name: Get short SHA
id: short-sha
run: |
echo "Maven Project version: ${{ steps.maven-project-info.outputs.VERSION }}"
echo "::set-output name=COMMIT_ID_SHORT::${GITHUB_SHA::8}"
- name: Create version number SNAPSHOT
id: create-version-snapshot
if: ( steps.set-release-candidate-mode.outputs.CREATE_RC != 'true' )
uses: frabert/replace-string-action@v1.1
with:
pattern: "^(.*)-SNAPSHOT$"
string: ${{ steps.maven-project-info.outputs.VERSION }}
replace-with: "$1-${{ steps.short-sha.outputs.COMMIT_ID_SHORT }}-SNAPSHOT"
- name: Create version number RELEASE CANDIDATE
id: create-version-rc
if: ( steps.set-release-candidate-mode.outputs.CREATE_RC == 'true' )
uses: frabert/replace-string-action@v1.1
with:
pattern: "^(.*)-SNAPSHOT$"
string: ${{ steps.maven-project-info.outputs.VERSION }}
replace-with: "$1-rc.${GITHUB_RUN_NUMBER}"
- name: Set version number
if: endsWith( steps.maven-project-info.outputs.VERSION, '-SNAPSHOT' ) && ( steps.maven-project-info.outputs.PACKAGING != 'pom' )
run: |
echo "New version: ${{ steps.create-version-number.outputs.replaced }}"
- name: Build with Maven
run: mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Unit Test with Maven
run: mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Verify with Maven
run: mvn -U -Dmaven.main.skip -Dunit.test.skip verify --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
#TODO - name: Set Leak Period [SonarCloud.io]
#TODO run: checkout du parent commun
#TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true'
#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832'
- name: Quality Gate [SonarCloud.io]
#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555'
run: mvn -U -Dsonar.branch.name=steps.get-branche-name.outputs.BRANCHE_NAME -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Add tags [SonarCloud.io]
run: |
curl -u "${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java"
122 changes: 84 additions & 38 deletions .github/workflows/maven-java.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Maven CI for Java

on: [push]
on:
push:
branches-ignore:
- 'feature/*'
- 'bugfix/*'

jobs:
gihub-context-get-info:
Expand All @@ -18,23 +22,42 @@ jobs:
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"

maven-build-test-package-deploy-site:
name: Maven test, package and deploy Java project
runs-on: ubuntu-latest
steps:
- name: Set up JDK 1.8
uses: actions/setup-java@v1
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: 1.8
distribution: 'adopt'
java-version: '11'
cache: 'maven'
- name: Maven version
run: mvn -version --file pom.xml --settings .github/workflows/settings.xml
run: mvn -version
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Check out from version control
uses: actions/checkout@v2
- name: Cache Maven packages
- name: Cache Maven dependencies
uses: actions/cache@v1
env:
cache-name: cache-maven-dependencies
Expand All @@ -45,38 +68,53 @@ jobs:
${{ runner.os }}-m2-${{ env.cache-name }}-
${{ runner.os }}-m2-
${{ runner.os }}-
- name: Get groupId
run: mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate '-Dexpression=project.groupId' -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Get artifactId
run: mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate '-Dexpression=project.artifactId' -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
- name: Get version
id: build-version-initial
run: mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate '-Dexpression=project.version' -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml
- name: Get Maven Project information
id: maven-project-info
run: |
echo "$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=PACKAGING::$(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=SONAR_HOST_URL::$(mvn help:evaluate -Dexpression=sonar.host.url -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
echo "::set-output name=SONAR_PROJECT_KEY::$(mvn help:evaluate -Dexpression=sonar.projectKey -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)"
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
#TODEL - name: Get short SHA
#TODEL id: short-sha
#TODEL run: |
#TODEL echo "Version initiale: ${MVN_VERSION}"
#TODEL echo "::set-env name=COMMIT_ID_SHORT::${GITHUB_SHA::8}"
#TODEL - name: Create version number
#TODEL id: create-version-number
#TODEL uses: frabert/replace-string-action@v1.1
#TODEL with:
#TODEL pattern: "^(.*)-SNAPSHOT$"
#TODEL string: ${{env.MVN_VERSION}}
#TODEL replace-with: "$1-${COMMIT_ID_SHORT}-SNAPSHOT"
#TODEL - name: Set version number
#TODEL run: |
#TODEL echo "New version: ${{ steps.create-version-number.outputs.replaced }}"
#TODEL mvn versions:set -DnewVersion=${{ steps.create-version-number.outputs.replaced }}
- name: Get Branche name
id: get-branche-name
run: |
echo "::set-output name=BRANCHE_NAME::${GITHUB_REF#refs/heads/}"
- name: Set Release Candidate Mode (branche == (release/*|hotfix/*))
id: set-release-candidate-mode
if: startsWith( steps.get-branche-name.outputs.BRANCHE_NAME, 'release/' ) || ( startsWith( steps.get-branche-name.outputs.BRANCHE_NAME, 'hotfix/' ) )
run: |
echo "::set-output name=CREATE_RC::true"
- name: Get short SHA
id: short-sha
run: |
echo "Maven Project version: ${{ steps.maven-project-info.outputs.VERSION }}"
echo "::set-output name=COMMIT_ID_SHORT::${GITHUB_SHA::8}"
- name: Create version number SNAPSHOT
id: create-version-snapshot
if: ( steps.set-release-candidate-mode.outputs.CREATE_RC != 'true' )
uses: frabert/replace-string-action@v1.1
with:
pattern: "^(.*)-SNAPSHOT$"
string: ${{ steps.maven-project-info.outputs.VERSION }}
replace-with: "$1-${{ steps.short-sha.outputs.COMMIT_ID_SHORT }}-SNAPSHOT"
- name: Create version number RELEASE CANDIDATE
id: create-version-rc
if: ( steps.set-release-candidate-mode.outputs.CREATE_RC == 'true' )
uses: frabert/replace-string-action@v1.1
with:
pattern: "^(.*)-SNAPSHOT$"
string: ${{ steps.maven-project-info.outputs.VERSION }}
replace-with: "$1-rc.${GITHUB_RUN_NUMBER}"
- name: Set version number
if: endsWith( steps.maven-project-info.outputs.VERSION, '-SNAPSHOT' ) && ( steps.maven-project-info.outputs.PACKAGING != 'pom' )
run: |
echo "New version: ${{ steps.create-version-number.outputs.replaced }}"
#TODO mvn versions:set -DnewVersion=${{ steps.create-version-number.outputs.replaced }} --file pom.xml
- name: Build with Maven
run: mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml
env:
Expand All @@ -92,14 +130,22 @@ jobs:
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
#TODO - name: Set Leak Period [SonarQube]
#TODO - name: Set Leak Period [SonarCloud.io]
#TODO run: checkout du parent commun
#TODO run: mvn -U clean verify '-Dmaven.test.failure.ignore=true'
#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]r' '-Dsonar.buildbreaker.skip=true' '-Dsonar.projectVersion=#d0b75832'
#TODO - name: Quality Gate [SonarQube]
- name: Quality Gate [SonarCloud.io]
#TODO run: mvn -U '-Dsonar.links.scm=http://gitxxx' '-Dsonar.links.ci=http://jenkinsxxx' org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar '-Dsonar.projectKey=[groupId]-[artifactId]' '-Dsonar.branch.name=develop' '-Dsonar.projectName=[artifactId]' '-Dsonar.gitlab.ref_name=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.commit_sha=b7c32ea3401d64f97eecc4dd46de331b00391cd7' '-Dsonar.gitlab.project_id=3555'
run: mvn -U -Dsonar.branch.name=steps.get-branche-name.outputs.BRANCHE_NAME -Dsonar.gitlab.commit_sha=${GITHUB_SHA} sonar:sonar --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Add tags [SonarCloud.io]
run: |
curl -u "${{ secrets.SONAR_TOKEN }}" -X POST "${{ steps.maven-project-info.outputs.SONAR_HOST_URL }}/api/project_tags/set?project=${{ steps.maven-project-info.outputs.SONAR_PROJECT_KEY }}&tags=socle,java"
- name: Publish to GitHub Packages Apache Maven
run: mvn -U -Dmaven.main.skip -Dunit.test.skip -Dintegration.test.skip deploy --file pom.xml --settings .github/workflows/settings.xml
run: mvn -U -Dmaven.main.skip -Dunit.test.skip -Dverify.skip jar:jar@default-jar assembly:single@make-assembly source:jar-no-fork@attach-sources javadoc:jar@attach-javadocs deploy --file pom.xml --settings .github/workflows/settings.xml
env:
SERVER_USERNAME: $GITHUB_ACTOR
SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}}
Expand Down
Loading