Compare commits

...

5 Commits

Author SHA1 Message Date
Fabio Niephaus
aafbedb8d3 Bump version to 1.2.8. 2025-01-21 13:20:45 +01:00
Fabio Niephaus
51d59d0348 Update ci.yml workflow with template. 2025-01-21 13:20:45 +01:00
Fabio Niephaus
ee1b2d994c Update check-dist.yml workflow with template. 2025-01-21 13:20:45 +01:00
Fabio Niephaus
6cf8f984ce Address eslint errors and warnings. 2025-01-21 13:03:59 +01:00
Fabio Niephaus
61fd4fc5d8 Upgrade to eslint 9. 2025-01-21 13:03:58 +01:00
29 changed files with 60027 additions and 80656 deletions

View File

@@ -1,4 +0,0 @@
dist/
lib/
node_modules/
jest.config.js

View File

@@ -1,55 +0,0 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}

View File

@@ -1,9 +1,13 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/
# In TypeScript actions, `dist/` is a special directory. When you reference
# an action with the `uses:` property, `dist/index.js` is the code that will be
# run. For this project, the `dist/index.js` file is transpiled from other
# source files. This workflow ensures the `dist/` directory contains the
# expected transpiled code.
#
# If this workflow is run from a feature branch, it will act as an additional CI
# check and fail if the checked-in `dist/` directory does not match what is
# expected from the build.
name: Check Transpiled JavaScript
on:
push:
@@ -16,40 +20,57 @@ on:
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
jobs:
check-dist:
name: Check dist/
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: Set Node.js 20.x
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
with:
node-version: 20.x
node-version-file: .node-version
cache: npm
- name: Install dependencies
- name: Install Dependencies
id: install
run: npm ci
- name: Rebuild the dist/ directory
run: npm run build
- name: Build dist/ Directory
id: build
run: npm run bundle
- name: Compare the expected and actual dist/ directories
# This will fail the workflow if the `dist/` directory is different than
# expected.
- name: Compare Directories
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
if [ ! -d dist/ ]; then
echo "Expected dist/ directory does not exist. See status below:"
ls -la ./
exit 1
fi
if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff --ignore-space-at-eol --text dist/
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
# If `dist/` was different than expected, upload the expected version as a
# workflow artifact.
- if: ${{ failure() && steps.diff.outcome == 'failure' }}
name: Upload Artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/

View File

@@ -1,4 +1,4 @@
name: 'build-test'
name: Continuous Integration
on:
push:
@@ -8,19 +8,32 @@ on:
paths-ignore:
- '**.md'
workflow_dispatch:
permissions:
contents: read
jobs:
build: # make sure build/ci work properly
test-typescript:
name: TypeScript Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
npm install
- run: |
npm run all
test:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Dependencies
run: npm clean-install
- name: Check Format
run: npm run format:check
- name: Lint
run: npm run lint
- name: Test
run: npm run test
test-action:
name: GraalVM
runs-on: ${{ matrix.os }}
strategy:
@@ -28,11 +41,11 @@ jobs:
java-version: ['23', '21', '17', '20', 'dev']
distribution: ['graalvm', 'graalvm-community']
os: [
ubuntu-latest,
macos-latest, # macOS on Apple silicon
macos-13, # macOS on Intel
windows-latest
]
ubuntu-latest,
macos-latest, # macOS on Apple silicon
macos-13, # macOS on Intel
windows-latest
]
set-gds-token: [false]
components: ['']
include:
@@ -95,8 +108,9 @@ jobs:
java --version
native-image --version
if: runner.os == 'Windows'
test-ce: # make sure the action works on a clean machine without building
needs: test
test-action-ce: # make sure the action works on a clean machine without building
needs: test-action
name: CE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
@@ -164,8 +178,9 @@ jobs:
native-image --version
gu.cmd remove native-image
if: runner.os == 'Windows'
test-ee:
needs: test
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 }}
@@ -212,8 +227,9 @@ jobs:
native-image --version
gu.cmd remove native-image
if: runner.os == 'Windows'
test-mandrel:
needs: test
test-action-mandrel:
needs: test-action
name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
@@ -256,8 +272,9 @@ jobs:
java --version
native-image --version
if: runner.os == 'Windows'
test-liberica:
needs: test
test-action-liberica:
needs: test-action
name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
@@ -298,7 +315,8 @@ jobs:
exit 24
}
if: runner.os == 'Windows'
test-native-image-windows:
test-action-native-image-windows:
name: native-image on windows-latest
runs-on: windows-latest
permissions:
@@ -320,7 +338,8 @@ jobs:
javac HelloWorld.java
native-image HelloWorld
./helloworld
test-native-image-windows-msvc:
test-action-native-image-windows-msvc:
name: native-image on windows-2022
runs-on: windows-2022
permissions:
@@ -342,7 +361,8 @@ jobs:
javac HelloWorld.java
native-image HelloWorld
./helloworld
test-native-image-musl:
test-action-native-image-musl:
name: native-image-musl on ubuntu-latest
runs-on: ubuntu-latest
permissions:
@@ -365,7 +385,8 @@ jobs:
javac HelloWorld.java
native-image --static --libc=musl HelloWorld
./helloworld
test-extensive:
test-action-extensive:
name: extensive tests on ubuntu-latest
runs-on: ubuntu-latest
permissions:
@@ -420,7 +441,8 @@ jobs:
# popd > /dev/null
- name: Remove components
run: gu remove espresso llvm-toolchain nodejs python ruby wasm
test-sbom:
test-action-sbom:
name: test 'native-image-enable-sbom' option
runs-on: ${{ matrix.os }}
permissions:
@@ -456,4 +478,4 @@ jobs:
mvn --no-transfer-progress -Pnative package
cmd /c verify-sbom.cmd
shell: cmd
if: runner.os == 'Windows'
if: runner.os == 'Windows'

