Fix integration test such that it only runs sbom test

This commit is contained in:
Joel Rudsberg 2024-11-29 16:04:37 +01:00
parent d4b97a410d
commit 1a3dab34e4
4 changed files with 408 additions and 413 deletions

View File

@ -18,416 +18,408 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: | - run: |
npm install npm install
- run: |
npm run build && npm run package && npm test
# - run: | # - run: |
# npm run all # npm run all
test: # test:
if: ${{ github.ref != 'refs/heads/sbom-support' }} # name: GraalVM
name: GraalVM # runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }} # strategy:
strategy: # matrix:
matrix: # java-version: ['23', '21', '17', '20', 'dev']
java-version: ['23', '21', '17', '20', 'dev'] # distribution: ['graalvm', 'graalvm-community']
distribution: ['graalvm', 'graalvm-community'] # os: [
os: [ # ubuntu-latest,
ubuntu-latest, # macos-latest, # macOS on Apple silicon
macos-latest, # macOS on Apple silicon # macos-13, # macOS on Intel
macos-13, # macOS on Intel # windows-latest
windows-latest # ]
] # set-gds-token: [false]
set-gds-token: [false] # components: ['']
components: [''] # include:
include: # - java-version: 'latest-ea'
- java-version: 'latest-ea' # distribution: 'graalvm'
distribution: 'graalvm' # os: ubuntu-latest
os: ubuntu-latest # - java-version: '24-ea'
- java-version: '24-ea' # distribution: 'graalvm'
distribution: 'graalvm' # os: ubuntu-latest
os: ubuntu-latest # - java-version: '21'
- java-version: '21' # distribution: ''
distribution: '' # os: ubuntu-latest
os: ubuntu-latest # - java-version: 'dev'
- java-version: 'dev' # distribution: ''
distribution: '' # os: windows-latest
os: windows-latest # - java-version: '21'
- java-version: '21' # distribution: 'graalvm-community'
distribution: 'graalvm-community' # os: ubuntu-latest
os: ubuntu-latest # components: 'native-image' # should print a warning but not fail
components: 'native-image' # should print a warning but not fail # - java-version: '21.0.0' # test for GA version (see #63)
- java-version: '21.0.0' # test for GA version (see #63) # distribution: 'graalvm'
distribution: 'graalvm' # os: ubuntu-latest
os: ubuntu-latest # - java-version: '17'
- java-version: '17' # distribution: 'graalvm'
distribution: 'graalvm' # os: ubuntu-latest
os: ubuntu-latest # set-gds-token: true
set-gds-token: true # - java-version: '17.0.13'
- java-version: '17.0.13' # distribution: 'graalvm'
distribution: 'graalvm' # os: ubuntu-latest
os: ubuntu-latest # set-gds-token: true
set-gds-token: true # steps:
steps: # - uses: actions/checkout@v4
- uses: actions/checkout@v4 # - name: Run setup-graalvm action
- name: Run setup-graalvm action # uses: ./
uses: ./ # with:
with: # java-version: ${{ matrix.java-version }}
java-version: ${{ matrix.java-version }} # distribution: ${{ matrix.distribution }}
distribution: ${{ matrix.distribution }} # github-token: ${{ secrets.GITHUB_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }} # components: ${{ matrix.components }}
components: ${{ matrix.components }} # gds-token: ${{ matrix.set-gds-token && secrets.GDS_TOKEN || '' }}
gds-token: ${{ matrix.set-gds-token && secrets.GDS_TOKEN || '' }} # - name: Check environment
- name: Check environment # run: |
run: | # echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "GRAALVM_HOME: $GRAALVM_HOME" # if [[ "${{ matrix.java-version }}" == "dev" ]]; then
if [[ "${{ matrix.java-version }}" == "dev" ]]; then # [[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12
[[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12 # else
else # [[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23 # fi
fi # echo "JAVA_HOME: $JAVA_HOME"
echo "JAVA_HOME: $JAVA_HOME" # java --version
java --version # java --version | grep "GraalVM" || exit 34
java --version | grep "GraalVM" || exit 34 # native-image --version
native-image --version # if: runner.os != 'Windows'
if: runner.os != 'Windows' # - name: Check Windows environment
- name: Check Windows environment # run: |
run: | # echo "GRAALVM_HOME: $env:GRAALVM_HOME"
echo "GRAALVM_HOME: $env:GRAALVM_HOME" # echo "JAVA_HOME: $env:JAVA_HOME"
echo "JAVA_HOME: $env:JAVA_HOME" # java --version
java --version # native-image --version
native-image --version # test-ce: # make sure the action works on a clean machine without building
test-ce: # make sure the action works on a clean machine without building # needs: test
if: ${{ github.ref != 'refs/heads/sbom-support' }} # name: CE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
needs: test # runs-on: ${{ matrix.os }}
name: CE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }} # strategy:
runs-on: ${{ matrix.os }} # matrix:
strategy: # version: ['latest', 'dev']
matrix: # java-version: ['17', '20']
version: ['latest', 'dev'] # components: ['native-image']
java-version: ['17', '20'] # os: [macos-latest, windows-latest, ubuntu-latest]
components: ['native-image'] # exclude:
os: [macos-latest, windows-latest, ubuntu-latest] # - version: 'latest'
exclude: # java-version: '20'
- version: 'latest' # - version: 'dev'
java-version: '20' # java-version: '19'
- version: 'dev' # include:
java-version: '19' # - version: '22.2.0' # for update notifications
include: # java-version: '17'
- version: '22.2.0' # for update notifications # components: 'native-image'
java-version: '17' # os: ubuntu-20.04
components: 'native-image' # - version: '21.2.0'
os: ubuntu-20.04 # java-version: '8' # for JDK 8 notification
- version: '21.2.0' # components: 'native-image'
java-version: '8' # for JDK 8 notification # os: ubuntu-latest
components: 'native-image' # - version: '22.3.1'
os: ubuntu-latest # java-version: '11' # for JDK 11 notification
- version: '22.3.1' # components: 'native-image'
java-version: '11' # for JDK 11 notification # os: macos-13
components: 'native-image' # - version: '22.3.1'
os: macos-13 # java-version: '17'
- version: '22.3.1' # components: 'native-image'
java-version: '17' # os: windows-2022
components: 'native-image' # - version: 'dev'
os: windows-2022 # java-version: 'dev'
- version: 'dev' # components: 'native-image'
java-version: 'dev' # os: ubuntu-latest
components: 'native-image' # steps:
os: ubuntu-latest # - uses: actions/checkout@v4
steps: # - name: Run setup-graalvm action
- uses: actions/checkout@v4 # uses: ./
- name: Run setup-graalvm action # with:
uses: ./ # version: ${{ matrix.version }}
with: # java-version: ${{ matrix.java-version }}
version: ${{ matrix.version }} # components: ${{ matrix.components }}
java-version: ${{ matrix.java-version }} # github-token: ${{ secrets.GITHUB_TOKEN }}
components: ${{ matrix.components }} # - name: Check environment
github-token: ${{ secrets.GITHUB_TOKEN }} # run: |
- name: Check environment # echo "GRAALVM_HOME: $GRAALVM_HOME"
run: | # if [[ "${{ matrix.version }}" == "dev" ]] && [[ "${{ matrix.java-version }}" == "dev" ]]; then
echo "GRAALVM_HOME: $GRAALVM_HOME" # [[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12
if [[ "${{ matrix.version }}" == "dev" ]] && [[ "${{ matrix.java-version }}" == "dev" ]]; then # else
[[ "$GRAALVM_HOME" == *"$RUNNER_TEMP"* ]] || exit 12 # [[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23
else # fi
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 23 # echo "JAVA_HOME: $JAVA_HOME"
fi # java -version
echo "JAVA_HOME: $JAVA_HOME" # java -version 2>&1 | grep "GraalVM" || exit 34
java -version # native-image --version
java -version 2>&1 | grep "GraalVM" || exit 34 # if [[ "${{ matrix.java-version }}" != "dev" ]]; then
native-image --version # gu list
if [[ "${{ matrix.java-version }}" != "dev" ]]; then # fi
gu list # if: runner.os != 'Windows'
fi # - name: Check Windows environment
if: runner.os != 'Windows' # run: |
- name: Check Windows environment # echo "GRAALVM_HOME: $env:GRAALVM_HOME"
run: | # echo "JAVA_HOME: $env:JAVA_HOME"
echo "GRAALVM_HOME: $env:GRAALVM_HOME" # java -version
echo "JAVA_HOME: $env:JAVA_HOME" # native-image --version
java -version # gu.cmd remove native-image
native-image --version # if: runner.os == 'Windows'
gu.cmd remove native-image # test-ee:
if: runner.os == 'Windows' # needs: test
test-ee: # name: EE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
if: ${{ github.ref != 'refs/heads/sbom-support' }} # runs-on: ${{ matrix.os }}
needs: test # strategy:
name: EE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }} # matrix:
if: github.event_name != 'pull_request' # version: ['latest']
runs-on: ${{ matrix.os }} # java-version: ['17']
strategy: # components: ['native-image']
matrix: # os: [macos-latest, windows-latest, ubuntu-latest]
version: ['latest'] # include:
java-version: ['17'] # - version: '22.3.3'
components: ['native-image'] # java-version: '11'
os: [macos-latest, windows-latest, ubuntu-latest] # components: 'native-image'
include: # os: ubuntu-latest
- version: '22.3.3' # - version: '22.3.3'
java-version: '11' # java-version: '17'
components: 'native-image' # components: 'native-image'
os: ubuntu-latest # os: ubuntu-latest
- version: '22.3.3' # steps:
java-version: '17' # - uses: actions/checkout@v4
components: 'native-image' # - name: Run setup-graalvm action
os: ubuntu-latest # uses: ./
steps: # with:
- uses: actions/checkout@v4 # version: ${{ matrix.version }}
- name: Run setup-graalvm action # gds-token: ${{ secrets.GDS_TOKEN }}
uses: ./ # java-version: ${{ matrix.java-version }}
with: # components: ${{ matrix.components }}
version: ${{ matrix.version }} # github-token: ${{ secrets.GITHUB_TOKEN }}
gds-token: ${{ secrets.GDS_TOKEN }} # - name: Check environment
java-version: ${{ matrix.java-version }} # run: |
components: ${{ matrix.components }} # echo "GRAALVM_HOME: $GRAALVM_HOME"
github-token: ${{ secrets.GITHUB_TOKEN }} # [[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
- name: Check environment # echo "JAVA_HOME: $JAVA_HOME"
run: | # java --version
echo "GRAALVM_HOME: $GRAALVM_HOME" # java --version | grep -e "GraalVM EE" -e "Oracle GraalVM" || exit 23
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12 # native-image --version
echo "JAVA_HOME: $JAVA_HOME" # gu list
java --version # if: runner.os != 'Windows'
java --version | grep -e "GraalVM EE" -e "Oracle GraalVM" || exit 23 # - name: Check Windows environment
native-image --version # run: |
gu list # echo "GRAALVM_HOME: $env:GRAALVM_HOME"
if: runner.os != 'Windows' # echo "JAVA_HOME: $env:JAVA_HOME"
- name: Check Windows environment # java --version
run: | # native-image --version
echo "GRAALVM_HOME: $env:GRAALVM_HOME" # gu.cmd remove native-image
echo "JAVA_HOME: $env:JAVA_HOME" # if: runner.os == 'Windows'
java --version # test-mandrel:
native-image --version # needs: test
gu.cmd remove native-image # name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
if: runner.os == 'Windows' # runs-on: ${{ matrix.os }}
test-mandrel: # strategy:
if: ${{ github.ref != 'refs/heads/sbom-support' }} # matrix:
needs: test # version: ['mandrel-22.2.0.0-Final', '23.0.1.2-Final', 'mandrel-latest']
name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }} # java-version: ['17']
runs-on: ${{ matrix.os }} # distribution: ['mandrel']
strategy: # os: [windows-latest, ubuntu-latest]
matrix: # include:
version: ['mandrel-22.2.0.0-Final', '23.0.1.2-Final', 'mandrel-latest'] # - version: 'mandrel-latest'
java-version: ['17'] # java-version: '17'
distribution: ['mandrel'] # distribution: '' # test empty distribution for backward compatibility
os: [windows-latest, ubuntu-latest] # os: ubuntu-latest
include: # - version: '' # test with no version
- version: 'mandrel-latest' # java-version: '21'
java-version: '17' # distribution: 'mandrel'
distribution: '' # test empty distribution for backward compatibility # os: ubuntu-latest
os: ubuntu-latest # steps:
- version: '' # test with no version # - uses: actions/checkout@v4
java-version: '21' # - name: Run setup-graalvm action
distribution: 'mandrel' # uses: ./
os: ubuntu-latest # with:
steps: # version: ${{ matrix.version }}
- uses: actions/checkout@v4 # distribution: ${{ matrix.distribution }}
- name: Run setup-graalvm action # java-version: ${{ matrix.java-version }}
uses: ./ # github-token: ${{ secrets.GITHUB_TOKEN }}
with: # - name: Check environment
version: ${{ matrix.version }} # run: |
distribution: ${{ matrix.distribution }} # echo "GRAALVM_HOME: $GRAALVM_HOME"
java-version: ${{ matrix.java-version }} # [[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
github-token: ${{ secrets.GITHUB_TOKEN }} # echo "JAVA_HOME: $JAVA_HOME"
- name: Check environment # java --version
run: | # java --version | grep "Temurin" || exit 23
echo "GRAALVM_HOME: $GRAALVM_HOME" # native-image --version
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12 # if: runner.os != 'Windows'
echo "JAVA_HOME: $JAVA_HOME" # - name: Check Windows environment
java --version # run: |
java --version | grep "Temurin" || exit 23 # echo "GRAALVM_HOME: $env:GRAALVM_HOME"
native-image --version # echo "JAVA_HOME: $env:JAVA_HOME"
if: runner.os != 'Windows' # java --version
- name: Check Windows environment # native-image --version
run: | # if: runner.os == 'Windows'
echo "GRAALVM_HOME: $env:GRAALVM_HOME" # test-liberica:
echo "JAVA_HOME: $env:JAVA_HOME" # needs: test
java --version # name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }})
native-image --version # runs-on: ${{ matrix.os }}
if: runner.os == 'Windows' # strategy:
test-liberica: # matrix:
if: ${{ github.ref != 'refs/heads/sbom-support' }} # java-version: ['17', '21.0.2']
needs: test # java-package: ['', 'jdk', 'jdk+fx']
name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }}) # os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }} # steps:
strategy: # - uses: actions/checkout@v4
matrix: # - name: Run setup-graalvm action
java-version: ['17', '21.0.2'] # uses: ./
java-package: ['', 'jdk', 'jdk+fx'] # with:
os: [ubuntu-latest, macos-latest, windows-latest] # distribution: liberica
steps: # java-version: ${{ matrix.java-version }}
- uses: actions/checkout@v4 # java-package: ${{ matrix.java-package }}
- name: Run setup-graalvm action # github-token: ${{ secrets.GITHUB_TOKEN }}
uses: ./ # - name: Check environment
with: # run: |
distribution: liberica # echo "GRAALVM_HOME: $GRAALVM_HOME"
java-version: ${{ matrix.java-version }} # [[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12
java-package: ${{ matrix.java-package }} # echo "JAVA_HOME: $JAVA_HOME"
github-token: ${{ secrets.GITHUB_TOKEN }} # java --version
- name: Check environment # java --version | fgrep -qw ${{ matrix.java-version }} || exit 23
run: | # native-image --version
echo "GRAALVM_HOME: $GRAALVM_HOME" # native-image --version | fgrep -qw ${{ matrix.java-version }} || exit 24
[[ "$GRAALVM_HOME" == *"$RUNNER_TOOL_CACHE"* ]] || exit 12 # if: runner.os != 'Windows'
echo "JAVA_HOME: $JAVA_HOME" # - name: Check Windows environment
java --version # shell: pwsh
java --version | fgrep -qw ${{ matrix.java-version }} || exit 23 # run: |
native-image --version # echo "GRAALVM_HOME: $env:GRAALVM_HOME"
native-image --version | fgrep -qw ${{ matrix.java-version }} || exit 24 # echo "JAVA_HOME: $env:JAVA_HOME"
if: runner.os != 'Windows' # java --version
- name: Check Windows environment # if (!(java --version | findstr \<${{ matrix.java-version }}\>)) {
shell: pwsh # exit 23
run: | # }
echo "GRAALVM_HOME: $env:GRAALVM_HOME" # native-image --version
echo "JAVA_HOME: $env:JAVA_HOME" # if (!(native-image --version | findstr \<${{ matrix.java-version }}\>)) {
java --version # exit 24
if (!(java --version | findstr \<${{ matrix.java-version }}\>)) { # }
exit 23 # if: runner.os == 'Windows'
} # test-native-image-windows:
native-image --version # name: native-image on windows-latest
if (!(native-image --version | findstr \<${{ matrix.java-version }}\>)) { # runs-on: windows-latest
exit 24 # permissions:
} # contents: read
if: runner.os == 'Windows' # pull-requests: write # for `native-image-pr-reports` option
test-native-image-windows: # steps:
if: ${{ github.ref != 'refs/heads/sbom-support' }} # - uses: actions/checkout@v4
name: native-image on windows-latest # - name: Run setup-graalvm action
runs-on: windows-latest # uses: ./
permissions: # with:
contents: read # java-version: 'dev'
pull-requests: write # for `native-image-pr-reports` option # distribution: 'graalvm-community'
steps: # native-image-job-reports: 'true'
- uses: actions/checkout@v4 # native-image-pr-reports: 'true'
- name: Run setup-graalvm action # github-token: ${{ secrets.GITHUB_TOKEN }}
uses: ./ # - name: Build HelloWorld executable with GraalVM Native Image on Windows
with: # run: |
java-version: 'dev' # echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
distribution: 'graalvm-community' # javac HelloWorld.java
native-image-job-reports: 'true' # native-image HelloWorld
native-image-pr-reports: 'true' # ./helloworld
github-token: ${{ secrets.GITHUB_TOKEN }} # test-native-image-windows-msvc:
- name: Build HelloWorld executable with GraalVM Native Image on Windows # name: native-image on windows-2022
run: | # runs-on: windows-2022
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java # permissions:
javac HelloWorld.java # contents: read
native-image HelloWorld # pull-requests: write # for `native-image-pr-reports` option
./helloworld # steps:
test-native-image-windows-msvc: # - uses: actions/checkout@v4
if: ${{ github.ref != 'refs/heads/sbom-support' }} # - name: Run setup-graalvm action
name: native-image on windows-2022 # uses: ./
runs-on: windows-2022 # with:
permissions: # java-version: '17'
contents: read # distribution: 'graalvm'
pull-requests: write # for `native-image-pr-reports` option # native-image-job-reports: 'true'
steps: # native-image-pr-reports: 'true'
- uses: actions/checkout@v4 # github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run setup-graalvm action # - name: Build HelloWorld executable with GraalVM Native Image on Windows
uses: ./ # run: |
with: # echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
java-version: '17' # javac HelloWorld.java
distribution: 'graalvm' # native-image HelloWorld
native-image-job-reports: 'true' # ./helloworld
native-image-pr-reports: 'true' # test-native-image-musl:
github-token: ${{ secrets.GITHUB_TOKEN }} # name: native-image-musl on ubuntu-latest
- name: Build HelloWorld executable with GraalVM Native Image on Windows # runs-on: ubuntu-latest
run: | # permissions:
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java # contents: read
javac HelloWorld.java # pull-requests: write # for `native-image-pr-reports` option
native-image HelloWorld # steps:
./helloworld # - uses: actions/checkout@v4
test-native-image-musl: # - name: Run setup-graalvm action
if: ${{ github.ref != 'refs/heads/sbom-support' }} # uses: ./
name: native-image-musl on ubuntu-latest # with:
runs-on: ubuntu-latest # java-version: 'dev'
permissions: # distribution: 'graalvm-community'
contents: read # native-image-musl: 'true'
pull-requests: write # for `native-image-pr-reports` option # native-image-job-reports: 'true'
steps: # native-image-pr-reports: 'true'
- uses: actions/checkout@v4 # github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run setup-graalvm action # - name: Build static HelloWorld executable with GraalVM Native Image and musl
uses: ./ # run: |
with: # echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
java-version: 'dev' # javac HelloWorld.java
distribution: 'graalvm-community' # native-image --static --libc=musl HelloWorld
native-image-musl: 'true' # ./helloworld
native-image-job-reports: 'true' # test-extensive:
native-image-pr-reports: 'true' # name: extensive tests on ubuntu-latest
github-token: ${{ secrets.GITHUB_TOKEN }} # runs-on: ubuntu-latest
- name: Build static HelloWorld executable with GraalVM Native Image and musl # permissions:
run: | # contents: read
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java # pull-requests: write # for `native-image-pr-reports` option
javac HelloWorld.java # steps:
native-image --static --libc=musl HelloWorld # - uses: actions/checkout@v4
./helloworld # - name: Run setup-graalvm action
test-extensive: # uses: ./
if: ${{ github.ref != 'refs/heads/sbom-support' }} # with:
name: extensive tests on ubuntu-latest # java-version: '17.0.8'
runs-on: ubuntu-latest # distribution: 'graalvm'
permissions: # components: 'espresso,llvm-toolchain,native-image,nodejs,python,ruby,wasm'
contents: read # set-java-home: 'false'
pull-requests: write # for `native-image-pr-reports` option # native-image-job-reports: 'true'
steps: # native-image-pr-reports: 'true'
- uses: actions/checkout@v4 # github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run setup-graalvm action # - name: Check environment
uses: ./ # run: |
with: # echo "GRAALVM_HOME: $GRAALVM_HOME"
java-version: '17.0.8' # echo "JAVA_HOME: $JAVA_HOME"
distribution: 'graalvm' # [[ "$GRAALVM_HOME" != "$JAVA_HOME" ]] || exit 12
components: 'espresso,llvm-toolchain,native-image,nodejs,python,ruby,wasm' # [[ $(which java) == *"graalvm"* ]] || exit 23
set-java-home: 'false' # java --version
native-image-job-reports: 'true' # java -truffle --version
native-image-pr-reports: 'true' # gu --version
github-token: ${{ secrets.GITHUB_TOKEN }} # gu list
- name: Check environment # [[ $(which lli) == *"graalvm"* ]] || exit 34
run: | # lli --version
echo "GRAALVM_HOME: $GRAALVM_HOME" # native-image --version
echo "JAVA_HOME: $JAVA_HOME" # [[ $(which node) == *"graalvm"* ]] || exit 45
[[ "$GRAALVM_HOME" != "$JAVA_HOME" ]] || exit 12 # node --version
[[ $(which java) == *"graalvm"* ]] || exit 23 # graalpy --version
java --version # truffleruby --version
java -truffle --version # wasm --version
gu --version # - name: Build HelloWorld.java with GraalVM Native Image
gu list # run: |
[[ $(which lli) == *"graalvm"* ]] || exit 34 # echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
lli --version # javac HelloWorld.java
native-image --version # native-image -g HelloWorld
[[ $(which node) == *"graalvm"* ]] || exit 45 # ./helloworld
node --version # # - name: Build Ruby-FFI with TruffleRuby
graalpy --version # # run: |
truffleruby --version # # [[ $(which bundle) == *"graalvm"* ]] || exit 57
wasm --version # # git clone --depth 1 https://github.com/ffi/ffi.git
- name: Build HelloWorld.java with GraalVM Native Image # # pushd ffi > /dev/null
run: | # # # https://github.com/ffi/ffi/blob/447845cb3030194c79700c86fb388a12e6f81386/.github/workflows/ci.yml#L58-L62
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java # # bundle install
javac HelloWorld.java # # bundle exec rake libffi
native-image -g HelloWorld # # bundle exec rake compile
./helloworld # # bundle exec rake test
# - name: Build Ruby-FFI with TruffleRuby # # popd > /dev/null
# run: | # - name: Remove components
# [[ $(which bundle) == *"graalvm"* ]] || exit 57 # run: gu remove espresso llvm-toolchain nodejs python ruby wasm
# git clone --depth 1 https://github.com/ffi/ffi.git
# pushd ffi > /dev/null
# # https://github.com/ffi/ffi/blob/447845cb3030194c79700c86fb388a12e6f81386/.github/workflows/ci.yml#L58-L62
# bundle install
# bundle exec rake libffi
# bundle exec rake compile
# bundle exec rake test
# popd > /dev/null
- name: Remove components
run: gu remove espresso llvm-toolchain nodejs python ruby wasm
test-sbom: test-sbom:
if: ${{ github.ref == 'refs/heads/sbom-support' }} needs: build
name: test 'native-image-enable-sbom' option name: test 'native-image-enable-sbom' option
runs-on: macos-latest # TODO: use matrix vlaue runs-on: macos-latest # TODO: use matrix vlaue
# TODO: use appropriate matrix # TODO: use appropriate matrix
@ -435,16 +427,14 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./ - uses: ./
with: with:
java-version: 'latest-ea' java-version: '23'
distribution: 'graalvm' distribution: 'graalvm'
native-image-enable-sbom: 'true' native-image-enable-sbom: 'true'
# set-java-home: 'false'
components: 'native-image' components: 'native-image'
- name: Verify SBOM was generated - name: Verify SBOM was generated
run: | run: |
# Create a simple native image that will generate SBOM
echo 'public class Hello { public static void main(String[] args) { System.out.println("Hello"); } }' > Hello.java echo 'public class Hello { public static void main(String[] args) { System.out.println("Hello"); } }' > Hello.java
javac Hello.java javac Hello.java
# '--enable-sbom=export' should get injected into the native-image command
native-image Hello native-image Hello
# Verify SBOM file exists
find . -name "*.sbom.json" | grep . || exit 1 find . -name "*.sbom.json" | grep . || exit 1

