From 3dc1a3f87c2860a993536acc227d5fdf40bd35ae Mon Sep 17 00:00:00 2001 From: Emmanuel Bruno Date: Thu, 25 May 2023 19:26:03 +0200 Subject: [PATCH] cleans up java CI --- .github/workflows/ci.yml | 3 + .../.github/workflows-advanced/ci.yml | 11 --- .../.github/workflows/CI-java.yml | 14 ++++ .../.github/workflows/basic-java.yml | 77 ------------------- 4 files changed, 17 insertions(+), 88 deletions(-) delete mode 100644 maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows-advanced/ci.yml create mode 100644 maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/CI-java.yml delete mode 100644 maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/basic-java.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c4adc6..ad671e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,3 +9,6 @@ jobs: name: build-sonar-site-upload uses: ebpro/gh-actions-shared-java/.github/workflows/ci-shareable-maven.yml@develop secrets: inherit + with: + maven-args: --errors --batch-mode --show-version --update-snapshots --settings ci-settings.xml --color always --no-transfer-progress + verify-goal: --activate-profiles gpgsigning verify diff --git a/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows-advanced/ci.yml b/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows-advanced/ci.yml deleted file mode 100644 index 7c4adc6..0000000 --- a/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows-advanced/ci.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: CI Java (Host) - -on: - push: - workflow_dispatch: - -jobs: - build: - name: build-sonar-site-upload - uses: ebpro/gh-actions-shared-java/.github/workflows/ci-shareable-maven.yml@develop - secrets: inherit diff --git a/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/CI-java.yml b/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/CI-java.yml new file mode 100644 index 0000000..b26d822 --- /dev/null +++ b/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/CI-java.yml @@ -0,0 +1,14 @@ +name: CI Java (Host) + +on: + push: + workflow_dispatch: + +jobs: + build: + name: build-sonar-site-upload + uses: ebpro/gh-actions-shared-java/.github/workflows/ci-shareable-maven.yml@develop + secrets: inherit + with: + maven-args: --errors --batch-mode --show-version --update-snapshots --settings ci-settings.xml --color always --no-transfer-progress + verify-goal: --activate-profiles jacoco,javadoc,gpgsigning verify diff --git a/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/basic-java.yml b/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/basic-java.yml deleted file mode 100644 index dfd19da..0000000 --- a/maven-archetype-withparent/src/main/resources/archetype-resources/.github/workflows/basic-java.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Java CI - -on: [ push ] - -env: - GITHUBACTOR: ${{secrets.GITHUBACTOR}} - GITHUBTOKEN: ${{secrets.GITHUBTOKEN}} - SONAR_URL: ${{secrets.SONAR_URL}} - SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} - DOCKERHUB_USERNAME: ${{secrets.DOCKERHUB_USERNAME}} - DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_TOKEN}} - -jobs: - # This job build, test and stage the artefact and the website for the develop branch - maven-build-test-site: - # The tags to select the runner - runs-on: [ self-hosted, Linux ] - steps: - # Environment setup - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - cache: 'maven' - - name: Set up Maven - uses: stCarolas/setup-maven@v4.5 - with: - maven-version: 3.8.6 - - name: Extract branch name - shell: bash - run: echo "MY_BRANCH=$(git rev-parse --abbrev-ref HEAD | tr / _)" >> $GITHUB_ENV - # Build and test - - name: Build and Test with Maven - run: > - mvn --batch-mode \ - --update-snapshots \ - --color always \ - --settings docker/ci-settings.xml \ - -P jacoco \ - verify - # Check quality with SonarQube - ### THIS STEP MUST BE ENABLED BY CONFIGURING : SONAR_URL and SONAR_TOKEN secrets. - - name: Quality check with Sonarqube - shell: bash - if: env.SONAR_URL != null && env.SONAR_TOKEN != null - run: > - mvn -DskipTests=true \ - --batch-mode \ - --color always \ - --settings docker/ci-settings.xml \ - -Dsonar.branch.name=$MY_BRANCH \ - -P jacoco,sonar \ - sonar:sonar - # Stage artifact - - run: mkdir staging && cp target/*.jar staging - - name: Stage artifacts - uses: actions/upload-artifact@v3 - with: - name: Package - path: staging - - name: Install SSH Key - uses: webfactory/ssh-agent@v0.7.0 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - # Build and deploy project site - - name: Build and deploy site with Maven - if: ${{github.ref == 'refs/heads/develop'}} - run: > - mvn --batch-mode \ - --color always \ - --settings docker/ci-settings.xml \ - site:site site-deploy \ No newline at end of file