name: Test on: workflow_call: push: branches: [ develop, main ] pull_request: branches: [ develop, main ] permissions: contents: read pull-requests: read concurrency: group: test-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: unit: name: Unit tests runs-on: ubuntu-latest timeout-minutes: 45 steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - name: Set up JDK 21 uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 with: distribution: liberica java-version: 21 cache: maven cache-dependency-path: "**/pom.xml" - name: Run unit tests run: | set -euo pipefail mvn -U -e -B -Dskip.integration.tests=true -Dcoverage.check.skip=true test --no-transfer-progress - name: Upload surefire reports if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: surefire-reports path: '**/target/surefire-reports/' if-no-files-found: ignore retention-days: 7 - name: Upload jacoco unit data if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: jacoco-unit-exec path: '**/target/jacoco.exec' if-no-files-found: ignore retention-days: 7 integration: name: Integration tests runs-on: ubuntu-latest timeout-minutes: 60 steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - name: Set up JDK 21 uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 with: distribution: liberica java-version: 21 cache: maven cache-dependency-path: "**/pom.xml" - name: Verify docker availability run: | docker version docker info - name: Run integration tests env: TESTCONTAINERS_REUSE_ENABLE: "true" run: | set -euo pipefail mvn -U -e -B -Dskip.unit.tests=true -Dcoverage.check.skip=true verify --no-transfer-progress - name: Upload failsafe reports if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: failsafe-reports path: '**/target/failsafe-reports/' if-no-files-found: ignore retention-days: 7 - name: Upload jacoco integration data if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: jacoco-it-exec path: '**/target/jacoco-it.exec' if-no-files-found: ignore retention-days: 7 coverage: name: Aggregated coverage runs-on: ubuntu-latest timeout-minutes: 30 needs: - unit - integration steps: - name: Checkout uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - name: Set up JDK 21 uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 with: distribution: liberica java-version: 21 cache: maven cache-dependency-path: "**/pom.xml" - name: Download unit jacoco data uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 with: name: jacoco-unit-exec path: ./ - name: Download integration jacoco data uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 with: name: jacoco-it-exec path: ./ - name: Build aggregate coverage report run: | set -euo pipefail mvn -U -e -B -pl dc3-coverage -am -Dskip.unit.tests=true -Dskip.integration.tests=true verify --no-transfer-progress - name: Upload aggregate report if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: jacoco-aggregate path: dc3-coverage/target/site/jacoco-aggregate/ if-no-files-found: ignore retention-days: 14