Skip to content

Commit

Permalink
Align GHA for main and pull-request
Browse files Browse the repository at this point in the history
Align GHA for main and pull-request by:
- defining continue-on-error to true for main gha
- by adding -Dstyle.color=always to all runs
- only run Sonatype step if deploy-enabled is true
- defining fail-fast to false pull request gha
  • Loading branch information
smcvb committed Sep 14, 2022
1 parent 25da9c0 commit a505f0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
build:
name: Test and Build on JDK ${{ matrix.java-version }}
runs-on: ubuntu-latest
continue-on-error: true # do not fail the whole job if one of the steps fails

strategy:
matrix:
include:
Expand All @@ -21,7 +23,7 @@ jobs:
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
uses: actions/setup-java@v3.5.0
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
Expand All @@ -33,17 +35,17 @@ jobs:
- name: Regular Build
if: ${{ !matrix.sonar-enabled }}
run: |
./mvnw -B -U clean verify
./mvnw -B -U -Dstyle.color=always clean verify
- name: Build with Coverage reports
if: matrix.sonar-enabled
run: |
./mvnw -B -U -Dcoverage clean verify
./mvnw -B -U -Dstyle.color=always -Dcoverage clean verify
- name: Sonar Analysis
if: matrix.sonar-enabled
run: |
./mvnw -B sonar:sonar \
./mvnw -B -Dstyle.color=always sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-spring-native \
-Dsonar.organization=axonframework \
-Dsonar.host.url=https://sonarcloud.io \
Expand All @@ -52,9 +54,9 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Sonatype
if: success()
if: success() && ${{ matrix.deploy-enabled }}
run: |
./mvnw -B -U deploy -DskipTests=true
./mvnw -B -U -Dstyle.color=always deploy -DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_ID }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@v3

- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
uses: actions/setup-java@v3.5.0
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
Expand All @@ -30,17 +30,17 @@ jobs:
- name: Regular Build
if: ${{ !matrix.sonar-enabled }}
run: |
./mvnw -B -U clean verify
./mvnw -B -U -Dstyle.color=always clean verify
- name: Build with Coverage reports
if: matrix.sonar-enabled
run: |
./mvnw -B -U -Dcoverage clean verify
./mvnw -B -U -Dstyle.color=always -Possrh -Dcoverage clean verify
- name: Sonar Analysis
if: ${{ success() && matrix.sonar-enabled && github.event.pull_request.head.repo.full_name == github.repository }}
run: |
./mvnw -B sonar:sonar \
./mvnw -B -Dstyle.color=always sonar:sonar \
-Dsonar.projectKey=AxonFramework_extension-spring-native \
-Dsonar.organization=axonframework \
-Dsonar.host.url=https://sonarcloud.io \
Expand Down

0 comments on commit a505f0e

Please sign in to comment.