View File

@ -115,7 +115,7 @@ describe('sbom feature', () => {
expect(spyInfo).toHaveBeenCalledWith('Found SBOM file: ' + sbomPath) expect(spyInfo).toHaveBeenCalledWith('Found SBOM file: ' + sbomPath)
expect(spyInfo).toHaveBeenCalledWith('=== SBOM Content ===') expect(spyInfo).toHaveBeenCalledWith('=== SBOM Content ===')
expect(spyInfo).toHaveBeenCalledWith('Found 2 dependencies:') expect(spyInfo).toHaveBeenCalledWith('Found 2 components:')
expect(spyInfo).toHaveBeenCalledWith('- json@20211205') expect(spyInfo).toHaveBeenCalledWith('- json@20211205')
expect(spyInfo).toHaveBeenCalledWith('- main-test-app@1.0-SNAPSHOT') expect(spyInfo).toHaveBeenCalledWith('- main-test-app@1.0-SNAPSHOT')
expect(spyWarning).not.toHaveBeenCalled() expect(spyWarning).not.toHaveBeenCalled()

View File

@ -50,7 +50,7 @@ function displaySBOMContent(sbomData: any): void {
core.info('=== SBOM Content ===') core.info('=== SBOM Content ===')
if (sbomData.components) { if (sbomData.components) {
core.info(`Found ${sbomData.components.length} dependencies:`) core.info(`Found ${sbomData.components.length} components:`)
for (const component of sbomData.components) { for (const component of sbomData.components) {
core.info(`- ${component.name}@${component.version || 'unknown'}`) core.info(`- ${component.name}@${component.version || 'unknown'}`)
if (component.dependencies?.length > 0) { if (component.dependencies?.length > 0) {

View File

@ -18,6 +18,11 @@ import {setUpSBOMSupport} from './features/sbom'
async function run(): Promise<void> { async function run(): Promise<void> {
try { try {
core.info('')
core.info('Starting setup...')
const isSbomEnabled = core.getInput('native-image-enable-sbom') === 'true'
core.info(`SBOM generation is ${isSbomEnabled ? 'enabled' : 'disabled'}`)
core.info('')
const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true}) const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true})
const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE) const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE)
const distribution = core.getInput(c.INPUT_DISTRIBUTION) const distribution = core.getInput(c.INPUT_DISTRIBUTION)