Skip to content

Commit

Permalink
Only fail on test failures if it's a release
Browse files Browse the repository at this point in the history
For pushes and PR's it won't fail but you can see that it is failing in the logging.
  • Loading branch information
SerhatG committed Apr 28, 2022
1 parent 3a6dc89 commit e504618
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion common/build-and-analyse-using-maven-and-sonar/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
ROOT_POM_DIRECTORY:
required: true
description: "The directory where the root POM can be found."
FAIL_ON_TEST_FAILURES:
required: true
description: "Whether to fail step on test failures."
SONAR_TOKEN:
required: false
description: "The token needed to push analyses to Sonar. Will skip this step if not provided."
Expand All @@ -22,5 +25,5 @@ runs:
shell: bash
run: |
SONAR_TOKEN=${{ inputs.SONAR_TOKEN }}
mvn --no-transfer-progress -f ${{ inputs.ROOT_POM_DIRECTORY }}/pom.xml -P ${SONAR_TOKEN:+sonar,}publish verify ${SONAR_TOKEN:+sonar:sonar}
mvn --no-transfer-progress -f ${{ inputs.ROOT_POM_DIRECTORY }}/pom.xml -Dmaven.test.failure.ignore=${{ inputs.FAIL_ON_TEST_FAILURES }} -P ${SONAR_TOKEN:+sonar,}publish verify ${SONAR_TOKEN:+sonar:sonar}
5 changes: 4 additions & 1 deletion common/build-using-maven/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
ROOT_POM_DIRECTORY:
required: true
description: "The directory where the root POM can be found."
FAIL_ON_TEST_FAILURES:
required: true
description: "Whether to fail step on test failures."

runs:
using: "composite"
Expand All @@ -16,5 +19,5 @@ runs:
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
shell: bash
run: mvn --no-transfer-progress -f ${{ inputs.ROOT_POM_DIRECTORY }}/pom.xml -P publish verify
run: mvn --no-transfer-progress -f ${{ inputs.ROOT_POM_DIRECTORY }}/pom.xml -Dmaven.test.failure.ignore=${{ inputs.FAIL_ON_TEST_FAILURES }} -P publish verify

1 change: 1 addition & 0 deletions events/pull_request-event-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ runs:
with:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
ROOT_POM_DIRECTORY: ${{ inputs.ROOT_POM_DIRECTORY }}
FAIL_ON_TEST_FAILURES: false

1 change: 1 addition & 0 deletions events/push-event-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ runs:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ inputs.SONAR_TOKEN }}
ROOT_POM_DIRECTORY: ${{ inputs.ROOT_POM_DIRECTORY }}
FAIL_ON_TEST_FAILURES: false

- id: get-project-version
uses: ./aerius-github-actions/common/get-maven-project-version
Expand Down
1 change: 1 addition & 0 deletions events/release-event-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ runs:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ inputs.SONAR_TOKEN }}
ROOT_POM_DIRECTORY: ${{ inputs.ROOT_POM_DIRECTORY }}
FAIL_ON_TEST_FAILURES: true

- uses: ./aerius-github-actions/common/publish-maven-artifacts
with:
Expand Down

0 comments on commit e504618

Please sign in to comment.