From e06c1063556f9e552333a4c6b274481c1e1bf101 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 08:24:12 +0200 Subject: [PATCH 1/7] :green_heart: Specific workflow for feature and bugfix in GitHub Actions Part of #56 --- .github/workflows/maven-java-feature.yml | 64 ++++++++++++++++++++++++ .github/workflows/maven-java.yml | 6 ++- 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/maven-java-feature.yml diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml new file mode 100644 index 0000000..e62cde4 --- /dev/null +++ b/.github/workflows/maven-java-feature.yml @@ -0,0 +1,64 @@ +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: + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - 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 "$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml)" + echo "$(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --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 [SonarQube] + #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] + #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' diff --git a/.github/workflows/maven-java.yml b/.github/workflows/maven-java.yml index 1bb8d43..f1e48f6 100644 --- a/.github/workflows/maven-java.yml +++ b/.github/workflows/maven-java.yml @@ -1,6 +1,10 @@ name: Maven CI for Java -on: [push] +on: + push: + branches-ignore: + - 'feature/*' + - 'bugfix/*' jobs: gihub-context-get-info: From bab206e3709ab7e5549c16fb0247d56cc16943f7 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 08:48:59 +0200 Subject: [PATCH 2/7] :bug: Revert error delete compile --- .github/workflows/maven-java-feature.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/maven-java-feature.yml b/.github/workflows/maven-java-feature.yml index e62cde4..223048e 100644 --- a/.github/workflows/maven-java-feature.yml +++ b/.github/workflows/maven-java-feature.yml @@ -46,6 +46,11 @@ jobs: env: SERVER_USERNAME: $GITHUB_ACTOR SERVER_PASSWORD: ${{ secrets.MVN_PCKGS_REPO_TOKEN}} + - 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: From 358eeb8c64861c6c3ff039b4defd85132d6edf7a Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 09:13:35 +0200 Subject: [PATCH 3/7] :green_heart: Specific workflow for feature and bugfix in Travis CI Part of #56 --- .travis.yml | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4f9e72c..0935853 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,9 +6,33 @@ cache: - $HOME/.m2 install: true -script: - - mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml - - mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml - - mvn -U -Dmaven.main.skip -Dunit.test.skip verify --file pom.xml --settings .github/workflows/settings.xml - - 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 - - mvn -U site --file pom.xml --settings .github/workflows/settings.xml +jobs: + include: + - stage: Get Maven Project information + script: + - mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml + - mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml + - mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml + - mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml + + - stage: Unit Test with Maven + script: + - mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml + + - stage: Verify with Maven + script: + - mvn -U -Dmaven.main.skip -Dunit.test.skip verify --file pom.xml --settings .github/workflows/settings.xml + + - stage: Publish to GitHub Packages Apache Maven + script: + - 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 + + - stage: Site with Maven + script: + - mvn -U site --file pom.xml --settings .github/workflows/settings.xml + +stages: + - name: Publish to GitHub Packages Apache Maven + if: type = push AND branch =~ /^((develop|master)|((release|hotfix|support)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?))$/ + - name: Site with Maven + if: type = push AND branch =~ /^((develop|master)|((release|hotfix|support)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?))$/ From b28d1c982e5b36e41db1826a1956a7a4a43269d4 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 09:21:39 +0200 Subject: [PATCH 4/7] :bug: Foget compile in Travis CI --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0935853..e587b4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,10 @@ jobs: - mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml - mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml + - stage: Build with Maven + script: + - mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml + - stage: Unit Test with Maven script: - mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml From c38aaf91dfb6936c22a186aeb55eeacb06306ae2 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 09:31:02 +0200 Subject: [PATCH 5/7] :bug: Print Maven Project info in Travis --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e587b4b..23e3489 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,10 @@ jobs: include: - stage: Get Maven Project information script: - - mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml - - mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml - - mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml - - mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml + - echo $(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) + - echo $(help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) + - echo $(help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) + - echo $(help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - stage: Build with Maven script: From ef729a4109782617addf8fc656d3c2c2f4a2000b Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 09:33:17 +0200 Subject: [PATCH 6/7] :bug: Add mvn in command line --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 23e3489..06370f5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,9 @@ jobs: - stage: Get Maven Project information script: - echo $(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - - echo $(help:evaluate -Dexpression=project.artifactId -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - - echo $(help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - - echo $(help:evaluate -Dexpression=project.packaging -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 $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) + - echo $(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - stage: Build with Maven script: From e740b14c0cc3bfd71c9aaacc2d4fb85e47a10382 Mon Sep 17 00:00:00 2001 From: Bertrand DELION Date: Wed, 22 Apr 2020 09:38:10 +0200 Subject: [PATCH 7/7] :green_heart: Travis process time optimization --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06370f5..5021884 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,16 +15,10 @@ jobs: - echo $(mvn help:evaluate -Dexpression=project.version -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - echo $(mvn help:evaluate -Dexpression=project.packaging -q -DforceStdout --file pom.xml --settings .github/workflows/settings.xml) - - stage: Build with Maven + - stage: Build, Test and Verify with Maven script: - mvn -U clean compile -Pproject-controls-check --file pom.xml --settings .github/workflows/settings.xml - - - stage: Unit Test with Maven - script: - mvn -U -Dmaven.main.skip test --file pom.xml --settings .github/workflows/settings.xml - - - stage: Verify with Maven - script: - mvn -U -Dmaven.main.skip -Dunit.test.skip verify --file pom.xml --settings .github/workflows/settings.xml - stage: Publish to GitHub Packages Apache Maven