Files
Vickey efd26c645b ci: add unit, integration and e2e workflows with makefile targets
Wire the test toolchain into developer-facing entry points and CI:

- Makefile gains test, test-it, test-e2e and coverage targets; the help
  banner advertises them alongside the existing build commands so
  contributors do not need to memorise the underlying mvn invocations.
- A new Test workflow runs three sequenced jobs: unit (mvn test, skipping
  the integration phase), integration (mvn verify, skipping unit phase,
  running with TESTCONTAINERS_REUSE_ENABLE=true), and a final coverage
  job that downloads both jacoco .exec artifacts and rebuilds the
  aggregate report from dc3-coverage.
- A new E2E workflow runs make test-e2e on develop/release/main pushes
  and on manual dispatch, with a 90 minute timeout that accommodates
  cold compose start-up plus the full critical path battery.
- The existing CI workflow keeps its fast-fail compile job unchanged so
  PR feedback latency stays low; tests are now owned exclusively by
  the new Test workflow.
2026-05-13 13:08:28 +08:00

147 lines
3.6 KiB
YAML

name: Test
on:
push:
branches: [ develop, release, main ]
pull_request:
branches: [ develop, release, 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@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
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 test --no-transfer-progress
- name: Upload surefire reports
if: always()
uses: actions/upload-artifact@v4
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@v4
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@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
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 verify --no-transfer-progress
- name: Upload failsafe reports
if: always()
uses: actions/upload-artifact@v4
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@v4
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@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: liberica
java-version: 21
cache: maven
cache-dependency-path: "**/pom.xml"
- name: Download unit jacoco data
uses: actions/download-artifact@v4
with:
name: jacoco-unit-exec
path: ./
- name: Download integration jacoco data
uses: actions/download-artifact@v4
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@v4
with:
name: jacoco-aggregate
path: dc3-coverage/target/site/jacoco-aggregate/
if-no-files-found: ignore
retention-days: 14