Skip to content

Commit

Permalink
Improve mvn test
Browse files Browse the repository at this point in the history
  • Loading branch information
rudsberg committed Dec 2, 2024
1 parent 2764325 commit 4f8ed01
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 44 deletions.
20 changes: 7 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -432,20 +432,14 @@ jobs:
npm run package
- uses: ./
with:
java-version: '23'
java-version: 'latest-ea'
distribution: 'graalvm'
native-image-enable-sbom: 'true'
# - name: Verify SBOM was generated with 'native-image'
# run: |
# echo 'public class Hello { public static void main(String[] args) { System.out.println("Hello"); } }' > Hello.java
# javac Hello.java
# native-image Hello
# find . -name "*.sbom.json" | grep . || exit 1
- name: Verify SBOM was generated with mvn
- name: Verify that SBOM was generated and dependency snapshot submitted
run: |
echo 'before running mvn'
ls
cd __tests__/sbom/main-test-app
ls
mvn -Pnative package
find . -name "*.sbom.json" | grep . || exit 1
mvn -Pnative package | tee maven_output.log
find . -name "*.sbom.json" | grep . || exit 1
grep -E "Found SBOM file: .*/sbom.sbom.json" maven_output.log || exit 1
grep -E "pkg:maven/org.json/json@20211205" maven_output.log || exit 1
grep -E "Dependency snapshot submitted successfully" maven_output.log || exit 1
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,7 @@ Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
lib/**/*

# Ignore target directory in test
__tests__/**/target
66 changes: 36 additions & 30 deletions __tests__/sbom/main-test-app/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.oracle</groupId>
Expand All @@ -10,7 +11,7 @@
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
</properties>

<dependencies>
<dependency>
Expand All @@ -20,30 +21,35 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.3</version>
<executions>
<execution>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>sbom</imageName>
<mainClass>com.oracle.sbom.SBOMTestApplication</mainClass>
<buildArgs>
<buildArg>-Ob</buildArg>
<buildArg>--no-fallback</buildArg>
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>
<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.3</version>
<executions>
<execution>
<goals>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>sbom</imageName>
<mainClass>com.oracle.sbom.SBOMTestApplication</mainClass>
<buildArgs>
<buildArg>-Ob</buildArg>
<buildArg>--no-fallback</buildArg>
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit 4f8ed01

Please sign in to comment.