Skip to content

Commit

Permalink
Remove publish-unit-test-result-action, centralize common Maven optio…
Browse files Browse the repository at this point in the history
…ns (#3031)
  • Loading branch information
scordio committed Apr 28, 2023
1 parent 9397e00 commit f606340
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 58 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/binary-compatibility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
paths:
- 'assertj-core/**'

env:
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always -DskipTests

jobs:
verify-with-base:
name: Verify with target branch
Expand All @@ -28,19 +31,12 @@ jobs:
ref: ${{ github.base_ref }}
path: ${{ github.run_id }}.${{ github.base_ref }}
- name: Build `${{ github.base_ref }}`
run: >
./mvnw -B -V --no-transfer-progress -e -f ${{ github.run_id }}.${{ github.base_ref }}/assertj-core/pom.xml package
-DskipTests
-Djansi.passthrough=true
-Dstyle.color=always
run: ./mvnw $MAVEN_ARGS -f ${{ github.run_id }}.${{ github.base_ref }}/assertj-core/pom.xml package
- name: Compare `${{ github.head_ref }}` with `${{ github.base_ref }}`
run: >
./mvnw -B -V --no-transfer-progress -e -f assertj-core/pom.xml -Pjapicmp-branch package japicmp:cmp
-DskipTests
./mvnw $MAVEN_ARGS -f assertj-core/pom.xml -Pjapicmp-branch package japicmp:cmp
-Djapicmp.breakBuildOnBinaryIncompatibleModifications=true
-Djapicmp.oldVersion.basedir=${{ github.run_id }}.${{ github.base_ref }}/assertj-core
-Djansi.passthrough=true
-Dstyle.color=always
- name: Add label
if: failure()
Expand Down Expand Up @@ -96,11 +92,8 @@ jobs:

- name: Compare with the latest release
run: >
./mvnw -B -V --no-transfer-progress -e -f assertj-core/pom.xml package japicmp:cmp
-DskipTests
./mvnw $MAVEN_ARGS -f assertj-core/pom.xml package japicmp:cmp
-Djapicmp.breakBuildOnBinaryIncompatibleModifications=true
-Djansi.passthrough=true
-Dstyle.color=always
- name: Add label
if: github.base_ref != null && failure()
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/cross-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Cross-Version

on: [push, pull_request]

env:
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always -Djacoco.skip=true

jobs:

test_java:
Expand All @@ -20,8 +23,4 @@ jobs:
release: ${{ matrix.java }}
version: latest
- name: Test
run: >
./mvnw -B -V --no-transfer-progress -e verify javadoc:javadoc
-Djacoco.skip=true
-Djansi.passthrough=true
-Dstyle.color=always
run: ./mvnw $MAVEN_ARGS verify javadoc:javadoc
34 changes: 6 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@ name: CI

on: [push, pull_request]

env:
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always

jobs:

test_os:
name: OS ${{ matrix.os }}
permissions:
# Needed for test reporting
checks: write
pull-requests: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
comment-test-results: true
- os: macOS-latest
comment-test-results: false
- os: windows-latest
comment-test-results: false
os: [ubuntu-latest, macOS-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -30,20 +23,7 @@ jobs:
java-version: 17
cache: 'maven'
- name: Test
# Note: arguments with a period or bang in them have to be single quoted to prevent
# confusing the PowerShell instance on Windows runners.
run: >
./mvnw -B -V --no-transfer-progress -e verify javadoc:javadoc
'-Djansi.passthrough=true'
'-Dstyle.color=always'
- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ matrix.comment-test-results }}
continue-on-error: true
with:
check_name: "JUnit test results"
junit_files: "assertj*/**/target/surefire-reports/TEST-*.xml"
run: ./mvnw $MAVEN_ARGS verify javadoc:javadoc

sonar:
name: Sonar code analysis
Expand All @@ -62,12 +42,10 @@ jobs:
cache: 'maven'
- name: Test with Sonar
run: >
./mvnw -B -V --no-transfer-progress -e verify javadoc:javadoc sonar:sonar
./mvnw $MAVEN_ARGS verify javadoc:javadoc sonar:sonar
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=assertj
-Dsonar.projectKey=joel-costigliola_assertj-core
-Djansi.passthrough=true
-Dstyle.color=always
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
11 changes: 5 additions & 6 deletions .github/workflows/pitest-receive-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ name: Receive
on:
pull_request:

env:
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always

jobs:
store-pitest-feedback:
# Only run on forked repos.
Expand All @@ -39,14 +42,10 @@ jobs:
# we add config to analyse only changes made within a PR and treat surviving mutants as check errors
# failWhenNoMutations is unset in the pom, as otherwise PRs that do not affect java code would fail
run: >
mvn -B -e -Ppitest -Dfeatures="+GIT(from[HEAD~1]), +gitci" test
-Djansi.passthrough=true
-Dstyle.color=always
./mvnw $MAVEN_ARGS -Ppitest -Dfeatures="+GIT(from[HEAD~1]), +gitci" test
- name: aggregate files
run: >
mvn -B -e -f assertj-core/pom.xml -Ppitest pitest-git:aggregate
-Djansi.passthrough=true
-Dstyle.color=always
./mvnw $MAVEN_ARGS -f assertj-core/pom.xml -Ppitest pitest-git:aggregate
- name: upload results
uses: actions/upload-artifact@v3
with:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pitest-updated-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ on:
types:
- completed

env:
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always

jobs:
pitest-update-pr:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
Expand All @@ -43,6 +46,4 @@ jobs:
# the code, but does mean the version here must be maintained. An alternative would be to checkout the code and use
# the github goal. This will work as long as the artifact is extracted to the maven target directory
run: >
mvn -B -DrepoToken=${{ secrets.GITHUB_TOKEN }} com.groupcdg:pitest-github-maven-plugin:1.0.8:updatePR
-Djansi.passthrough=true
-Dstyle.color=always
./mvnw $MAVEN_ARGS -DrepoToken=${{ secrets.GITHUB_TOKEN }} com.groupcdg:pitest-github-maven-plugin:1.0.8:updatePR
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Release
on:
workflow_dispatch:

env:
MAVEN_ARGS: -B -V -ntp -e -Djansi.passthrough=true -Dstyle.color=always -Djacoco.skip=true

jobs:
release:

Expand All @@ -25,9 +28,7 @@ jobs:
run: |
git config user.name '${{ github.actor }}'
git config user.email '${{ github.actor }}@users.noreply.github.com'
./mvnw -B release:prepare release:perform -Dpassword=${{ secrets.GITHUB_TOKEN }} \
-Djansi.passthrough=true \
-Dstyle.color=always
./mvnw $MAVEN_ARGS release:prepare release:perform -Dpassword=${{ secrets.GITHUB_TOKEN }}
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
Expand Down

0 comments on commit f606340

Please sign in to comment.