Skip to content

Commit

Permalink
Move maven build action into Analyze workflow
Browse files Browse the repository at this point in the history
SonarCloud depends on the jacoco XML to be produced, but will be
started before it is uploaded on PRs, thus failing. Moving the
maven build action into that workflow reduces the overall build
time as maven and gradle build can run in parallel.
  • Loading branch information
Philzen committed Jun 14, 2024
1 parent b3548c4 commit cef35f2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
25 changes: 21 additions & 4 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: SonarCloud
on:
workflow_call:
inputs: {}
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]

jobs:
analyze:
name: Analyze
Expand All @@ -29,11 +30,27 @@ jobs:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Download code coverage results
uses: actions/download-artifact@v4

- name: "[Maven] Verify & generate JaCoCo XML"
env:
MAVEN_OPTS: '-Dstyle.color=always'
MAVEN_SWITCHES: >-
--show-version
--no-transfer-progress
--update-snapshots
--fail-at-end
--batch-mode
run: mvn ${{ env.MAVEN_SWITCHES }} -P coverage verify

- name: Upload maven build result
uses: actions/upload-artifact@v4
with:
name: maven-build-target-folder
path: target

- name: List current location
run: find .

- name: Analyze project
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@ jobs:
uses: gradle/actions/setup-gradle@v3
with:
arguments: ${{ env.GRADLE_SWITCHES }} build test
- name: "[Maven] Verify & generate JaCoCo XML"
env:
MAVEN_OPTS: '-Dstyle.color=always'
MAVEN_SWITCHES: >-
--show-version
--no-transfer-progress
--update-snapshots
--fail-at-end
--batch-mode
run: mvn ${{ env.MAVEN_SWITCHES }} -P coverage verify

- name: Upload maven build result
uses: actions/upload-artifact@v4
with:
name: maven-build-target-folder
path: target

call:
needs: [build]
uses: './.github/workflows/analyse.yml'
secrets: inherit

publish-snapshots:
needs: [build]
Expand Down

0 comments on commit cef35f2

Please sign in to comment.