mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-04-02 10:00:12 +08:00
Compare commits
28 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
aef1f09405 | ||
|
26a86e7135 | ||
|
01ed653ac8 | ||
|
3ca6fc3a8a | ||
|
271a696e78 | ||
|
2063b36b79 | ||
|
44d0c2f19b | ||
|
26e3dc36fc | ||
|
e6854f2a7c | ||
|
a1c06b5535 | ||
|
e4bdac3847 | ||
|
00f0f13934 | ||
|
63ca6fe724 | ||
|
5b85983c0a | ||
|
f4c22e2c3f | ||
|
2ea5788b37 | ||
|
b5709ab80d | ||
|
6e1c9cebb5 | ||
|
601e3a4caa | ||
|
b0cb26a8da | ||
|
30b157ff45 | ||
|
0f761465f7 | ||
|
f07b5bfaef | ||
|
fcc01ed19b | ||
|
c65e623881 | ||
|
3040d71541 | ||
|
70a5974953 | ||
|
aa331906a0 |
37
.github/workflows/ci.yml
vendored
37
.github/workflows/ci.yml
vendored
@ -41,7 +41,7 @@ jobs:
|
||||
PASSES_GDS_TOKEN_CHECK: ${{ !matrix.set-gds-token || secrets.GDS_TOKEN != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: ['23', '21', '17', '20', 'dev']
|
||||
java-version: ['24', '21', '17', '20', 'dev']
|
||||
distribution: ['graalvm', 'graalvm-community']
|
||||
os: [
|
||||
ubuntu-latest, # Linux on Intel
|
||||
@ -56,7 +56,7 @@ jobs:
|
||||
- java-version: 'latest-ea'
|
||||
distribution: 'graalvm'
|
||||
os: ubuntu-latest
|
||||
- java-version: '24-ea'
|
||||
- java-version: '25-ea'
|
||||
distribution: 'graalvm'
|
||||
os: ubuntu-latest
|
||||
- java-version: '21'
|
||||
@ -90,7 +90,7 @@ jobs:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
components: ${{ matrix.components }}
|
||||
gds-token: ${{ matrix.set-gds-token && secrets.GDS_TOKEN || '' }}
|
||||
if: env.PASSES_GDS_TOKEN_CHECK
|
||||
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' }}
|
||||
- name: Check environment
|
||||
run: |
|
||||
echo "GRAALVM_HOME: $GRAALVM_HOME"
|
||||
@ -103,14 +103,14 @@ jobs:
|
||||
java --version
|
||||
java --version | grep "GraalVM" || exit 34
|
||||
native-image --version
|
||||
if: runner.os != 'Windows' && env.PASSES_GDS_TOKEN_CHECK
|
||||
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os != 'Windows' }}
|
||||
- name: Check Windows environment
|
||||
run: |
|
||||
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
|
||||
echo "JAVA_HOME: $env:JAVA_HOME"
|
||||
java --version
|
||||
native-image --version
|
||||
if: runner.os == 'Windows' && env.PASSES_GDS_TOKEN_CHECK
|
||||
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os == 'Windows' }}
|
||||
|
||||
test-action-ce: # make sure the action works on a clean machine without building
|
||||
needs: test-action
|
||||
@ -172,7 +172,7 @@ jobs:
|
||||
if [[ "${{ matrix.java-version }}" != "dev" ]]; then
|
||||
gu list
|
||||
fi
|
||||
if: runner.os != 'Windows'
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
- name: Check Windows environment
|
||||
run: |
|
||||
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
|
||||
@ -180,13 +180,16 @@ jobs:
|
||||
java -version
|
||||
native-image --version
|
||||
gu.cmd remove native-image
|
||||
if: runner.os == 'Windows'
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
|
||||
test-action-ee:
|
||||
needs: test-action
|
||||
name: EE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
|
||||
if: github.event_name != 'pull_request'
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
# Skip builds that require a GDS token but have no access to one (e.g., secrets are unavailable in PR runs)
|
||||
PASSES_GDS_TOKEN_CHECK: ${{ secrets.GDS_TOKEN != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
version: ['latest']
|
||||
@ -212,6 +215,7 @@ jobs:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
components: ${{ matrix.components }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' }}
|
||||
- name: Check environment
|
||||
run: |
|
||||
echo "GRAALVM_HOME: $GRAALVM_HOME"
|
||||
@ -221,7 +225,7 @@ jobs:
|
||||
java --version | grep -e "GraalVM EE" -e "Oracle GraalVM" || exit 23
|
||||
native-image --version
|
||||
gu list
|
||||
if: runner.os != 'Windows'
|
||||
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os != 'Windows' }}
|
||||
- name: Check Windows environment
|
||||
run: |
|
||||
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
|
||||
@ -229,7 +233,7 @@ jobs:
|
||||
java --version
|
||||
native-image --version
|
||||
gu.cmd remove native-image
|
||||
if: runner.os == 'Windows'
|
||||
if: ${{ env.PASSES_GDS_TOKEN_CHECK == 'true' && runner.os == 'Windows' }}
|
||||
|
||||
test-action-mandrel:
|
||||
needs: test-action
|
||||
@ -267,14 +271,14 @@ jobs:
|
||||
java --version
|
||||
java --version | grep "Temurin" || exit 23
|
||||
native-image --version
|
||||
if: runner.os != 'Windows'
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
- name: Check Windows environment
|
||||
run: |
|
||||
echo "GRAALVM_HOME: $env:GRAALVM_HOME"
|
||||
echo "JAVA_HOME: $env:JAVA_HOME"
|
||||
java --version
|
||||
native-image --version
|
||||
if: runner.os == 'Windows'
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
|
||||
test-action-liberica:
|
||||
needs: test-action
|
||||
@ -303,7 +307,7 @@ jobs:
|
||||
java --version | fgrep -qw ${{ matrix.java-version }} || exit 23
|
||||
native-image --version
|
||||
native-image --version | fgrep -qw ${{ matrix.java-version }} || exit 24
|
||||
if: runner.os != 'Windows'
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
- name: Check Windows environment
|
||||
shell: pwsh
|
||||
run: |
|
||||
@ -317,7 +321,7 @@ jobs:
|
||||
if (!(native-image --version | findstr \<${{ matrix.java-version }}\>)) {
|
||||
exit 24
|
||||
}
|
||||
if: runner.os == 'Windows'
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
|
||||
test-action-native-image-windows:
|
||||
name: native-image on windows-latest
|
||||
@ -454,7 +458,7 @@ jobs:
|
||||
matrix:
|
||||
java-version: ['24-ea', 'latest-ea']
|
||||
distribution: ['graalvm']
|
||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||
os: [macos-latest, windows-latest, ubuntu-latest, ubuntu-22.04-arm]
|
||||
components: ['']
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -466,17 +470,18 @@ jobs:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
components: ${{ matrix.components }}
|
||||
native-image-enable-sbom: 'true'
|
||||
cache: 'maven'
|
||||
- name: Build Maven project and verify that SBOM was generated and its contents
|
||||
run: |
|
||||
cd __tests__/sbom/main-test-app
|
||||
mvn --no-transfer-progress -Pnative package
|
||||
bash verify-sbom.sh
|
||||
shell: bash
|
||||
if: runner.os != 'Windows'
|
||||
if: ${{ runner.os != 'Windows' }}
|
||||
- name: Build Maven project and verify that SBOM was generated and its contents (Windows)
|
||||
run: |
|
||||
cd __tests__\sbom\main-test-app
|
||||
mvn --no-transfer-progress -Pnative package
|
||||
cmd /c verify-sbom.cmd
|
||||
shell: cmd
|
||||
if: runner.os == 'Windows'
|
||||
if: ${{ runner.os == 'Windows' }}
|
||||
|
@ -9,7 +9,7 @@ This action:
|
||||
- exports a `$GRAALVM_HOME` environment variable
|
||||
- adds `$GRAALVM_HOME/bin` to the `$PATH` environment variable<br>(Native Image, Truffle languages, and tools can be invoked directly)
|
||||
- sets `$JAVA_HOME` to `$GRAALVM_HOME` by default<br>(can be disabled via `set-java-home: 'false'`, see [Options](#options))
|
||||
- supports `x64` and `aarch64` (selected automatically, `aarch64` requires a [self-hosted runner][gha-self-hosted-runners])
|
||||
- supports `x64` and `aarch64/arm64` (see how to use [Linux arm64 runners](https://github.blog/changelog/2025-01-16-linux-arm64-hosted-runners-now-available-for-free-in-public-repositories-public-preview/))
|
||||
- supports dependency caching for Apache Maven, Gradle, and sbt (see [`cache` option](#options))
|
||||
- sets up Windows environments with build tools using [vcvarsall.bat][vcvarsall]
|
||||
- has built-in support for GraalVM components and the [GraalVM Updater][gu]
|
||||
|
@ -145,6 +145,7 @@ describe('sbom feature', () => {
|
||||
writeFileSync(sbomPath, JSON.stringify(sbom, null, 2))
|
||||
|
||||
mockFindSBOM([sbomPath])
|
||||
jest.spyOn(core, 'getState').mockReturnValue(javaVersion)
|
||||
|
||||
await processSBOM()
|
||||
}
|
||||
@ -190,6 +191,10 @@ describe('sbom feature', () => {
|
||||
]
|
||||
}
|
||||
|
||||
it('should throw an error if setUpSBOMSupport was not called before processSBOM', async () => {
|
||||
await expect(processSBOM()).rejects.toThrow('setUpSBOMSupport must be called before processSBOM')
|
||||
})
|
||||
|
||||
it('should process SBOM and display components', async () => {
|
||||
await setUpAndProcessSBOM(sampleSBOM)
|
||||
|
||||
|
@ -72,6 +72,6 @@ outputs:
|
||||
description: 'A boolean value to indicate an exact match was found for the primary key'
|
||||
runs:
|
||||
using: 'node20'
|
||||
main: 'dist/main.js'
|
||||
post: 'dist/cleanup.js'
|
||||
main: 'dist/main/index.js'
|
||||
post: 'dist/cleanup/index.js'
|
||||
post-if: 'success()'
|
||||
|
1
dist/cleanup.js.map
generated
vendored
1
dist/cleanup.js.map
generated
vendored
File diff suppressed because one or more lines are too long
126537
dist/main.js → dist/cleanup/index.js
generated
vendored
126537
dist/main.js → dist/cleanup/index.js
generated
vendored
File diff suppressed because one or more lines are too long
1
dist/main.js.map
generated
vendored
1
dist/main.js.map
generated
vendored
File diff suppressed because one or more lines are too long
125276
dist/cleanup.js → dist/main/index.js
generated
vendored
125276
dist/cleanup.js → dist/main/index.js
generated
vendored
File diff suppressed because one or more lines are too long
@ -1,29 +1,14 @@
|
||||
// See: https://jestjs.io/docs/configuration
|
||||
|
||||
/** @type {import('ts-jest').JestConfigWithTsJest} **/
|
||||
export default {
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
collectCoverage: true,
|
||||
collectCoverageFrom: ['./src/**'],
|
||||
coverageDirectory: './coverage',
|
||||
coveragePathIgnorePatterns: ['/node_modules/', '/dist/'],
|
||||
coverageReporters: ['json-summary', 'text', 'lcov'],
|
||||
extensionsToTreatAsEsm: ['.ts'],
|
||||
moduleFileExtensions: ['ts', 'js'],
|
||||
preset: 'ts-jest',
|
||||
reporters: ['default'],
|
||||
resolver: 'ts-jest-resolver',
|
||||
testEnvironment: 'node',
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
|
||||
transform: {
|
||||
'^.+\\.ts$': [
|
||||
'ts-jest',
|
||||
{
|
||||
tsconfig: 'tsconfig.eslint.json',
|
||||
useESM: true
|
||||
}
|
||||
]
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
|
2205
package-lock.json
generated
2205
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
43
package.json
43
package.json
@ -2,8 +2,7 @@
|
||||
"name": "setup-graalvm",
|
||||
"author": "GraalVM Community",
|
||||
"description": "GitHub Action for GraalVM",
|
||||
"version": "1.3.0",
|
||||
"type": "module",
|
||||
"version": "1.3.3",
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -27,14 +26,14 @@
|
||||
"format:check": "npx prettier --check .",
|
||||
"lint": "npx eslint .",
|
||||
"package": "npm run package:main && npm run package:cleanup",
|
||||
"package:main": "npx rollup --config rollup.main.config.ts --configPlugin @rollup/plugin-typescript",
|
||||
"package:cleanup": "npx rollup --config rollup.cleanup.config.ts --configPlugin @rollup/plugin-typescript",
|
||||
"package:main": "npx ncc build src/main.ts -o dist/main",
|
||||
"package:cleanup": "npx ncc build src/cleanup.ts -o dist/cleanup",
|
||||
"test": "npx jest",
|
||||
"all": "npm run format:write && npm run lint && npm run test && npm run package"
|
||||
},
|
||||
"license": "UPL",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.0.0",
|
||||
"@actions/cache": "^4.0.2",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
@ -43,26 +42,23 @@
|
||||
"@actions/io": "^1.1.3",
|
||||
"@actions/tool-cache": "^2.0.2",
|
||||
"@octokit/core": "^5.2.0",
|
||||
"@octokit/types": "^12.6.0",
|
||||
"@octokit/types": "^13.8.0",
|
||||
"@github/dependency-submission-toolkit": "^2.0.4",
|
||||
"semver": "^7.6.3",
|
||||
"uuid": "^11.0.5"
|
||||
"semver": "^7.7.1",
|
||||
"uuid": "^11.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.6",
|
||||
"@rollup/plugin-commonjs": "^28.0.1",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.0",
|
||||
"@rollup/plugin-typescript": "^12.1.1",
|
||||
"@eslint/compat": "^1.2.7",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^20.17.12",
|
||||
"@types/node": "^20.17.22",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.22.0",
|
||||
"@typescript-eslint/parser": "^8.22.0",
|
||||
"eslint": "^9.19.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"@typescript-eslint/eslint-plugin": "^8.25.0",
|
||||
"@typescript-eslint/parser": "^8.25.0",
|
||||
"@vercel/ncc": "^0.38.3",
|
||||
"eslint": "^9.21.0",
|
||||
"eslint-config-prettier": "^10.0.2",
|
||||
"eslint-import-resolver-typescript": "^3.8.3",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-jest": "^28.10.0",
|
||||
"eslint-plugin-jsonc": "^2.19.1",
|
||||
@ -70,15 +66,10 @@
|
||||
"eslint-plugin-prettier": "^5.2.3",
|
||||
"jest": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier-eslint": "^16.3.0",
|
||||
"rollup": "^4.34.1",
|
||||
"ts-jest": "^29.2.5",
|
||||
"ts-jest-resolver": "^2.0.1",
|
||||
"ts-jest": "^29.2.6",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.7.3"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-linux-x64-gnu": "*"
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
// See: https://rollupjs.org/introduction/
|
||||
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import json from '@rollup/plugin-json'
|
||||
import nodeResolve from '@rollup/plugin-node-resolve'
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
|
||||
const config = {
|
||||
input: 'src/cleanup.ts',
|
||||
output: {
|
||||
esModule: true,
|
||||
file: 'dist/cleanup.js',
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [typescript(), nodeResolve(), commonjs(), json()]
|
||||
}
|
||||
|
||||
export default config
|
@ -1,19 +0,0 @@
|
||||
// See: https://rollupjs.org/introduction/
|
||||
|
||||
import commonjs from '@rollup/plugin-commonjs'
|
||||
import json from '@rollup/plugin-json'
|
||||
import nodeResolve from '@rollup/plugin-node-resolve'
|
||||
import typescript from '@rollup/plugin-typescript'
|
||||
|
||||
const config = {
|
||||
input: 'src/main.ts',
|
||||
output: {
|
||||
esModule: true,
|
||||
file: 'dist/main.js',
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [typescript(), nodeResolve(), commonjs(), json()]
|
||||
}
|
||||
|
||||
export default config
|
@ -25,10 +25,10 @@
|
||||
*/
|
||||
|
||||
import * as core from '@actions/core'
|
||||
import * as constants from './constants.js'
|
||||
import { save } from './features/cache.js'
|
||||
import { generateReports } from './features/reports.js'
|
||||
import { processSBOM } from './features/sbom.js'
|
||||
import * as constants from './constants'
|
||||
import { save } from './features/cache'
|
||||
import { generateReports } from './features/reports'
|
||||
import { processSBOM } from './features/sbom'
|
||||
|
||||
/**
|
||||
* Check given input and run a save process for the specified package manager
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as otypes from '@octokit/types'
|
||||
|
||||
export const ACTION_VERSION = '1.3.0'
|
||||
export const ACTION_VERSION = '1.3.3'
|
||||
|
||||
export const INPUT_VERSION = 'version'
|
||||
export const INPUT_GDS_TOKEN = 'gds-token'
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as core from '@actions/core'
|
||||
import { GRAALVM_PLATFORM } from './constants.js'
|
||||
import { exec } from './utils.js'
|
||||
import { GRAALVM_PLATFORM } from './constants'
|
||||
import { exec } from './utils'
|
||||
|
||||
const APT_GET_INSTALL_BASE = 'sudo apt-get -y --no-upgrade install'
|
||||
const COMPONENT_TO_DEPS = new Map<string, Map<string, string>>([
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as c from '../constants.js'
|
||||
import * as c from '../constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import { exec } from '../utils.js'
|
||||
import { exec } from '../utils'
|
||||
import { join } from 'path'
|
||||
|
||||
const MUSL_NAME = 'x86_64-linux-musl-native'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as c from '../constants.js'
|
||||
import * as c from '../constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import * as github from '@actions/github'
|
||||
@ -11,7 +11,7 @@ import {
|
||||
updatePRComment,
|
||||
tmpfile,
|
||||
setNativeImageOption
|
||||
} from '../utils.js'
|
||||
} from '../utils'
|
||||
|
||||
const BUILD_OUTPUT_JSON_PATH = tmpfile('native-image-build-output.json')
|
||||
const BYTES_TO_KiB = 1024
|
||||
|
@ -1,17 +1,16 @@
|
||||
import * as c from '../constants.js'
|
||||
import * as c from '../constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import * as github from '@actions/github'
|
||||
import * as glob from '@actions/glob'
|
||||
import { basename } from 'path'
|
||||
import * as semver from 'semver'
|
||||
import { setNativeImageOption } from '../utils.js'
|
||||
import { setNativeImageOption } from '../utils'
|
||||
|
||||
const INPUT_NI_SBOM = 'native-image-enable-sbom'
|
||||
const SBOM_FILE_SUFFIX = '.sbom.json'
|
||||
const MIN_JAVA_VERSION = '24.0.0'
|
||||
|
||||
let javaVersionOrLatestEA: string | null = null
|
||||
const javaVersionKey = 'javaVersionKey'
|
||||
|
||||
interface SBOM {
|
||||
components: Component[]
|
||||
@ -67,36 +66,36 @@ interface DependencySnapshot {
|
||||
>
|
||||
}
|
||||
|
||||
export function setUpSBOMSupport(javaVersionOrDev: string, distribution: string): void {
|
||||
export function setUpSBOMSupport(javaVersion: string, distribution: string): void {
|
||||
if (!isFeatureEnabled()) {
|
||||
return
|
||||
}
|
||||
|
||||
validateJavaVersionAndDistribution(javaVersionOrDev, distribution)
|
||||
javaVersionOrLatestEA = javaVersionOrDev
|
||||
setNativeImageOption(javaVersionOrLatestEA, '--enable-sbom=export')
|
||||
validateJavaVersionAndDistribution(javaVersion, distribution)
|
||||
core.saveState(javaVersionKey, javaVersion)
|
||||
setNativeImageOption(javaVersion, '--enable-sbom=export')
|
||||
core.info('Enabled SBOM generation for Native Image build')
|
||||
}
|
||||
|
||||
function validateJavaVersionAndDistribution(javaVersionOrDev: string, distribution: string): void {
|
||||
function validateJavaVersionAndDistribution(javaVersion: string, distribution: string): void {
|
||||
if (distribution !== c.DISTRIBUTION_GRAALVM) {
|
||||
throw new Error(
|
||||
`The '${INPUT_NI_SBOM}' option is only supported for Oracle GraalVM (distribution '${c.DISTRIBUTION_GRAALVM}'), but found distribution '${distribution}'.`
|
||||
)
|
||||
}
|
||||
|
||||
if (javaVersionOrDev === 'dev') {
|
||||
if (javaVersion === 'dev') {
|
||||
throw new Error(`The '${INPUT_NI_SBOM}' option is not supported for java-version 'dev'.`)
|
||||
}
|
||||
|
||||
if (javaVersionOrDev === 'latest-ea') {
|
||||
if (javaVersion === 'latest-ea') {
|
||||
return
|
||||
}
|
||||
|
||||
const coercedJavaVersion = semver.coerce(javaVersionOrDev)
|
||||
const coercedJavaVersion = semver.coerce(javaVersion)
|
||||
if (!coercedJavaVersion || semver.gt(MIN_JAVA_VERSION, coercedJavaVersion)) {
|
||||
throw new Error(
|
||||
`The '${INPUT_NI_SBOM}' option is only supported for GraalVM for JDK ${MIN_JAVA_VERSION} or later, but found java-version '${javaVersionOrDev}'.`
|
||||
`The '${INPUT_NI_SBOM}' option is only supported for GraalVM for JDK ${MIN_JAVA_VERSION} or later, but found java-version '${javaVersion}'.`
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -106,7 +105,8 @@ export async function processSBOM(): Promise<void> {
|
||||
return
|
||||
}
|
||||
|
||||
if (javaVersionOrLatestEA === null) {
|
||||
const javaVersion = core.getState(javaVersionKey)
|
||||
if (!javaVersion) {
|
||||
throw new Error('setUpSBOMSupport must be called before processSBOM')
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ export async function processSBOM(): Promise<void> {
|
||||
const sbomData = parseSBOM(sbomContent)
|
||||
const components = mapToComponentsWithDependencies(sbomData)
|
||||
printSBOMContent(components)
|
||||
const snapshot = convertSBOMToSnapshot(sbomPath, components)
|
||||
const snapshot = convertSBOMToSnapshot(javaVersion, sbomPath, components)
|
||||
await submitDependencySnapshot(snapshot)
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
@ -184,7 +184,7 @@ function printSBOMContent(components: Component[]): void {
|
||||
core.info('==================')
|
||||
}
|
||||
|
||||
function convertSBOMToSnapshot(sbomPath: string, components: Component[]): DependencySnapshot {
|
||||
function convertSBOMToSnapshot(javaVersion: string, sbomPath: string, components: Component[]): DependencySnapshot {
|
||||
const context = github.context
|
||||
const sbomFileName = basename(sbomPath)
|
||||
|
||||
@ -203,7 +203,7 @@ function convertSBOMToSnapshot(sbomPath: string, components: Component[]): Depen
|
||||
},
|
||||
detector: {
|
||||
name: 'Oracle GraalVM',
|
||||
version: javaVersionOrLatestEA ?? '',
|
||||
version: javaVersion,
|
||||
url: 'https://www.graalvm.org/'
|
||||
},
|
||||
scanned: new Date().toISOString(),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as fs from 'fs'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
@ -8,8 +8,8 @@ import * as stream from 'stream'
|
||||
import * as util from 'util'
|
||||
import * as semver from 'semver'
|
||||
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'
|
||||
import { RetryHelper } from '@actions/tool-cache/lib/retry-helper.js'
|
||||
import { calculateSHA256 } from './utils.js'
|
||||
import { RetryHelper } from '@actions/tool-cache/lib/retry-helper'
|
||||
import { calculateSHA256 } from './utils'
|
||||
import { ok } from 'assert'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as semver from 'semver'
|
||||
import {
|
||||
@ -8,8 +8,8 @@ import {
|
||||
getLatestRelease,
|
||||
getMatchingTags,
|
||||
getTaggedRelease
|
||||
} from './utils.js'
|
||||
import { downloadGraalVM, downloadGraalVMEELegacy } from './gds.js'
|
||||
} from './utils'
|
||||
import { downloadGraalVM, downloadGraalVMEELegacy } from './gds'
|
||||
import { downloadTool } from '@actions/tool-cache'
|
||||
import { basename } from 'path'
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as semver from 'semver'
|
||||
import { GRAALVM_PLATFORM } from './constants.js'
|
||||
import { exec } from './utils.js'
|
||||
import { GRAALVM_PLATFORM } from './constants'
|
||||
import { exec } from './utils'
|
||||
import { join } from 'path'
|
||||
|
||||
const BASE_FLAGS = ['--non-interactive', 'install', '--no-progress']
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as semver from 'semver'
|
||||
import { downloadExtractAndCacheJDK, getTaggedRelease, getMatchingTags } from './utils.js'
|
||||
import { downloadExtractAndCacheJDK, getTaggedRelease, getMatchingTags } from './utils'
|
||||
import { downloadTool } from '@actions/tool-cache'
|
||||
import { spawnSync } from 'child_process'
|
||||
|
||||
|
24
src/main.ts
24
src/main.ts
@ -1,20 +1,20 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as graalvm from './graalvm.js'
|
||||
import * as graalvm from './graalvm'
|
||||
import * as semver from 'semver'
|
||||
import { isFeatureAvailable as isCacheAvailable } from '@actions/cache'
|
||||
import { basename, join } from 'path'
|
||||
import { restore } from './features/cache.js'
|
||||
import { setUpDependencies } from './dependencies.js'
|
||||
import { setUpGUComponents } from './gu.js'
|
||||
import { setUpMandrel } from './mandrel.js'
|
||||
import { setUpLiberica } from './liberica.js'
|
||||
import { checkForUpdates } from './features/check-for-updates.js'
|
||||
import { setUpNativeImageMusl } from './features/musl.js'
|
||||
import { setUpWindowsEnvironment } from './msvc.js'
|
||||
import { setUpNativeImageBuildReports } from './features/reports.js'
|
||||
import { restore } from './features/cache'
|
||||
import { setUpDependencies } from './dependencies'
|
||||
import { setUpGUComponents } from './gu'
|
||||
import { setUpMandrel } from './mandrel'
|
||||
import { setUpLiberica } from './liberica'
|
||||
import { checkForUpdates } from './features/check-for-updates'
|
||||
import { setUpNativeImageMusl } from './features/musl'
|
||||
import { setUpWindowsEnvironment } from './msvc'
|
||||
import { setUpNativeImageBuildReports } from './features/reports'
|
||||
import { exec } from '@actions/exec'
|
||||
import { setUpSBOMSupport } from './features/sbom.js'
|
||||
import { setUpSBOMSupport } from './features/sbom'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
import { downloadExtractAndCacheJDK } from './utils.js'
|
||||
import { downloadExtractAndCacheJDK } from './utils'
|
||||
import { downloadTool } from '@actions/tool-cache'
|
||||
import { basename } from 'path'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as core from '@actions/core'
|
||||
import { execSync } from 'child_process'
|
||||
import { existsSync } from 'fs'
|
||||
import { VERSION_DEV } from './constants.js'
|
||||
import { VERSION_DEV } from './constants'
|
||||
|
||||
// Keep in sync with https://github.com/actions/virtual-environments
|
||||
const KNOWN_VISUAL_STUDIO_INSTALLATIONS = [
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as c from './constants.js'
|
||||
import * as c from './constants'
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import * as httpClient from '@actions/http-client'
|
||||
|
@ -15,6 +15,7 @@
|
||||
"noUnusedParameters": false,
|
||||
"pretty": true,
|
||||
"resolveJsonModule": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"strictNullChecks": true,
|
||||
"target": "ES2022"
|
||||
|
@ -6,12 +6,5 @@
|
||||
"noEmit": true
|
||||
},
|
||||
"exclude": ["dist", "node_modules"],
|
||||
"include": [
|
||||
"__tests__",
|
||||
"src",
|
||||
"eslint.config.mjs",
|
||||
"jest.config.js",
|
||||
"rollup.cleanup.config.ts",
|
||||
"rollup.main.config.ts"
|
||||
]
|
||||
"include": ["__tests__", "src", "eslint.config.mjs", "jest.config.js"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user