1
.node-version Normal file
View File

@@ -0,0 +1 @@
20.9.0

View File

@@ -1,3 +1,3 @@
dist/
lib/
node_modules/
node_modules/
README.md

16
.prettierrc.yml Normal file
View File

@@ -0,0 +1,16 @@
# See: https://prettier.io/docs/en/configuration
printWidth: 80
tabWidth: 2
useTabs: false
semi: false
singleQuote: true
quoteProps: as-needed
jsxSingleQuote: false
trailingComma: none
bracketSpacing: true
bracketSameLine: true
arrowParens: always
proseWrap: always
htmlWhitespaceSensitivity: css
endOfLine: lf

View File

@@ -94,7 +94,7 @@ describe('dependency cache', () => {
beforeEach(() => {
spyCacheRestore = jest
.spyOn(cache, 'restoreCache')
.mockImplementation((paths: string[], primaryKey: string) =>
.mockImplementation((_paths: string[], _primaryKey: string) =>
Promise.resolve(undefined)
)
spyWarning.mockImplementation(() => null)
@@ -184,7 +184,7 @@ describe('dependency cache', () => {
beforeEach(() => {
spyCacheSave = jest
.spyOn(cache, 'saveCache')
.mockImplementation((paths: string[], key: string) =>
.mockImplementation((_paths: string[], _key: string) =>
Promise.resolve(0)
)
spyWarning.mockImplementation(() => null)

View File

@@ -35,7 +35,6 @@ describe('cleanup', () => {
ReturnType<typeof cache.saveCache>,
Parameters<typeof cache.saveCache>
>
let spyJobStatusSuccess: jest.SpyInstance
beforeEach(() => {
spyWarning = jest.spyOn(core, 'warning')
@@ -50,7 +49,7 @@ describe('cleanup', () => {
})
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
spyCacheSave.mockImplementation((paths: string[], key: string) =>
spyCacheSave.mockImplementation((_paths: string[], _key: string) =>
Promise.reject(
new cache.ReserveCacheError(
'Unable to reserve cache with key, another job may be creating this cache.'
@@ -66,7 +65,7 @@ describe('cleanup', () => {
})
it('does not fail even though the save process throws error', async () => {
spyCacheSave.mockImplementation((paths: string[], key: string) =>
spyCacheSave.mockImplementation((_paths: string[], _key: string) =>
Promise.reject(new Error('Unexpected error'))
)
jest.spyOn(core, 'getInput').mockImplementation((name: string) => {

View File

@@ -13,7 +13,7 @@ process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
test('request invalid version/javaVersion', async () => {
for (var combination of [
for (const combination of [
['22.3.0', '7'],
['22.3', '17'],
['22.3', '7']
@@ -23,7 +23,7 @@ test('request invalid version/javaVersion', async () => {
await graalvm.setUpGraalVMRelease('', combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}
@@ -36,17 +36,17 @@ test('request invalid version/javaVersion', async () => {
test('find version/javaVersion', async () => {
// Make sure the action can find the latest Java version for known major versions
for (var majorJavaVersion of ['17', '20']) {
for (const majorJavaVersion of ['17', '20']) {
await graalvm.findLatestGraalVMJDKCEJavaVersion(majorJavaVersion)
}
let error = new Error('unexpected')
try {
await graalvm.findLatestGraalVMJDKCEJavaVersion('11')
fail('Should not find Java version for 11')
throw new Error('Should not find Java version for 11')
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}
@@ -68,7 +68,7 @@ test('find version/javaVersion', async () => {
findGraalVMVersion(invalidRelease)
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}
@@ -78,17 +78,17 @@ test('find version/javaVersion', async () => {
findHighestJavaVersion(latestRelease, 'invalid')
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}
expect(error.message).toContain('Could not find highest Java version.')
})
test('find version/javaVersion', async () => {
let url22EA = await findLatestEABuildDownloadUrl('22-ea')
test('find EA version/javaVersion', async () => {
const url22EA = await findLatestEABuildDownloadUrl('22-ea')
expect(url22EA).not.toBe('')
let urlLatestEA = await findLatestEABuildDownloadUrl('latest-ea')
const urlLatestEA = await findLatestEABuildDownloadUrl('latest-ea')
expect(urlLatestEA).not.toBe('')
let error = new Error('unexpected')
@@ -96,7 +96,7 @@ test('find version/javaVersion', async () => {
await findLatestEABuildDownloadUrl('8-ea')
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}

View File

@@ -7,6 +7,8 @@ import {expect, test} from '@jest/globals'
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
/* eslint jest/expect-expect: ["error", { "assertFunctionNames": ["expect", "expectLatestToBe", "expectURL"] }] */
test('find latest JDK version', async () => {
// Make sure the action can find the latest Java version for known major versions
await expectLatestToBe('11', atLeast('11.0.22+12'))
@@ -61,8 +63,8 @@ function atLeast(expectedMinVersion: string): verifier {
return function (
version: string,
major: number,
minor: number,
patch: number
_minor: number,
_patch: number
) {
expect(major).toBe(expectedMajor)
if (semver.compareBuild(version, expectedMinVersion) < 0) {
@@ -90,9 +92,9 @@ function upToBuild(expectedMinVersion: string): verifier {
function exactly(expectedVersion: string): verifier {
return function (
version: string,
major: number,
minor: number,
patch: number
_major: number,
_minor: number,
_patch: number
) {
if (semver.compareBuild(version, expectedVersion) != 0) {
throw new Error(`Expected version ${expectedVersion} but got ${version}`)

View File

@@ -7,7 +7,7 @@ process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
test('request invalid version/javaVersion combination', async () => {
for (var combination of [
for (const combination of [
['mandrel-23.1.1.0-Final', '17'],
['mandrel-23.0.2.1-Final', '21']
]) {
@@ -16,7 +16,7 @@ test('request invalid version/javaVersion combination', async () => {
await mandrel.setUpMandrel(combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}
@@ -27,7 +27,7 @@ test('request invalid version/javaVersion combination', async () => {
}
})
test('request invalid version', async () => {
for (var combination of [
for (const combination of [
['mandrel-23.1.1.0', '21'],
['mandrel-23.0.2.1', '17']
]) {
@@ -36,7 +36,7 @@ test('request invalid version', async () => {
await mandrel.setUpMandrel(combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}
@@ -56,7 +56,7 @@ test('find latest', async () => {
test('get known latest Mandrel for specific JDK', async () => {
// Test deprecated versions that won't get updates anymore
for (var combination of [
for (const combination of [
['11', '22.2.0.0-Final'],
['20', '23.0.1.2-Final']
]) {
@@ -68,7 +68,7 @@ test('get known latest Mandrel for specific JDK', async () => {
test('get latest Mandrel for specific JDK', async () => {
// Test supported versions
for (var javaVersion of ['17', '21']) {
for (const javaVersion of ['17', '21']) {
const latest = await mandrel.getLatestMandrelReleaseUrl(javaVersion)
expect(latest).toContain(`mandrel-java${javaVersion}`)
}

View File

@@ -7,7 +7,7 @@ process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
test('decide whether Window env must be set up for GraalVM for JDK', async () => {
for (var javaVersion of [
for (const javaVersion of [
'17',
'17.0.8',
'17.0',
@@ -22,7 +22,7 @@ test('decide whether Window env must be set up for GraalVM for JDK', async () =>
})
test('decide whether Window env must be set up for legacy GraalVM', async () => {
for (var combination of [
for (const combination of [
['7', '22.3.0'],
['17', '22.3'],
['7', '22.3'],

View File

@@ -248,10 +248,13 @@ describe('sbom feature', () => {
const invalidSBOM = {
'out-of-spec-field': {}
}
let error
try {
await setUpAndProcessSBOM(invalidSBOM)
fail('Expected an error since invalid JSON was passed')
} catch (error) {
throw new Error('Expected an error since invalid JSON was passed')
} catch (e) {
error = e
} finally {
expect(error).toBeInstanceOf(Error)
}
})

View File

@@ -1,9 +1,8 @@
import * as path from 'path'
import {expect, test} from '@jest/globals'
import {toSemVer} from '../src/utils'
test('convert version', async () => {
for (var inputAndExpectedOutput of [
for (const inputAndExpectedOutput of [
['22', '22.0.0'],
['22.0', '22.0.0'],
['22.0.0', '22.0.0'],
@@ -17,13 +16,13 @@ test('convert version', async () => {
})
test('convert invalid version', async () => {
for (var input of ['dev', 'abc', 'a.b.c']) {
for (const input of ['dev', 'abc', 'a.b.c']) {
let error = new Error('unexpected')
try {
toSemVer(input)
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Error: ${err}`)
throw new Error(`Unexpected non-Error: ${err}`)
}
error = err
}

67436
dist/cleanup/index.js generated vendored

File diff suppressed because one or more lines are too long

69214
dist/main/index.js generated vendored

File diff suppressed because one or more lines are too long

82
eslint.config.mjs Normal file
View File

@@ -0,0 +1,82 @@
// See: https://eslint.org/docs/latest/use/configure/configuration-files
import {fixupPluginRules} from '@eslint/compat'
import {FlatCompat} from '@eslint/eslintrc'
import js from '@eslint/js'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import _import from 'eslint-plugin-import'
import jest from 'eslint-plugin-jest'
import prettier from 'eslint-plugin-prettier'
import globals from 'globals'
import path from 'node:path'
import {fileURLToPath} from 'node:url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
})
export default [
{
ignores: ['**/coverage', '**/dist', '**/linter', '**/node_modules']
},
...compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:jest/recommended',
'plugin:prettier/recommended'
),
{
plugins: {
import: fixupPluginRules(_import),
jest,
prettier,
'@typescript-eslint': typescriptEslint
},
languageOptions: {
globals: {
...globals.node,
...globals.jest,
Atomics: 'readonly',
SharedArrayBuffer: 'readonly'
},
parser: tsParser,
ecmaVersion: 2023,
sourceType: 'module',
parserOptions: {
project: ['tsconfig.eslint.json'],
tsconfigRootDir: '.'
}
},
settings: {
'import/resolver': {
typescript: {
alwaysTryTypes: true,
project: 'tsconfig.eslint.json'
}
}
},
rules: {
camelcase: 'off',
'eslint-comments/no-use': 'off',
'eslint-comments/no-unused-disable': 'off',
'@typescript-eslint/no-unused-vars': ['error', {argsIgnorePattern: '^_'}],
'i18n-text/no-en': 'off',
'import/no-namespace': 'off',
'no-console': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
'prettier/prettier': 'error'
}
}
]

View File

@@ -6,4 +6,4 @@ module.exports = {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
}

3563
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,17 @@
{
"name": "setup-graalvm",
"version": "1.2.7",
"version": "1.2.8",
"private": true,
"description": "GitHub Action for GraalVM",
"main": "lib/main.js",
"scripts": {
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"lint": "eslint src/**/*.ts",
"bundle": "npm run format:write && npm run package",
"format:write": "npx prettier --write .",
"format:check": "npx prettier --check .",
"lint": "npx eslint .",
"package": "ncc build -o dist/main src/main.ts && ncc build -o dist/cleanup src/cleanup.ts",
"test": "jest",
"all-but-test": "npm run build && npm run format && npm run lint && npm run package",
"all": "npm run all-but-test && npm test"
"test": "npx jest",
"all": "npm run format:write && npm run lint && npm run test && npm run package"
},
"repository": {
"type": "git",
@@ -42,16 +41,19 @@
"uuid": "^11.0.5"
},
"devDependencies": {
"@eslint/compat": "^1.2.5",
"@types/jest": "^29.5.14",
"@types/node": "^20.17.12",
"@types/semver": "^7.5.8",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@typescript-eslint/eslint-plugin": "^8.19.1",
"@typescript-eslint/parser": "^8.19.1",
"@vercel/ncc": "^0.38.3",
"eslint": "^8.57.0",
"eslint-plugin-github": "^4.10.2",
"eslint-plugin-jest": "^27.9.0",
"eslint": "^9.18.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.10.0",
"eslint-plugin-jsonc": "^2.18.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.2.3",

View File

@@ -46,7 +46,6 @@ async function saveCache(): Promise<void> {
* @returns Promise that will ignore error reported by the given promise
*/
async function ignoreErrors(promise: Promise<void>): Promise<unknown> {
/* eslint-disable github/no-then */
return new Promise(resolve => {
promise
.catch(error => {

View File

@@ -1,6 +1,6 @@
import * as otypes from '@octokit/types'
export const ACTION_VERSION = '1.2.7'
export const ACTION_VERSION = '1.2.8'
export const INPUT_VERSION = 'version'
export const INPUT_GDS_TOKEN = 'gds-token'

View File

@@ -89,7 +89,7 @@ export async function findLatestEABuildDownloadUrl(
response = await getContents(ORACLE_GRAALVM_REPO_EA_BUILDS, filePath)
} catch (error) {
throw new Error(
`Unable to resolve download URL for '${javaEaVersion}'. Please make sure the java-version is set correctly. ${c.ERROR_HINT}`
`Unable to resolve download URL for '${javaEaVersion}' (reason: ${error}). Please make sure the java-version is set correctly. ${c.ERROR_HINT}`
)
}
if (

View File

@@ -1,6 +1,6 @@
import * as c from './constants'
import * as httpClient from '@actions/http-client'
import {downloadExtractAndCacheJDK, getLatestRelease} from './utils'
import {downloadExtractAndCacheJDK} from './utils'
import {downloadTool} from '@actions/tool-cache'
import {basename} from 'path'
@@ -11,7 +11,9 @@ const DISCO_API_BASE = 'https://api.foojay.io/disco/v3.0/packages/jdks'
interface JdkData {
message: string
/* eslint-disable @typescript-eslint/no-explicit-any */
result: any
/* eslint-enable @typescript-eslint/no-explicit-any */
}
export async function setUpMandrel(
@@ -22,7 +24,9 @@ export async function setUpMandrel(
let mandrelHome
switch (version) {
case '':
// fetch latest if no version is specified
// fetch latest if no version is specified
mandrelHome = await setUpMandrelLatest(javaVersion)
break
case 'latest':
mandrelHome = await setUpMandrelLatest(javaVersion)
break

View File

@@ -1,5 +1,4 @@
import * as core from '@actions/core'
import * as semver from 'semver'
import {execSync} from 'child_process'
import {existsSync} from 'fs'
import {VERSION_DEV} from './constants'

23
tsconfig.base.json Normal file
View File

@@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"declarationMap": false,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"lib": ["ES2022"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"newLine": "lf",
"noImplicitAny": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"pretty": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"strictNullChecks": true,
"target": "ES2022"
}
}

16
tsconfig.eslint.json Normal file
View File

@@ -0,0 +1,16 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"noEmit": true
},
"exclude": ["dist", "node_modules"],
"include": [
"__fixtures__",
"__tests__",
"src",
"eslint.config.mjs",
"jest.config.js"
]
}

View File

@@ -1,12 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "./tsconfig.base.json",
"compilerOptions": {
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
"module": "NodeNext",
"moduleResolution": "NodeNext",
"outDir": "./dist"
},
"exclude": ["node_modules", "**/*.test.ts"]
"exclude": ["__fixtures__", "__tests__", "coverage", "dist", "node_modules"],
"include": ["src"]
}