Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 25 additions & 68 deletions .github/workflows/test-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ jobs:
# Stage 2: Unit Tests (run once on ubuntu-24.04)
# ============================================================================

unit-tests:
name: Unit Tests
core-tests:
name: Core Tests (Unit + Integration + Coverage)
needs: build-jar
runs-on: ubuntu-24.04

Expand All @@ -108,8 +108,16 @@ jobs:
name: libre2-core-jar
path: libre2-core/target/

- name: Run unit tests
run: mvn test -pl libre2-core -B
- name: Run unit + integration tests with coverage
run: mvn verify -pl libre2-core -B

- name: Upload JaCoCo coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: jacoco-coverage-report
path: libre2-core/target/site/jacoco/
retention-days: 30

# ============================================================================
# Stage 3: Integration Tests (all platforms)
Expand All @@ -120,7 +128,7 @@ jobs:

integration-macos-x86_64:
name: Integration Test macOS x86_64 (Intel)
needs: unit-tests
needs: core-tests
runs-on: macos-15-intel

steps:
Expand Down Expand Up @@ -155,7 +163,7 @@ jobs:

integration-macos-aarch64:
name: Integration Test macOS aarch64 (Apple Silicon)
needs: unit-tests
needs: core-tests
runs-on: macos-latest

steps:
Expand Down Expand Up @@ -193,7 +201,7 @@ jobs:

integration-linux-ubuntu-2004-x86_64:
name: Integration Test Linux Ubuntu 20.04 x86_64
needs: unit-tests
needs: core-tests
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -247,7 +255,7 @@ jobs:

integration-linux-ubuntu-2204-x86_64:
name: Integration Test Linux Ubuntu 22.04 x86_64
needs: unit-tests
needs: core-tests
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -279,61 +287,14 @@ jobs:
run: |
echo "✅ Integration tests passed on Ubuntu 22.04 linux-x86_64"

integration-linux-ubuntu-2404-x86_64:
name: Integration Test Linux Ubuntu 24.04 x86_64
needs: unit-tests
runs-on: ubuntu-latest

steps:
- name: Checkout code (for tests)
uses: actions/checkout@v4

- name: Download JAR artifact
uses: actions/download-artifact@v4
with:
name: libre2-core-jar
path: libre2-core/target/

- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: maven-${{ hashFiles('pom.xml') }}
restore-keys: maven-

- name: Test in Ubuntu 24.04 container
run: |
docker run --rm \
-v "$(pwd):/workspace" \
-v ~/.m2:/root/.m2 \
-w /workspace \
ubuntu:24.04 \
bash -c "
set -e
# Install JDK 17
apt-get update
apt-get install -y openjdk-17-jdk unzip

# Verify Java
java -version

# Verify native library in JAR
echo 'Checking linux-x86_64 library in JAR:'
unzip -l libre2-core/target/libre2-core-1.0.0.jar | grep 'linux-x86_64/libre2.so'

# Run integration tests
./mvnw failsafe:integration-test failsafe:verify -pl libre2-core -B

echo '✅ Integration tests passed on Ubuntu 24.04 linux-x86_64'
"

# ============================================================================
# Linux Integration Tests (RHEL-based: Rocky Linux versions)
# ============================================================================

integration-linux-rocky-8-x86_64:
name: Integration Test Linux Rocky 8 x86_64
needs: unit-tests
needs: core-tests
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -384,7 +345,7 @@ jobs:

