Skip to content

Commit

Permalink
Setup matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertuya committed Jul 15, 2023
1 parent 4e84b20 commit f7871ec
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
test-java:
runs-on: ubuntu-latest
#if: ${{ false }} # disable for now
strategy:
matrix:
scope: [UT]
fail-fast: false

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
Expand All @@ -29,36 +34,52 @@ jobs:
java-version: '8'
cache: 'maven'

- name: Test and aggregate surefire report
# Run the tests UT, IT and those that require database server

- name: Test and aggregate surefire report - ${{ matrix.scope }}
if: ${{ matrix.scope != 'UT' }}
run: >
mvn test surefire-report:report -Daggregate=true
-Dtest=!TestPostgres*,!TestSqlserver*,!TestOracle*,!ITTest*
-Dsurefire.failIfNoSpecifiedTests=false
-Dmaven.test.failure.ignore=true -U --no-transfer-progress
# Reporting

- name: Additional aggregated junit report
uses: javiertuya/junit-report-action@v1
if: always()
uses: javiertuya/junit-report-action@v1.1.0
with:
surefire-files: "**/target/surefire-reports/TEST-*.xml"
report-dir: target/site
report-title: "Test Report: ${{ matrix.scope }} - Branch: ${{ github.ref_name }}"

- name: Generate report checks
if: always()
uses: mikepenz/action-junit-report@v3.7.8
uses: mikepenz/action-junit-report@v3.8.0
with:
check_name: "test-result"
check_name: "test-result-${{ matrix.scope }}"
report_paths: "**/surefire-reports/TEST-*.xml"
fail_on_failure: 'true'

- if: always()
name: Publish test report files
name: Set unique jacoco.xml file names for each scope
#if not sonarqube will overwrite al jacoco files generated for the same module but different scopes
run: |
for file in */target/site/jacoco/jacoco.xml ; do mv $file ${file//jacoco.xml/jacoco-${{ matrix.scope }}.xml} ; done
ls -la */target/site/jacoco/*.xml
- name: Publish test report files
if: always()
uses: actions/upload-artifact@v3
with:
name: "test-report-files"
name: "test-report-files-${{ matrix.scope }}"
path: |
target/site
**/target/site/jacoco/jacoco.xml
**/target/site/jacoco/jacoco*.xml
**/target/surefire-reports
**/target/*.html
**/target/*.log
sonarqube:
needs: [test-java]
Expand All @@ -72,7 +93,7 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
restore-artifact-name1: "test-report-files"
restore-artifact-name1: "test-report-files-UT"

publish-java-snapshot:
#if: ${{ false }} # disable for now
Expand Down

0 comments on commit f7871ec

Please sign in to comment.