integration-linux-rocky-9-x86_64:
name: Integration Test Linux Rocky 9 x86_64
needs: unit-tests
needs: core-tests
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -633,7 +594,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: macos-15-intel
Expand Down Expand Up @@ -674,7 +634,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: macos-latest
Expand Down Expand Up @@ -719,7 +678,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: ubuntu-latest
Expand Down Expand Up @@ -780,7 +738,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: ubuntu-latest
Expand Down Expand Up @@ -821,7 +778,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: ubuntu-latest
Expand Down Expand Up @@ -880,7 +836,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: ubuntu-latest
Expand Down Expand Up @@ -938,7 +893,6 @@ jobs:
- integration-macos-aarch64
- integration-linux-ubuntu-2004-x86_64
- integration-linux-ubuntu-2204-x86_64
- integration-linux-ubuntu-2404-x86_64
- integration-linux-rocky-8-x86_64
- integration-linux-rocky-9-x86_64
runs-on: ubuntu-latest
Expand Down Expand Up @@ -1016,17 +970,20 @@ jobs:
run: |
echo "✅ All platform tests passed!"
echo ""
echo "4-Stage CI Pipeline Complete:"
echo "5-Stage CI Pipeline Complete:"
echo " Stage 1: Build JAR ✓"
echo " Stage 2: Unit Tests (22 tests, Ubuntu 24.04) ✓"
echo " Stage 3: Integration Tests (428 tests × 7 platforms) ✓"
echo " Stage 2: Core Tests (22 unit + 428 integration, Ubuntu 24.04, 67% coverage) ✓"
echo " Stage 3: Integration Tests (428 tests × 6 platforms) ✓"
echo " Stage 4: Performance Tests (11 tests × 7 platforms) ✓"
echo " Final: ARM64 Integration Tests (428 tests × 3 QEMU platforms) ✓"
echo ""
echo "Platforms tested:"
echo " - macOS x86_64 (Intel)"
echo " - macOS aarch64 (Apple Silicon)"
echo " - Linux Ubuntu 20.04/22.04/24.04 x86_64"
echo " - Linux Ubuntu 20.04/22.04 x86_64"
echo " - Linux Ubuntu 24.04 x86_64 (core-tests stage only)"
echo " - Linux Rocky 8/9 x86_64"
echo " - Linux Ubuntu 22.04/24.04 aarch64 (QEMU, final validation)"
echo " - Linux Rocky 9 aarch64 (QEMU, final validation)"
echo ""
echo "Code Coverage: 67% line coverage (unit + integration combined)"
92 changes: 84 additions & 8 deletions libre2-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- JVM arguments for DirectBuffer access -->
<argLine>
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED
</argLine>
<!-- JVM arguments for DirectBuffer access + JaCoCo agent -->
<argLine>@{argLine} --add-exports=java.base/sun.nio.ch=ALL-UNNAMED</argLine>
</configuration>
</plugin>

Expand Down Expand Up @@ -134,10 +132,8 @@
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<!-- JVM arguments for DirectBuffer access -->
<argLine>
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED
</argLine>
<!-- JVM arguments for DirectBuffer access + JaCoCo agent -->
<argLine>@{argLine} --add-exports=java.base/sun.nio.ch=ALL-UNNAMED</argLine>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -176,6 +172,86 @@
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<!-- Prepare agent for unit tests -->
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>

<!-- Prepare agent for integration tests -->
<execution>
<id>prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>

<!-- Merge unit and integration test coverage data -->
<execution>
<id>merge-results</id>
<phase>verify</phase>
<goals>
<goal>merge</goal>
</goals>
<configuration>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<includes>
<include>jacoco.exec</include>
<include>jacoco-it.exec</include>
</includes>
</fileSet>
</fileSets>
<destFile>${project.build.directory}/jacoco-merged.exec</destFile>
</configuration>
</execution>

<!-- Generate combined coverage report (unit + integration) -->
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-merged.exec</dataFile>
</configuration>
</execution>

<!-- Enforce minimum coverage threshold -->
<execution>
<id>check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco-merged.exec</dataFile>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.67</minimum> <!-- Current: 67%, enforce no regression -->
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
<junit.version>5.10.0</junit.version>
<assertj.version>3.24.2</assertj.version>
<logback.version>1.4.11</logback.version>

<!-- Plugin versions -->
<jacoco.version>0.8.11</jacoco.version>
</properties>

<dependencyManagement>
Expand Down