diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index 06939361e..000000000
--- a/.eslintignore
+++ /dev/null
@@ -1,6 +0,0 @@
-# Ignore list
-/*
-
-# Do not ignore these folders:
-!__tests__/
-!src/
\ No newline at end of file
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 293128e6e..000000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,51 +0,0 @@
-// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
-module.exports = {
- extends: [
- 'eslint:recommended',
- 'plugin:@typescript-eslint/recommended',
- 'plugin:eslint-plugin-jest/recommended',
- 'eslint-config-prettier'
- ],
- parser: '@typescript-eslint/parser',
- plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
- rules: {
- '@typescript-eslint/no-require-imports': 'error',
- '@typescript-eslint/no-non-null-assertion': 'off',
- '@typescript-eslint/no-explicit-any': 'off',
- '@typescript-eslint/no-empty-function': 'off',
- '@typescript-eslint/ban-ts-comment': [
- 'error',
- {
- 'ts-ignore': 'allow-with-description'
- }
- ],
- 'no-console': 'error',
- 'yoda': 'error',
- 'prefer-const': [
- 'error',
- {
- destructuring: 'all'
- }
- ],
- 'no-control-regex': 'off',
- 'no-constant-condition': ['error', {checkLoops: false}],
- 'node/no-extraneous-import': 'error'
- },
- overrides: [
- {
- files: ['**/*{test,spec}.ts'],
- rules: {
- '@typescript-eslint/no-unused-vars': 'off',
- 'jest/no-standalone-expect': 'off',
- 'jest/no-conditional-expect': 'off',
- 'no-console': 'off',
-
- }
- }
- ],
- env: {
- node: true,
- es6: true,
- 'jest/globals': true
- }
-};
diff --git a/.github/ISSUE_TEMPLATE/new_distribution_request.md b/.github/ISSUE_TEMPLATE/new_distribution_request.md
new file mode 100644
index 000000000..f5d7c7faf
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/new_distribution_request.md
@@ -0,0 +1,22 @@
+---
+name: New Java distribution template
+about: Suggest a new Java distribution
+title: ''
+labels: feature request, needs triage
+assignees: ''
+---
+
+**Description:**
+Describe your proposal.
+
+**Justification:**
+Justification or a use case for your proposal.
+
+**Download URL:**
+Download URL for the new distribution.
+
+**License:**
+Link to the license for the new distribution.
+
+**Are you willing to submit a PR?**
+
\ No newline at end of file
diff --git a/.github/PULL_REQUEST_TEMPLATE/new_distribution_pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/new_distribution_pull_request_template.md
new file mode 100644
index 000000000..4e3b44372
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE/new_distribution_pull_request_template.md
@@ -0,0 +1,16 @@
+**Description:**
+Describe your changes.
+
+**Related issue:**
+Add link to the related issue.
+
+**Download URL:**
+Download URL for the new distribution.
+
+**License:**
+Link to the license for the new distribution.
+
+**Check list:**
+- [ ] Mark if documentation changes are required.
+- [ ] Mark if tests were added or updated to cover the changes.
+- [ ] Mark if new distribution is being added.
\ No newline at end of file
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
new file mode 100644
index 000000000..7fdefa038
--- /dev/null
+++ b/.github/copilot-instructions.md
@@ -0,0 +1,43 @@
+# Copilot instructions
+
+## Build, test, and lint
+
+Use Node.js 24 or later (`package.json` declares `>=24.0.0`).
+
+- `npm ci` installs the locked dependencies.
+- `npm test` runs Jest serially with coverage.
+- `npm test -- --runTestsByPath __tests__/setup-java.test.ts` runs one test file.
+- `npm test -- --runTestsByPath __tests__/setup-java.test.ts --testNamePattern="pattern"` filters that file to matching test names.
+- `npm run lint` runs ESLint on TypeScript files.
+- `npm run format-check` checks Prettier formatting; `npm run format` applies it.
+- `npm run build` bundles the setup and post-job entrypoints into `dist/`.
+- `npm run check` runs format check, lint, build, and the full test suite.
+
+## Architecture
+
+This repository implements a Node.js GitHub Action. `action.yml` defines its inputs and outputs and runs `dist/setup/index.js` as the main entrypoint and `dist/cleanup/index.js` as the post-job entrypoint. The TypeScript sources in `src/` are bundled with NCC; the committed `dist/` files are what the action executes.
+
+The setup entrypoint parses inputs, resolves versions, and configures the action's shared features. `src/distributions/distribution-factory.ts` lazily selects a vendor installer. Vendor installers implement metadata lookup and archive handling on top of `JavaBase` in `src/distributions/base-installer.ts`, which centralizes version resolution, tool-cache/JDK-cache use, download verification, and Java environment setup. Package support and OS/architecture support are validated centrally in `package-types.ts` and `platform-types.ts`.
+
+The setup flow also configures problem matchers, Maven authentication and arguments, and Maven toolchains. The post-job entrypoint removes any isolated GPG home and saves enabled caches when the job succeeds and cache saving is not read-only.
+
+## Repository-specific conventions
+
+- Keep TypeScript source imports ESM-compatible: relative imports include the `.js` extension, even when the source file is `.ts`.
+- Distribution-specific download and metadata logic belongs in its installer under `src/distributions/`; reuse `JavaBase` rather than duplicating common resolution, caching, verification, or environment behavior.
+- When adding or changing distribution support, keep the distribution enum, factory, package-capability map, platform-capability map, README support documentation, unit tests, and relevant end-to-end workflow coverage consistent.
+- Unit tests live under `__tests__/` and use Jest/ts-jest. Distribution tests are grouped under `__tests__/distributors/`; use the corresponding test and fixture patterns when changing an installer. End-to-end coverage is defined in `.github/workflows/e2e-*.yml`.
+- Rebuild and commit generated `dist/` bundles for runtime-affecting source or dependency changes; do not make the bundles the source of truth. `npm run check` includes the build.
+- New npm dependencies need lockfile changes and corresponding license records under `.licenses/`, following `.licensed.yml` and the licensed workflow.
+
+## Action behavior principles
+
+- Treat `action.yml` inputs, outputs, defaults, and compatibility aliases as the public API. Keep implementation, README, and advanced-usage documentation aligned when behavior changes; preserve deprecated aliases unless a documented breaking change removes them.
+- Do not assume version syntax, package variants, or platform/architecture support is uniform across distributions. Keep capability checks and vendor resolution behavior consistent with the documented support matrix. `latest` means the newest stable GA release, not an early-access build.
+- Preserve selection semantics: a recognized vendor in a supported version file may supply the distribution; otherwise the caller must provide it. If both `java-version` and `java-version-file` are given, the explicit `java-version` takes precedence.
+- Preserve install-state behavior for multiple JDKs. The last installed JDK becomes the default unless `set-default: false`; all installed JDKs remain available through their version-specific environment variables and Maven toolchains. Toolchain entries accumulate non-destructively, and custom IDs must correspond one-for-one with requested versions.
+- Treat dependency, wrapper, and JDK caches as distinct features with distinct keys and save behavior. `cache` enables dependency caching and implicitly enables JDK caching unless `cache-jdk` overrides it; `cache-read-only` restores without saving. Keep changes to cache identity or lifecycle aligned with these documented contracts.
+- Preserve download-integrity guarantees: verify authoritative checksums when published. Signature verification is distribution-specific; explicit `verify-signature: true` must enforce verification where supported and fail clearly where unsupported. Do not silently weaken verification or imply that a cached install was downloaded and reverified.
+- Keep Maven credential inputs as environment-variable names, not secret values. Generated settings and custom repository behavior must respect the documented overwrite option, while toolchain merging remains non-destructive and independent of that option.
+
+See `docs/CONTRIBUTING.md` for contribution and validation guidance, `README.md` for the public contract, and `docs/advanced-usage.md` for detailed behavior and examples.
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 853bc0a13..f85e23877 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,22 +1,25 @@
-# To get started with Dependabot version updates, you'll need to specify which
-# package ecosystems to update and where the package manifests are located.
-# Please see the documentation for all configuration options:
-# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
-
version: 2
updates:
- # Enable version updates for npm
- package-ecosystem: 'npm'
- # Look for `package.json` and `lock` files in the `root` directory
directory: '/'
- # Check the npm registry for updates every day (weekdays)
schedule:
- interval: 'weekly'
+ interval: 'monthly'
+ cooldown:
+ default-days: 7
+ groups:
+ monthly-npm-updates:
+ applies-to: 'version-updates'
+ patterns:
+ - '*'
- # Enable version updates for GitHub Actions
- package-ecosystem: 'github-actions'
- # Workflow files stored in the default location of `.github/workflows`
- # You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
directory: '/'
schedule:
- interval: 'weekly'
+ interval: 'monthly'
+ cooldown:
+ default-days: 7
+ groups:
+ monthly-actions-updates:
+ applies-to: 'version-updates'
+ patterns:
+ - '*'
diff --git a/.github/java.json b/.github/java.json
index eda1b0cd4..5e52ab819 100644
--- a/.github/java.json
+++ b/.github/java.json
@@ -9,6 +9,31 @@
"message": 3
}
]
+ },
+ {
+ "owner": "javac",
+ "pattern": [
+ {
+ "regexp": "^([^:]+):(\\d+): (warning|error): (.+?)$",
+ "file": 1,
+ "line": 2,
+ "severity": 3,
+ "message": 4
+ }
+ ]
+ },
+ {
+ "owner": "maven-javac",
+ "pattern": [
+ {
+ "regexp": "^\\[(WARNING|ERROR)\\]\\s+(.+?\\.java):\\[(\\d+),(\\d+)\\]\\s+(.+)$",
+ "severity": 1,
+ "file": 2,
+ "line": 3,
+ "column": 4,
+ "message": 5
+ }
+ ]
}
]
-}
\ No newline at end of file
+}
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index ef54acadd..dcf4beaaf 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -5,5 +5,6 @@ Describe your changes.
Add link to the related issue.
**Check list:**
+- [ ] Ran `npm run check` locally (format, lint, build, test) and all checks pass.
- [ ] Mark if documentation changes are required.
- [ ] Mark if tests were added or updated to cover the changes.
\ No newline at end of file
diff --git a/.github/workflows/basic-validation.yml b/.github/workflows/basic-validation.yml
index e93e58009..ea70e0577 100644
--- a/.github/workflows/basic-validation.yml
+++ b/.github/workflows/basic-validation.yml
@@ -11,6 +11,9 @@ on:
paths-ignore:
- '**.md'
+permissions:
+ contents: read
+
jobs:
call-basic-validation:
name: Basic validation
diff --git a/.github/workflows/benchmark-cache-restore.yml b/.github/workflows/benchmark-cache-restore.yml
new file mode 100644
index 000000000..17e1da301
--- /dev/null
+++ b/.github/workflows/benchmark-cache-restore.yml
@@ -0,0 +1,211 @@
+name: Benchmark cache restore
+
+on:
+ workflow_dispatch:
+ inputs:
+ baseline-ref:
+ description: Git ref containing the sequential restore implementation
+ required: true
+ default: main
+ type: string
+ candidate-ref:
+ description: Git ref containing the concurrent restore implementation (defaults to the dispatched ref)
+ required: false
+ type: string
+
+permissions:
+ contents: read
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ warm-caches:
+ name: Warm ${{ matrix.tool }} ${{ matrix.profile }} caches (${{ matrix.os }})
+ runs-on: ${{ matrix.os }}
+ cache-mode: write-only
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-latest]
+ tool: [maven, gradle]
+ profile: [small, large]
+ steps:
+ - name: Checkout benchmark workflow
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Checkout baseline
+ uses: actions/checkout@v7
+ with:
+ path: baseline
+ persist-credentials: false
+ ref: ${{ inputs.baseline-ref }}
+ - name: Checkout candidate
+ uses: actions/checkout@v7
+ with:
+ path: candidate
+ persist-credentials: false
+ ref: ${{ inputs.candidate-ref || github.ref }}
+ - name: Prepare benchmark inputs
+ run: bash __tests__/benchmark-cache-restore.sh prepare "${{ matrix.tool }}" "${{ matrix.profile }}"
+ - name: Prepare cache save
+ uses: ./candidate
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ - name: Populate benchmark caches
+ run: |
+ bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ bash __tests__/benchmark-cache-restore.sh populate "${{ matrix.tool }}" "${{ matrix.profile }}"
+
+ benchmark:
+ name: Benchmark ${{ matrix.tool }} ${{ matrix.profile }} (${{ matrix.os }})
+ needs: warm-caches
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-latest]
+ tool: [maven, gradle]
+ profile: [small, large]
+ steps:
+ - name: Checkout benchmark workflow
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Checkout baseline
+ uses: actions/checkout@v7
+ with:
+ path: baseline
+ persist-credentials: false
+ ref: ${{ inputs.baseline-ref }}
+ - name: Checkout candidate
+ uses: actions/checkout@v7
+ with:
+ path: candidate
+ persist-credentials: false
+ ref: ${{ inputs.candidate-ref || github.ref }}
+ - name: Prepare benchmark inputs
+ run: bash __tests__/benchmark-cache-restore.sh prepare "${{ matrix.tool }}" "${{ matrix.profile }}"
+
+ - name: Reset caches for baseline iteration 1
+ run: bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ - name: Start baseline iteration 1 timer
+ run: bash __tests__/benchmark-cache-restore.sh start "${{ matrix.tool }}"
+ - name: Restore with baseline iteration 1
+ id: baseline-1
+ uses: ./baseline
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ cache-read-only: true
+ - name: Record baseline iteration 1
+ env:
+ CACHE_HIT: ${{ steps.baseline-1.outputs.cache-hit }}
+ run: bash __tests__/benchmark-cache-restore.sh record "${{ matrix.tool }}" "${{ matrix.os }}" "${{ matrix.profile }}" baseline 1 "$CACHE_HIT"
+
+ - name: Reset caches for candidate iteration 1
+ run: bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ - name: Start candidate iteration 1 timer
+ run: bash __tests__/benchmark-cache-restore.sh start "${{ matrix.tool }}"
+ - name: Restore with candidate iteration 1
+ id: candidate-1
+ uses: ./candidate
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ cache-read-only: true
+ - name: Record candidate iteration 1
+ env:
+ CACHE_HIT: ${{ steps.candidate-1.outputs.cache-hit }}
+ run: bash __tests__/benchmark-cache-restore.sh record "${{ matrix.tool }}" "${{ matrix.os }}" "${{ matrix.profile }}" candidate 1 "$CACHE_HIT"
+
+ - name: Reset caches for candidate iteration 2
+ run: bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ - name: Start candidate iteration 2 timer
+ run: bash __tests__/benchmark-cache-restore.sh start "${{ matrix.tool }}"
+ - name: Restore with candidate iteration 2
+ id: candidate-2
+ uses: ./candidate
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ cache-read-only: true
+ - name: Record candidate iteration 2
+ env:
+ CACHE_HIT: ${{ steps.candidate-2.outputs.cache-hit }}
+ run: bash __tests__/benchmark-cache-restore.sh record "${{ matrix.tool }}" "${{ matrix.os }}" "${{ matrix.profile }}" candidate 2 "$CACHE_HIT"
+
+ - name: Reset caches for baseline iteration 2
+ run: bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ - name: Start baseline iteration 2 timer
+ run: bash __tests__/benchmark-cache-restore.sh start "${{ matrix.tool }}"
+ - name: Restore with baseline iteration 2
+ id: baseline-2
+ uses: ./baseline
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ cache-read-only: true
+ - name: Record baseline iteration 2
+ env:
+ CACHE_HIT: ${{ steps.baseline-2.outputs.cache-hit }}
+ run: bash __tests__/benchmark-cache-restore.sh record "${{ matrix.tool }}" "${{ matrix.os }}" "${{ matrix.profile }}" baseline 2 "$CACHE_HIT"
+
+ - name: Reset caches for baseline iteration 3
+ run: bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ - name: Start baseline iteration 3 timer
+ run: bash __tests__/benchmark-cache-restore.sh start "${{ matrix.tool }}"
+ - name: Restore with baseline iteration 3
+ id: baseline-3
+ uses: ./baseline
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ cache-read-only: true
+ - name: Record baseline iteration 3
+ env:
+ CACHE_HIT: ${{ steps.baseline-3.outputs.cache-hit }}
+ run: bash __tests__/benchmark-cache-restore.sh record "${{ matrix.tool }}" "${{ matrix.os }}" "${{ matrix.profile }}" baseline 3 "$CACHE_HIT"
+
+ - name: Reset caches for candidate iteration 3
+ run: bash __tests__/benchmark-cache-restore.sh reset "${{ matrix.tool }}"
+ - name: Start candidate iteration 3 timer
+ run: bash __tests__/benchmark-cache-restore.sh start "${{ matrix.tool }}"
+ - name: Restore with candidate iteration 3
+ id: candidate-3
+ uses: ./candidate
+ with:
+ distribution: temurin
+ java-version: '17'
+ cache: ${{ matrix.tool }}
+ cache-dependency-path: benchmark/${{ matrix.tool == 'maven' && 'pom.xml' || 'build.gradle' }}
+ cache-read-only: true
+ - name: Record candidate iteration 3
+ env:
+ CACHE_HIT: ${{ steps.candidate-3.outputs.cache-hit }}
+ run: bash __tests__/benchmark-cache-restore.sh record "${{ matrix.tool }}" "${{ matrix.os }}" "${{ matrix.profile }}" candidate 3 "$CACHE_HIT"
+
+ - name: Summarize benchmark
+ run: bash __tests__/benchmark-cache-restore.sh summarize "${{ matrix.tool }}" "$GITHUB_STEP_SUMMARY"
+ - name: Upload raw timings
+ uses: actions/upload-artifact@v7
+ with:
+ name: cache-restore-${{ matrix.os }}-${{ matrix.tool }}-${{ matrix.profile }}
+ path: .benchmark-results/timings.csv
+ if-no-files-found: error
diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml
index 90ef986ad..5592249e7 100644
--- a/.github/workflows/check-dist.yml
+++ b/.github/workflows/check-dist.yml
@@ -11,6 +11,9 @@ on:
- '**.md'
workflow_dispatch:
+permissions:
+ contents: read
+
jobs:
call-check-dist:
name: Check dist/
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index 7a8261238..598f7de5d 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -8,7 +8,13 @@ on:
schedule:
- cron: '0 3 * * 0'
+permissions: {}
+
jobs:
call-codeQL-analysis:
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
diff --git a/.github/workflows/e2e-cache-dependency-path.yml b/.github/workflows/e2e-cache-dependency-path.yml
deleted file mode 100644
index 8b40e99f0..000000000
--- a/.github/workflows/e2e-cache-dependency-path.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-name: Validate cache with cache-dependency-path option
-
-on:
- push:
- branches:
- - main
- - releases/*
- paths-ignore:
- - '**.md'
- pull_request:
- paths-ignore:
- - '**.md'
-
-defaults:
- run:
- shell: bash
-
-jobs:
- gradle1-save:
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: Run setup-java with the cache for gradle
- uses: ./
- id: setup-java
- with:
- distribution: 'adopt'
- java-version: '17'
- cache: gradle
- cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- - name: Create files to cache
- # Need to avoid using Gradle daemon to stabilize the save process on Windows
- # https://github.com/actions/cache/issues/454#issuecomment-840493935
- run: |
- gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1
- if [ ! -d ~/.gradle/caches ]; then
- echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
- exit 1
- fi
- gradle1-restore:
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- needs: gradle1-save
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: Run setup-java with the cache for gradle
- uses: ./
- id: setup-java
- with:
- distribution: 'adopt'
- java-version: '11'
- cache: gradle
- cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- - name: Confirm that ~/.gradle/caches directory has been made
- run: |
- if [ ! -d ~/.gradle/caches ]; then
- echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
- exit 1
- fi
- ls ~/.gradle/caches/
- gradle2-restore:
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- needs: gradle1-save
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: Run setup-java with the cache for gradle
- uses: ./
- id: setup-java
- with:
- distribution: 'adopt'
- java-version: '11'
- cache: gradle
- cache-dependency-path: __tests__/cache/gradle2/*.gradle*
- - name: Confirm that ~/.gradle/caches directory has not been made
- run: |
- if [ -d ~/.gradle/caches ]; then
- echo "::error::The ~/.gradle/caches directory exists unexpectedly"
- exit 1
- fi
diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml
index 6df10b578..2a9fef541 100644
--- a/.github/workflows/e2e-cache.yml
+++ b/.github/workflows/e2e-cache.yml
@@ -11,6 +11,9 @@ on:
paths-ignore:
- '**.md'
+permissions:
+ contents: read
+
defaults:
run:
shell: bash
@@ -18,18 +21,21 @@ defaults:
jobs:
gradle-save:
runs-on: ${{ matrix.os }}
+ cache-mode: write-only
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Run setup-java with the cache for gradle
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '17'
cache: gradle
- name: Create files to cache
@@ -37,12 +43,13 @@ jobs:
# https://github.com/actions/cache/issues/454#issuecomment-840493935
run: |
gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1
- if [ ! -d ~/.gradle/caches ]; then
- echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
- exit 1
- fi
+ mkdir -p "$HOME/.gradle/wrapper/dists/setup-java-e2e"
+ echo "gradle wrapper cache" > "$HOME/.gradle/wrapper/dists/setup-java-e2e/payload"
+ bash __tests__/check-dir.sh "$HOME/.gradle/caches"
+ bash __tests__/check-dir.sh "$HOME/.gradle/wrapper/dists"
gradle-restore:
runs-on: ${{ matrix.os }}
+ cache-mode: read
strategy:
fail-fast: false
matrix:
@@ -50,46 +57,50 @@ jobs:
needs: gradle-save
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Run setup-java with the cache for gradle
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
cache: gradle
+ cache-read-only: true
- name: Confirm that ~/.gradle/caches directory has been made
- run: |
- if [ ! -d ~/.gradle/caches ]; then
- echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
- exit 1
- fi
- ls ~/.gradle/caches/
+ run: bash __tests__/check-dir.sh "$HOME/.gradle/caches"
+ - name: Confirm that the Gradle Wrapper cache has been restored
+ run: bash __tests__/check-dir.sh "$HOME/.gradle/wrapper/dists"
maven-save:
runs-on: ${{ matrix.os }}
+ cache-mode: write-only
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Run setup-java with the cache for maven
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
cache: maven
- name: Create files to cache
run: |
mvn verify -f __tests__/cache/maven/pom.xml
- if [ ! -d ~/.m2/repository ]; then
- echo "::error::The ~/.m2/repository directory does not exist unexpectedly"
- exit 1
- fi
+ mkdir -p "$HOME/.m2/wrapper/dists/setup-java-e2e"
+ echo "maven wrapper cache" > "$HOME/.m2/wrapper/dists/setup-java-e2e/payload"
+ bash __tests__/check-dir.sh "$HOME/.m2/repository"
+ bash __tests__/check-dir.sh "$HOME/.m2/wrapper/dists"
maven-restore:
runs-on: ${{ matrix.os }}
+ cache-mode: read
strategy:
fail-fast: false
matrix:
@@ -97,23 +108,24 @@ jobs:
needs: maven-save
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Run setup-java with the cache for maven
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
cache: maven
+ cache-read-only: true
- name: Confirm that ~/.m2/repository directory has been made
- run: |
- if [ ! -d ~/.m2/repository ]; then
- echo "::error::The ~/.m2/repository directory does not exist unexpectedly"
- exit 1
- fi
- ls ~/.m2/repository
+ run: bash __tests__/check-dir.sh "$HOME/.m2/repository"
+ - name: Confirm that the Maven Wrapper cache has been restored
+ run: bash __tests__/check-dir.sh "$HOME/.m2/wrapper/dists"
sbt-save:
runs-on: ${{ matrix.os }}
+ cache-mode: write-only
defaults:
run:
shell: bash
@@ -124,12 +136,14 @@ jobs:
os: [macos-15-intel, windows-latest, ubuntu-22.04]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Run setup-java with the cache for sbt
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
cache: sbt
- name: Setup SBT
@@ -142,27 +156,16 @@ jobs:
- name: Check files to cache on macos-latest
if: matrix.os == 'macos-15-intel'
- run: |
- if [ ! -d ~/Library/Caches/Coursier ]; then
- echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
- exit 1
- fi
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/Library/Caches/Coursier"
- name: Check files to cache on windows-latest
if: matrix.os == 'windows-latest'
- run: |
- if [ ! -d ~/AppData/Local/Coursier/Cache ]; then
- echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly"
- exit 1
- fi
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/AppData/Local/Coursier/Cache"
- name: Check files to cache on ubuntu-latest
- if: matrix.os == 'ubuntu-latest'
- run: |
- if [ ! -d ~/.cache/coursier ]; then
- echo "::error::The ~/.cache/coursier directory does not exist unexpectedly"
- exit 1
- fi
+ if: matrix.os == 'ubuntu-22.04'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/.cache/coursier"
sbt-restore:
runs-on: ${{ matrix.os }}
+ cache-mode: read
defaults:
run:
shell: bash
@@ -174,36 +177,338 @@ jobs:
needs: sbt-save
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Run setup-java with the cache for sbt
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
cache: sbt
+ cache-read-only: true
- name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-15-intel'
- run: |
- if [ ! -d ~/Library/Caches/Coursier ]; then
- echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
- exit 1
- fi
- ls ~/Library/Caches/Coursier
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/Library/Caches/Coursier"
- name: Confirm that ~/AppData/Local/Coursier/Cache directory has been made
if: matrix.os == 'windows-latest'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/AppData/Local/Coursier/Cache"
+ - name: Confirm that ~/.cache/coursier directory has been made
+ if: matrix.os == 'ubuntu-22.04'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/.cache/coursier"
+ gradle1-save:
+ runs-on: ${{ matrix.os }}
+ cache-mode: write-only
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-latest]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for gradle
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ cache: gradle
+ cache-dependency-path: __tests__/cache/gradle1/*.gradle*
+ - name: Create files to cache
+ # Need to avoid using Gradle daemon to stabilize the save process on Windows
+ # https://github.com/actions/cache/issues/454#issuecomment-840493935
+ run: |
+ gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1
+ mkdir -p "$HOME/.gradle/wrapper/dists/setup-java-e2e-gradle1"
+ echo "gradle wrapper cache gradle1" > "$HOME/.gradle/wrapper/dists/setup-java-e2e-gradle1/payload"
+ bash __tests__/check-dir.sh "$HOME/.gradle/caches"
+ bash __tests__/check-dir.sh "$HOME/.gradle/wrapper/dists"
+ gradle1-restore:
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-latest]
+ needs: gradle1-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for gradle
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: gradle
+ cache-dependency-path: __tests__/cache/gradle1/*.gradle*
+ - name: Confirm that ~/.gradle/caches directory has been made
+ run: bash __tests__/check-dir.sh "$HOME/.gradle/caches"
+ - name: Confirm that the Gradle Wrapper cache has been restored
+ run: bash __tests__/check-dir.sh "$HOME/.gradle/wrapper/dists"
+ gradle2-restore:
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-latest]
+ needs: gradle1-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for gradle
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: gradle
+ cache-dependency-path: __tests__/cache/gradle2/*.gradle*
+ - name: Confirm that ~/.gradle/caches directory has not been made
+ run: bash __tests__/check-dir.sh "$HOME/.gradle/caches" absent
+ maven1-save:
+ runs-on: ${{ matrix.os }}
+ cache-mode: write-only
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-latest]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for maven
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: maven
+ cache-dependency-path: __tests__/cache/maven/pom.xml
+ - name: Create files to cache
+ run: |
+ mvn verify -f __tests__/cache/maven/pom.xml
+ mkdir -p "$HOME/.m2/wrapper/dists/setup-java-e2e-maven1"
+ echo "maven wrapper cache maven1" > "$HOME/.m2/wrapper/dists/setup-java-e2e-maven1/payload"
+ bash __tests__/check-dir.sh "$HOME/.m2/repository"
+ bash __tests__/check-dir.sh "$HOME/.m2/wrapper/dists"
+ maven1-restore:
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-latest]
+ needs: maven1-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for maven
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: maven
+ cache-dependency-path: __tests__/cache/maven/pom.xml
+ - name: Confirm that ~/.m2/repository directory has been made
+ run: bash __tests__/check-dir.sh "$HOME/.m2/repository"
+ - name: Confirm that the Maven Wrapper cache has been restored
+ run: bash __tests__/check-dir.sh "$HOME/.m2/wrapper/dists"
+ maven2-restore:
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-latest]
+ needs: maven1-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for maven
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: maven
+ cache-dependency-path: |
+ __tests__/cache/maven2/pom.xml
+ README.md
+ - name: Confirm that ~/.m2/repository directory has not been made
+ run: bash __tests__/check-dir.sh "$HOME/.m2/repository" absent
+ sbt1-save:
+ runs-on: ${{ matrix.os }}
+ cache-mode: write-only
+ defaults:
+ run:
+ shell: bash
+ working-directory: __tests__/cache/sbt
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-22.04]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for sbt
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: sbt
+ cache-dependency-path: __tests__/cache/sbt/*.sbt
+ - name: Setup SBT
+ if: matrix.os == 'macos-15-intel'
run: |
- if [ ! -d ~/AppData/Local/Coursier/Cache ]; then
- echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly"
- exit 1
- fi
- ls ~/AppData/Local/Coursier/Cache
+ echo ""Installing SBT...""
+ brew install sbt
+ - name: Create files to cache
+ run: sbt update
+
+ - name: Check files to cache on macos-latest
+ if: matrix.os == 'macos-15-intel'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/Library/Caches/Coursier"
+ - name: Check files to cache on windows-latest
+ if: matrix.os == 'windows-latest'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/AppData/Local/Coursier/Cache"
+ - name: Check files to cache on ubuntu-latest
+ if: matrix.os == 'ubuntu-22.04'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/.cache/coursier"
+ sbt1-restore:
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ defaults:
+ run:
+ shell: bash
+ working-directory: __tests__/cache/sbt
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-22.04]
+ needs: sbt1-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for sbt
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: sbt
+ cache-dependency-path: __tests__/cache/sbt/*.sbt
+
+ - name: Confirm that ~/Library/Caches/Coursier directory has been made
+ if: matrix.os == 'macos-15-intel'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/Library/Caches/Coursier"
+ - name: Confirm that ~/AppData/Local/Coursier/Cache directory has been made
+ if: matrix.os == 'windows-latest'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/AppData/Local/Coursier/Cache"
- name: Confirm that ~/.cache/coursier directory has been made
- if: matrix.os == 'ubuntu-latest'
+ if: matrix.os == 'ubuntu-22.04'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/.cache/coursier"
+ sbt2-restore:
+ runs-on: ${{ matrix.os }}
+ cache-mode: read
+ defaults:
+ run:
+ shell: bash
+ working-directory: __tests__/cache/sbt2
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-15-intel, windows-latest, ubuntu-22.04]
+ needs: sbt1-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with the cache for sbt
+ uses: ./
+ id: setup-java
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: sbt
+ cache-dependency-path: __tests__/cache/sbt2/*.sbt
+
+ - name: Confirm that ~/Library/Caches/Coursier directory has not been made
+ if: matrix.os == 'macos-15-intel'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/Library/Caches/Coursier" absent
+ - name: Confirm that ~/AppData/Local/Coursier/Cache directory has not been made
+ if: matrix.os == 'windows-latest'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/AppData/Local/Coursier/Cache" absent
+ - name: Confirm that ~/.cache/coursier directory has not been made
+ if: matrix.os == 'ubuntu-22.04'
+ run: bash "$GITHUB_WORKSPACE/__tests__/check-dir.sh" "$HOME/.cache/coursier" absent
+ custom-maven-path-save:
+ runs-on: ubuntu-latest
+ cache-mode: write-only
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with a custom Maven cache path
+ uses: ./
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: maven
+ cache-dependency-path: |
+ __tests__/cache/maven2/pom.xml
+ .github/workflows/e2e-cache.yml
+ cache-path: |
+ ${{ runner.temp }}/setup-java-custom-maven-repository
+ !${{ runner.temp }}/setup-java-custom-maven-repository/**/*.lastUpdated
+ - name: Populate the custom Maven repository
run: |
- if [ ! -d ~/.cache/coursier ]; then
- echo "::error::The ~/.cache/coursier directory does not exist unexpectedly"
- exit 1
- fi
- ls ~/.cache/coursier
+ mvn -Dmaven.repo.local="$RUNNER_TEMP/setup-java-custom-maven-repository" verify -f __tests__/cache/maven2/pom.xml
+ touch "$RUNNER_TEMP/setup-java-custom-maven-repository/setup-java-cache-path-marker"
+ bash __tests__/check-dir.sh "$RUNNER_TEMP/setup-java-custom-maven-repository"
+ custom-maven-path-restore:
+ runs-on: ubuntu-latest
+ cache-mode: read
+ needs: custom-maven-path-save
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Run setup-java with a custom Maven cache path
+ uses: ./
+ with:
+ distribution: 'temurin'
+ java-version: '11'
+ cache: maven
+ cache-dependency-path: |
+ __tests__/cache/maven2/pom.xml
+ .github/workflows/e2e-cache.yml
+ cache-path: |
+ ${{ runner.temp }}/setup-java-custom-maven-repository
+ !${{ runner.temp }}/setup-java-custom-maven-repository/**/*.lastUpdated
+ cache-read-only: true
+ - name: Confirm that the custom Maven repository has been restored
+ run: test -f "$RUNNER_TEMP/setup-java-custom-maven-repository/setup-java-cache-path-marker"
diff --git a/.github/workflows/e2e-local-file.yml b/.github/workflows/e2e-local-file.yml
index 92fdf7597..657334ce0 100644
--- a/.github/workflows/e2e-local-file.yml
+++ b/.github/workflows/e2e-local-file.yml
@@ -11,44 +11,10 @@ on:
paths-ignore:
- '**.md'
-jobs:
- setup-java-local-file-adopt:
- name: Validate installation from local file Adopt
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: Download Adopt OpenJDK file
- run: |
- if ($IsLinux) {
- $downloadUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
- $localFilename = "java_package.tar.gz"
- } elseif ($IsMacOS) {
- $downloadUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_mac_hotspot_11.0.10_9.tar.gz"
- $localFilename = "java_package.tar.gz"
- } elseif ($IsWindows) {
- $downloadUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9.zip"
- $localFilename = "java_package.zip"
- }
- echo "LocalFilename=$localFilename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- (New-Object System.Net.WebClient).DownloadFile($downloadUrl, "$env:RUNNER_TEMP/$localFilename")
- shell: pwsh
- - name: setup-java
- uses: ./
- id: setup-java
- with:
- distribution: 'jdkfile'
- jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
- java-version: '11.0.0-ea'
- architecture: x64
- - name: Verify Java version
- run: bash __tests__/verify-java.sh "11.0.10" "${{ steps.setup-java.outputs.path }}"
- shell: bash
+permissions:
+ contents: read
+jobs:
setup-java-local-file-zulu:
name: Validate installation from local file Zulu
runs-on: ${{ matrix.os }}
@@ -58,7 +24,9 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Download Zulu OpenJDK file
run: |
if ($IsLinux) {
@@ -79,11 +47,13 @@ jobs:
id: setup-java
with:
distribution: 'jdkfile'
- jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
+ jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }}
java-version: '11.0.0-ea'
architecture: x64
- name: Verify Java version
- run: bash __tests__/verify-java.sh "11.0" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "11.0" "$JAVA_PATH"
shell: bash
setup-java-local-file-temurin:
@@ -95,7 +65,9 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Download Eclipse Temurin file
run: |
if ($IsLinux) {
@@ -116,9 +88,12 @@ jobs:
id: setup-java
with:
distribution: 'jdkfile'
+ # Intentionally uses the deprecated `jdkFile` alias to keep it covered.
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
java-version: '11.0.0-ea'
architecture: x64
- name: Verify Java version
- run: bash __tests__/verify-java.sh "11.0.12" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "11.0.12" "$JAVA_PATH"
shell: bash
diff --git a/.github/workflows/e2e-publishing.yml b/.github/workflows/e2e-publishing.yml
index 0c0aaafa9..f7419d8e8 100644
--- a/.github/workflows/e2e-publishing.yml
+++ b/.github/workflows/e2e-publishing.yml
@@ -11,6 +11,9 @@ on:
paths-ignore:
- '**.md'
+permissions:
+ contents: read
+
defaults:
run:
shell: pwsh
@@ -25,29 +28,43 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: setup-java
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
server-id: maven
- server-username: MAVEN_USERNAME
- server-password: MAVEN_CENTRAL_TOKEN
- gpg-passphrase: MAVEN_GPG_PASSPHRASE
+ server-username-env-var: MAVEN_USERNAME
+ server-password-env-var: MAVEN_CENTRAL_TOKEN
+ gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
- name: Validate settings.xml
run: |
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
Get-Content $xmlPath | ForEach-Object { Write-Host $_ }
- [xml]$xml = Get-Content $xmlPath
- $servers = $xml.settings.servers.server
- if (($servers[0].id -ne 'maven') -or ($servers[0].username -ne '${env.MAVEN_USERNAME}') -or ($servers[0].password -ne '${env.MAVEN_CENTRAL_TOKEN}')) {
- throw "Generated XML file is incorrect"
- }
+ $content = [System.IO.File]::ReadAllText($xmlPath)
+ $expected = @(
+ ''
+ ' false'
+ ' '
+ ' '
+ ' maven'
+ ' ${env.MAVEN_USERNAME}'
+ ' ${env.MAVEN_CENTRAL_TOKEN}'
+ ' '
+ ' '
+ ''
+ ) -join "`n"
- if (($servers[1].id -ne 'gpg.passphrase') -or ($servers[1].passphrase -ne '${env.MAVEN_GPG_PASSPHRASE}')) {
+ if ($content -ne $expected) {
+ Write-Host "Expected settings.xml:"
+ $expected -split "`n" | ForEach-Object { Write-Host $_ }
throw "Generated XML file is incorrect"
}
@@ -60,7 +77,9 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Create fake settings.xml
run: |
$xmlDirectory = Join-Path $HOME ".m2"
@@ -71,12 +90,12 @@ jobs:
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
server-id: maven
- server-username: MAVEN_USERNAME
- server-password: MAVEN_CENTRAL_TOKEN
- gpg-passphrase: MAVEN_GPG_PASSPHRASE
+ server-username-env-var: MAVEN_USERNAME
+ server-password-env-var: MAVEN_CENTRAL_TOKEN
+ gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
- name: Validate settings.xml is overwritten
run: |
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
@@ -96,7 +115,9 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Create fake settings.xml
run: |
$xmlDirectory = Join-Path $HOME ".m2"
@@ -107,13 +128,13 @@ jobs:
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
server-id: maven
- server-username: MAVEN_USERNAME
- server-password: MAVEN_CENTRAL_TOKEN
+ server-username-env-var: MAVEN_USERNAME
+ server-password-env-var: MAVEN_CENTRAL_TOKEN
overwrite-settings: false
- gpg-passphrase: MAVEN_GPG_PASSPHRASE
+ gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
- name: Validate that settings.xml is not overwritten
run: |
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
@@ -133,17 +154,19 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: setup-java
uses: ./
id: setup-java
with:
- distribution: 'adopt'
+ distribution: 'temurin'
java-version: '11'
server-id: maven
- server-username: MAVEN_USERNAME
- server-password: MAVEN_CENTRAL_TOKEN
- gpg-passphrase: MAVEN_GPG_PASSPHRASE
+ server-username-env-var: MAVEN_USERNAME
+ server-password-env-var: MAVEN_CENTRAL_TOKEN
+ gpg-passphrase-env-var: MAVEN_GPG_PASSPHRASE
settings-path: ${{ runner.temp }}
- name: Validate settings.xml location
run: |
@@ -151,3 +174,203 @@ jobs:
if (-not (Test-Path $path)) {
throw "settings.xml file is not found in expected location"
}
+
+ test-maven-mirrors:
+ name: Maven mirrors (${{ matrix.mirror-of }})
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-latest]
+ mirror-of: ['*', 'external:*']
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Configure Maven mirrors without repository inputs
+ uses: $/
+ with:
+ distribution: 'temurin'
+ java-version: '21'
+ settings-path: ${{ runner.temp }}/maven-mirror-test
+ mvn-server-credentials: |
+ private:PRIVATE_USERNAME:PRIVATE_TOKEN
+ mvn-mirrors: |
+ private:https://mirror.example.invalid/maven:${{ matrix.mirror-of }}
+ - name: Validate generated settings and Maven mirror selection
+ env:
+ MIRROR_OF: ${{ matrix.mirror-of }}
+ PRIVATE_USERNAME: mirror-test-user
+ PRIVATE_TOKEN: mirror-test-token
+ run: |
+ $directory = Join-Path $env:RUNNER_TEMP "maven-mirror-test"
+ $settingsPath = Join-Path $directory "settings.xml"
+ [xml]$settings = Get-Content -Path $settingsPath -Raw
+ $mirrors = @($settings.settings.mirrors.mirror)
+ if ($mirrors.Count -ne 1 -or $mirrors[0].id -ne "private" -or $mirrors[0].url -ne "https://mirror.example.invalid/maven" -or $mirrors[0].mirrorOf -ne $env:MIRROR_OF) {
+ throw "Incorrect generated mirror"
+ }
+ if ($settings.settings.profiles -or $settings.settings.activeProfiles) {
+ throw "Mirror-only settings must not add repository profiles"
+ }
+ $server = $settings.settings.servers.server
+ if ($server.id -ne "private" -or $server.username -ne '${env.PRIVATE_USERNAME}' -or $server.password -ne '${env.PRIVATE_TOKEN}') {
+ throw "Mirror credentials were not preserved"
+ }
+
+ $pomPath = Join-Path $directory "pom.xml"
+ @'
+
+ 4.0.0
+ setup-java.test
+ mirror-settings
+ 1.0
+
+
+ pom-dependencies
+ https://dependencies.example.invalid/maven
+
+
+
+
+ pom-plugins
+ https://plugins.example.invalid/maven
+
+
+
+ '@ | Set-Content -Path $pomPath
+
+ # validate requires no plugins or dependencies, so mirror selection can
+ # be inspected offline without contacting the deliberately invalid URLs.
+ $output = & mvn --batch-mode --no-transfer-progress --offline --debug `
+ --settings $settingsPath --file $pomPath `
+ "-Dmaven.repo.local=$directory/repository" validate 2>&1
+ if ($LASTEXITCODE -ne 0) {
+ throw "Could not inspect Maven mirror selection: $output"
+ }
+ $log = $output -join "`n"
+ foreach ($id in @("central", "pom-dependencies")) {
+ $expected = "Using mirror private (https://mirror.example.invalid/maven) for $id ("
+ if (-not $log.Contains($expected)) {
+ throw "Maven did not select the mirror for ${id}: $log"
+ }
+ }
+ foreach ($type in @("dependencies", "plugins")) {
+ $pattern = 'Repositories \(' + $type + '\)\s*: \[private \(https://mirror\.example\.invalid/maven, [^\]]+\)\]'
+ if ($log -notmatch $pattern) {
+ throw "Maven did not redirect all $type repositories: $log"
+ }
+ }
+
+ test-maven-repositories:
+ name: Maven ${{ matrix.repositories }} repositories
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [macos-latest, windows-latest, ubuntu-latest]
+ repositories: [dependencies, plugins, both]
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Prepare Maven model inspection
+ run: |
+ $directory = Join-Path $env:RUNNER_TEMP "maven-repository-test"
+ New-Item -Path $directory -ItemType Directory -Force | Out-Null
+ $pomPath = Join-Path $directory "pom.xml"
+ $warmSettingsPath = Join-Path $directory "warm-settings.xml"
+ $cachePath = Join-Path $directory "repository"
+ $outputPath = Join-Path $directory "warm-effective-pom.xml"
+
+ # This project repository keeps the inspection plugin available offline
+ # after the generated settings disable inherited plugin Central.
+ @'
+
+ 4.0.0
+ setup-java.test
+ repository-settings
+ 1.0
+
+
+ inspection
+ https://repo.maven.apache.org/maven2
+
+
+
+ '@ | Set-Content -Path $pomPath
+ '' | Set-Content -Path $warmSettingsPath
+
+ mvn --batch-mode --no-transfer-progress --settings $warmSettingsPath `
+ "-Dmaven.repo.local=$cachePath" --file $pomPath `
+ org.apache.maven.plugins:maven-help-plugin:3.5.1:effective-pom `
+ "-Doutput=$outputPath"
+ if ($LASTEXITCODE -ne 0) {
+ throw "Could not prepare the Maven Help Plugin"
+ }
+ - name: Configure dependency and plugin repositories
+ uses: ./
+ with:
+ distribution: 'temurin'
+ java-version: '21'
+ settings-path: ${{ runner.temp }}/maven-repository-test/settings
+ mvn-server-credentials: |
+ private:PRIVATE_USERNAME:PRIVATE_TOKEN
+ mvn-repositories: ${{ matrix.repositories != 'plugins' && 'private:https://repo.example.invalid/maven:false' || '' }}
+ mvn-plugin-repositories: ${{ matrix.repositories != 'dependencies' && 'private:https://repo.example.invalid/maven:false' || '' }}
+ mvn-repositories-include-central: false
+ - name: Validate generated settings and effective Maven repositories
+ env:
+ REPOSITORY_CONFIGURATION: ${{ matrix.repositories }}
+ run: |
+ $directory = Join-Path $env:RUNNER_TEMP "maven-repository-test"
+ $settingsPath = Join-Path $directory "settings/settings.xml"
+ [xml]$settings = Get-Content -Path $settingsPath -Raw
+ $profiles = @($settings.settings.profiles.profile)
+ if ($profiles.Count -ne 1 -or $profiles[0].id -ne "setup-java-repositories") {
+ throw "Expected one repository profile"
+ }
+ $activeProfiles = @($settings.settings.activeProfiles.activeProfile)
+ if ($activeProfiles.Count -ne 1 -or $activeProfiles[0] -ne "setup-java-repositories") {
+ throw "Expected one active repository profile"
+ }
+ $server = $settings.settings.servers.server
+ if ($server.id -ne "private" -or $server.username -ne '${env.PRIVATE_USERNAME}' -or $server.password -ne '${env.PRIVATE_TOKEN}') {
+ throw "Repository credentials were not preserved"
+ }
+
+ function Assert-Repositories($repositories, $expectPrivate, $context) {
+ $central = @($repositories | Where-Object { $_.id -eq "central" })
+ if ($central.Count -ne 1 -or $central[0].releases.enabled -ne "false" -or $central[0].snapshots.enabled -ne "false") {
+ throw "$context did not disable inherited Maven Central"
+ }
+ $private = @($repositories | Where-Object { $_.id -eq "private" })
+ $expectedCount = if ($expectPrivate) { 1 } else { 0 }
+ if ($private.Count -ne $expectedCount) {
+ throw "$context has incorrect private repositories"
+ }
+ if ($expectPrivate -and ($private[0].url -ne "https://repo.example.invalid/maven" -or $private[0].snapshots.enabled -ne "false")) {
+ throw "$context has incorrect private repository settings"
+ }
+ }
+
+ $expectDependencies = $env:REPOSITORY_CONFIGURATION -ne "plugins"
+ $expectPlugins = $env:REPOSITORY_CONFIGURATION -ne "dependencies"
+ Assert-Repositories @($profiles[0].repositories.repository) $expectDependencies "Settings dependency repositories"
+ Assert-Repositories @($profiles[0].pluginRepositories.pluginRepository) $expectPlugins "Settings plugin repositories"
+
+ $pomPath = Join-Path $directory "pom.xml"
+ $cachePath = Join-Path $directory "repository"
+ $outputPath = Join-Path $directory "effective-pom.xml"
+ mvn --batch-mode --no-transfer-progress --offline --settings $settingsPath `
+ "-Dmaven.repo.local=$cachePath" --file $pomPath `
+ org.apache.maven.plugins:maven-help-plugin:3.5.1:effective-pom `
+ "-Doutput=$outputPath"
+ if ($LASTEXITCODE -ne 0) {
+ throw "Could not inspect the effective Maven model"
+ }
+ [xml]$effectivePom = Get-Content -Path $outputPath -Raw
+ Assert-Repositories @($effectivePom.project.repositories.repository) $expectDependencies "Effective dependency repositories"
+ Assert-Repositories @($effectivePom.project.pluginRepositories.pluginRepository) $expectPlugins "Effective plugin repositories"
diff --git a/.github/workflows/e2e-smoke.yml b/.github/workflows/e2e-smoke.yml
new file mode 100644
index 000000000..fed3adf72
--- /dev/null
+++ b/.github/workflows/e2e-smoke.yml
@@ -0,0 +1,87 @@
+name: Validate Java e2e smoke
+
+on:
+ push:
+ branches:
+ - main
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+
+permissions:
+ contents: read
+
+jobs:
+ setup-java:
+ name: ${{ matrix.distribution }} ${{ matrix.version }} (${{ matrix.java-package }}) - ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: macos-latest
+ distribution: temurin
+ version: '11'
+ java-package: jdk
+ - os: windows-latest
+ distribution: temurin
+ version: '17'
+ java-package: jdk
+ - os: ubuntu-latest
+ distribution: temurin
+ version: '21'
+ java-package: jdk
+ - os: macos-latest
+ distribution: temurin
+ version: '25'
+ java-package: jdk
+ - os: windows-latest
+ distribution: temurin
+ version: '25'
+ java-package: jdk
+ - os: ubuntu-latest
+ distribution: temurin
+ version: '25'
+ java-package: jdk
+ - os: macos-latest
+ distribution: microsoft
+ version: '25'
+ java-package: jdk
+ - os: windows-latest
+ distribution: microsoft
+ version: '25'
+ java-package: jdk
+ - os: ubuntu-latest
+ distribution: microsoft
+ version: '25'
+ java-package: jdk
+ - os: ubuntu-latest
+ distribution: zulu
+ version: '17'
+ java-package: jre
+ - os: ubuntu-latest
+ distribution: liberica
+ version: '21'
+ java-package: jdk+fx
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: setup-java
+ uses: ./
+ id: setup-java
+ with:
+ java-version: ${{ matrix.version }}
+ java-package: ${{ matrix.java-package }}
+ distribution: ${{ matrix.distribution }}
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Verify Java
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
+ shell: bash
diff --git a/.github/workflows/e2e-versions.yml b/.github/workflows/e2e-versions.yml
index 845fce16f..7e7f339db 100644
--- a/.github/workflows/e2e-versions.yml
+++ b/.github/workflows/e2e-versions.yml
@@ -3,28 +3,27 @@ name: Validate Java e2e
on:
push:
branches:
- - main
- releases/*
paths-ignore:
- '**.md'
- pull_request:
- paths-ignore:
- - '**.md'
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
+
+permissions:
+ contents: read
+
jobs:
setup-java-major-versions:
- name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
+ name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest]
- distribution: [
+ distribution:
+ [
'temurin',
- 'adopt',
- 'adopt-openj9',
'zulu',
'liberica',
'microsoft',
@@ -32,8 +31,10 @@ jobs:
'corretto',
'dragonwell',
'sapmachine',
- 'jetbrains'
- ] # internally 'adopt-hotspot' is the same as 'adopt'
+ 'jetbrains',
+ 'kona',
+ 'liberica-nik'
+ ]
version: ['21', '11', '17']
exclude:
- distribution: microsoft
@@ -50,15 +51,55 @@ jobs:
- distribution: microsoft
os: macos-latest
version: 25
+ - distribution: microsoft
+ os: windows-latest
+ version: '25.0.5+0.2'
+ - distribution: microsoft
+ os: ubuntu-latest
+ version: '25.0.5+0.2'
+ - distribution: microsoft
+ os: macos-latest
+ version: '25.0.5+0.2'
+ - distribution: kona
+ os: windows-latest
+ version: 25
+ - distribution: kona
+ os: ubuntu-latest
+ version: 25
+ - distribution: kona
+ os: macos-latest
+ version: 25
+ - distribution: liberica-nik
+ os: windows-latest
+ version: 25
+ - distribution: liberica-nik
+ os: ubuntu-latest
+ version: 25
+ - distribution: liberica-nik
+ os: macos-latest
+ version: 25
- distribution: oracle
os: macos-15-intel
- version: 17
+ version: 25
- distribution: oracle
os: windows-latest
- version: 21
+ version: 25
+ - distribution: oracle
+ os: ubuntu-latest
+ version: 25
+ # Oracle no longer publishes JDK 21 under /latest, so a major-only request resolves to the archived GA build.
- distribution: oracle
os: ubuntu-latest
version: 21
+ - distribution: oracle-openjdk
+ os: macos-15-intel
+ version: 21
+ - distribution: oracle-openjdk
+ os: windows-latest
+ version: 21
+ - distribution: oracle-openjdk
+ os: ubuntu-latest
+ version: 21
- distribution: graalvm
os: macos-latest
version: 17.0.12
@@ -72,8 +113,11 @@ jobs:
os: ubuntu-latest
version: '24-ea'
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - &checkout_step
+ name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: setup-java
uses: ./
id: setup-java
@@ -83,17 +127,69 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ SETUP_JAVA_VERSION: ${{ steps.setup-java.outputs.version }}
+ REQUIRE_CONCRETE_VERSION: ${{ ((matrix.distribution == 'oracle' && matrix.version != 21) || matrix.distribution == 'graalvm') && !contains(matrix.version, '.') && !contains(matrix.version, '-ea') }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH" "$SETUP_JAVA_VERSION" "$REQUIRE_CONCRETE_VERSION"
+ shell: bash
+
+ setup-java-checksum-verification:
+ name: Corretto checksum verification - ubuntu-latest
+ runs-on: ubuntu-latest
+ steps:
+ - *checkout_step
+ - name: setup-java with forced download
+ uses: ./
+ id: setup-java
+ with:
+ java-version: '21'
+ distribution: corretto
+ force-download: true
+ - name: Verify Java
+ env:
+ JAVA_VERSION: '21'
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
+ shell: bash
+
+ setup-java-alpine-linux:
+ name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - alpine-linux - ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ container:
+ image: alpine:3.21
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest]
+ distribution: ['temurin', 'sapmachine']
+ version: ['21', '17']
+ steps:
+ - *checkout_step
+ - name: Install bash and GnuPG
+ run: apk add --no-cache bash gnupg
+ - name: setup-java
+ uses: ./
+ id: setup-java
+ with:
+ java-version: ${{ matrix.version }}
+ distribution: ${{ matrix.distribution }}
+ - name: Verify Java
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
shell: bash
setup-java-major-minor-versions:
- name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
+ name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
needs: setup-java-major-versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
+ os: &default_os [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica']
version:
- '11.0'
@@ -122,8 +218,7 @@ jobs:
os: ubuntu-latest
version: '17.0.7'
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: setup-java
uses: ./
id: setup-java
@@ -131,10 +226,12 @@ jobs:
java-version: ${{ matrix.version }}
distribution: ${{ matrix.distribution }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
- shell: bash
env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
+ shell: bash
setup-java-check-latest:
name: ${{ matrix.distribution }} ${{ matrix.version }} - check-latest flag - ${{ matrix.os }}
@@ -143,7 +240,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
+ os: *default_os
distribution:
[
'temurin',
@@ -157,8 +254,7 @@ jobs:
- distribution: dragonwell
os: macos-latest
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: setup-java
uses: ./
id: setup-java
@@ -169,7 +265,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "11" "$JAVA_PATH"
shell: bash
setup-java-multiple-jdks:
@@ -179,7 +277,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
+ os: *default_os
distribution:
[
'temurin',
@@ -193,8 +291,7 @@ jobs:
- distribution: dragonwell
os: macos-latest
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: setup-java
uses: ./
id: setup-java
@@ -207,10 +304,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java env variables
run: |
+ $javaArch = if ($env:RUNNER_ARCH -eq "ARM64") { "AARCH64" } else { $env:RUNNER_ARCH }
$versionsArr = "11","17"
foreach ($version in $versionsArr)
{
- $envName = "JAVA_HOME_${version}_${env:RUNNER_ARCH}"
+ $envName = "JAVA_HOME_${version}_${javaArch}"
$JavaVersionPath = [Environment]::GetEnvironmentVariable($envName)
if (-not (Test-Path "$JavaVersionPath")) {
Write-Host "$envName is not found"
@@ -219,73 +317,74 @@ jobs:
}
shell: pwsh
- name: Verify Java
- run: bash __tests__/verify-java.sh "17" "${{ steps.setup-java.outputs.path }}"
- shell: bash
-
- setup-java-ea-versions-zulu:
- name: zulu ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
- needs: setup-java-major-minor-versions
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- os: [macos-15-intel, windows-latest, ubuntu-latest]
- version: ['17-ea', '15.0.0-ea.14']
- steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: setup-java
- uses: ./
- id: setup-java
- with:
- java-version: ${{ matrix.version }}
- distribution: zulu
- - name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "17" "$JAVA_PATH"
shell: bash
- setup-java-ea-versions-temurin:
- name: temurin ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
+ setup-java-ea-versions:
+ name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ contains(matrix.os, 'macos') && !contains(matrix.os, 'intel') && 'arm64' || 'x64' }}) - ${{ matrix.os }}
needs: setup-java-major-minor-versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- version: ['17-ea']
+ include:
+ - {os: macos-15-intel, version: '17-ea', distribution: zulu}
+ - {os: windows-latest, version: '17-ea', distribution: zulu}
+ - {os: ubuntu-latest, version: '17-ea', distribution: zulu}
+ - {os: macos-15-intel, version: '15.0.0-ea.14', distribution: zulu}
+ - {os: windows-latest, version: '15.0.0-ea.14', distribution: zulu}
+ - {os: ubuntu-latest, version: '15.0.0-ea.14', distribution: zulu}
+ - {os: macos-latest, version: '17-ea', distribution: temurin}
+ - {os: windows-latest, version: '17-ea', distribution: temurin}
+ - {os: ubuntu-latest, version: '17-ea', distribution: temurin}
+ - {os: macos-latest, version: '17-ea', distribution: sapmachine}
+ - {os: windows-latest, version: '17-ea', distribution: sapmachine}
+ - {os: ubuntu-latest, version: '17-ea', distribution: sapmachine}
+ - {os: macos-latest, version: '21-ea', distribution: sapmachine}
+ - {os: windows-latest, version: '21-ea', distribution: sapmachine}
+ - {os: ubuntu-latest, version: '21-ea', distribution: sapmachine}
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: setup-java
uses: ./
id: setup-java
with:
java-version: ${{ matrix.version }}
- distribution: temurin
+ distribution: ${{ matrix.distribution }}
+ verify-signature: ${{ matrix.distribution == 'temurin' && contains(matrix.version, '-ea') && 'false' || '' }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
shell: bash
- setup-java-ea-versions-sapmachine:
- name: sapmachine ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
+ setup-java-signature-verification:
+ name: ${{ matrix.distribution }} ${{ matrix.version }} signature verification - ${{ matrix.os }}
needs: setup-java-major-minor-versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- version: ['17-ea', '21-ea']
+ os: *default_os
+ version: ['21', '17']
+ distribution: [temurin, microsoft]
steps:
- - name: Checkout
- uses: actions/checkout@v6
- - name: setup-java
+ - *checkout_step
+ - name: setup-java with signature verification
uses: ./
id: setup-java
with:
java-version: ${{ matrix.version }}
- distribution: sapmachine
+ distribution: ${{ matrix.distribution }}
+ verify-signature: true
- name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
shell: bash
setup-java-custom-package-type:
@@ -317,6 +416,10 @@ jobs:
java-package: jre+fx
version: '11'
os: ubuntu-latest
+ - distribution: 'liberica-nik'
+ java-package: jdk+fx
+ version: '21'
+ os: ubuntu-latest
- distribution: 'corretto'
java-package: jre
version: '8'
@@ -363,8 +466,7 @@ jobs:
os: ubuntu-latest
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: setup-java
uses: ./
id: setup-java
@@ -375,7 +477,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
shell: bash
# Only Liberica and Zulu provide x86
@@ -391,8 +496,7 @@ jobs:
distribution: ['liberica', 'zulu', 'corretto']
version: ['11']
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: setup-java
uses: ./
id: setup-java
@@ -401,21 +505,42 @@ jobs:
java-version: ${{ matrix.version }}
architecture: 'x86'
- name: Verify Java
- run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_VERSION: ${{ matrix.version }}
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "$JAVA_VERSION" "$JAVA_PATH"
shell: bash
+ setup-java-unsupported-platform:
+ name: Reject unsupported Oracle x86 on Linux
+ runs-on: ubuntu-latest
+ steps:
+ - *checkout_step
+ - name: Attempt unsupported setup
+ id: unsupported-setup
+ continue-on-error: true
+ uses: ./
+ with:
+ distribution: oracle
+ java-version: '21'
+ architecture: x86
+ - name: Verify setup was rejected
+ if: always()
+ env:
+ SETUP_OUTCOME: ${{ steps.unsupported-setup.outcome }}
+ run: test "$SETUP_OUTCOME" = failure
+
setup-java-version-both-version-inputs-presents:
name: ${{ matrix.distribution }} version (should be from input) - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
+ os: *default_os
distribution: ['temurin', 'microsoft', 'corretto']
java-version-file: ['.java-version', '.tool-versions']
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: Create .java-version file
shell: bash
run: echo "17" > .java-version
@@ -430,7 +555,9 @@ jobs:
java-version: 11
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "11" "$JAVA_PATH"
shell: bash
setup-java-version-from-file-major-notation:
@@ -439,12 +566,11 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
+ os: *default_os
distribution: ['temurin', 'zulu', 'liberica', 'microsoft', 'corretto']
java-version-file: ['.java-version', '.tool-versions']
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: Create .java-version file
shell: bash
run: echo "11" > .java-version
@@ -458,7 +584,9 @@ jobs:
distribution: ${{ matrix.distribution }}
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "11" "$JAVA_PATH"
shell: bash
setup-java-version-from-file-major-minor-patch-notation:
@@ -467,12 +595,11 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- distribution: ['adopt', 'adopt-openj9', 'zulu']
+ os: *default_os
+ distribution: ['temurin', 'zulu']
java-version-file: ['.java-version', '.tool-versions']
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: Create .java-version file
shell: bash
run: echo "17.0.10" > .java-version
@@ -486,7 +613,9 @@ jobs:
distribution: ${{ matrix.distribution }}
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "17.0.10" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "17.0.10" "$JAVA_PATH"
shell: bash
setup-java-version-from-file-major-minor-patch-with-dist:
@@ -495,12 +624,11 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [macos-latest, windows-latest, ubuntu-latest]
- distribution: ['adopt', 'zulu', 'liberica']
+ os: *default_os
+ distribution: ['temurin', 'zulu', 'liberica']
java-version-file: ['.java-version', '.tool-versions', '.sdkmanrc']
steps:
- - name: Checkout
- uses: actions/checkout@v6
+ - *checkout_step
- name: Create .java-version file
shell: bash
run: echo "openjdk64-17.0.10" > .java-version
@@ -517,5 +645,106 @@ jobs:
distribution: ${{ matrix.distribution }}
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
- run: bash __tests__/verify-java.sh "17.0.10" "${{ steps.setup-java.outputs.path }}"
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "17.0.10" "$JAVA_PATH"
+ shell: bash
+
+ setup-java-version-from-sdkman-major:
+ name: temurin 26 from .sdkmanrc - ubuntu-latest
+ runs-on: ubuntu-latest
+ steps:
+ - *checkout_step
+ - name: Create SDKMAN and Gradle files
+ run: |
+ echo "java=26-tem" > .sdkmanrc
+ touch build.gradle
+ - name: setup-java
+ uses: ./
+ id: setup-java
+ with:
+ java-version-file: .sdkmanrc
+ cache: gradle
+ - name: Verify Java
+ env:
+ JAVA_PATH: ${{ steps.setup-java.outputs.path }}
+ run: bash __tests__/verify-java.sh "26" "$JAVA_PATH"
+
+ setup-java-set-default:
+ name: set-default option - ${{ matrix.os }}
+ needs: setup-java-major-versions
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: *default_os
+ steps:
+ - *checkout_step
+ - name: Setup Java 17 as default
+ uses: ./
+ id: setup-java-17
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Setup Java 21 without setting as default
+ uses: ./
+ id: setup-java-21
+ with:
+ distribution: 'temurin'
+ java-version: '21'
+ set-default: false
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Verify JAVA_HOME still points to Java 17
+ env:
+ JAVA_17_PATH: ${{ steps.setup-java-17.outputs.path }}
+ run: |
+ echo "JAVA_HOME=$JAVA_HOME"
+ echo "Java 17 path=$JAVA_17_PATH"
+ if [ "$JAVA_HOME" != "$JAVA_17_PATH" ]; then
+ echo "JAVA_HOME should still point to Java 17"
+ exit 1
+ fi
+ shell: bash
+ - name: Verify java -version reports Java 17
+ run: |
+ JAVA_VERSION=$(java -version 2>&1 | head -1)
+ echo "java -version: $JAVA_VERSION"
+ if ! echo "$JAVA_VERSION" | grep -q "17"; then
+ echo "Default java should still be version 17"
+ exit 1
+ fi
+ shell: bash
+ - name: Verify JAVA_HOME_21 env var is set
+ run: |
+ $javaArch = if ($env:RUNNER_ARCH -eq "ARM64") { "AARCH64" } else { $env:RUNNER_ARCH }
+ $envName = "JAVA_HOME_21_${javaArch}"
+ $JavaVersionPath = [Environment]::GetEnvironmentVariable($envName)
+ if (-not $JavaVersionPath) {
+ Write-Host "$envName is not set"
+ exit 1
+ }
+ if (-not (Test-Path "$JavaVersionPath")) {
+ Write-Host "$envName path does not exist: $JavaVersionPath"
+ exit 1
+ }
+ Write-Host "$envName=$JavaVersionPath"
+ shell: pwsh
+ - name: Verify Java 21 outputs are set
+ env:
+ JAVA_21_PATH: ${{ steps.setup-java-21.outputs.path }}
+ JAVA_21_VERSION: ${{ steps.setup-java-21.outputs.version }}
+ run: |
+ echo "Java 21 path=$JAVA_21_PATH"
+ echo "Java 21 version=$JAVA_21_VERSION"
+ if [ -z "$JAVA_21_PATH" ]; then
+ echo "Java 21 path output should be set"
+ exit 1
+ fi
+ if [ -z "$JAVA_21_VERSION" ]; then
+ echo "Java 21 version output should be set"
+ exit 1
+ fi
shell: bash
diff --git a/.github/workflows/latest-jdk-versions.yml b/.github/workflows/latest-jdk-versions.yml
new file mode 100644
index 000000000..eb140c5ea
--- /dev/null
+++ b/.github/workflows/latest-jdk-versions.yml
@@ -0,0 +1,157 @@
+# Daily report of the exact JDK version each distribution currently resolves
+# for every major from Java 6 through the newest GA release, and `latest`, on every operating
+# system and architecture setup-java supports for it. Versions are resolved
+# from vendor metadata only; no JDK is downloaded.
+name: Latest JDK versions report
+
+on:
+ schedule:
+ - cron: '30 6 * * *'
+ workflow_dispatch:
+ inputs:
+ java-versions:
+ description: 'Comma-separated java-version values (default: every major from Java 6 through the newest GA release, and latest)'
+ required: false
+ default: ''
+ pull_request:
+ paths:
+ - 'src/reports/**'
+ - '.github/workflows/latest-jdk-versions.yml'
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ build:
+ name: Build report tool
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - name: Setup Node.js
+ uses: actions/setup-node@v7
+ with:
+ node-version: '24.x'
+ cache: npm
+ - name: Install dependencies
+ run: npm ci
+ - name: Bundle report tool
+ run: npm run build:latest-versions-report
+ - name: Upload report tool
+ uses: actions/upload-artifact@v7
+ with:
+ name: latest-versions-report-tool
+ path: lib/latest-versions-report/
+ retention-days: 1
+
+ resolve:
+ name: Resolve versions (${{ matrix.platform }})
+ needs: build
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 30
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - os: ubuntu-latest
+ platform: linux
+ - os: macos-latest
+ platform: macos
+ - os: windows-latest
+ platform: windows
+ # Liberica's Solaris metadata is queried without running a Solaris JDK.
+ - os: ubuntu-latest
+ platform: solaris
+ steps:
+ - name: Setup Node.js
+ uses: actions/setup-node@v7
+ with:
+ node-version: '24.x'
+ - name: Download report tool
+ uses: actions/download-artifact@v8
+ with:
+ name: latest-versions-report-tool
+ path: tool
+ - name: Resolve latest versions without downloading
+ run: node tool/index.js resolve "results/$REPORT_PLATFORM.json"
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ REPORT_VERSIONS: ${{ inputs.java-versions }}
+ REPORT_PLATFORM: ${{ matrix.platform }}
+ - name: Upload resolved versions
+ uses: actions/upload-artifact@v7
+ with:
+ name: latest-jdk-versions-${{ matrix.platform }}
+ path: results/
+ retention-days: 1
+
+ # Installers pick musl builds on Alpine, which can resolve to other versions.
+ resolve-alpine:
+ name: Resolve versions (alpine)
+ needs: build
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ container:
+ image: node:24-alpine
+ defaults:
+ run:
+ shell: sh
+ steps:
+ - name: Download report tool
+ uses: actions/download-artifact@v8
+ with:
+ name: latest-versions-report-tool
+ path: tool
+ - name: Resolve latest versions without downloading
+ run: node tool/index.js resolve results/alpine.json
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ REPORT_VERSIONS: ${{ inputs.java-versions }}
+ - name: Upload resolved versions
+ uses: actions/upload-artifact@v7
+ with:
+ name: latest-jdk-versions-alpine
+ path: results/
+ retention-days: 1
+
+ report:
+ name: Report
+ needs: [build, resolve, resolve-alpine]
+ if: ${{ !cancelled() && needs.build.result == 'success' }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup Node.js
+ uses: actions/setup-node@v7
+ with:
+ node-version: '24.x'
+ - name: Download report tool
+ uses: actions/download-artifact@v8
+ with:
+ name: latest-versions-report-tool
+ path: tool
+ - name: Download resolved versions
+ uses: actions/download-artifact@v8
+ with:
+ pattern: latest-jdk-versions-*
+ path: results
+ merge-multiple: true
+ - name: Write report
+ run: node tool/index.js summarize results latest-jdk-versions.md
+ - name: Upload report
+ uses: actions/upload-artifact@v7
+ with:
+ name: latest-jdk-versions-report
+ path: |
+ latest-jdk-versions.md
+ results/
+ retention-days: 30
diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml
index 37f1560c3..b5d009cb5 100644
--- a/.github/workflows/licensed.yml
+++ b/.github/workflows/licensed.yml
@@ -9,6 +9,9 @@ on:
- main
workflow_dispatch:
+permissions:
+ contents: read
+
jobs:
call-licensed:
name: Licensed
diff --git a/.github/workflows/publish-immutable-actions.yml b/.github/workflows/publish-immutable-actions.yml
index bfe592049..3888f9a85 100644
--- a/.github/workflows/publish-immutable-actions.yml
+++ b/.github/workflows/publish-immutable-actions.yml
@@ -5,6 +5,8 @@ on:
types: [released]
workflow_dispatch:
+permissions: {}
+
jobs:
publish:
runs-on: ubuntu-latest
@@ -15,7 +17,9 @@ jobs:
steps:
- name: Checking out
- uses: actions/checkout@v6
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
- name: Publish
id: publish
uses: actions/publish-immutable-action@v0.0.4
diff --git a/.github/workflows/update-config-files.yml b/.github/workflows/update-config-files.yml
index 87af50042..bacdc74ec 100644
--- a/.github/workflows/update-config-files.yml
+++ b/.github/workflows/update-config-files.yml
@@ -5,7 +5,12 @@ on:
- cron: '0 3 * * 0'
workflow_dispatch:
+permissions: {}
+
jobs:
call-update-configuration-files:
name: Update configuration files
+ permissions:
+ contents: write # to push the branch with updated configuration files
+ pull-requests: write # to open/update the configuration update PR
uses: actions/reusable-workflows/.github/workflows/update-config-files.yml@main
diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml
new file mode 100644
index 000000000..2009e6e70
--- /dev/null
+++ b/.github/workflows/zizmor.yml
@@ -0,0 +1,48 @@
+name: Security analysis with zizmor
+
+on:
+ push:
+ branches:
+ - main
+ - releases/*
+ paths-ignore:
+ - '**.md'
+ pull_request:
+ paths-ignore:
+ - '**.md'
+ workflow_dispatch:
+
+permissions: {}
+
+jobs:
+ zizmor:
+ name: Analyze workflows with zizmor
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ security-events: write # to upload SARIF results to code scanning
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+
+ - name: Set up Python
+ uses: actions/setup-python@v7
+ with:
+ python-version: '3.x'
+
+ - name: Install zizmor
+ run: pip install zizmor
+
+ - name: Run zizmor
+ run: zizmor --format sarif .github/workflows/ > zizmor.sarif
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Upload SARIF results to code scanning
+ if: always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
+ uses: github/codeql-action/upload-sarif@v4
+ with:
+ sarif_file: zizmor.sarif
+ category: zizmor
diff --git a/.github/zizmor.yml b/.github/zizmor.yml
new file mode 100644
index 000000000..38309ec47
--- /dev/null
+++ b/.github/zizmor.yml
@@ -0,0 +1,11 @@
+# Configuration for zizmor (https://docs.zizmor.sh)
+rules:
+ unpinned-uses:
+ config:
+ # First-party GitHub-maintained actions are trusted and referenced by
+ # major-version tags (the convention used across the actions org).
+ # Any third-party action must be pinned to a full commit SHA.
+ policies:
+ actions/*: ref-pin
+ github/*: ref-pin
+ '*': hash-pin
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 000000000..2312dc587
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1 @@
+npx lint-staged
diff --git a/.husky/pre-push b/.husky/pre-push
new file mode 100755
index 000000000..192cb67eb
--- /dev/null
+++ b/.husky/pre-push
@@ -0,0 +1 @@
+npm run build && npm test
diff --git a/.licensed.yml b/.licensed.yml
index 012638854..7f17bb852 100644
--- a/.licensed.yml
+++ b/.licensed.yml
@@ -10,7 +10,11 @@ allowed:
- mit
- cc0-1.0
- unlicense
+ - blueoak-1.0.0
reviewed:
npm:
- - "@actions/http-client" # MIT (license text present), but detected as "other"
\ No newline at end of file
+ - "@actions/http-client" # MIT (license text present), but detected as "other"
+ - "argparse" # Python Software Foundation License (PSF), but detected as "other"
+ - "balanced-match"
+ - "brace-expansion"
diff --git a/.licenses/npm/@actions/cache.dep.yml b/.licenses/npm/@actions/cache.dep.yml
index 8da40e4e9..77337a724 100644
--- a/.licenses/npm/@actions/cache.dep.yml
+++ b/.licenses/npm/@actions/cache.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/cache"
-version: 5.0.1
+version: 6.3.0
type: npm
summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
diff --git a/.licenses/npm/@actions/core-1.11.1.dep.yml b/.licenses/npm/@actions/core-1.11.1.dep.yml
deleted file mode 100644
index 09e099f71..000000000
--- a/.licenses/npm/@actions/core-1.11.1.dep.yml
+++ /dev/null
@@ -1,20 +0,0 @@
----
-name: "@actions/core"
-version: 1.11.1
-type: npm
-summary: Actions core lib
-homepage: https://github.com/actions/toolkit/tree/main/packages/core
-license: mit
-licenses:
-- sources: LICENSE.md
- text: |-
- The MIT License (MIT)
-
- Copyright 2019 GitHub
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-notices: []
diff --git a/.licenses/npm/@actions/core-2.0.1.dep.yml b/.licenses/npm/@actions/core.dep.yml
similarity index 98%
rename from .licenses/npm/@actions/core-2.0.1.dep.yml
rename to .licenses/npm/@actions/core.dep.yml
index eb49b54d0..081715159 100644
--- a/.licenses/npm/@actions/core-2.0.1.dep.yml
+++ b/.licenses/npm/@actions/core.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/core"
-version: 2.0.1
+version: 3.0.1
type: npm
summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core
diff --git a/.licenses/npm/@actions/exec-1.1.1.dep.yml b/.licenses/npm/@actions/exec-1.1.1.dep.yml
deleted file mode 100644
index cbc5abd39..000000000
--- a/.licenses/npm/@actions/exec-1.1.1.dep.yml
+++ /dev/null
@@ -1,20 +0,0 @@
----
-name: "@actions/exec"
-version: 1.1.1
-type: npm
-summary: Actions exec lib
-homepage: https://github.com/actions/toolkit/tree/main/packages/exec
-license: mit
-licenses:
-- sources: LICENSE.md
- text: |-
- The MIT License (MIT)
-
- Copyright 2019 GitHub
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-notices: []
diff --git a/.licenses/npm/@actions/exec-2.0.0.dep.yml b/.licenses/npm/@actions/exec.dep.yml
similarity index 98%
rename from .licenses/npm/@actions/exec-2.0.0.dep.yml
rename to .licenses/npm/@actions/exec.dep.yml
index 132d5859d..003562f8b 100644
--- a/.licenses/npm/@actions/exec-2.0.0.dep.yml
+++ b/.licenses/npm/@actions/exec.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/exec"
-version: 2.0.0
+version: 3.0.0
type: npm
summary: Actions exec lib
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
diff --git a/.licenses/npm/@actions/glob.dep.yml b/.licenses/npm/@actions/glob.dep.yml
index f7bf0793a..24d3f6916 100644
--- a/.licenses/npm/@actions/glob.dep.yml
+++ b/.licenses/npm/@actions/glob.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/glob"
-version: 0.5.0
+version: 0.7.0
type: npm
summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/main/packages/glob
diff --git a/.licenses/npm/@actions/http-client-3.0.2.dep.yml b/.licenses/npm/@actions/http-client-3.0.2.dep.yml
deleted file mode 100644
index dd1f80dd7..000000000
--- a/.licenses/npm/@actions/http-client-3.0.2.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: "@actions/http-client"
-version: 3.0.2
-type: npm
-summary: Actions Http Client
-homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
-license: other
-licenses:
-- sources: LICENSE
- text: |
- Actions Http Client for Node.js
-
- Copyright (c) GitHub, Inc.
-
- All rights reserved.
-
- MIT License
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
- associated documentation files (the "Software"), to deal in the Software without restriction,
- including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
- and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
- LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-notices: []
diff --git a/.licenses/npm/@actions/http-client-2.2.3.dep.yml b/.licenses/npm/@actions/http-client.dep.yml
similarity index 98%
rename from .licenses/npm/@actions/http-client-2.2.3.dep.yml
rename to .licenses/npm/@actions/http-client.dep.yml
index 1ae400a62..dc741537d 100644
--- a/.licenses/npm/@actions/http-client-2.2.3.dep.yml
+++ b/.licenses/npm/@actions/http-client.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/http-client"
-version: 2.2.3
+version: 4.0.1
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
diff --git a/.licenses/npm/@actions/io-1.1.3.dep.yml b/.licenses/npm/@actions/io-1.1.3.dep.yml
deleted file mode 100644
index d28465403..000000000
--- a/.licenses/npm/@actions/io-1.1.3.dep.yml
+++ /dev/null
@@ -1,20 +0,0 @@
----
-name: "@actions/io"
-version: 1.1.3
-type: npm
-summary: Actions io lib
-homepage: https://github.com/actions/toolkit/tree/main/packages/io
-license: mit
-licenses:
-- sources: LICENSE.md
- text: |-
- The MIT License (MIT)
-
- Copyright 2019 GitHub
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-notices: []
diff --git a/.licenses/npm/@actions/io-2.0.0.dep.yml b/.licenses/npm/@actions/io.dep.yml
similarity index 98%
rename from .licenses/npm/@actions/io-2.0.0.dep.yml
rename to .licenses/npm/@actions/io.dep.yml
index 2707c519b..dadddb4ed 100644
--- a/.licenses/npm/@actions/io-2.0.0.dep.yml
+++ b/.licenses/npm/@actions/io.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/io"
-version: 2.0.0
+version: 3.0.2
type: npm
summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/main/packages/io
diff --git a/.licenses/npm/@actions/tool-cache.dep.yml b/.licenses/npm/@actions/tool-cache.dep.yml
index fbf911fef..e7bf5bf0f 100644
--- a/.licenses/npm/@actions/tool-cache.dep.yml
+++ b/.licenses/npm/@actions/tool-cache.dep.yml
@@ -1,6 +1,6 @@
---
name: "@actions/tool-cache"
-version: 2.0.1
+version: 4.0.0
type: npm
summary: Actions tool-cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache
diff --git a/.licenses/npm/@azure/abort-controller-1.1.0.dep.yml b/.licenses/npm/@azure/abort-controller.dep.yml
similarity index 90%
rename from .licenses/npm/@azure/abort-controller-1.1.0.dep.yml
rename to .licenses/npm/@azure/abort-controller.dep.yml
index b19b8f7a4..32d238adf 100644
--- a/.licenses/npm/@azure/abort-controller-1.1.0.dep.yml
+++ b/.licenses/npm/@azure/abort-controller.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/abort-controller"
-version: 1.1.0
+version: 2.2.0
type: npm
summary: Microsoft Azure SDK for JavaScript - Aborter
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md
@@ -8,9 +8,9 @@ license: mit
licenses:
- sources: LICENSE
text: |
- The MIT License (MIT)
+ Copyright (c) Microsoft Corporation.
- Copyright (c) 2020 Microsoft
+ MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,7 @@ licenses:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
diff --git a/.licenses/npm/@azure/core-auth.dep.yml b/.licenses/npm/@azure/core-auth.dep.yml
index 193d51d60..48b2844a8 100644
--- a/.licenses/npm/@azure/core-auth.dep.yml
+++ b/.licenses/npm/@azure/core-auth.dep.yml
@@ -1,10 +1,10 @@
---
name: "@azure/core-auth"
-version: 1.10.1
+version: 1.11.0
type: npm
summary: Provides low-level interfaces and helper methods for authentication in Azure
SDK
-homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-auth/README.md
+homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-auth/README.md
license: mit
licenses:
- sources: LICENSE
diff --git a/.licenses/npm/@azure/core-client.dep.yml b/.licenses/npm/@azure/core-client.dep.yml
index 410915353..ea8eb8ec9 100644
--- a/.licenses/npm/@azure/core-client.dep.yml
+++ b/.licenses/npm/@azure/core-client.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/core-client"
-version: 1.10.1
+version: 1.11.1
type: npm
summary: Core library for interfacing with AutoRest generated code
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-client/
diff --git a/.licenses/npm/@azure/core-http-compat.dep.yml b/.licenses/npm/@azure/core-http-compat.dep.yml
index 1f0f6521f..c25f52b53 100644
--- a/.licenses/npm/@azure/core-http-compat.dep.yml
+++ b/.licenses/npm/@azure/core-http-compat.dep.yml
@@ -1,9 +1,9 @@
---
name: "@azure/core-http-compat"
-version: 2.3.1
+version: 2.5.0
type: npm
summary: Core HTTP Compatibility Library to bridge the gap between Core V1 & V2 packages.
-homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-compat/
+homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-http-compat/
license: mit
licenses:
- sources: LICENSE
diff --git a/.licenses/npm/@azure/core-paging.dep.yml b/.licenses/npm/@azure/core-paging.dep.yml
index cc3160584..09c56a260 100644
--- a/.licenses/npm/@azure/core-paging.dep.yml
+++ b/.licenses/npm/@azure/core-paging.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/core-paging"
-version: 1.6.2
+version: 1.7.0
type: npm
summary: Core types for paging async iterable iterators
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md
@@ -8,9 +8,9 @@ license: mit
licenses:
- sources: LICENSE
text: |
- The MIT License (MIT)
+ Copyright (c) Microsoft Corporation.
- Copyright (c) 2020 Microsoft
+ MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,7 @@ licenses:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
diff --git a/.licenses/npm/@azure/core-rest-pipeline.dep.yml b/.licenses/npm/@azure/core-rest-pipeline-1.23.0.dep.yml
similarity index 98%
rename from .licenses/npm/@azure/core-rest-pipeline.dep.yml
rename to .licenses/npm/@azure/core-rest-pipeline-1.23.0.dep.yml
index 7b3b7e6a9..8a1cad571 100644
--- a/.licenses/npm/@azure/core-rest-pipeline.dep.yml
+++ b/.licenses/npm/@azure/core-rest-pipeline-1.23.0.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/core-rest-pipeline"
-version: 1.22.2
+version: 1.23.0
type: npm
summary: Isomorphic client library for making HTTP requests in node.js and browser.
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/
diff --git a/.licenses/npm/@azure/abort-controller-2.1.2.dep.yml b/.licenses/npm/@azure/core-rest-pipeline-1.25.0.dep.yml
similarity index 79%
rename from .licenses/npm/@azure/abort-controller-2.1.2.dep.yml
rename to .licenses/npm/@azure/core-rest-pipeline-1.25.0.dep.yml
index 934bd3bfa..663516957 100644
--- a/.licenses/npm/@azure/abort-controller-2.1.2.dep.yml
+++ b/.licenses/npm/@azure/core-rest-pipeline-1.25.0.dep.yml
@@ -1,16 +1,16 @@
---
-name: "@azure/abort-controller"
-version: 2.1.2
+name: "@azure/core-rest-pipeline"
+version: 1.25.0
type: npm
-summary: Microsoft Azure SDK for JavaScript - Aborter
-homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md
+summary: Isomorphic client library for making HTTP requests in node.js and browser.
+homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-rest-pipeline/README.md
license: mit
licenses:
- sources: LICENSE
text: |
- The MIT License (MIT)
+ Copyright (c) Microsoft Corporation.
- Copyright (c) 2020 Microsoft
+ MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,7 @@ licenses:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
diff --git a/.licenses/npm/@azure/core-tracing.dep.yml b/.licenses/npm/@azure/core-tracing.dep.yml
index 71f7b7f09..467ae44b8 100644
--- a/.licenses/npm/@azure/core-tracing.dep.yml
+++ b/.licenses/npm/@azure/core-tracing.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/core-tracing"
-version: 1.3.1
+version: 1.4.0
type: npm
summary: Provides low-level interfaces and helper methods for tracing in Azure SDK
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-tracing/README.md
diff --git a/.licenses/npm/@azure/core-util.dep.yml b/.licenses/npm/@azure/core-util.dep.yml
index a05648544..7a6451790 100644
--- a/.licenses/npm/@azure/core-util.dep.yml
+++ b/.licenses/npm/@azure/core-util.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/core-util"
-version: 1.13.1
+version: 1.14.0
type: npm
summary: Core library for shared utility methods
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/
diff --git a/.licenses/npm/@azure/core-xml.dep.yml b/.licenses/npm/@azure/core-xml.dep.yml
index b82ec6d5b..f501dd734 100644
--- a/.licenses/npm/@azure/core-xml.dep.yml
+++ b/.licenses/npm/@azure/core-xml.dep.yml
@@ -1,9 +1,9 @@
---
name: "@azure/core-xml"
-version: 1.5.0
+version: 1.6.0
type: npm
summary: Core library for interacting with XML payloads
-homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-xml/
+homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-xml/README.md
license: mit
licenses:
- sources: LICENSE
diff --git a/.licenses/npm/@azure/logger.dep.yml b/.licenses/npm/@azure/logger.dep.yml
index 065ecaa55..511d51b7a 100644
--- a/.licenses/npm/@azure/logger.dep.yml
+++ b/.licenses/npm/@azure/logger.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/logger"
-version: 1.3.0
+version: 1.4.0
type: npm
summary: Microsoft Azure SDK for JavaScript - Logger
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md
diff --git a/.licenses/npm/@azure/storage-blob.dep.yml b/.licenses/npm/@azure/storage-blob.dep.yml
index d0cb028fa..e28cfaa1f 100644
--- a/.licenses/npm/@azure/storage-blob.dep.yml
+++ b/.licenses/npm/@azure/storage-blob.dep.yml
@@ -1,6 +1,6 @@
---
name: "@azure/storage-blob"
-version: 12.29.1
+version: 12.31.0
type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/
diff --git a/.licenses/npm/@azure/storage-common.dep.yml b/.licenses/npm/@azure/storage-common.dep.yml
index fc3370913..139a9a9d8 100644
--- a/.licenses/npm/@azure/storage-common.dep.yml
+++ b/.licenses/npm/@azure/storage-common.dep.yml
@@ -1,9 +1,9 @@
---
name: "@azure/storage-common"
-version: 12.1.1
+version: 12.5.0
type: npm
summary: Azure Storage Common Client Library for JavaScript
-homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-internal-avro/
+homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-common/README.md
license: mit
licenses:
- sources: LICENSE
diff --git a/.licenses/npm/@fastify/busboy.dep.yml b/.licenses/npm/@fastify/busboy.dep.yml
deleted file mode 100644
index 51267ac9f..000000000
--- a/.licenses/npm/@fastify/busboy.dep.yml
+++ /dev/null
@@ -1,30 +0,0 @@
----
-name: "@fastify/busboy"
-version: 2.1.0
-type: npm
-summary: A streaming parser for HTML form data for node.js
-homepage:
-license: mit
-licenses:
-- sources: LICENSE
- text: |-
- Copyright Brian White. All rights reserved.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to
- deal in the Software without restriction, including without limitation the
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- sell copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
-notices: []
diff --git a/.licenses/npm/@nodable/entities.dep.yml b/.licenses/npm/@nodable/entities.dep.yml
new file mode 100644
index 000000000..bebf9b903
--- /dev/null
+++ b/.licenses/npm/@nodable/entities.dep.yml
@@ -0,0 +1,11 @@
+---
+name: "@nodable/entities"
+version: 3.1.0
+type: npm
+summary: Entity parser for XML, HTML, External entites with security and NCR control
+homepage:
+license: mit
+licenses:
+- sources: README.md
+ text: MIT
+notices: []
diff --git a/.licenses/npm/@oozcitak/util.dep.yml b/.licenses/npm/@oozcitak/util.dep.yml
deleted file mode 100644
index dcee45c0f..000000000
--- a/.licenses/npm/@oozcitak/util.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: "@oozcitak/util"
-version: 8.3.8
-type: npm
-summary: Utility functions
-homepage: http://github.com/oozcitak/util
-license: mit
-licenses:
-- sources: LICENSE
- text: |
- MIT License
-
- Copyright (c) 2019 Ozgur Ozcitak
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-notices: []
diff --git a/.licenses/npm/@types/node.dep.yml b/.licenses/npm/@types/node.dep.yml
deleted file mode 100644
index 86544f488..000000000
--- a/.licenses/npm/@types/node.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: "@types/node"
-version: 24.1.0
-type: npm
-summary: TypeScript definitions for node
-homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
-license: mit
-licenses:
-- sources: LICENSE
- text: |2
- MIT License
-
- Copyright (c) Microsoft Corporation.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE
-notices: []
diff --git a/.licenses/npm/@typespec/ts-http-runtime.dep.yml b/.licenses/npm/@typespec/ts-http-runtime.dep.yml
index 4b4764430..260656874 100644
--- a/.licenses/npm/@typespec/ts-http-runtime.dep.yml
+++ b/.licenses/npm/@typespec/ts-http-runtime.dep.yml
@@ -1,9 +1,9 @@
---
name: "@typespec/ts-http-runtime"
-version: 0.3.2
+version: 0.3.9
type: npm
summary: Isomorphic client library for making HTTP requests in node.js and browser.
-homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/ts-http-runtime/
+homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/ts-http-runtime/README.md
license: mit
licenses:
- sources: LICENSE
diff --git a/.licenses/npm/@oozcitak/infra.dep.yml b/.licenses/npm/anynum.dep.yml
similarity index 82%
rename from .licenses/npm/@oozcitak/infra.dep.yml
rename to .licenses/npm/anynum.dep.yml
index eeac49dd3..891456f01 100644
--- a/.licenses/npm/@oozcitak/infra.dep.yml
+++ b/.licenses/npm/anynum.dep.yml
@@ -1,16 +1,17 @@
---
-name: "@oozcitak/infra"
-version: 1.0.8
+name: anynum
+version: 1.0.1
type: npm
-summary: An implementation of the Infra Living Standard
-homepage: http://github.com/oozcitak/infra
+summary: Normalize all Unicode decimal digits (Devanagari, Arabic, Thai, etc.) to
+ ASCII numerals. Zero dependencies, performance-first.
+homepage:
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
- Copyright (c) 2019 Ozgur Ozcitak
+ Copyright (c) 2026 Natural Intelligence
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -29,4 +30,6 @@ licenses:
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+- sources: README.md
+ text: MIT
notices: []
diff --git a/.licenses/npm/argparse.dep.yml b/.licenses/npm/argparse.dep.yml
deleted file mode 100644
index 2cd2843cf..000000000
--- a/.licenses/npm/argparse.dep.yml
+++ /dev/null
@@ -1,38 +0,0 @@
----
-name: argparse
-version: 1.0.10
-type: npm
-summary: Very powerful CLI arguments parser. Native port of argparse - python's options
- parsing library
-homepage: https://github.com/nodeca/argparse#readme
-license: mit
-licenses:
-- sources: LICENSE
- text: |
- (The MIT License)
-
- Copyright (C) 2012 by Vitaly Puzrin
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-- sources: README.md
- text: |-
- Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).
- Released under the MIT license. See
- [LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.
-notices: []
diff --git a/.licenses/npm/balanced-match.dep.yml b/.licenses/npm/balanced-match.dep.yml
index 36095592b..101c2c32b 100644
--- a/.licenses/npm/balanced-match.dep.yml
+++ b/.licenses/npm/balanced-match.dep.yml
@@ -1,39 +1,18 @@
---
name: balanced-match
-version: 1.0.2
+version: 4.0.4
type: npm
summary: Match balanced character pairs, like "{" and "}"
-homepage: https://github.com/juliangruber/balanced-match
+homepage:
license: mit
licenses:
- sources: LICENSE.md
text: |
(MIT)
- Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+ Original code Copyright Julian Gruber
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-- sources: README.md
- text: |-
- (MIT)
-
- Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
+ Port to TypeScript Copyright Isaac Z. Schlueter
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
diff --git a/.licenses/npm/brace-expansion.dep.yml b/.licenses/npm/brace-expansion.dep.yml
index 95ca8eb1f..8a9c0556d 100644
--- a/.licenses/npm/brace-expansion.dep.yml
+++ b/.licenses/npm/brace-expansion.dep.yml
@@ -1,16 +1,18 @@
---
name: brace-expansion
-version: 1.1.12
+version: 5.0.12
type: npm
summary: Brace expansion as known from sh/bash
-homepage: https://github.com/juliangruber/brace-expansion
+homepage:
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
- Copyright (c) 2013 Julian Gruber
+ Copyright Julian Gruber
+
+ TypeScript port Copyright Isaac Z. Schlueter
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -22,29 +24,6 @@ licenses:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-- sources: README.md
- text: |-
- (MIT)
-
- Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
- of the Software, and to permit persons to whom the Software is furnished to do
- so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
diff --git a/.licenses/npm/concat-map.dep.yml b/.licenses/npm/concat-map.dep.yml
deleted file mode 100644
index 20216b958..000000000
--- a/.licenses/npm/concat-map.dep.yml
+++ /dev/null
@@ -1,31 +0,0 @@
----
-name: concat-map
-version: 0.0.1
-type: npm
-summary: concatenative mapdashery
-homepage: https://github.com/substack/node-concat-map#readme
-license: other
-licenses:
-- sources: LICENSE
- text: |
- This software is released under the MIT license:
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- the Software, and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-- sources: README.markdown
- text: MIT
-notices: []
diff --git a/.licenses/npm/debug.dep.yml b/.licenses/npm/debug.dep.yml
index b9b723389..b49c69e92 100644
--- a/.licenses/npm/debug.dep.yml
+++ b/.licenses/npm/debug.dep.yml
@@ -1,6 +1,6 @@
---
name: debug
-version: 4.3.4
+version: 4.4.3
type: npm
summary: Lightweight debugging utility for Node.js and the browser
homepage:
diff --git a/.licenses/npm/esprima.dep.yml b/.licenses/npm/esprima.dep.yml
deleted file mode 100644
index 538091c52..000000000
--- a/.licenses/npm/esprima.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: esprima
-version: 4.0.1
-type: npm
-summary: ECMAScript parsing infrastructure for multipurpose analysis
-homepage: http://esprima.org
-license: bsd-2-clause
-licenses:
-- sources: LICENSE.BSD
- text: |
- Copyright JS Foundation and other contributors, https://js.foundation/
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-notices: []
diff --git a/.licenses/npm/fast-xml-builder.dep.yml b/.licenses/npm/fast-xml-builder.dep.yml
index c08d698a2..3e52f4152 100644
--- a/.licenses/npm/fast-xml-builder.dep.yml
+++ b/.licenses/npm/fast-xml-builder.dep.yml
@@ -1,6 +1,6 @@
---
name: fast-xml-builder
-version: 1.0.0
+version: 1.3.1
type: npm
summary: Build XML from JSON without C/C++ based libraries
homepage:
diff --git a/.licenses/npm/fast-xml-parser.dep.yml b/.licenses/npm/fast-xml-parser.dep.yml
index 0aba3a22f..0126797cf 100644
--- a/.licenses/npm/fast-xml-parser.dep.yml
+++ b/.licenses/npm/fast-xml-parser.dep.yml
@@ -1,6 +1,6 @@
---
name: fast-xml-parser
-version: 5.4.1
+version: 5.12.0
type: npm
summary: Validate XML, Parse XML, Build XML without C/C++ based libraries
homepage:
diff --git a/.licenses/npm/@oozcitak/dom.dep.yml b/.licenses/npm/is-unsafe.dep.yml
similarity index 82%
rename from .licenses/npm/@oozcitak/dom.dep.yml
rename to .licenses/npm/is-unsafe.dep.yml
index a810093aa..cbc4b8823 100644
--- a/.licenses/npm/@oozcitak/dom.dep.yml
+++ b/.licenses/npm/is-unsafe.dep.yml
@@ -1,16 +1,17 @@
---
-name: "@oozcitak/dom"
-version: 1.15.8
+name: is-unsafe
+version: 2.0.3
type: npm
-summary: A modern DOM implementation
-homepage: http://github.com/oozcitak/dom
+summary: Zero-dependency, DOM-free, pure predicate for detecting unsafe strings across
+ HTML, XML, SVG, SQL, SHELL, and REGEX contexts
+homepage:
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
- Copyright (c) 2019 Ozgur Ozcitak
+ Copyright (c) 2026 Natural Intelligence
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -29,4 +30,6 @@ licenses:
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+- sources: README.md
+ text: MIT
notices: []
diff --git a/.licenses/npm/js-yaml.dep.yml b/.licenses/npm/js-yaml.dep.yml
deleted file mode 100644
index 3b8875d01..000000000
--- a/.licenses/npm/js-yaml.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: js-yaml
-version: 3.14.0
-type: npm
-summary: YAML 1.2 parser and serializer
-homepage: https://github.com/nodeca/js-yaml
-license: mit
-licenses:
-- sources: LICENSE
- text: |
- (The MIT License)
-
- Copyright (C) 2011-2015 by Vitaly Puzrin
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-notices: []
diff --git a/.licenses/npm/minimatch.dep.yml b/.licenses/npm/minimatch.dep.yml
index 81a973572..d9010847c 100644
--- a/.licenses/npm/minimatch.dep.yml
+++ b/.licenses/npm/minimatch.dep.yml
@@ -1,26 +1,66 @@
---
name: minimatch
-version: 3.1.5
+version: 10.2.6
type: npm
summary: a glob matcher in javascript
homepage:
-license: isc
+license: blueoak-1.0.0
licenses:
-- sources: LICENSE
+- sources: LICENSE.md
text: |
- The ISC License
+ # Blue Oak Model License
- Copyright (c) Isaac Z. Schlueter and Contributors
+ Version 1.0.0
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
+ ## Purpose
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ This license gives everyone as much permission to work with
+ this software as possible, while protecting contributors
+ from liability.
+
+ ## Acceptance
+
+ In order to receive this license, you must agree to its
+ rules. The rules of this license are both obligations
+ under that agreement and conditions to your license.
+ You must not do anything with this software that triggers
+ a rule that you cannot or will not follow.
+
+ ## Copyright
+
+ Each contributor licenses you to do everything with this
+ software that would otherwise infringe that contributor's
+ copyright in it.
+
+ ## Notices
+
+ You must ensure that everyone who gets a copy of
+ any part of this software from you, with or without
+ changes, also gets the text of this license or a link to
+ .
+
+ ## Excuse
+
+ If anyone notifies you in writing that you have not
+ complied with [Notices](#notices), you can keep your
+ license by taking all practical steps to comply within 30
+ days after the notice. If you do not do so, your license
+ ends immediately.
+
+ ## Patent
+
+ Each contributor licenses you to do everything with this
+ software that would otherwise infringe any patent claims
+ they can license or become able to license.
+
+ ## Reliability
+
+ No contributor can revoke this license.
+
+ ## No Liability
+
+ **_As far as the law allows, this software comes as is,
+ without any warranty or condition, and no contributor
+ will be liable to anyone for any damages related to this
+ software or this license, under any kind of legal claim._**
notices: []
diff --git a/.licenses/npm/ms.dep.yml b/.licenses/npm/ms.dep.yml
index ac3c8eb15..5a303e4d6 100644
--- a/.licenses/npm/ms.dep.yml
+++ b/.licenses/npm/ms.dep.yml
@@ -1,6 +1,6 @@
---
name: ms
-version: 2.1.2
+version: 2.1.3
type: npm
summary: Tiny millisecond conversion utility
homepage:
@@ -10,7 +10,7 @@ licenses:
text: |
The MIT License (MIT)
- Copyright (c) 2016 Zeit, Inc.
+ Copyright (c) 2020 Vercel, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/.licenses/npm/@oozcitak/url.dep.yml b/.licenses/npm/path-expression-matcher.dep.yml
similarity index 84%
rename from .licenses/npm/@oozcitak/url.dep.yml
rename to .licenses/npm/path-expression-matcher.dep.yml
index 6f3ae3985..a671e7d7c 100644
--- a/.licenses/npm/@oozcitak/url.dep.yml
+++ b/.licenses/npm/path-expression-matcher.dep.yml
@@ -1,16 +1,16 @@
---
-name: "@oozcitak/url"
-version: 1.0.4
+name: path-expression-matcher
+version: 1.6.2
type: npm
-summary: An implementation of the URL Living Standard
-homepage: http://github.com/oozcitak/url
+summary: Efficient path tracking and pattern matching for XML/JSON parsers
+homepage: https://github.com/NaturalIntelligence/path-expression-matcher#readme
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
- Copyright (c) 2019 Ozgur Ozcitak
+ Copyright (c) 2024
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/.licenses/npm/semver-6.3.1.dep.yml b/.licenses/npm/semver-6.3.1.dep.yml
deleted file mode 100644
index 248cb0301..000000000
--- a/.licenses/npm/semver-6.3.1.dep.yml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-name: semver
-version: 6.3.1
-type: npm
-summary: The semantic version parser used by npm.
-homepage:
-license: isc
-licenses:
-- sources: LICENSE
- text: |
- The ISC License
-
- Copyright (c) Isaac Z. Schlueter and Contributors
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
- IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-notices: []
diff --git a/.licenses/npm/semver-7.7.1.dep.yml b/.licenses/npm/semver.dep.yml
similarity index 98%
rename from .licenses/npm/semver-7.7.1.dep.yml
rename to .licenses/npm/semver.dep.yml
index 3194cf4ae..c5813fabe 100644
--- a/.licenses/npm/semver-7.7.1.dep.yml
+++ b/.licenses/npm/semver.dep.yml
@@ -1,6 +1,6 @@
---
name: semver
-version: 7.7.1
+version: 7.8.5
type: npm
summary: The semantic version parser used by npm.
homepage:
diff --git a/.licenses/npm/sprintf-js.dep.yml b/.licenses/npm/sprintf-js.dep.yml
deleted file mode 100644
index e7157634f..000000000
--- a/.licenses/npm/sprintf-js.dep.yml
+++ /dev/null
@@ -1,37 +0,0 @@
----
-name: sprintf-js
-version: 1.0.3
-type: npm
-summary: JavaScript sprintf implementation
-homepage: https://github.com/alexei/sprintf.js#readme
-license: bsd-3-clause
-licenses:
-- sources: LICENSE
- text: |
- Copyright (c) 2007-2014, Alexandru Marasteanu
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of this software nor the names of its contributors may be
- used to endorse or promote products derived from this software without
- specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-- sources: README.md
- text: "**sprintf.js** is licensed under the terms of the 3-clause BSD license."
-notices: []
diff --git a/.licenses/npm/strnum.dep.yml b/.licenses/npm/strnum.dep.yml
index 3aa1cde76..d560b95e7 100644
--- a/.licenses/npm/strnum.dep.yml
+++ b/.licenses/npm/strnum.dep.yml
@@ -1,6 +1,6 @@
---
name: strnum
-version: 2.1.2
+version: 2.5.1
type: npm
summary: Parse String to Number based on configuration
homepage:
diff --git a/.licenses/npm/undici-types.dep.yml b/.licenses/npm/undici-types.dep.yml
deleted file mode 100644
index 370219bfa..000000000
--- a/.licenses/npm/undici-types.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: undici-types
-version: 7.8.0
-type: npm
-summary: A stand-alone types package for Undici
-homepage: https://undici.nodejs.org
-license: mit
-licenses:
-- sources: LICENSE
- text: |
- MIT License
-
- Copyright (c) Matteo Collina and Undici contributors
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-notices: []
diff --git a/.licenses/npm/undici-5.29.0.dep.yml b/.licenses/npm/undici.dep.yml
similarity index 98%
rename from .licenses/npm/undici-5.29.0.dep.yml
rename to .licenses/npm/undici.dep.yml
index fadecf4a7..459f1a92c 100644
--- a/.licenses/npm/undici-5.29.0.dep.yml
+++ b/.licenses/npm/undici.dep.yml
@@ -1,6 +1,6 @@
---
name: undici
-version: 5.29.0
+version: 6.29.1
type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org
diff --git a/.licenses/npm/uuid.dep.yml b/.licenses/npm/uuid.dep.yml
deleted file mode 100644
index 45970fef6..000000000
--- a/.licenses/npm/uuid.dep.yml
+++ /dev/null
@@ -1,39 +0,0 @@
----
-name: uuid
-version: 3.4.0
-type: npm
-summary: RFC4122 (v1, v4, and v5) UUIDs
-homepage: https://github.com/uuidjs/uuid#readme
-license: mit
-licenses:
-- sources: LICENSE.md
- text: |
- The MIT License (MIT)
-
- Copyright (c) 2010-2016 Robert Kieffer and other contributors
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-notices:
-- sources: AUTHORS
- text: |-
- Robert Kieffer
- Christoph Tavan
- AJ ONeal
- Vincent Voyer
- Roman Shtylman
diff --git a/.licenses/npm/undici-6.23.0.dep.yml b/.licenses/npm/xml-naming.dep.yml
similarity index 86%
rename from .licenses/npm/undici-6.23.0.dep.yml
rename to .licenses/npm/xml-naming.dep.yml
index 887600045..bfc32c71c 100644
--- a/.licenses/npm/undici-6.23.0.dep.yml
+++ b/.licenses/npm/xml-naming.dep.yml
@@ -1,16 +1,17 @@
---
-name: undici
-version: 6.23.0
+name: xml-naming
+version: 0.3.0
type: npm
-summary: An HTTP/1.1 client, written from scratch for Node.js
-homepage: https://undici.nodejs.org
+summary: Validates XML name productions — Name, NCName, QName, NMToken, NMTokens —
+ for XML 1.0 and 1.1
+homepage:
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
- Copyright (c) Matteo Collina and Undici contributors
+ Copyright (c) 2026 Natural Intelligence
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/.licenses/npm/xmlbuilder2.dep.yml b/.licenses/npm/xmlbuilder2.dep.yml
deleted file mode 100644
index 378714677..000000000
--- a/.licenses/npm/xmlbuilder2.dep.yml
+++ /dev/null
@@ -1,32 +0,0 @@
----
-name: xmlbuilder2
-version: 2.4.1
-type: npm
-summary: An XML builder for node.js
-homepage: http://github.com/oozcitak/xmlbuilder2
-license: mit
-licenses:
-- sources: LICENSE
- text: |
- MIT License
-
- Copyright (c) 2019 Ozgur Ozcitak
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- SOFTWARE.
-notices: []
diff --git a/.prettierrc.js b/.prettierrc.js
deleted file mode 100644
index 468cdb1e2..000000000
--- a/.prettierrc.js
+++ /dev/null
@@ -1,11 +0,0 @@
-// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
-module.exports = {
- printWidth: 80,
- tabWidth: 2,
- useTabs: false,
- semi: true,
- singleQuote: true,
- trailingComma: 'none',
- bracketSpacing: false,
- arrowParens: 'avoid'
-};
diff --git a/.prettierrc.json b/.prettierrc.json
new file mode 100644
index 000000000..b243c2ff0
--- /dev/null
+++ b/.prettierrc.json
@@ -0,0 +1,10 @@
+{
+ "printWidth": 80,
+ "tabWidth": 2,
+ "useTabs": false,
+ "semi": true,
+ "singleQuote": true,
+ "trailingComma": "none",
+ "bracketSpacing": false,
+ "arrowParens": "avoid"
+}
diff --git a/README.md b/README.md
index 35c6ce3f5..ea57bc807 100644
--- a/README.md
+++ b/README.md
@@ -3,291 +3,528 @@
[](https://github.com/actions/setup-java/actions/workflows/basic-validation.yml)
[](https://github.com/actions/setup-java/actions/workflows/e2e-versions.yml)
[](https://github.com/actions/setup-java/actions/workflows/e2e-cache.yml)
+[](https://github.com/actions/setup-java/actions/workflows/latest-jdk-versions.yml)
-The `setup-java` action provides the following functionality for GitHub Actions runners:
-- Downloading and setting up a requested version of Java. See [Usage](#usage) for a list of supported distributions.
-- Extracting and caching custom version of Java from a local file.
-- Configuring runner for publishing using Apache Maven.
-- Configuring runner for publishing using Gradle.
-- Configuring runner for using GPG private key.
-- Registering problem matchers for error output.
-- Caching dependencies managed by Apache Maven.
-- Caching dependencies managed by Gradle.
-- Caching dependencies managed by sbt.
-- [Maven Toolchains declaration](https://maven.apache.org/guides/mini/guide-using-toolchains.html) for specified JDK versions.
+Set up Java for GitHub Actions workflows. `setup-java` installs a requested Java distribution, adds it to `PATH`, configures `JAVA_HOME`, and can optionally cache build dependencies for Apache Maven, Gradle, and sbt; generate Maven publishing configuration, verify JDK package signatures, manage multiple JDKs, and manage Maven toolchains.
-This action allows you to work with Java and Scala projects.
-
-## Breaking changes in V5
-
-- Upgraded action from node20 to node24
- > Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
-
-For more details, see the full release notes on the [releases page](https://github.com/actions/setup-java/releases/tag/v5.0.0)
-
-## V2 vs V1
-
-- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
-- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ - run: java --version
+```
-For information about the latest releases, recent updates, and newly supported distributions, please refer to the `setup-java` [Releases](https://github.com/actions/setup-java/releases).
+## Contents
+
+- [What it does](#what-it-does)
+- [What's new](#whats-new)
+- [Usage](#usage)
+- [Inputs](#inputs)
+- [Supported distributions](#supported-distributions)
+- [Supported version syntax](#supported-version-syntax)
+- [Caching](#caching)
+- [Multiple JDKs and Maven toolchains](#multiple-jdks-and-maven-toolchains)
+- [Publishing packages](#publishing-packages)
+- [Advanced usage](#advanced-usage)
+
+## What it does
+
+- Downloads and installs Java from a supported distribution.
+- Uses a requested Java version, a version file, or the `latest` stable release alias.
+- Extracts and caches a custom JDK archive from a local file.
+- Configures Maven `settings.xml`, Maven Toolchains, Maven GPG signing inputs, and environment-variable based credentials for publishing workflows.
+- Registers Java problem matchers for compiler diagnostics and uncaught exceptions.
+- Caches dependencies for Maven, Gradle, and sbt.
+- Caches downloaded JDK installations between jobs.
+- Verifies downloaded archive checksums when a distribution publishes authoritative checksums.
+- Optionally verifies package signatures for supported distributions.
+
+`setup-java` works with Java, Scala, Kotlin, Gradle, Maven, and sbt projects.
+
+## What's new
+
+### V6
+
+- Migrated the action implementation to ESM to support the latest `@actions/*` packages.
+- Added Oracle OpenJDK (`oracle-openjdk`), Red Hat Build of OpenJDK (`redhat`), and Liberica Native Image Kit (`liberica-nik`), and expanded Tencent Kona support through JDK 25.
+- Added `java-version: latest` to resolve the newest stable GA release from the distribution's remote metadata.
+- Expanded install compatibility with JEP 322 multi-field versions such as `18.0.1.1`, Temurin `jdk+jmods` packages, and native musl artifacts on Alpine for Dragonwell, Corretto, Zulu, and Liberica.
+- JDK downloads now automatically verify authoritative checksums. Package signature verification is supported for Temurin and Microsoft builds, with configurable strict enforcement.
+- Added `force-download: true` to bypass the tool cache and perform a reproducible fresh install.
+- Dependency caching now supports custom paths with `cache-path` and restore-only operation with `cache-read-only: true`.
+- Dependency cache keys now include `.mvn/extensions.xml` and `gradle.properties`, preventing stale restores when Maven extensions or Gradle dependency properties change.
+- Downloaded JDKs are now [cached](#caching-jdk-installations) automatically when `cache` is set; use `cache-jdk` to enable or disable it independently.
+- Warm JDK-cached jobs can reuse cached release metadata, avoiding vendor API calls while retaining a stale-metadata fallback for vendor outages and rate limits.
+- Maven configuration now supports multiple server credentials and custom dependency-resolution repositories.
+- Maven signing keys are imported into an isolated temporary GPG home instead of the runner's default keyring.
+- Java compiler and uncaught-exception annotations are now disabled by default. Set `problem-matcher: true` to enable them.
+- GraalVM distributions now set `GRAALVM_HOME` in addition to `JAVA_HOME`.
+- Invalid boolean values, unsupported distribution/package/platform combinations, and mismatched Maven toolchain ID counts now fail with targeted errors.
+- Renamed environment-variable-name inputs so they are not mistaken for secret values:
+ - `server-username` -> `server-username-env-var`
+ - `server-password` -> `server-password-env-var`
+ - `gpg-passphrase` -> `gpg-passphrase-env-var`
+- Deprecated aliases still work, but emit warnings.
+- Maven GPG passphrases are now passed through `gpg.passphraseEnvName` instead of a deprecated `gpg.passphrase` server entry in `settings.xml`. This requires `maven-gpg-plugin` 3.2.0 or newer. See [GPG](docs/advanced-usage.md#gpg).
+- Legacy AdoptOpenJDK distributions were removed. Use `temurin` instead of `adopt` or `adopt-hotspot`, and `semeru` instead of `adopt-openj9`.
+- See the [complete V6 release notes](https://github.com/actions/setup-java/releases/tag/v6.0.0) for all enhancements and fixes.
+
+### V5
+
+- Upgraded the action runtime from Node 20 to Node 24. Self-hosted runners must use version `v2.327.1` or later. See the [runner release notes](https://github.com/actions/runner/releases/tag/v2.327.1).
+- Added support for [GraalVM Community](#supported-distributions) and [Tencent Kona](#supported-distributions).
+- Expanded `java-version-file` support with `.sdkmanrc` files and automatic distribution detection from SDKMAN and asdf vendor identifiers.
+- Added optional package-signature verification for Eclipse Temurin and Microsoft Build of OpenJDK downloads.
+- Added `set-default: false` for installing a JDK without changing `JAVA_HOME` or `PATH`.
+- Improved dependency caching with separate Maven and Gradle wrapper caches, Maven extension-aware cache keys, and the `cache-primary-key` output.
+- Improved Maven and Java build behavior by preserving toolchain entries across repeated action invocations, suppressing transfer progress by default, generating non-interactive Maven settings, and matching `javac` compiler errors.
+- Renamed the `jdkFile` input to `jdk-file`; the old name remains available as a deprecated alias.
+- See the [complete V5 release history](https://github.com/actions/setup-java/releases?q=v5&expanded=true) for enhancements and fixes across all V5 releases.
+
+### Older versions
+
+> [!WARNING]
+> `actions/setup-java` versions `v1` through `v4` are deprecated. Upgrade workflows to `actions/setup-java@v6`, the latest stable release.
## Usage
- - `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified.
+### Install Eclipse Temurin
- - `java-version-file`: The path to a file containing java version. Supported file types are `.java-version` and `.tool-versions`. See more details in [about .java-version-file](docs/advanced-usage.md#Java-version-file).
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ - run: java --version
+```
- - `distribution`: _(required)_ Java [distribution](#supported-distributions).
+### Install Microsoft Build of OpenJDK
- - `java-package`: The packaging variant of the chosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`.
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: microsoft
+ java-version: '25'
+ - run: java --version
+```
- - `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
+### Read the version from a file
+
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version-file: .java-version
+ - run: java --version
+```
- - `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM.
+Supported version files are `.java-version`, `.tool-versions`, and `.sdkmanrc`. A `.sdkmanrc` file can also provide the distribution when it contains a recognized suffix, such as `java=21.0.5-tem`.
- - `check-latest`: Setting this option makes the action to check for the latest available version for the version spec.
+### Use the newest stable Java
- - `cache`: Quick [setup caching](#caching-packages-dependencies) for the dependencies managed through one of the predefined package managers. It can be one of "maven", "gradle" or "sbt".
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: latest
+ - run: java --version
+```
- - `cache-dependency-path`: The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.
+`latest` resolves the newest stable GA release from remote metadata rather than from the runner tool cache. Distributions that do not publish a release listing (such as `oracle` and `graalvm`) resolve the newest GA feature version from the Adoptium available-releases API and then request that version from their own catalog. `latest` is not supported with `java-version-file`, early-access versions, or `distribution: jdkfile`.
+
+## Inputs
+
+| Input | Description | Default |
+| --- | --- | --- |
+| `java-version` | Java version to install. Supports whole versions, semver ranges, early-access versions, and `latest`. Required unless `java-version-file` is set. | |
+| `java-version-file` | Path to `.java-version`, `.tool-versions`, or `.sdkmanrc`. Used when `java-version` is not set. | |
+| `distribution` | Java distribution keyword. Values are case-sensitive and must match one of the supported keywords below. Required unless `java-version-file` points to `.sdkmanrc` with a recognized distribution suffix. | |
+| `java-package` | Package variant such as `jdk`, `jre`, `jdk+fx`, `jre+fx`, `jdk+crac`, `jre+crac`, `jdk+jmods`, `jdk+jcef`, `jre+jcef`, `jdk+ft`, or `jre+ft`. Support varies by distribution. | `jdk` |
+| `architecture` | Package architecture. Canonical values are `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`, `ppc64`, `riscv64`, and `s390x`. Aliases `ia32`, `amd64`, `arm`, and `arm64` are normalized. | Runner architecture |
+| `jdk-file` | Local compressed JDK archive. Requires `distribution: jdkfile`. | |
+| `check-latest` | Check remote metadata for the latest version satisfying the version spec before using the runner tool cache. | `false` |
+| `force-download` | Always download Java and replace any matching version in the tool cache. | `false` |
+| `set-default` | Add Java to `PATH` and set `JAVA_HOME`. When `false`, only version-specific `JAVA_HOME__` variables are set. | `true` |
+| `problem-matcher` | Register Java compiler and uncaught exception problem matchers. | `false` |
+| `verify-signature` | Verify downloaded Java package signatures when supported. Explicitly setting this to `true` makes verification failures fatal. | Distribution-dependent; see [Download integrity and signatures](#download-integrity-and-signatures) |
+| `verify-signature-public-key` | One or more ASCII-armored GPG public keys used for signature verification. Concatenate multiple armored key blocks. Custom keys replace the bundled distribution keys. | |
+| `token` | Token for fetching GitHub.com-hosted version manifests, useful on GitHub Enterprise Server when unauthenticated requests are rate-limited. | `${{ github.token }}` on GitHub.com; empty string on GHES |
+| `cache` | Enable dependency caching for `maven`, `gradle`, or `sbt`. | |
+| `cache-jdk` | Cache downloaded JDK installations between jobs. When omitted, JDK caching is enabled only if `cache` is set. Set explicitly to `true` or `false` to override. | Enabled when `cache` is set |
+| `cache-dependency-path` | Dependency file paths used for cache key hashing. Supports globs and multiline values. | Auto-detected by package manager |
+| `cache-path` | Cache paths to use instead of the package manager's default dependency cache path. Supports multiline values and exclusions. | |
+| `cache-read-only` | Restore dependency, wrapper, and JDK caches without saving changes in the post step. | `false` |
+| `server-id` | Maven repository ID used in generated `settings.xml`. | `github` |
+| `server-username-env-var` | Environment variable name for Maven repository username. | `GITHUB_ACTOR` |
+| `server-password-env-var` | Environment variable name for Maven repository password or token. | `GITHUB_TOKEN` |
+| `mvn-server-credentials` | Multiline Maven server credentials in the format `server-id:USERNAME_ENV:PASSWORD_ENV`. Replaces the single server configured by the three inputs above when set. | |
+| `mvn-server-repository-origins` | Multiline Maven credential origins in the format `server-id:repository-origin`. Each origin must belong to a configured server ID. Requires Maven 3.10+. | |
+| `mvn-repositories` | Multiline Maven dependency repositories in the format `repository-id:repository-url:snapshots-enabled`. | |
+| `mvn-plugin-repositories` | Multiline Maven plugin repositories in the format `repository-id:repository-url:snapshots-enabled`. Can be used independently of `mvn-repositories`. | |
+| `mvn-mirrors` | Multiline Maven mirrors in the format `mirror-id:mirror-url:mirror-of`. Redirect matching dependency and plugin repositories; use a matching server ID for authentication. | |
+| `mvn-repositories-include-central` | Include Maven Central for dependency and plugin repositories in the generated profile. When `false`, Central is disabled for both types unless that type explicitly declares `central`. Has no effect when neither repository list is configured. | `true` |
+| `mvn-repositories-prioritize-central` | Place Maven Central before custom dependency and plugin repositories. Has no effect when Central is excluded or neither repository list is configured. | `true` |
+| `settings-path` | Directory where `settings.xml` is written. | `~/.m2` |
+| `overwrite-settings` | Overwrite an existing `settings.xml`. | `true` |
+| `gpg-private-key` | GPG private key to import into an isolated temporary keyring. | |
+| `gpg-passphrase-env-var` | Environment variable name for the GPG private key passphrase. | `GPG_PASSPHRASE` when a key is set |
+| `mvn-toolchain-id` | Maven Toolchain ID. When multiple Java versions are installed, the number of IDs must match the number of versions. | `${mvn-toolchain-vendor}_${java-version}` |
+| `mvn-toolchain-vendor` | Maven Toolchain vendor value. | `${distribution}` |
+| `show-download-progress` | Keep Maven artifact download and transfer progress in logs. When `false`, the action adds `-ntp` to `MAVEN_ARGS`. | `false` |
+
+- `java-package`: Supported package types are `jdk`, `jre`, `jdk+fx`, `jre+fx`, `jdk+crac`, `jre+crac`, `jdk+jmods`, `jdk+jcef`, `jre+jcef`, `jdk+ft`, and `jre+ft`. Availability varies by distribution.
+
+Deprecated aliases `jdkFile`, `server-username`, `server-password`, and `gpg-passphrase` remain accepted for compatibility, but should be replaced with the current input names.
+
+## Outputs
+
+| Output | Description |
+| --- | --- |
+| `distribution` | Distribution that was installed. |
+| `version` | Actual Java version that was installed. |
+| `path` | Installation path, also used for `JAVA_HOME` when `set-default` is enabled. |
+| `cache-hit` | Whether an exact dependency cache match was restored. |
+| `cache-primary-key` | Primary cache key computed for the selected package manager. Empty when caching is disabled or skipped. |
+
+## Supported distributions
+
+| Keyword | Distribution | License |
+| --- | --- | --- |
+| `corretto` | [Amazon Corretto](https://aws.amazon.com/corretto/) | [License](https://aws.amazon.com/corretto/faqs/) |
+| `dragonwell` | [Alibaba Dragonwell JDK](https://dragonwell-jdk.io/) | [License](https://www.aliyun.com/product/dragonwell/) |
+| `graalvm` | [Oracle GraalVM](https://www.graalvm.org/) | [License](https://www.oracle.com/downloads/licenses/graal-free-license.html) |
+| `graalvm-community` | [GraalVM Community](https://github.com/graalvm/graalvm-ce-builds/releases) | [License](https://github.com/oracle/graal/blob/master/LICENSE) |
+| `jetbrains` | [JetBrains Runtime](https://github.com/JetBrains/JetBrainsRuntime/) | [License](https://github.com/JetBrains/JetBrainsRuntime/blob/main/LICENSE) |
+| `kona` | [Tencent Kona JDK](https://tencent.github.io/konajdk/) | [License](https://tencent.github.io/konajdk/LICENSE.txt) |
+| `liberica` | [Liberica JDK](https://bell-sw.com/) | [License](https://bell-sw.com/liberica_eula/) |
+| `liberica-nik` | [Liberica Native Image Kit](https://bell-sw.com/pages/downloads/native-image-kit/) | [License](https://bell-sw.com/liberica_nik_eula/) |
+| `microsoft` | [Microsoft Build of OpenJDK](https://www.microsoft.com/openjdk) | [License](https://docs.microsoft.com/java/openjdk/faq) |
+| `oracle` | [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) | [License](https://java.com/freeuselicense) |
+| `oracle-openjdk` | [Oracle OpenJDK](https://jdk.java.net/) | [License](https://openjdk.org/legal/gplv2+ce.html) |
+| `redhat` | [Red Hat Build of OpenJDK](https://developers.redhat.com/products/openjdk/overview) | [License](https://openjdk.org/legal/gplv2+ce.html) |
+| `sapmachine` | [SAP SapMachine JDK/JRE](https://sapmachine.io/) | [License](https://github.com/SAP/SapMachine/blob/sapmachine/LICENSE) |
+| `semeru` | [IBM Semeru Runtime Open Edition](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [License](https://openjdk.java.net/legal/gplv2+ce.html) |
+| `temurin` | [Eclipse Temurin](https://adoptium.net/) | [License](https://adoptium.net/about.html) |
+| `zulu` | [Azul Zulu OpenJDK](https://www.azul.com/downloads/zulu-community/?package=jdk) | [License](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
+| `jdkfile` | Custom JDK archive | |
+
+> [!NOTE]
+> Distribution availability, package variants, architectures, and version metadata differ by vendor. Check the vendor documentation when a specific version or platform matters.
+
+Additional distribution notes:
+
+- Oracle OpenJDK builds are archived after a limited number of releases and no longer receive security updates. To continue receiving security patches, use Oracle JDK or another vendor.
+- Azul Zulu maps `arm64` to `aarch64` when querying the Azul Metadata API.
+- Microsoft Build of OpenJDK uses Microsoft's live version manifest, falling back to the bundled version list when no release matches. Version `25.0.5.0.2` can also be requested as `25.0.5+0.2`.
+- GraalVM Community is available as `distribution: graalvm-community` for stable JDK 17 and later releases.
+- On Ubuntu runners, commands executed with `sudo` do not inherit the `JAVA_HOME` and `PATH` set by `setup-java` and may fall back to the system-default JDK.
+
+## Supported version syntax
+
+`java-version` accepts exact versions, version ranges, early-access versions, and `latest`.
+
+| Syntax | Examples |
+| --- | --- |
+| Major version | `8`, `11`, `17`, `21`, `25` |
+| Specific feature or patch version | `11.0`, `11.0.4`, `17.0`, `8.0.282+8` |
+| JEP 322 multi-field versions | `11.0.9.1`, `18.0.1.1`, `26.0.2.1+1` |
+| Early access | `15-ea`, `15.0.0-ea`, `27-ea` |
+| Latest stable GA release | `latest` |
+
+When `check-latest` is `false`, the action first tries the runner tool cache for the requested distribution, package type, architecture, and version range. It downloads Java only when no matching cached version is found. When `check-latest` is `true`, the action checks remote metadata first and downloads if the cached version is not current.
+
+GitHub-hosted runners primarily pre-cache Eclipse Temurin JDKs. See the installed Java versions for [Ubuntu](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md#java), [Windows](https://github.com/actions/runner-images/blob/main/images/windows/Windows2025-Readme.md#java), and [macOS](https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#java). On a fresh GitHub-hosted runner, requests for other distributions usually miss the tool cache and resolve from remote metadata. For broad version ranges such as a major version (`21`, `25`), this often behaves similarly to `check-latest: true` because the action downloads the latest available release that satisfies the range.
+
+To see which exact version a request resolves to today, open the summary of the latest run of the daily [Latest JDK versions report](https://github.com/actions/setup-java/actions/workflows/latest-jdk-versions.yml) workflow. For every supported distribution, it lists the version that `setup-java` currently resolves from vendor metadata for every major from Java 6 through the newest stable GA release (including non-LTS releases), plus `latest`, on every operating system and architecture the action supports for that distribution, including Alpine Linux and Solaris. Because vendors publish builds per platform, the same request can resolve to different versions on different platforms. The report doesn't download any JDKs. Floating vendor URLs are marked when their exact version cannot be established from metadata alone. It shows what a job installs on a tool-cache miss or with `check-latest: true`.
+
+## Download integrity and signatures
+
+`setup-java` automatically verifies downloaded archive checksums when a selected distribution publishes an authoritative checksum. Automatic checksum verification currently applies to `temurin`, `semeru`, `corretto`, `dragonwell`, `kona`, `sapmachine`, `graalvm`, `graalvm-community`, `zulu`, `oracle`, `oracle-openjdk`, `microsoft`, and `jetbrains`.
+
+Distributions or individual releases without an authoritative checksum continue to install normally, with the omission reported in debug logs. Installations resolved directly from the runner tool cache — including JDKs preinstalled on the runner image and JDKs installed by an earlier step of the same job — are not downloaded again and are not reverified, even when `verify-signature: true` is set. Use `force-download: true` to always download and verify the archive.
+
+Package signature verification is supported for `temurin` and `microsoft`. When `verify-signature` is omitted, the action checks the signature and warns if GPG is unavailable or verification fails, but does not enforce the result. Explicitly setting `verify-signature: true` enforces verification and makes these failures fatal. Setting `verify-signature: true` for an unsupported distribution also fails the workflow.
+
+> [!WARNING]
+> Requesting explicit signature verification with verify-signature can fail a build after an unexpected but legitimate vendor signing-key rotation, because the action's bundled keys may not yet include the new key. Confirm a new key through the vendor's trusted documentation before using it.
+
+After confirming a legitimate rotation, configure the updated key with `verify-signature-public-key`. The input accepts one or more ASCII-armored public keys; concatenate complete armored key blocks when both old and new vendor keys are needed during a transition. Custom keys replace, rather than extend, the keys bundled with the selected distribution.
- #### Maven options
- The action has a bunch of inputs to generate maven's [settings.xml](https://maven.apache.org/settings.html) on the fly and pass the values to Apache Maven GPG Plugin as well as Apache Maven Toolchains. See [advanced usage](docs/advanced-usage.md) for more.
+```yaml
+- uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ verify-signature: true
+ verify-signature-public-key: |
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
+ ...vendor key material...
+ -----END PGP PUBLIC KEY BLOCK-----
+```
- - `overwrite-settings`: By default action overwrites the settings.xml. In order to skip generation of file if it exists, set this to `false`.
+As a temporary fallback while a legitimate rotation is being investigated, set `verify-signature: false`. This disables package signature verification, although authoritative checksum verification still applies when the vendor publishes a checksum.
- - `server-id`: ID of the distributionManagement repository in the pom.xml file. Default is `github`.
+```yaml
+- uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ verify-signature: false
+```
- - `server-username`: Environment variable name for the username for authentication to the Apache Maven repository. Default is GITHUB_ACTOR.
+## Caching
- - `server-password`: Environment variable name for password or token for authentication to the Apache Maven repository. Default is GITHUB_TOKEN.
+`setup-java` manages three kinds of caches. Each one is restored and saved as a separate cache entry.
- - `settings-path`: Maven related setting to point to the directory where the settings.xml file will be written. Default is ~/.m2.
+| Cache | What it stores | Key based on | How it is enabled |
+| --- | --- | --- | --- |
+| Dependency cache | Downloaded dependencies, such as `~/.m2/repository`, `~/.gradle/caches`, or the sbt cache paths | Runner OS, architecture, package manager, and a hash of the dependency files | Set `cache` to `maven`, `gradle`, or `sbt` |
+| Wrapper caches | Maven and Gradle wrapper distributions (`~/.m2/wrapper/dists`, `~/.gradle/wrapper`) | Runner OS, architecture, wrapper cache name, and a hash of the wrapper properties | Set `cache` to `maven` or `gradle` |
+| JDK cache | The downloaded JDK installation | Runner OS, architecture, distribution, package type, resolved version, release identity, and signature-verification identity | Enabled implicitly whenever `cache` is set, or explicitly with `cache-jdk: true`. Opt out with `cache-jdk: false` |
- - `gpg-private-key`: GPG private key to import. Default is empty string.
+Set `cache` to `maven`, `gradle`, or `sbt` to cache dependencies with minimal configuration.
- - `gpg-passphrase`: Environment variable name for the GPG private key passphrase. Default is GPG_PASSPHRASE.
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ cache: maven
+ - run: mvn verify
+```
- - `mvn-toolchain-id`: Name of Maven Toolchain ID if the default name of `${distribution}_${java-version}` is not wanted.
+The primary dependency cache key is `setup-java----`, where `` is the runner's Node.js process architecture. The primary cache stores dependency directories such as `~/.m2/repository`, `~/.gradle/caches`, or the sbt cache paths. Its file hash is based on these files by default:
- - `mvn-toolchain-vendor`: Name of Maven Toolchain Vendor if the default name of `${distribution}` is not wanted.
+| Package manager | Files used for the primary dependency-cache key |
+| --- | --- |
+| Gradle | `**/*.gradle*`, `**/gradle.properties`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, `**/versions.properties` |
+| Maven | `**/pom.xml`, `**/.mvn/wrapper/maven-wrapper.properties`, `**/.mvn/extensions.xml` |
+| sbt | `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt` |
-### Basic Configuration
+Use `cache-dependency-path` to override the files used for key hashing, especially in monorepos:
-#### Eclipse Temurin
```yaml
-steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
+- uses: actions/setup-java@v6
with:
- distribution: 'temurin' # See 'Supported distributions' for available options
+ distribution: temurin
java-version: '25'
-- run: java HelloWorldApp.java
+ cache: gradle
+ cache-dependency-path: |
+ sub-project/*.gradle*
+ sub-project/**/gradle-wrapper.properties
```
-#### Azul Zulu OpenJDK
+Use `cache-path` when the build tool stores dependencies outside the default location:
+
```yaml
-steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
+- uses: actions/setup-java@v6
with:
- distribution: 'zulu' # See 'Supported distributions' for available options
+ distribution: temurin
java-version: '25'
-- run: java HelloWorldApp.java
+ cache: maven
+ cache-path: |
+ /custom/maven/repository
+ !/custom/maven/repository/**/*.lastUpdated
+- run: mvn -Dmaven.repo.local=/custom/maven/repository verify
```
-#### Supported version syntax
-The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
-- major versions: `8`, `11`, `16`, `17`, `21`, `25`
-- more specific versions: `8.0.282+8`, `8.0.232`, `11.0`, `11.0.4`, `17.0`
-- early access (EA) versions: `15-ea`, `15.0.0-ea`
+`cache-path` changes what is restored and saved, but not the cache key. Jobs that should share a cache key must use the same OS, architecture, package manager, dependency files, and cache paths.
-#### Supported distributions
-Currently, the following distributions are supported:
-| Keyword | Distribution | Official site | License
-|-|-|-|-|
-| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
-| `zulu` | Azul Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
-| `adopt` or `adopt-hotspot` | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
-| `adopt-openj9` | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
-| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
-| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
-| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
-| `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) |
-| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
-| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/)
-| `sapmachine` | SAP SapMachine JDK/JRE | [Link](https://sapmachine.io/) | [Link](https://github.com/SAP/SapMachine/blob/sapmachine/LICENSE)
-| `graalvm` | Oracle GraalVM | [Link](https://www.graalvm.org/) | [Link](https://www.oracle.com/downloads/licenses/graal-free-license.html)
-| `jetbrains` | JetBrains Runtime | [Link](https://github.com/JetBrains/JetBrainsRuntime/) | [Link](https://github.com/JetBrains/JetBrainsRuntime/blob/main/LICENSE)
+### Wrapper caches
-**NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.
+Maven and Gradle wrapper distributions are restored and saved as additional cache entries, separate from the primary dependency cache. These entries have their own keys in the form `setup-java----`.
-**NOTE:** AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` and `adopt-openj9`, to `temurin` and `semeru` respectively, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
+| Package manager | Wrapper cache name | Cached path | Files used for wrapper-cache key |
+| --- | --- | --- | --- |
+| Maven | `maven-wrapper` | `~/.m2/wrapper/dists` | `**/.mvn/wrapper/maven-wrapper.properties` |
+| Gradle | `gradle-wrapper` | `~/.gradle/wrapper` | `**/gradle-wrapper.properties` |
-**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
+These wrapper caches are independent from dependency caches, so they remain useful even when dependency files change frequently. The wrapper properties are also part of the Maven and Gradle primary dependency-cache key because wrapper changes can affect how dependencies are resolved, but the wrapper distribution files themselves are stored in the separate wrapper cache entries above.
-**NOTE:** To comply with the GraalVM Free Terms and Conditions (GFTC) license, it is recommended to use GraalVM JDK 17 version 17.0.12, as this is the only version of GraalVM JDK 17 available under the GFTC license. Additionally, it is encouraged to consider upgrading to GraalVM JDK 21, which offers the latest features and improvements.
+For advanced Gradle caching features such as build output caching, configuration cache support, encrypted cache storage, cleanup, and fine-grained cache control, consider [`gradle/actions/setup-gradle`](https://github.com/gradle/actions/tree/main/setup-gradle).
-### Caching packages dependencies
-The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
+### Caching JDK installations
-- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties`
-- maven: `**/pom.xml`
-- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`
+The JDK cache stores the downloaded JDK installation so later runs skip the download. It is enabled implicitly whenever dependency `cache` is set, so most workflows that cache dependencies are already caching the JDK. Set `cache-jdk: true` to enable it without dependency caching, or `cache-jdk: false` to opt out while keeping dependency caching. With neither `cache` nor `cache-jdk` set, nothing is cached.
-When the option `cache-dependency-path` is specified, the hash is based on the matching file. This option supports wildcards and a list of file names, and is especially useful for monorepos.
+> [!IMPORTANT]
+> Because JDK caching is on by default whenever `cache` is set, review [Caching JDK installations](docs/advanced-usage.md#caching-jdk-installations)
+> for the full `cache`/`cache-jdk` matrix, cache identity and storage impact.
-The workflow output `cache-hit` is set to indicate if an exact match was found for the key [as actions/cache does](https://github.com/actions/cache/tree/main#outputs).
+### Read-only caches
-The cache input is optional, and caching is turned off by default.
+Set `cache-read-only: true` to restore dependency, wrapper, and JDK caches without saving changes in the post action. This is useful for pull requests, merge queues, short-lived branches, and matrix fan-out jobs that should only consume caches produced elsewhere.
-#### Caching gradle dependencies
```yaml
-steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
+- uses: actions/setup-java@v6
with:
- distribution: 'temurin'
+ distribution: temurin
java-version: '25'
- cache: 'gradle'
- cache-dependency-path: | # optional
- sub-project/*.gradle*
- sub-project/**/gradle-wrapper.properties
-- run: ./gradlew build --no-daemon
+ cache: maven
+ cache-read-only: ${{ github.ref != 'refs/heads/main' }}
```
-Using the `cache: gradle` provides a simple and effective way to cache Gradle dependencies with minimal configuration.
-For projects that require more advanced `Gradle` caching features, such as caching build outputs, support for Gradle configuration cache, encrypted cache storage, fine-grained cache control (including options to enable or disable the cache, set it to read-only or write-only, perform automated cleanup, and define custom cache rules), or optimized performance for complex CI workflows, consider using [`gradle/actions/setup-gradle`](https://github.com/gradle/actions/tree/main/setup-gradle).
+For matrix fan-out, seed the cache once and make matrix jobs read-only consumers:
-For setup details and a comprehensive overview of all available features, visit the [setup-gradle documentation](https://github.com/gradle/actions/blob/main/docs/setup-gradle.md).
-
-#### Caching maven dependencies
```yaml
-steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
- with:
- distribution: 'temurin'
- java-version: '25'
- cache: 'maven'
- cache-dependency-path: 'sub-project/pom.xml' # optional
-- name: Build with Maven
- run: mvn -B package --file pom.xml
-```
+jobs:
+ seed-cache:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ cache: maven
+ - run: mvn dependency:go-offline dependency:resolve-plugins
-#### Caching sbt dependencies
-```yaml
-steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
- with:
- distribution: 'temurin'
- java-version: '25'
- cache: 'sbt'
- cache-dependency-path: | # optional
- sub-project/build.sbt
- sub-project/project/build.properties
-- name: Build with SBT
- run: sbt package
+ build:
+ needs: seed-cache
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ goal: [test, verify, package]
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ cache: maven
+ cache-read-only: true
+ - run: mvn ${{ matrix.goal }}
```
-#### Cache segment restore timeout
-Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a segment download gets stuck, which causes the workflow job to be stuck. The cache segment download timeout [was introduced](https://github.com/actions/toolkit/tree/main/packages/cache#cache-segment-restore-timeout) to solve this issue as it allows the segment download to get aborted and hence allows the job to proceed with a cache miss. The default value of the cache segment download timeout is set to 10 minutes and can be customized by specifying an environment variable named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with a timeout value in minutes.
+### Cache segment restore timeout
+
+Cache downloads are split into segments. To reduce the chance of a stuck segment blocking a workflow, set `SEGMENT_DOWNLOAD_TIMEOUT_MINS`:
```yaml
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
- with:
- distribution: 'temurin'
- java-version: '25'
- cache: 'gradle'
-- run: ./gradlew build --no-daemon
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ cache: gradle
+ - run: ./gradlew build --no-daemon
```
-### Check latest
-
-In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download.
-
-If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
-
-For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on-flight. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
+## Multiple JDKs and Maven toolchains
+Install multiple Java versions by providing a multiline `java-version` value. All configured JDKs are installed. The last one added to `PATH` becomes the default.
```yaml
steps:
-- uses: actions/checkout@v6
-- uses: actions/setup-java@v5
- with:
- distribution: 'temurin'
- java-version: '25'
- check-latest: true
-- run: java HelloWorldApp.java
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+ 25
```
-### Testing against different Java versions
+Other installed JDKs are available through version-specific variables such as `JAVA_HOME_17_X64`. To use a specific version later in the job, set `JAVA_HOME` and prepend its `bin` directory to `PATH`.
+
+`setup-java` writes a Maven Toolchains declaration for each installed JDK. When multiple JDKs are installed, the declaration contains all of them. Customize the generated toolchain values with `mvn-toolchain-id` and `mvn-toolchain-vendor`.
+
+## Testing with a Java matrix
+
```yaml
jobs:
build:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-latest
strategy:
matrix:
- java: [ '8', '11', '17', '21', '25' ]
- name: Java ${{ matrix.Java }} sample
+ java: ['8', '11', '17', '21', '25']
+ name: Java ${{ matrix.java }}
steps:
- - uses: actions/checkout@v6
- - name: Setup java
- uses: actions/setup-java@v5
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
with:
- distribution: ''
+ distribution: temurin
java-version: ${{ matrix.java }}
- - run: java HelloWorldApp.java
+ - run: java --version
+ - run: mvn verify
```
-### Install multiple JDKs
+## Publishing packages
-All configured Java versions are added to the PATH. The last one added to the PATH (i.e., the last JDK set up by this action) will be used as the default and available globally. Other Java versions can be accessed through environment variables such as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. To use a specific Java version, set the JAVA_HOME environment variable accordingly and prepend its bin directory to the PATH to ensure it takes priority during execution.
+`setup-java` generates Maven `settings.xml` and Maven Toolchains configuration. For Gradle publishing, it installs Java for the workflow; the Gradle build file remains responsible for reading credentials from environment variables.
+
+### Maven
```yaml
- steps:
- - uses: actions/setup-java@v5
- with:
- distribution: ''
- java-version: |
- 8
- 11
- 15
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ server-id: github
+ server-username-env-var: GITHUB_ACTOR
+ server-password-env-var: GITHUB_TOKEN
+ - run: mvn --batch-mode deploy
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+```
+
+For dependencies hosted outside Maven Central, use `mvn-repositories`; for build
+plugins, use `mvn-plugin-repositories`. Either input adds its own repository type
+to the same active profile in the generated `settings.xml`. Repository IDs can
+match `mvn-server-credentials` IDs when authentication is required.
+See [Resolving Maven dependencies from custom repositories](docs/advanced-usage.md#resolving-maven-dependencies-from-custom-repositories)
+and [Resolving Maven plugins from custom repositories](docs/advanced-usage.md#resolving-maven-plugins-from-custom-repositories).
+
+To redirect repositories, including Central and repositories declared in project
+or parent POMs, use [`mvn-mirrors`](docs/advanced-usage.md#redirecting-maven-repositories-with-mirrors).
+It works independently of the repository inputs; a `mirrorOf` pattern of `*`
+routes all dependency and plugin repositories through the configured mirror.
+
+> [!WARNING]
+> `mvn-repositories-include-central: false` now disables inherited Maven Central
+> for **both dependencies and plugins**, even in existing workflows that only
+> configure `mvn-repositories`. Builds relying on uncached plugins from Central
+> must configure `mvn-plugin-repositories` with an accessible plugin repository
+> or explicitly declare `central` there. Neither repository list configured
+> means the Central controls remain inactive.
+
+### GPG signing
+
+```yaml
+steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-java@v6
+ with:
+ distribution: temurin
+ java-version: '25'
+ gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
+ gpg-passphrase-env-var: GPG_PASSPHRASE
+ - run: mvn --batch-mode deploy
+ env:
+ GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
```
-### Using Maven Toolchains
-In the example above multiple JDKs are installed for the same job. The result after the last JDK is installed is a Maven Toolchains declaration containing references to all three JDKs. The values for `id`, `version`, and `vendor` of the individual Toolchain entries are the given input values for `distribution` and `java-version` (`vendor` being the combination of `${distribution}_${java-version}`) by default.
-
-### Advanced Configuration
-
-- [Selecting a Java distribution](docs/advanced-usage.md#Selecting-a-Java-distribution)
- - [Eclipse Temurin](docs/advanced-usage.md#Eclipse-Temurin)
- - [Adopt](docs/advanced-usage.md#Adopt)
- - [Zulu](docs/advanced-usage.md#Zulu)
- - [Liberica](docs/advanced-usage.md#Liberica)
- - [Microsoft](docs/advanced-usage.md#Microsoft)
- - [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto)
- - [Oracle](docs/advanced-usage.md#Oracle)
- - [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
- - [SapMachine](docs/advanced-usage.md#SapMachine)
- - [GraalVM](docs/advanced-usage.md#GraalVM)
-- [Installing custom Java package type](docs/advanced-usage.md#Installing-custom-Java-package-type)
-- [Installing custom Java architecture](docs/advanced-usage.md#Installing-custom-Java-architecture)
-- [Installing custom Java distribution from local file](docs/advanced-usage.md#Installing-Java-from-local-file)
-- [Testing against different Java distributions](docs/advanced-usage.md#Testing-against-different-Java-distributions)
-- [Testing against different platforms](docs/advanced-usage.md#Testing-against-different-platforms)
-- [Publishing using Apache Maven](docs/advanced-usage.md#Publishing-using-Apache-Maven)
-- [Publishing using Gradle](docs/advanced-usage.md#Publishing-using-Gradle)
-- [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache)
-- [Modifying Maven Toolchains](docs/advanced-usage.md#Modifying-Maven-Toolchains)
-- [Java Version File](docs/advanced-usage.md#Java-version-file)
+Maven GPG signing requires `maven-gpg-plugin` 3.2.0 or newer because `setup-java` passes the passphrase through `gpg.passphraseEnvName`.
## Recommended permissions
@@ -298,10 +535,41 @@ permissions:
contents: read # access to check out code and install dependencies
```
+Publishing workflows may require additional permissions depending on the target registry.
+
+## Advanced usage
+
+See [advanced usage](docs/advanced-usage.md) for detailed examples:
+
+- [Selecting a Java distribution](docs/advanced-usage.md#selecting-a-java-distribution)
+- [Installing custom Java package types](docs/advanced-usage.md#installing-custom-java-package-type)
+- [Package compatibility](docs/advanced-usage.md#package-compatibility)
+- [Ensuring the Maven cache is complete](docs/advanced-usage.md#ensuring-the-maven-cache-is-complete-plugin-dependencies)
+- [Caching JDK installations](docs/advanced-usage.md#caching-jdk-installations)
+- [Platform and architecture compatibility](docs/advanced-usage.md#platform-and-architecture-compatibility)
+- [Installing custom Java architecture](docs/advanced-usage.md#installing-custom-java-architecture)
+- [Installing a JDK without setting it as default](docs/advanced-usage.md#installing-jdk-without-setting-as-default)
+- [Installing Java from a local file](docs/advanced-usage.md#installing-java-from-local-file)
+- [Testing against different Java distributions](docs/advanced-usage.md#testing-against-different-java-distributions)
+- [Testing against different platforms](docs/advanced-usage.md#testing-against-different-platforms)
+- [Publishing using Apache Maven](docs/advanced-usage.md#publishing-using-apache-maven)
+- [Apache Maven with a settings path](docs/advanced-usage.md#apache-maven-with-a-settings-path)
+- [Maven transfer progress](docs/advanced-usage.md#maven-transfer-progress-download-logs)
+- [Java problem matcher](docs/advanced-usage.md#java-problem-matcher-compiler-annotations)
+- [Publishing using Gradle](docs/advanced-usage.md#publishing-using-gradle)
+- [Hosted tool cache](docs/advanced-usage.md#hosted-tool-cache)
+- [Modifying Maven Toolchains](docs/advanced-usage.md#modifying-maven-toolchains)
+- [Java version files](docs/advanced-usage.md#java-version-file)
+- [Self-signed certificates and internal CAs on GitHub Enterprise](docs/advanced-usage.md#self-signed-certificates-and-internal-cas-github-enterprise)
+
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE).
## Contributions
-Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
+Contributions are welcome. See our [Contributor's Guide](docs/CONTRIBUTING.md).
+
+## Code of Conduct
+
+:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
diff --git a/__tests__/auth.test.ts b/__tests__/auth.test.ts
index 06591da7a..5fa5e9b85 100644
--- a/__tests__/auth.test.ts
+++ b/__tests__/auth.test.ts
@@ -1,27 +1,138 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import {fileURLToPath} from 'url';
import * as io from '@actions/io';
-import * as core from '@actions/core';
import * as fs from 'fs';
import * as path from 'path';
import os from 'os';
+import {XMLParser} from 'fast-xml-parser';
-import * as auth from '../src/auth';
-import {M2_DIR, MVN_SETTINGS_FILE} from '../src/constants';
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(() => []),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+jest.unstable_mockModule('../src/gpg.js', () => ({
+ importKey: jest.fn(),
+ removeGpgHome: jest.fn(),
+ toGpgPath: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const gpg = await import('../src/gpg.js');
+const auth = await import('../src/auth.js');
+const {M2_DIR, MVN_SETTINGS_FILE, STATE_GPG_HOME} =
+ await import('../src/constants.js');
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
const m2Dir = path.join(__dirname, M2_DIR);
const settingsFile = path.join(m2Dir, MVN_SETTINGS_FILE);
+const credentials = (id: string, username: string, password: string) => [
+ {id, usernameEnvVar: username, passwordEnvVar: password}
+];
+const repositorySettings = (
+ repositories: auth.MavenRepository[],
+ includeCentral = true,
+ prioritizeCentral = true,
+ pluginRepositories: auth.MavenRepository[] = []
+): auth.MavenRepositorySettings => ({
+ repositories,
+ pluginRepositories,
+ includeCentral,
+ prioritizeCentral
+});
+const repositoryInputs = ['mvn-repositories', 'mvn-plugin-repositories'];
+const privateRepository = {
+ id: 'private',
+ url: 'https://repo.example.com/maven',
+ snapshotsEnabled: true
+};
+const privateRepositoryXml = {
+ id: privateRepository.id,
+ url: privateRepository.url,
+ snapshots: {enabled: 'true'}
+};
+const centralRepositoryXml = {
+ id: 'central',
+ url: 'https://repo.maven.apache.org/maven2',
+ snapshots: {enabled: 'false'}
+};
+const disabledCentralRepositoryXml = {
+ ...centralRepositoryXml,
+ releases: {enabled: 'false'}
+};
+const repositoryConfigurations = [
+ {
+ name: 'dependency-only',
+ repositories: [privateRepository],
+ pluginRepositories: []
+ },
+ {
+ name: 'plugin-only',
+ repositories: [],
+ pluginRepositories: [privateRepository]
+ },
+ {
+ name: 'combined',
+ repositories: [privateRepository],
+ pluginRepositories: [privateRepository]
+ }
+];
describe('auth tests', () => {
- let spyOSHomedir: jest.SpyInstance;
- let spyInfo: jest.SpyInstance;
+ let spyOSHomedir: any;
+ let spyInfo: any;
beforeEach(async () => {
await io.rmRF(m2Dir);
spyOSHomedir = jest.spyOn(os, 'homedir');
spyOSHomedir.mockReturnValue(__dirname);
- spyInfo = jest.spyOn(core, 'info');
+ spyInfo = core.info as jest.Mock;
spyInfo.mockImplementation(() => null);
+ (gpg.toGpgPath as jest.Mock).mockImplementation((p: string) => p);
}, 300000);
+ afterEach(() => {
+ (core.getInput as jest.Mock).mockReset();
+ (core.getMultilineInput as jest.Mock).mockReset();
+ (core.getMultilineInput as jest.Mock).mockReturnValue([]);
+ (core.warning as jest.Mock).mockReset();
+ (core.exportVariable as jest.Mock).mockReset();
+ (gpg.importKey as jest.Mock).mockReset();
+ (gpg.removeGpgHome as jest.Mock).mockReset();
+ (gpg.toGpgPath as jest.Mock).mockReset();
+ });
+
afterAll(async () => {
try {
await io.rmRF(m2Dir);
@@ -43,9 +154,7 @@ describe('auth tests', () => {
await io.rmRF(altHome); // ensure it doesn't already exist
await auth.createAuthenticationSettings(
- id,
- username,
- password,
+ credentials(id, username, password),
altHome,
true
);
@@ -56,7 +165,7 @@ describe('auth tests', () => {
expect(fs.existsSync(altHome)).toBe(true);
expect(fs.existsSync(altSettingsFile)).toBe(true);
expect(fs.readFileSync(altSettingsFile, 'utf-8')).toEqual(
- auth.generate(id, username, password)
+ auth.generate(credentials(id, username, password))
);
await io.rmRF(altHome);
@@ -68,9 +177,7 @@ describe('auth tests', () => {
const password = 'TOKEN';
await auth.createAuthenticationSettings(
- id,
- username,
- password,
+ credentials(id, username, password),
m2Dir,
true
);
@@ -78,7 +185,7 @@ describe('auth tests', () => {
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true);
expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual(
- auth.generate(id, username, password)
+ auth.generate(credentials(id, username, password))
);
}, 100000);
@@ -89,9 +196,7 @@ describe('auth tests', () => {
const gpgPassphrase = 'GPG';
await auth.createAuthenticationSettings(
- id,
- username,
- password,
+ credentials(id, username, password),
m2Dir,
true,
gpgPassphrase
@@ -100,10 +205,56 @@ describe('auth tests', () => {
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true);
expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual(
- auth.generate(id, username, password, gpgPassphrase)
+ auth.generate(credentials(id, username, password), gpgPassphrase)
);
}, 100000);
+ it('exports a GPG-compatible path and persists the native GPG home', async () => {
+ const gpgHome = 'D:\\a\\_temp\\setup-java-gpg-1';
+ const exportedGpgHome = '/d/a/_temp/setup-java-gpg-1';
+ (gpg.importKey as jest.Mock).mockResolvedValue(gpgHome);
+ (gpg.toGpgPath as jest.Mock).mockReturnValue(exportedGpgHome);
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ const inputs: Record = {
+ 'server-id': 'packages',
+ 'server-username-env-var': 'USERNAME',
+ 'server-password-env-var': 'PASSWORD',
+ 'settings-path': m2Dir,
+ 'gpg-private-key': 'KEY ONE\nKEY TWO'
+ };
+ return inputs[name] ?? '';
+ });
+
+ await auth.configureAuthentication();
+
+ expect(gpg.importKey).toHaveBeenCalledWith('KEY ONE\nKEY TWO');
+ expect(core.saveState).toHaveBeenCalledWith(STATE_GPG_HOME, gpgHome);
+ expect(gpg.toGpgPath).toHaveBeenCalledWith(gpgHome);
+ expect(core.exportVariable).toHaveBeenCalledWith(
+ 'GNUPGHOME',
+ exportedGpgHome
+ );
+ });
+
+ it('removes the isolated GPG home when environment export fails', async () => {
+ const gpgHome = path.join(__dirname, 'runner', 'temp', 'setup-java-gpg-2');
+ (gpg.importKey as jest.Mock).mockResolvedValue(gpgHome);
+ (core.exportVariable as jest.Mock).mockImplementation(() => {
+ throw new Error('environment file unavailable');
+ });
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ if (name === 'gpg-private-key') return 'KEY CONTENTS';
+ if (name === 'settings-path') return m2Dir;
+ return '';
+ });
+
+ await expect(auth.configureAuthentication()).rejects.toThrow(
+ 'environment file unavailable'
+ );
+
+ expect(gpg.removeGpgHome).toHaveBeenCalledWith(gpgHome);
+ });
+
it('overwrites existing settings.xml files', async () => {
const id = 'packages';
const username = 'USERNAME';
@@ -115,9 +266,7 @@ describe('auth tests', () => {
expect(fs.existsSync(settingsFile)).toBe(true);
await auth.createAuthenticationSettings(
- id,
- username,
- password,
+ credentials(id, username, password),
m2Dir,
true
);
@@ -125,7 +274,7 @@ describe('auth tests', () => {
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true);
expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual(
- auth.generate(id, username, password)
+ auth.generate(credentials(id, username, password))
);
}, 100000);
@@ -140,9 +289,7 @@ describe('auth tests', () => {
expect(fs.existsSync(settingsFile)).toBe(true);
await auth.createAuthenticationSettings(
- id,
- username,
- password,
+ credentials(id, username, password),
m2Dir,
false
);
@@ -160,6 +307,7 @@ describe('auth tests', () => {
const expectedSettings = `
+ false
${id}
@@ -169,7 +317,9 @@ describe('auth tests', () => {
`;
- expect(auth.generate(id, username, password)).toEqual(expectedSettings);
+ expect(auth.generate(credentials(id, username, password))).toEqual(
+ expectedSettings
+ );
});
it('generates valid settings.xml with additional configuration', () => {
@@ -181,21 +331,1279 @@ describe('auth tests', () => {
const expectedSettings = `
+ false
${id}
\${env.${username}}
\${env.&<>"''"><&}
+
+
+
+ setup-java-gpg
+
+ ${gpgPassphrase}
+
+
+
+
+ setup-java-gpg
+
+`;
+
+ expect(
+ auth.generate(credentials(id, username, password), gpgPassphrase)
+ ).toEqual(expectedSettings);
+ });
+
+ it('generates repository origins for a Maven server', () => {
+ const settings = auth.generate([
+ {
+ id: 'central',
+ usernameEnvVar: 'CENTRAL_USER',
+ passwordEnvVar: 'CENTRAL_PASS',
+ repositoryOrigins: ['https://central.sonatype.com']
+ }
+ ]);
+
+ expect(settings).toContain(`
+ https://central.sonatype.com
+ `);
+ });
+
+ it('does not add a gpg profile when the passphrase env var is the maven-gpg-plugin default', () => {
+ const id = 'packages';
+ const username = 'USER';
+ const password = '&<>"\'\'"><&';
+ const gpgPassphrase = 'MAVEN_GPG_PASSPHRASE';
+
+ const expectedSettings = `
+ false
+
- gpg.passphrase
- \${env.${gpgPassphrase}}
+ ${id}
+ \${env.${username}}
+ \${env.&<>"''"><&}
`;
- expect(auth.generate(id, username, password, gpgPassphrase)).toEqual(
- expectedSettings
+ expect(
+ auth.generate(credentials(id, username, password), gpgPassphrase)
+ ).toEqual(expectedSettings);
+ });
+
+ it('escapes settings.xml values while preserving parsed semantics', () => {
+ const id = `packages&<>"'é`;
+ const username = `USER&<>"'é`;
+ const password = `TOKEN&<>"'é`;
+ const gpgPassphrase = `GPG&<>"'é`;
+
+ const xml = auth.generate(
+ credentials(id, username, password),
+ gpgPassphrase
);
+ const parsed = parseXmlObject(xml) as any;
+
+ expect(parsed.settings.interactiveMode).toBe('false');
+ expect(xmlElementText(xml, 'id')).toBe(id);
+ expect(xmlElementText(xml, 'username')).toBe(`\${env.${username}}`);
+ expect(xmlElementText(xml, 'password')).toBe(`\${env.${password}}`);
+ expect(xmlElementText(xml, 'gpg.passphraseEnvName')).toBe(gpgPassphrase);
+ expect(parsed.settings.activeProfiles.activeProfile).toBe('setup-java-gpg');
+ });
+
+ it('generates ordered settings.xml entries for multiple servers', () => {
+ const servers = [
+ {
+ id: 'releases',
+ usernameEnvVar: 'RELEASES_USERNAME',
+ passwordEnvVar: 'RELEASES_PASSWORD'
+ },
+ {
+ id: 'snapshots',
+ usernameEnvVar: 'SNAPSHOTS_USERNAME',
+ passwordEnvVar: 'SNAPSHOTS_PASSWORD'
+ }
+ ];
+
+ const parsed = parseXmlObject(auth.generate(servers)) as any;
+
+ expect(parsed.settings.servers.server).toEqual([
+ {
+ id: 'releases',
+ username: '${env.RELEASES_USERNAME}',
+ password: '${env.RELEASES_PASSWORD}'
+ },
+ {
+ id: 'snapshots',
+ username: '${env.SNAPSHOTS_USERNAME}',
+ password: '${env.SNAPSHOTS_PASSWORD}'
+ }
+ ]);
+ });
+
+ it('generates an active profile with Central before custom repositories by default', () => {
+ const parsed = parseXmlObject(
+ auth.generate(
+ credentials('packages', 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings([
+ {
+ id: 'private',
+ url: 'https://repo.example.com/maven',
+ snapshotsEnabled: true
+ }
+ ])
+ )
+ ) as any;
+
+ expect(parsed.settings.profiles.profile).toEqual({
+ id: 'setup-java-repositories',
+ repositories: {
+ repository: [
+ {
+ id: 'central',
+ url: 'https://repo.maven.apache.org/maven2',
+ snapshots: {enabled: 'false'}
+ },
+ {
+ id: 'private',
+ url: 'https://repo.example.com/maven',
+ snapshots: {enabled: 'true'}
+ }
+ ]
+ }
+ });
+ expect(parsed.settings.activeProfiles.activeProfile).toBe(
+ 'setup-java-repositories'
+ );
+ });
+
+ it('places custom repositories before Central when configured', () => {
+ const parsed = parseXmlObject(
+ auth.generate(
+ credentials('packages', 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings(
+ [
+ {
+ id: 'first',
+ url: 'https://first.example.com',
+ snapshotsEnabled: false
+ },
+ {
+ id: 'second',
+ url: 'https://second.example.com',
+ snapshotsEnabled: true
+ }
+ ],
+ true,
+ false
+ )
+ )
+ ) as any;
+
+ expect(
+ parsed.settings.profiles.profile.repositories.repository.map(
+ (repository: {id: string}) => repository.id
+ )
+ ).toEqual(['first', 'second', 'central']);
+ });
+
+ it.each([
+ {
+ name: 'Central first by default',
+ prioritizeCentral: undefined,
+ expectedRepositories: [
+ {
+ id: 'central',
+ url: 'https://repo.maven.apache.org/maven2',
+ snapshots: {enabled: 'false'}
+ },
+ {
+ id: 'first',
+ url: 'https://first.example.com/plugins',
+ snapshots: {enabled: 'false'}
+ },
+ {
+ id: 'second',
+ url: 'https://second.example.com/plugins',
+ snapshots: {enabled: 'true'}
+ }
+ ]
+ },
+ {
+ name: 'custom plugins before Central',
+ prioritizeCentral: false,
+ expectedRepositories: [
+ {
+ id: 'first',
+ url: 'https://first.example.com/plugins',
+ snapshots: {enabled: 'false'}
+ },
+ {
+ id: 'second',
+ url: 'https://second.example.com/plugins',
+ snapshots: {enabled: 'true'}
+ },
+ {
+ id: 'central',
+ url: 'https://repo.maven.apache.org/maven2',
+ snapshots: {enabled: 'false'}
+ }
+ ]
+ }
+ ])(
+ 'generates plugin-only settings with $name',
+ ({prioritizeCentral, expectedRepositories}) => {
+ const xml = auth.generate(
+ [],
+ undefined,
+ repositorySettings([], true, prioritizeCentral, [
+ {
+ id: 'first',
+ url: 'https://first.example.com/plugins',
+ snapshotsEnabled: false
+ },
+ {
+ id: 'second',
+ url: 'https://second.example.com/plugins',
+ snapshotsEnabled: true
+ }
+ ])
+ );
+
+ expect(parseXmlObject(xml)).toEqual(
+ expect.objectContaining({
+ settings: expect.objectContaining({
+ profiles: {
+ profile: {
+ id: 'setup-java-repositories',
+ pluginRepositories: {
+ pluginRepository: expectedRepositories
+ }
+ }
+ },
+ activeProfiles: {activeProfile: 'setup-java-repositories'}
+ })
+ })
+ );
+ }
+ );
+
+ it('excludes Central from the generated repository profile when configured', () => {
+ const parsed = parseXmlObject(
+ auth.generate(
+ credentials('packages', 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings(
+ [
+ {
+ id: 'private',
+ url: 'https://repo.example.com',
+ snapshotsEnabled: false
+ }
+ ],
+ false
+ )
+ )
+ ) as any;
+
+ expect(parsed.settings.profiles.profile.repositories.repository).toEqual([
+ {
+ id: 'private',
+ url: 'https://repo.example.com',
+ snapshots: {enabled: 'false'}
+ },
+ {
+ id: 'central',
+ url: 'https://repo.maven.apache.org/maven2',
+ releases: {enabled: 'false'},
+ snapshots: {enabled: 'false'}
+ }
+ ]);
+ expect(
+ parsed.settings.profiles.profile.pluginRepositories.pluginRepository
+ ).toEqual(disabledCentralRepositoryXml);
+ });
+
+ it('combines repository and GPG configuration in shared profile blocks', () => {
+ const parsed = parseXmlObject(
+ auth.generate(
+ credentials('packages', 'USERNAME', 'PASSWORD'),
+ 'GPG_PASSPHRASE',
+ repositorySettings(
+ [
+ {
+ id: 'private',
+ url: 'https://repo.example.com',
+ snapshotsEnabled: false
+ }
+ ],
+ false
+ )
+ )
+ ) as any;
+
+ expect(parsed.settings.profiles.profile).toEqual([
+ {
+ id: 'setup-java-repositories',
+ repositories: {
+ repository: [
+ {
+ id: 'private',
+ url: 'https://repo.example.com',
+ snapshots: {enabled: 'false'}
+ },
+ {
+ id: 'central',
+ url: 'https://repo.maven.apache.org/maven2',
+ releases: {enabled: 'false'},
+ snapshots: {enabled: 'false'}
+ }
+ ]
+ },
+ pluginRepositories: {
+ pluginRepository: disabledCentralRepositoryXml
+ }
+ },
+ {
+ id: 'setup-java-gpg',
+ properties: {['gpg.passphraseEnvName']: 'GPG_PASSPHRASE'}
+ }
+ ]);
+ expect(parsed.settings.activeProfiles.activeProfile).toEqual([
+ 'setup-java-repositories',
+ 'setup-java-gpg'
+ ]);
+ });
+
+ it.each(
+ repositoryConfigurations.flatMap(configuration =>
+ [
+ {includeCentral: true, prioritizeCentral: true},
+ {includeCentral: true, prioritizeCentral: false},
+ {includeCentral: false, prioritizeCentral: true},
+ {includeCentral: false, prioritizeCentral: false}
+ ].map(controls => ({...configuration, ...controls}))
+ )
+ )(
+ 'generates $name repositories with includeCentral=$includeCentral and prioritizeCentral=$prioritizeCentral',
+ ({repositories, pluginRepositories, includeCentral, prioritizeCentral}) => {
+ const xml = auth.generate(
+ credentials('private', 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings(
+ repositories,
+ includeCentral,
+ prioritizeCentral,
+ pluginRepositories
+ )
+ );
+ const expectedEntries = (configured: boolean) => {
+ const entries = includeCentral
+ ? configured
+ ? prioritizeCentral
+ ? [centralRepositoryXml, privateRepositoryXml]
+ : [privateRepositoryXml, centralRepositoryXml]
+ : []
+ : configured
+ ? [privateRepositoryXml, disabledCentralRepositoryXml]
+ : [disabledCentralRepositoryXml];
+ return entries.length === 1 ? entries[0] : entries;
+ };
+ const includeRepositories = repositories.length > 0 || !includeCentral;
+ const includePluginRepositories =
+ pluginRepositories.length > 0 || !includeCentral;
+
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {
+ profiles: {
+ profile: {
+ id: 'setup-java-repositories',
+ ...(includeRepositories
+ ? {
+ repositories: {
+ repository: expectedEntries(repositories.length > 0)
+ }
+ }
+ : {}),
+ ...(includePluginRepositories
+ ? {
+ pluginRepositories: {
+ pluginRepository: expectedEntries(
+ pluginRepositories.length > 0
+ )
+ }
+ }
+ : {})
+ }
+ },
+ activeProfiles: {activeProfile: 'setup-java-repositories'}
+ }
+ });
+ if (!includeRepositories) {
+ expect(xml).not.toContain('');
+ }
+ if (!includePluginRepositories) {
+ expect(xml).not.toContain('');
+ }
+ }
+ );
+
+ it.each(repositoryConfigurations)(
+ 'handles explicit Central independently for $name repositories',
+ ({repositories, pluginRepositories}) => {
+ const central = {
+ id: 'central',
+ url: 'https://mirror.example.com/maven',
+ snapshotsEnabled: true
+ };
+ const explicitCentralXml = {
+ id: central.id,
+ url: central.url,
+ snapshots: {enabled: 'true'}
+ };
+ const xml = auth.generate(
+ [],
+ undefined,
+ repositorySettings(
+ repositories.length ? [central] : [],
+ false,
+ true,
+ pluginRepositories.length ? [central] : []
+ )
+ );
+
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {
+ profiles: {
+ profile: {
+ repositories: {
+ repository: repositories.length
+ ? explicitCentralXml
+ : disabledCentralRepositoryXml
+ },
+ pluginRepositories: {
+ pluginRepository: pluginRepositories.length
+ ? explicitCentralXml
+ : disabledCentralRepositoryXml
+ }
+ }
+ }
+ }
+ });
+ expect(xml.match(/central<\/id>/g)).toHaveLength(2);
+ }
+ );
+
+ it('escapes plugin repository values while preserving parsed semantics', () => {
+ const repository = {
+ id: `private&<>"'é`,
+ url: `https://repo.example.com:8443/a?x=1&y="'é`,
+ snapshotsEnabled: false
+ };
+ const xml = auth.generate(
+ credentials(repository.id, 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings([], true, true, [repository])
+ );
+
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {
+ servers: {server: {id: repository.id}},
+ profiles: {
+ profile: {
+ pluginRepositories: {
+ pluginRepository: [
+ centralRepositoryXml,
+ {
+ id: repository.id,
+ url: repository.url,
+ snapshots: {enabled: 'false'}
+ }
+ ]
+ }
+ }
+ }
+ }
+ });
+ expect(xml).toContain('private&<>');
+ expect(xml).toContain('x=1&y=<value>');
+ expect(xml).not.toContain('');
+ });
+
+ it('escapes repository values while preserving parsed semantics', () => {
+ const repository = {
+ id: `private&<>"'é`,
+ url: `https://repo.example.com/a?x=1&y="'é`,
+ snapshotsEnabled: true
+ };
+ const xml = auth.generate(
+ credentials('packages', 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings([repository], false)
+ );
+ const parsed = parseXmlObject(xml) as any;
+
+ expect(
+ parsed.settings.profiles.profile.repositories.repository.find(
+ (entry: {id: string}) => entry.id === repository.id
+ )
+ ).toEqual({
+ id: repository.id,
+ url: repository.url,
+ snapshots: {enabled: 'true'}
+ });
+ });
+
+ it('parses and trims multiline Maven server credentials', () => {
+ expect(
+ auth.parseMavenServerCredentials([
+ '',
+ ' releases : RELEASES_USERNAME : RELEASES_PASSWORD ',
+ 'snapshots:SNAPSHOTS_USERNAME:SNAPSHOTS_PASSWORD'
+ ])
+ ).toEqual([
+ {
+ id: 'releases',
+ usernameEnvVar: 'RELEASES_USERNAME',
+ passwordEnvVar: 'RELEASES_PASSWORD'
+ },
+ {
+ id: 'snapshots',
+ usernameEnvVar: 'SNAPSHOTS_USERNAME',
+ passwordEnvVar: 'SNAPSHOTS_PASSWORD'
+ }
+ ]);
+ });
+
+ it.each([
+ '*',
+ 'central',
+ 'external:*',
+ 'external:http:*',
+ '*,!internal',
+ 'external:*,!internal',
+ '!internal,external:http:*',
+ 'external:*,!external:http:*'
+ ])('preserves the mirror selector %s and URL colons', mirrorOf => {
+ expect(
+ auth.parseMavenMirrors([
+ '',
+ ' \t ',
+ ` private : https://[2001:db8::1]:8443/maven : ${mirrorOf} `,
+ 'public:https://repo.example.com:443/releases:central'
+ ])
+ ).toEqual([
+ {
+ id: 'private',
+ url: 'https://[2001:db8::1]:8443/maven',
+ mirrorOf
+ },
+ {
+ id: 'public',
+ url: 'https://repo.example.com:443/releases',
+ mirrorOf: 'central'
+ }
+ ]);
+ });
+
+ it.each([
+ 'https://repo.example.com:8443',
+ 'https://repo.example.com:8443/maven',
+ 'https://[2001:db8::1]',
+ 'https://[2001:db8::1]/maven',
+ 'https://[2001:db8::1]:8443',
+ 'https://[2001:db8::1]:8443/maven',
+ 'https://repo.example.com/maven?redirect=https%3A//upstream.example.com%3A8443',
+ 'https://repo.example.com/maven#urn%3Aartifact',
+ 'https://repo.example.com/maven?redirect=https://upstream.example.com:8443',
+ 'https://repo.example.com/maven#urn:artifact'
+ ])('preserves the complete mirror URL %s with an explicit selector', url => {
+ expect(
+ auth.parseMavenMirrors([`private:${url}:external:http:*,!internal`])
+ ).toEqual([{id: 'private', url, mirrorOf: 'external:http:*,!internal'}]);
+ });
+
+ it.each([
+ 'private',
+ 'private:https://repo.example.com',
+ 'private:https://repo.example.com:8443',
+ 'private:https://repo.example.com:8443/maven',
+ 'private:https://[2001:db8::1]',
+ 'private:https://[2001:db8::1]/maven',
+ 'private:https://[2001:db8::1]:8443',
+ 'private:https://[2001:db8::1]:8443/maven',
+ 'private:repo.example.com:central',
+ ':https://repo.example.com:*',
+ 'private::*',
+ 'private:https://repo.example.com:',
+ 'private: :*',
+ 'private:https://repo.example.com: '
+ ])('rejects malformed mirror entry %s with a line number', entry => {
+ expect(() => auth.parseMavenMirrors(['', entry])).toThrow(
+ 'Invalid mvn-mirrors entry at line 2.'
+ );
+ });
+
+ it('rejects duplicate mirror IDs after trimming', () => {
+ expect(() =>
+ auth.parseMavenMirrors([
+ 'private:https://first.example.com:*',
+ ' private :https://second.example.com:central'
+ ])
+ ).toThrow("Duplicate mirror-id 'private' in mvn-mirrors input at line 2");
+ });
+
+ it('leaves settings unchanged for absent or blank mirrors', () => {
+ const servers = credentials('github', 'USERNAME', 'PASSWORD');
+ expect(auth.parseMavenMirrors(['', ' ', '\t'])).toEqual([]);
+ expect(auth.generate(servers, undefined, undefined, [])).toBe(
+ auth.generate(servers)
+ );
+ expect(auth.generate(servers)).not.toContain('');
+ });
+
+ it('generates public mirrors without credentials or repository profiles', () => {
+ const mirrors = auth.parseMavenMirrors([
+ 'public:https://repo.example.com:external:*',
+ 'fallback:https://other.example.com:central'
+ ]);
+ const xml = auth.generate([], undefined, undefined, mirrors);
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {mirrors: {mirror: mirrors}}
+ });
+ expect(xml).not.toContain('');
+ expect(xml).not.toContain('');
+ });
+
+ it('escapes all mirror fields as XML text', () => {
+ const mirror = {
+ id: 'private<&>',
+ url: 'https://repo.example.com/maven?a=1&b=',
+ mirrorOf: '*,!internal<&>'
+ };
+ const xml = auth.generate([], undefined, undefined, [mirror]);
+ expect(xml).toContain('private<&>');
+ expect(xml).toContain('a=1&b=<value>');
+ expect(xml).toContain('*,!internal<&>');
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {mirrors: {mirror}}
+ });
+ });
+
+ it.each([
+ {combined: false, overwrite: true},
+ {combined: true, overwrite: true},
+ {combined: true, overwrite: false}
+ ])(
+ 'configures mirrors with combined=$combined and overwrite=$overwrite',
+ async ({combined, overwrite}) => {
+ const directory = path.join(m2Dir, 'mirrors');
+ const location = path.join(directory, MVN_SETTINGS_FILE);
+ fs.mkdirSync(directory, {recursive: true});
+ fs.writeFileSync(location, 'EXISTING SETTINGS');
+ const url = 'https://maven.example.com/releases';
+ const inputs: Record = {
+ 'settings-path': directory,
+ 'overwrite-settings': String(overwrite),
+ 'mvn-repositories-include-central': 'false',
+ ...(combined ? {'gpg-passphrase-env-var': 'GPG_PASSPHRASE'} : {})
+ };
+ const multilineInputs: Record = {
+ 'mvn-server-credentials': ['private:PRIVATE_USERNAME:PRIVATE_TOKEN'],
+ 'mvn-mirrors': [`private:${url}:*`],
+ ...(combined
+ ? {
+ 'mvn-repositories': [`private:${url}:false`],
+ 'mvn-plugin-repositories': [`private:${url}:false`]
+ }
+ : {})
+ };
+ jest.mocked(core.getInput).mockImplementation(name => inputs[name] ?? '');
+ jest
+ .mocked(core.getMultilineInput)
+ .mockImplementation(name => multilineInputs[name] ?? []);
+
+ await auth.configureAuthentication();
+
+ const xml = fs.readFileSync(location, 'utf8');
+ if (!overwrite) {
+ expect(xml).toBe('EXISTING SETTINGS');
+ return;
+ }
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {
+ mirrors: {mirror: {id: 'private', url, mirrorOf: '*'}},
+ servers: {
+ server: {
+ id: 'private',
+ username: '${env.PRIVATE_USERNAME}',
+ password: '${env.PRIVATE_TOKEN}'
+ }
+ }
+ }
+ });
+ if (combined) {
+ expect(xml).toContain('');
+ expect(xml).toContain('');
+ expect(xml).toContain('GPG_PASSPHRASE');
+ } else {
+ expect(xml).not.toContain('');
+ expect(core.getInput).not.toHaveBeenCalledWith(
+ 'mvn-repositories-include-central'
+ );
+ }
+ }
+ );
+
+ it.each(repositoryInputs)(
+ 'parses %s while preserving colons in URLs',
+ inputName => {
+ expect(
+ auth.parseMavenRepositories(
+ [
+ '',
+ ' private : https://repo.example.com:8443/maven : TRUE ',
+ 'releases:https://repo.example.com/releases:false'
+ ],
+ true,
+ inputName
+ )
+ ).toEqual([
+ {
+ id: 'private',
+ url: 'https://repo.example.com:8443/maven',
+ snapshotsEnabled: true
+ },
+ {
+ id: 'releases',
+ url: 'https://repo.example.com/releases',
+ snapshotsEnabled: false
+ }
+ ]);
+ }
+ );
+
+ it.each(
+ [
+ {
+ entries: ['private'],
+ error:
+ 'Invalid mvn-repositories entry at line 1. Expected format: repository-id:repository-url:snapshots-enabled'
+ },
+ {
+ entries: ['private:https://repo.example.com'],
+ error:
+ "Invalid snapshots-enabled value '//repo.example.com' in mvn-repositories entry at line 1. Expected true or false"
+ },
+ {
+ entries: ['private::true'],
+ error:
+ 'Invalid mvn-repositories entry at line 1. repository-id, repository URL, and snapshots-enabled are required'
+ },
+ {
+ entries: ['private:https://repo.example.com:'],
+ error:
+ 'Invalid mvn-repositories entry at line 1. repository-id, repository URL, and snapshots-enabled are required'
+ },
+ {
+ entries: ['', 'private:https://repo.example.com:true', ' :url:false'],
+ error:
+ 'Invalid mvn-repositories entry at line 3. repository-id, repository URL, and snapshots-enabled are required'
+ },
+ {
+ entries: ['private:https://repo.example.com:sometimes'],
+ error:
+ "Invalid snapshots-enabled value 'sometimes' in mvn-repositories entry at line 1. Expected true or false"
+ }
+ ].flatMap(testCase =>
+ repositoryInputs.map(inputName => ({
+ ...testCase,
+ inputName,
+ error: testCase.error.replace('mvn-repositories', inputName)
+ }))
+ )
+ )('rejects malformed $inputName: $entries', ({entries, error, inputName}) => {
+ expect(() => auth.parseMavenRepositories(entries, true, inputName)).toThrow(
+ error
+ );
+ });
+
+ it.each(repositoryInputs)('rejects duplicate IDs in %s', inputName => {
+ expect(() =>
+ auth.parseMavenRepositories(
+ [
+ 'private:https://first.example.com:false',
+ 'private:https://second.example.com:true'
+ ],
+ true,
+ inputName
+ )
+ ).toThrow(`Duplicate repository-id 'private' in ${inputName} input`);
+ });
+
+ it.each(repositoryInputs)(
+ 'reserves the Central ID in %s only when automatic inclusion is enabled',
+ inputName => {
+ const central = 'central:https://custom.example.com/maven:false';
+
+ expect(() =>
+ auth.parseMavenRepositories([central], true, inputName)
+ ).toThrow(
+ "Repository-id 'central' is reserved when mvn-repositories-include-central is enabled"
+ );
+ expect(auth.parseMavenRepositories([central], false, inputName)).toEqual([
+ {
+ id: 'central',
+ url: 'https://custom.example.com/maven',
+ snapshotsEnabled: false
+ }
+ ]);
+ }
+ );
+
+ it('uses an explicit Central repository instead of adding a disabled override', () => {
+ const parsed = parseXmlObject(
+ auth.generate(
+ credentials('packages', 'USERNAME', 'PASSWORD'),
+ undefined,
+ repositorySettings(
+ auth.parseMavenRepositories(
+ ['central:https://mirror.example.com/maven:true'],
+ false
+ ),
+ false
+ )
+ )
+ ) as any;
+
+ expect(parsed.settings.profiles.profile.repositories.repository).toEqual({
+ id: 'central',
+ url: 'https://mirror.example.com/maven',
+ snapshots: {enabled: 'true'}
+ });
+ });
+
+ it('reads Maven repository settings and Central controls', () => {
+ (core.getMultilineInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'mvn-repositories'
+ ? ['private:https://repo.example.com:true']
+ : []
+ );
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ const inputs: Record = {
+ 'mvn-repositories-include-central': 'false',
+ 'mvn-repositories-prioritize-central': 'false'
+ };
+ return inputs[name] ?? '';
+ });
+
+ expect(auth.getMavenRepositorySettings()).toEqual({
+ repositories: [
+ {
+ id: 'private',
+ url: 'https://repo.example.com',
+ snapshotsEnabled: true
+ }
+ ],
+ pluginRepositories: [],
+ includeCentral: false,
+ prioritizeCentral: false
+ });
+ });
+
+ it('does not read repository controls when no repositories are configured', () => {
+ (
+ core.getInput as jest.MockedFunction
+ ).mockReturnValue('false');
+ expect(auth.getMavenRepositorySettings()).toBeUndefined();
+ expect(core.getInput).not.toHaveBeenCalled();
+ });
+
+ it('ignores blank dependency and plugin repository inputs', () => {
+ (
+ core.getMultilineInput as jest.MockedFunction<
+ typeof core.getMultilineInput
+ >
+ ).mockReturnValue(['', ' ', '\t']);
+
+ expect(auth.getMavenRepositorySettings()).toBeUndefined();
+ expect(core.getInput).not.toHaveBeenCalled();
+ });
+
+ it.each(repositoryConfigurations)(
+ 'reads $name inputs with default Central controls and shared IDs',
+ ({repositories, pluginRepositories}) => {
+ (
+ core.getInput as jest.MockedFunction
+ ).mockReturnValue('');
+ (
+ core.getMultilineInput as jest.MockedFunction<
+ typeof core.getMultilineInput
+ >
+ ).mockImplementation(name => {
+ const configured =
+ name === 'mvn-repositories' ? repositories : pluginRepositories;
+ return configured.map(
+ repository =>
+ `${repository.id}:${repository.url}:${repository.snapshotsEnabled}`
+ );
+ });
+
+ expect(auth.getMavenRepositorySettings()).toEqual({
+ repositories,
+ pluginRepositories,
+ includeCentral: true,
+ prioritizeCentral: true
+ });
+ }
+ );
+
+ it.each([true, false])(
+ 'configures plugin repositories with credentials, GPG, a custom path, and overwrite=%s',
+ async overwriteSettings => {
+ const directory = path.join(m2Dir, 'custom');
+ const location = path.join(directory, MVN_SETTINGS_FILE);
+ fs.mkdirSync(directory, {recursive: true});
+ fs.writeFileSync(location, 'EXISTING SETTINGS');
+ (
+ core.getInput as jest.MockedFunction
+ ).mockImplementation(name => {
+ const inputs: Record = {
+ 'settings-path': directory,
+ 'overwrite-settings': String(overwriteSettings),
+ 'gpg-passphrase-env-var': 'GPG_PASSPHRASE',
+ 'mvn-repositories-include-central': 'false'
+ };
+ return inputs[name] ?? '';
+ });
+ (
+ core.getMultilineInput as jest.MockedFunction<
+ typeof core.getMultilineInput
+ >
+ ).mockImplementation(name => {
+ const inputs: Record = {
+ 'mvn-server-credentials': ['private:USERNAME:PASSWORD'],
+ 'mvn-server-repository-origins': ['private:https://repo.example.com'],
+ 'mvn-plugin-repositories': [
+ 'private:https://repo.example.com/maven:true'
+ ]
+ };
+ return inputs[name] ?? [];
+ });
+
+ await auth.configureAuthentication();
+
+ const xml = fs.readFileSync(location, 'utf8');
+ if (!overwriteSettings) {
+ expect(xml).toBe('EXISTING SETTINGS');
+ return;
+ }
+ expect(parseXmlObject(xml)).toMatchObject({
+ settings: {
+ servers: {
+ server: {
+ id: 'private',
+ username: '${env.USERNAME}',
+ password: '${env.PASSWORD}',
+ repositoryOrigins: {
+ repositoryOrigin: 'https://repo.example.com'
+ }
+ }
+ },
+ profiles: {
+ profile: [
+ {
+ id: 'setup-java-repositories',
+ repositories: {repository: disabledCentralRepositoryXml},
+ pluginRepositories: {
+ pluginRepository: [
+ privateRepositoryXml,
+ disabledCentralRepositoryXml
+ ]
+ }
+ },
+ {
+ id: 'setup-java-gpg',
+ properties: {'gpg.passphraseEnvName': 'GPG_PASSPHRASE'}
+ }
+ ]
+ },
+ activeProfiles: {
+ activeProfile: ['setup-java-repositories', 'setup-java-gpg']
+ }
+ }
+ });
+ expect(fs.existsSync(settingsFile)).toBe(false);
+ }
+ );
+
+ it.each([
+ {
+ entries: ['releases:RELEASES_USERNAME'],
+ error:
+ 'Invalid mvn-server-credentials entry at line 1. Expected format: server-id:USERNAME_ENV:PASSWORD_ENV'
+ },
+ {
+ entries: ['', 'releases:RELEASES_USERNAME:RELEASES_PASSWORD:EXTRA'],
+ error:
+ 'Invalid mvn-server-credentials entry at line 2. Expected format: server-id:USERNAME_ENV:PASSWORD_ENV'
+ },
+ {
+ entries: ['releases::RELEASES_PASSWORD'],
+ error:
+ 'Invalid mvn-server-credentials entry at line 1. server-id, username environment variable, and password environment variable are required'
+ }
+ ])(
+ 'rejects malformed Maven server credentials: $entries',
+ ({entries, error}) => {
+ expect(() => auth.parseMavenServerCredentials(entries)).toThrow(error);
+ }
+ );
+
+ it('rejects duplicate Maven server ids', () => {
+ expect(() =>
+ auth.parseMavenServerCredentials([
+ 'releases:RELEASES_USERNAME:RELEASES_PASSWORD',
+ 'releases:OTHER_USERNAME:OTHER_PASSWORD'
+ ])
+ ).toThrow("Duplicate server-id 'releases' in mvn-server-credentials input");
+ });
+
+ it('uses multiline Maven server credentials instead of single-server inputs', () => {
+ (core.getMultilineInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'mvn-server-credentials'
+ ? [
+ 'releases:RELEASES_USERNAME:RELEASES_PASSWORD',
+ 'snapshots:SNAPSHOTS_USERNAME:SNAPSHOTS_PASSWORD'
+ ]
+ : name === 'mvn-server-repository-origins'
+ ? ['releases:https://repo.example.com']
+ : []
+ );
+
+ expect(auth.getMavenServerSettings()).toEqual([
+ {
+ id: 'releases',
+ usernameEnvVar: 'RELEASES_USERNAME',
+ passwordEnvVar: 'RELEASES_PASSWORD',
+ repositoryOrigins: ['https://repo.example.com']
+ },
+ {
+ id: 'snapshots',
+ usernameEnvVar: 'SNAPSHOTS_USERNAME',
+ passwordEnvVar: 'SNAPSHOTS_PASSWORD'
+ }
+ ]);
+ expect(core.getInput).not.toHaveBeenCalled();
+ });
+
+ it('uses the existing single-server inputs when multiline credentials are absent', () => {
+ (core.getInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'server-id' ? 'github' : ''
+ );
+
+ expect(auth.getMavenServerSettings()).toEqual([
+ {
+ id: 'github',
+ usernameEnvVar: 'GITHUB_ACTOR',
+ passwordEnvVar: 'GITHUB_TOKEN'
+ }
+ ]);
+ });
+
+ it('preserves deprecated single-server aliases as fallback inputs', () => {
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ const inputs: Record = {
+ 'server-id': 'legacy',
+ 'server-username': 'LEGACY_USERNAME',
+ 'server-password': 'LEGACY_PASSWORD'
+ };
+ return inputs[name] ?? '';
+ });
+
+ expect(auth.getMavenServerSettings()).toEqual([
+ {
+ id: 'legacy',
+ usernameEnvVar: 'LEGACY_USERNAME',
+ passwordEnvVar: 'LEGACY_PASSWORD'
+ }
+ ]);
+ expect(core.warning).toHaveBeenCalledTimes(2);
+ });
+
+ it('adds normalized repository origins to matching Maven servers', () => {
+ expect(
+ auth.addMavenServerRepositoryOrigins(
+ [
+ {
+ id: 'central',
+ usernameEnvVar: 'CENTRAL_USER',
+ passwordEnvVar: 'CENTRAL_PASS'
+ },
+ {
+ id: 'packages',
+ usernameEnvVar: 'GITHUB_ACTOR',
+ passwordEnvVar: 'GITHUB_TOKEN'
+ }
+ ],
+ [
+ 'central:https://central.sonatype.com/',
+ 'central:https://central.sonatype.com',
+ 'central:https://central.sonatype.com:443',
+ 'packages:https://maven.pkg.github.com',
+ 'packages:ssh://packages.example.com:22',
+ 'packages:ftp://packages.example.com:21'
+ ]
+ )
+ ).toEqual([
+ {
+ id: 'central',
+ usernameEnvVar: 'CENTRAL_USER',
+ passwordEnvVar: 'CENTRAL_PASS',
+ repositoryOrigins: ['https://central.sonatype.com']
+ },
+ {
+ id: 'packages',
+ usernameEnvVar: 'GITHUB_ACTOR',
+ passwordEnvVar: 'GITHUB_TOKEN',
+ repositoryOrigins: [
+ 'https://maven.pkg.github.com',
+ 'ssh://packages.example.com:22',
+ 'ftp://packages.example.com:21'
+ ]
+ }
+ ]);
+ });
+
+ it.each([
+ {
+ entries: ['central'],
+ error:
+ 'Invalid mvn-server-repository-origins entry at line 1. Expected format: server-id:repository-origin'
+ },
+ {
+ entries: ['other:https://repo.example.com'],
+ error:
+ "Unknown server-id 'other' in mvn-server-repository-origins at line 1"
+ },
+ {
+ entries: ['central:https://repo.example.com/path'],
+ error:
+ "Invalid repository origin 'https://repo.example.com/path' in mvn-server-repository-origins at line 1"
+ },
+ {
+ entries: ['central:https:repo.example.com'],
+ error:
+ "Invalid repository origin 'https:repo.example.com' in mvn-server-repository-origins at line 1"
+ },
+ {
+ entries: ['central:https:/repo.example.com'],
+ error:
+ "Invalid repository origin 'https:/repo.example.com' in mvn-server-repository-origins at line 1"
+ },
+ {
+ entries: ['central:https://repo.example.com?'],
+ error:
+ "Invalid repository origin 'https://repo.example.com?' in mvn-server-repository-origins at line 1"
+ },
+ {
+ entries: ['central:https://repo.example.com#'],
+ error:
+ "Invalid repository origin 'https://repo.example.com#' in mvn-server-repository-origins at line 1"
+ },
+ {
+ entries: ['central:https://@repo.example.com'],
+ error:
+ "Invalid repository origin 'https://@repo.example.com' in mvn-server-repository-origins at line 1"
+ }
+ ])('rejects invalid Maven server repository origins', ({entries, error}) => {
+ expect(() =>
+ auth.addMavenServerRepositoryOrigins(
+ [
+ {
+ id: 'central',
+ usernameEnvVar: 'CENTRAL_USER',
+ passwordEnvVar: 'CENTRAL_PASS'
+ }
+ ],
+ entries
+ )
+ ).toThrow(error);
+ });
+
+ function xmlElementText(xml: string, tagName: string): string {
+ const match = new RegExp(`<${tagName}>([\\s\\S]*?)${tagName}>`).exec(xml);
+ expect(match).not.toBeNull();
+ return (parseXmlObject(`${match?.[1]}`) as {value: string})
+ .value;
+ }
+
+ function parseXmlObject(xml: string): unknown {
+ const parser = new XMLParser({
+ ignoreAttributes: false,
+ attributeNamePrefix: '@',
+ parseAttributeValue: false,
+ parseTagValue: false,
+ trimValues: true
+ });
+ return parser.parse(xml);
+ }
+
+ it('uses deprecated input aliases and warns', () => {
+ const mockGetInput = core.getInput as jest.MockedFunction<
+ typeof core.getInput
+ >;
+ const mockWarning = core.warning as jest.MockedFunction<
+ typeof core.warning
+ >;
+ mockGetInput.mockImplementation(name =>
+ name === 'server-username' ? 'LEGACY_USERNAME' : ''
+ );
+
+ expect(
+ auth.getInputWithDeprecatedAlias(
+ 'server-username-env-var',
+ 'server-username',
+ 'GITHUB_ACTOR'
+ )
+ ).toBe('LEGACY_USERNAME');
+ expect(mockWarning).toHaveBeenCalledWith(
+ "The 'server-username' input is deprecated and may be removed in a future release. Please use 'server-username-env-var' instead."
+ );
+
+ mockGetInput.mockReset();
+ mockWarning.mockReset();
+ });
+
+ it('prefers the replacement input over its deprecated alias', () => {
+ const mockGetInput = core.getInput as jest.MockedFunction<
+ typeof core.getInput
+ >;
+ mockGetInput.mockImplementation(name => {
+ const inputs: Record = {
+ 'server-password-env-var': 'NEW_PASSWORD',
+ 'server-password': 'LEGACY_PASSWORD'
+ };
+ return inputs[name] || '';
+ });
+
+ expect(
+ auth.getInputWithDeprecatedAlias(
+ 'server-password-env-var',
+ 'server-password',
+ 'GITHUB_TOKEN'
+ )
+ ).toBe('NEW_PASSWORD');
+ expect(core.warning).toHaveBeenCalled();
+
+ mockGetInput.mockReset();
+ (core.warning as jest.Mock).mockReset();
});
});
diff --git a/__tests__/benchmark-cache-restore.sh b/__tests__/benchmark-cache-restore.sh
new file mode 100644
index 000000000..46470eafe
--- /dev/null
+++ b/__tests__/benchmark-cache-restore.sh
@@ -0,0 +1,135 @@
+#!/usr/bin/env bash
+
+set -euo pipefail
+
+command=${1:?command is required}
+tool=${2:?tool is required}
+
+case "$tool" in
+ maven)
+ dependency_cache="$HOME/.m2/repository"
+ wrapper_cache="$HOME/.m2/wrapper/dists"
+ dependency_file="benchmark/pom.xml"
+ wrapper_file="benchmark/.mvn/wrapper/maven-wrapper.properties"
+ ;;
+ gradle)
+ dependency_cache="$HOME/.gradle/caches"
+ wrapper_cache="$HOME/.gradle/wrapper"
+ dependency_file="benchmark/build.gradle"
+ wrapper_file="benchmark/gradle/wrapper/gradle-wrapper.properties"
+ ;;
+ *)
+ echo "Unsupported tool: $tool" >&2
+ exit 1
+ ;;
+esac
+
+case "$command" in
+ prepare)
+ profile=${3:?profile is required}
+ mkdir -p "$(dirname "$dependency_file")" "$(dirname "$wrapper_file")"
+ printf '// setup-java cache benchmark v1: %s\n' "$profile" > "$dependency_file"
+ printf '# setup-java cache benchmark v1: %s\n' "$profile" > "$wrapper_file"
+ ;;
+ reset)
+ rm -rf "$dependency_cache" "$wrapper_cache"
+ ;;
+ populate)
+ profile=${3:?profile is required}
+ case "$profile" in
+ small)
+ dependency_megabytes=8
+ wrapper_megabytes=2
+ ;;
+ large)
+ dependency_megabytes=128
+ wrapper_megabytes=32
+ ;;
+ *)
+ echo "Unsupported profile: $profile" >&2
+ exit 1
+ ;;
+ esac
+ mkdir -p "$dependency_cache/setup-java-benchmark"
+ mkdir -p "$wrapper_cache/setup-java-benchmark"
+ dd if=/dev/urandom \
+ of="$dependency_cache/setup-java-benchmark/payload" \
+ bs=1048576 count="$dependency_megabytes" 2>/dev/null
+ dd if=/dev/urandom \
+ of="$wrapper_cache/setup-java-benchmark/payload" \
+ bs=1048576 count="$wrapper_megabytes" 2>/dev/null
+ ;;
+ start)
+ node -e "require('fs').writeFileSync('.benchmark-start', String(Date.now()))"
+ ;;
+ record)
+ os=${3:?os is required}
+ profile=${4:?profile is required}
+ implementation=${5:?implementation is required}
+ iteration=${6:?iteration is required}
+ cache_hit=${7:?cache-hit output is required}
+ if [ "$cache_hit" != "true" ]; then
+ echo "Expected an exact dependency-cache hit for $implementation" >&2
+ exit 1
+ fi
+ test -f "$dependency_cache/setup-java-benchmark/payload"
+ started=$(cat .benchmark-start)
+ finished=$(node -e "process.stdout.write(String(Date.now()))")
+ elapsed=$((finished - started))
+ mkdir -p .benchmark-results
+ printf '%s,%s,%s,%s,%s,%s\n' \
+ "$os" "$tool" "$profile" "$implementation" "$iteration" "$elapsed" \
+ >> .benchmark-results/timings.csv
+ ;;
+ summarize)
+ summary_file=${3:?summary file is required}
+ results_file=".benchmark-results/timings.csv"
+ node --input-type=module - "$results_file" "$summary_file" <<'NODE'
+import fs from 'node:fs';
+
+const [, , resultsFile, summaryFile] = process.argv;
+const rows = fs
+ .readFileSync(resultsFile, 'utf8')
+ .trim()
+ .split('\n')
+ .map(line => {
+ const [os, tool, profile, implementation, iteration, elapsed] =
+ line.split(',');
+ return {os, tool, profile, implementation, iteration, elapsed: +elapsed};
+ });
+const average = implementation => {
+ const values = rows
+ .filter(row => row.implementation === implementation)
+ .map(row => row.elapsed);
+ if (values.length === 0) {
+ throw new Error(`No ${implementation} benchmark results were recorded`);
+ }
+ return Math.round(values.reduce((sum, value) => sum + value, 0) / values.length);
+};
+const baseline = average('baseline');
+const candidate = average('candidate');
+const change = (((candidate - baseline) / baseline) * 100).toFixed(1);
+const {os, tool, profile} = rows[0];
+const lines = [
+ `### ${tool} ${profile} cache restore on ${os}`,
+ '',
+ '| Implementation | Iteration | Wall time (ms) |',
+ '| --- | ---: | ---: |',
+ ...rows.map(
+ row =>
+ `| ${row.implementation} | ${row.iteration} | ${row.elapsed} |`
+ ),
+ `| **baseline average** | | **${baseline}** |`,
+ `| **candidate average** | | **${candidate}** |`,
+ '',
+ `Candidate change from baseline: **${change}%**`,
+ ''
+];
+fs.appendFileSync(summaryFile, `${lines.join('\n')}\n`);
+NODE
+ ;;
+ *)
+ echo "Unsupported command: $command" >&2
+ exit 1
+ ;;
+esac
diff --git a/__tests__/cache-feature.test.ts b/__tests__/cache-feature.test.ts
new file mode 100644
index 000000000..4953d9b93
--- /dev/null
+++ b/__tests__/cache-feature.test.ts
@@ -0,0 +1,80 @@
+import {jest, describe, it, expect, afterEach} from '@jest/globals';
+
+jest.unstable_mockModule('@actions/cache', () => ({
+ isFeatureAvailable: jest.fn()
+}));
+
+jest.unstable_mockModule('@actions/core', () => ({
+ warning: jest.fn(),
+ debug: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ info: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const cache = await import('@actions/cache');
+const core = await import('@actions/core');
+const {isCacheFeatureAvailable} = await import('../src/cache-feature.js');
+
+describe('isCacheFeatureAvailable', () => {
+ it('is disabled on GHES when cache feature is unavailable', () => {
+ (cache.isFeatureAvailable as jest.Mock).mockImplementation(
+ () => false
+ );
+ const warningMock = core.warning as jest.Mock;
+ const message =
+ 'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.';
+
+ try {
+ process.env['GITHUB_SERVER_URL'] = 'http://example.com';
+ expect(isCacheFeatureAvailable()).toBe(false);
+ expect(warningMock).toHaveBeenCalledWith(message);
+ } finally {
+ delete process.env['GITHUB_SERVER_URL'];
+ }
+ });
+
+ it('is disabled on dotcom when cache feature is unavailable', () => {
+ (cache.isFeatureAvailable as jest.Mock).mockImplementation(
+ () => false
+ );
+ const warningMock = core.warning as jest.Mock;
+ const message =
+ 'The runner was not able to contact the cache service. Caching will be skipped';
+
+ try {
+ process.env['GITHUB_SERVER_URL'] = 'http://github.com';
+ expect(isCacheFeatureAvailable()).toBe(false);
+ expect(warningMock).toHaveBeenCalledWith(message);
+ } finally {
+ delete process.env['GITHUB_SERVER_URL'];
+ }
+ });
+
+ it('is enabled when cache feature is available', () => {
+ (cache.isFeatureAvailable as jest.Mock).mockImplementation(() => true);
+ expect(isCacheFeatureAvailable()).toBe(true);
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ jest.clearAllMocks();
+ });
+});
diff --git a/__tests__/cache.test.ts b/__tests__/cache.test.ts
index 9762fb983..690f4a6a5 100644
--- a/__tests__/cache.test.ts
+++ b/__tests__/cache.test.ts
@@ -1,22 +1,85 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
import {mkdtempSync} from 'fs';
import {tmpdir} from 'os';
import {join} from 'path';
-import {restore, save} from '../src/cache';
+import {createHash} from 'crypto';
import * as fs from 'fs';
import * as os from 'os';
-import * as core from '@actions/core';
-import * as cache from '@actions/cache';
-import * as glob from '@actions/glob';
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+jest.unstable_mockModule('@actions/cache', () => ({
+ restoreCache: jest.fn(),
+ saveCache: jest.fn(),
+ isFeatureAvailable: jest.fn(),
+ ValidationError: class ValidationError extends Error {
+ constructor(message: string) {
+ super(message);
+ this.name = 'ValidationError';
+ }
+ },
+ ReserveCacheError: class ReserveCacheError extends Error {
+ constructor(message: string) {
+ super(message);
+ this.name = 'ReserveCacheError';
+ }
+ }
+}));
+
+jest.unstable_mockModule('@actions/glob', () => ({
+ hashFiles: jest.fn(),
+ create: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const cache = await import('@actions/cache');
+const glob = await import('@actions/glob');
+const {restore, save, validatePackageManager} = await import('../src/cache.js');
describe('dependency cache', () => {
const ORIGINAL_RUNNER_OS = process.env['RUNNER_OS'];
const ORIGINAL_GITHUB_WORKSPACE = process.env['GITHUB_WORKSPACE'];
const ORIGINAL_CWD = process.cwd();
let workspace: string;
- let spyInfo: jest.SpyInstance>;
- let spyWarning: jest.SpyInstance>;
- let spyDebug: jest.SpyInstance>;
- let spySaveState: jest.SpyInstance>;
+ let spyInfo: any;
+ let spyWarning: any;
+ let spyDebug: any;
+ let spySaveState: any;
+ let spyCoreError: any;
beforeEach(() => {
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
@@ -40,17 +103,21 @@ describe('dependency cache', () => {
});
beforeEach(() => {
- spyInfo = jest.spyOn(core, 'info');
+ spyInfo = core.info as jest.Mock;
spyInfo.mockImplementation(() => null);
- spyWarning = jest.spyOn(core, 'warning');
+ spyWarning = core.warning as jest.Mock;
spyWarning.mockImplementation(() => null);
- spyDebug = jest.spyOn(core, 'debug');
+ spyDebug = core.debug as jest.Mock;
spyDebug.mockImplementation(() => null);
- spySaveState = jest.spyOn(core, 'saveState');
+ spySaveState = core.saveState as jest.Mock;
spySaveState.mockImplementation(() => null);
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -58,25 +125,39 @@ describe('dependency cache', () => {
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
resetState();
+
+ jest.resetAllMocks();
+ jest.clearAllMocks();
+ jest.restoreAllMocks();
+ });
+
+ describe('validatePackageManager', () => {
+ it('accepts supported package managers', () => {
+ expect(() => validatePackageManager('maven')).not.toThrow();
+ expect(() => validatePackageManager('gradle')).not.toThrow();
+ expect(() => validatePackageManager('sbt')).not.toThrow();
+ });
+
+ it('throws the targeted error for unsupported package managers', () => {
+ expect(() => validatePackageManager('ant')).toThrow(
+ 'unknown package manager specified: ant'
+ );
+ });
});
describe('restore', () => {
- let spyCacheRestore: jest.SpyInstance<
- ReturnType,
- Parameters
- >;
- let spyGlobHashFiles: jest.SpyInstance<
- ReturnType,
- Parameters
- >;
+ let spyCacheRestore: any;
+ let spyGlobHashFiles: any;
+ let spySetOutput: any;
beforeEach(() => {
- spyCacheRestore = jest
- .spyOn(cache, 'restoreCache')
- .mockImplementation((paths: string[], primaryKey: string) =>
- Promise.resolve(undefined)
- );
- spyGlobHashFiles = jest.spyOn(glob, 'hashFiles');
+ spyCacheRestore = (cache.restoreCache as any).mockImplementation(
+ (paths: string[], primaryKey: string) => Promise.resolve(undefined)
+ );
+ spyGlobHashFiles = glob.hashFiles as jest.Mock;
+ spyGlobHashFiles.mockResolvedValue('hash-stub');
+ spySetOutput = core.setOutput as jest.Mock;
+ spySetOutput.mockImplementation(() => null);
spyWarning.mockImplementation(() => null);
});
@@ -87,29 +168,196 @@ describe('dependency cache', () => {
});
describe('for maven', () => {
- it('throws error if no pom.xml found', async () => {
+ it('throws error if no pom.xml, maven-wrapper.properties, or extensions.xml found', async () => {
+ spyGlobHashFiles.mockResolvedValue('');
await expect(restore('maven', '')).rejects.toThrow(
`No file in ${projectRoot(
workspace
- )} matched to [**/pom.xml], make sure you have checked out the target repository`
+ )} matched to [**/pom.xml,**/.mvn/wrapper/maven-wrapper.properties,**/.mvn/extensions.xml], make sure you have checked out the target repository`
);
});
- it('downloads cache', async () => {
+ it('downloads cache based on pom.xml', async () => {
createFile(join(workspace, 'pom.xml'));
await restore('maven', '');
- expect(spyCacheRestore).toHaveBeenCalled();
- expect(spyGlobHashFiles).toHaveBeenCalledWith('**/pom.xml');
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'repository')],
+ expect.any(String)
+ );
+ expect(spyGlobHashFiles).toHaveBeenCalledWith(
+ '**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties\n**/.mvn/extensions.xml'
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
+ });
+ it('sets the cache-primary-key output', async () => {
+ createFile(join(workspace, 'pom.xml'));
+
+ await restore('maven', '');
+ expect(spySetOutput).toHaveBeenCalledWith(
+ 'cache-primary-key',
+ expect.stringContaining('setup-java-')
+ );
+ });
+ it('downloads cache based on maven-wrapper.properties', async () => {
+ createDirectory(join(workspace, '.mvn'));
+ createDirectory(join(workspace, '.mvn', 'wrapper'));
+ createFile(
+ join(workspace, '.mvn', 'wrapper', 'maven-wrapper.properties')
+ );
+
+ await restore('maven', '');
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'repository')],
+ expect.any(String)
+ );
+ expect(spyGlobHashFiles).toHaveBeenCalledWith(
+ '**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties\n**/.mvn/extensions.xml'
+ );
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
});
+ it('downloads cache based on extensions.xml', async () => {
+ createDirectory(join(workspace, '.mvn'));
+ createFile(join(workspace, '.mvn', 'extensions.xml'));
+
+ await restore('maven', '');
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'repository')],
+ expect.any(String)
+ );
+ expect(spyGlobHashFiles).toHaveBeenCalledWith(
+ '**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties\n**/.mvn/extensions.xml'
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
+ });
+ it('restores the maven wrapper distribution cache independently of the main cache', async () => {
+ createDirectory(join(workspace, '.mvn'));
+ createDirectory(join(workspace, '.mvn', 'wrapper'));
+ createFile(
+ join(workspace, '.mvn', 'wrapper', 'maven-wrapper.properties')
+ );
+
+ await restore('maven', '', ['/custom/maven/repository']);
+ // Main dependency cache no longer carries the wrapper dists path.
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ ['/custom/maven/repository'],
+ expect.any(String)
+ );
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'wrapper', 'dists')],
+ expect.stringContaining('maven-wrapper')
+ );
+ expect(spyGlobHashFiles).toHaveBeenCalledWith(
+ '**/.mvn/wrapper/maven-wrapper.properties'
+ );
+ expect(spyInfo).toHaveBeenCalledWith(
+ 'maven-wrapper cache is not found'
+ );
+ });
+ it('starts maven dependency and wrapper restores before either completes', async () => {
+ createDirectory(join(workspace, '.mvn'));
+ createDirectory(join(workspace, '.mvn', 'wrapper'));
+ createFile(
+ join(workspace, '.mvn', 'wrapper', 'maven-wrapper.properties')
+ );
+ const dependencyRestore = deferred();
+ const wrapperRestore = deferred();
+ const bothRestoresStarted = deferred();
+ let restoreCount = 0;
+ spyCacheRestore.mockImplementation((paths: string[]) => {
+ restoreCount++;
+ if (restoreCount === 2) {
+ bothRestoresStarted.resolve();
+ }
+ return paths.includes(join(os.homedir(), '.m2', 'repository'))
+ ? dependencyRestore.promise
+ : wrapperRestore.promise;
+ });
+
+ const restorePromise = restore('maven', '');
+ await bothRestoresStarted.promise;
+
+ expect(spyCacheRestore).toHaveBeenCalledTimes(2);
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-primary-key',
+ expect.any(String)
+ );
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-primary-key-maven-wrapper',
+ expect.any(String)
+ );
+
+ wrapperRestore.resolve('maven-wrapper-hit');
+ dependencyRestore.resolve('maven-dependency-hit');
+ await restorePromise;
+
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-matched-key-maven-wrapper',
+ 'maven-wrapper-hit'
+ );
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-matched-key',
+ 'maven-dependency-hit'
+ );
+ expect(spySetOutput).toHaveBeenCalledWith('cache-hit', false);
+ });
+ it('propagates a wrapper restore failure after starting both restores', async () => {
+ createDirectory(join(workspace, '.mvn'));
+ createDirectory(join(workspace, '.mvn', 'wrapper'));
+ createFile(
+ join(workspace, '.mvn', 'wrapper', 'maven-wrapper.properties')
+ );
+ const dependencyRestore = deferred();
+ const wrapperRestore = deferred();
+ const bothRestoresStarted = deferred();
+ let restoreCount = 0;
+ spyCacheRestore.mockImplementation((paths: string[]) => {
+ restoreCount++;
+ if (restoreCount === 2) {
+ bothRestoresStarted.resolve();
+ }
+ return paths.includes(join(os.homedir(), '.m2', 'repository'))
+ ? dependencyRestore.promise
+ : wrapperRestore.promise;
+ });
+
+ const restorePromise = restore('maven', '');
+ await bothRestoresStarted.promise;
+ wrapperRestore.reject(new Error('wrapper restore failed'));
+ dependencyRestore.resolve(undefined);
+
+ await expect(restorePromise).rejects.toThrow('wrapper restore failed');
+ });
+ it('skips the maven wrapper cache when no wrapper properties exist', async () => {
+ createFile(join(workspace, 'pom.xml'));
+ spyGlobHashFiles.mockImplementation((pattern: string) =>
+ Promise.resolve(
+ pattern === '**/.mvn/wrapper/maven-wrapper.properties'
+ ? ''
+ : 'hash-stub'
+ )
+ );
+
+ await restore('maven', '');
+ // Only the main dependency cache is restored; the wrapper cache path is
+ // never touched because the project does not use mvnw.
+ expect(spyCacheRestore).toHaveBeenCalledTimes(1);
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'repository')],
+ expect.any(String)
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ });
});
describe('for gradle', () => {
it('throws error if no build.gradle found', async () => {
+ spyGlobHashFiles.mockResolvedValue('');
await expect(restore('gradle', '')).rejects.toThrow(
`No file in ${projectRoot(
workspace
- )} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml,**/versions.properties], make sure you have checked out the target repository`
+ )} matched to [**/*.gradle*,**/gradle.properties,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml,**/versions.properties], make sure you have checked out the target repository`
);
});
it('downloads cache based on build.gradle', async () => {
@@ -118,7 +366,7 @@ describe('dependency cache', () => {
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
- '**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
+ '**/*.gradle*\n**/gradle.properties\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
@@ -129,7 +377,7 @@ describe('dependency cache', () => {
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
- '**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
+ '**/*.gradle*\n**/gradle.properties\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
@@ -141,7 +389,7 @@ describe('dependency cache', () => {
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
- '**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
+ '**/*.gradle*\n**/gradle.properties\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
@@ -153,14 +401,124 @@ describe('dependency cache', () => {
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
- '**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
+ '**/*.gradle*\n**/gradle.properties\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
});
+ it('changes the cache key when gradle.properties changes', async () => {
+ const buildFile = join(workspace, 'build.gradle');
+ const propertiesFile = join(workspace, 'gradle.properties');
+ createFile(buildFile);
+ createFile(propertiesFile, 'dependencyVersion=1.0.0');
+ spyGlobHashFiles.mockImplementation(async (pattern: string) => {
+ if (pattern === '**/gradle-wrapper.properties') {
+ return '';
+ }
+
+ const files = [buildFile];
+ if (pattern.split('\n').includes('**/gradle.properties')) {
+ files.push(propertiesFile);
+ }
+ const hash = createHash('sha256');
+ files.forEach(file => hash.update(fs.readFileSync(file)));
+ return hash.digest('hex');
+ });
+
+ await restore('gradle', '');
+ const firstKey = spyCacheRestore.mock.calls[0][1];
+
+ fs.writeFileSync(propertiesFile, 'dependencyVersion=2.0.0');
+ await restore('gradle', '');
+ const secondKey = spyCacheRestore.mock.calls[1][1];
+
+ expect(secondKey).not.toBe(firstKey);
+ });
+ it('restores the gradle wrapper distribution cache independently of the main cache', async () => {
+ createFile(join(workspace, 'build.gradle'));
+
+ await restore('gradle', '', ['/custom/gradle/caches']);
+ // Main dependency cache no longer carries the wrapper path.
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ ['/custom/gradle/caches'],
+ expect.any(String)
+ );
+ // Wrapper distribution is restored on its own, keyed only on the
+ // wrapper properties file.
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.gradle', 'wrapper')],
+ expect.stringContaining('setup-java-')
+ );
+ expect(spyGlobHashFiles).toHaveBeenCalledWith(
+ '**/gradle-wrapper.properties'
+ );
+ });
+ it('starts gradle dependency and wrapper restores before either completes', async () => {
+ createFile(join(workspace, 'build.gradle'));
+ createFile(join(workspace, 'gradle-wrapper.properties'));
+ const dependencyRestore = deferred();
+ const wrapperRestore = deferred();
+ const bothRestoresStarted = deferred();
+ let restoreCount = 0;
+ spyCacheRestore.mockImplementation((paths: string[]) => {
+ restoreCount++;
+ if (restoreCount === 2) {
+ bothRestoresStarted.resolve();
+ }
+ return paths.includes(join(os.homedir(), '.gradle', 'caches'))
+ ? dependencyRestore.promise
+ : wrapperRestore.promise;
+ });
+
+ const restorePromise = restore('gradle', '');
+ await bothRestoresStarted.promise;
+
+ expect(spyCacheRestore).toHaveBeenCalledTimes(2);
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-primary-key',
+ expect.any(String)
+ );
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-primary-key-gradle-wrapper',
+ expect.any(String)
+ );
+
+ dependencyRestore.resolve('gradle-dependency-hit');
+ wrapperRestore.resolve('gradle-wrapper-hit');
+ await restorePromise;
+
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-matched-key',
+ 'gradle-dependency-hit'
+ );
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-matched-key-gradle-wrapper',
+ 'gradle-wrapper-hit'
+ );
+ expect(spySetOutput).toHaveBeenCalledWith('cache-hit', false);
+ });
+ it('skips the gradle wrapper cache when no wrapper properties exist', async () => {
+ createFile(join(workspace, 'build.gradle'));
+ spyGlobHashFiles.mockImplementation((pattern: string) =>
+ Promise.resolve(
+ pattern === '**/gradle-wrapper.properties' ? '' : 'hash-stub'
+ )
+ );
+
+ await restore('gradle', '');
+ // Only the main dependency cache is restored; the wrapper cache path is
+ // never touched because the project does not use the gradle wrapper.
+ expect(spyCacheRestore).toHaveBeenCalledTimes(1);
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ [join(os.homedir(), '.gradle', 'caches')],
+ expect.any(String)
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ });
});
describe('for sbt', () => {
it('throws error if no build.sbt found', async () => {
+ spyGlobHashFiles.mockResolvedValue('');
await expect(restore('sbt', '')).rejects.toThrow(
`No file in ${projectRoot(
workspace
@@ -179,6 +537,13 @@ describe('dependency cache', () => {
expect(spyInfo).toHaveBeenCalledWith('sbt cache is not found');
});
it('detects scala and sbt changes under **/project/ folder', async () => {
+ let callCount = 0;
+ spyGlobHashFiles.mockImplementation(async () => {
+ callCount++;
+ // Return same hash for first two calls, different for third
+ return callCount <= 2 ? 'hash-v1' : 'hash-v2';
+ });
+
createFile(join(workspace, 'build.sbt'));
createDirectory(join(workspace, 'project'));
createFile(join(workspace, 'project/DependenciesV1.scala'));
@@ -207,13 +572,14 @@ describe('dependency cache', () => {
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
- '**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
+ '**/*.gradle*\n**/gradle.properties\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
});
describe('cache-dependency-path', () => {
it('throws error if no matching dependency file found', async () => {
+ spyGlobHashFiles.mockResolvedValue('');
createFile(join(workspace, 'build.gradle.kts'));
await expect(
restore('gradle', 'sub-project/**/build.gradle.kts')
@@ -253,19 +619,47 @@ describe('dependency cache', () => {
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
});
});
+ describe('cache-path', () => {
+ it.each([
+ ['maven', ['/custom/maven/repository']],
+ ['gradle', ['/custom/gradle/caches']],
+ [
+ 'sbt',
+ [
+ '/custom/ivy/cache',
+ '/custom/coursier/cache',
+ '!/custom/ivy/cache/*.lock'
+ ]
+ ]
+ ])(
+ 'restores and persists custom paths for %s',
+ async (packageManager, cachePaths) => {
+ await restore(packageManager, '', cachePaths);
+
+ expect(spyCacheRestore).toHaveBeenCalledWith(
+ cachePaths,
+ expect.any(String)
+ );
+ expect(spySaveState).toHaveBeenCalledWith(
+ 'cache-paths',
+ JSON.stringify(cachePaths)
+ );
+ }
+ );
+ });
});
describe('save', () => {
- let spyCacheSave: jest.SpyInstance<
- ReturnType,
- Parameters
- >;
+ let spyCacheSave: any;
+ let spyGlobCreate: jest.Mock;
beforeEach(() => {
- spyCacheSave = jest
- .spyOn(cache, 'saveCache')
- .mockImplementation((paths: string[], key: string) =>
- Promise.resolve(0)
- );
+ spyCacheSave = (cache.saveCache as any).mockImplementation(
+ (paths: string[], key: string) => Promise.resolve(0)
+ );
+ spyGlobCreate = glob.create as jest.Mock;
+ spyGlobCreate.mockResolvedValue({
+ glob: jest.fn(() => Promise.resolve(['wrapper-path']))
+ });
spyWarning.mockImplementation(() => null);
});
@@ -282,10 +676,12 @@ describe('dependency cache', () => {
await save('maven');
expect(spyCacheSave).toHaveBeenCalled();
expect(spyWarning).not.toHaveBeenCalled();
- expect(spyInfo).toHaveBeenCalled();
- expect(spyInfo).toHaveBeenCalledWith(
+ expect(spyInfo).not.toHaveBeenCalledWith(
expect.stringMatching(/^Cache saved with the key:.*/)
);
+ expect(spyDebug).toHaveBeenCalledWith(
+ expect.stringMatching(/^Cache was not saved for the key:.*/)
+ );
});
it('saves with error from toolkit, should fail workflow', async () => {
@@ -300,6 +696,42 @@ describe('dependency cache', () => {
);
});
+ it.each([
+ ['maven', ['/custom/maven/repository']],
+ ['gradle', ['/custom/gradle/caches']],
+ [
+ 'sbt',
+ [
+ '/custom/ivy/cache',
+ '/custom/coursier/cache',
+ '!/custom/ivy/cache/*.lock'
+ ]
+ ]
+ ])(
+ 'saves the persisted custom paths for %s',
+ async (packageManager, cachePaths) => {
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-paths':
+ return JSON.stringify(cachePaths);
+ default:
+ return '';
+ }
+ });
+
+ await save(packageManager);
+
+ expect(spyCacheSave).toHaveBeenCalledWith(
+ cachePaths,
+ 'setup-java-cache-primary-key'
+ );
+ }
+ );
+
describe('for maven', () => {
it('uploads cache even if no pom.xml found', async () => {
createStateForMissingBuildFile();
@@ -327,6 +759,114 @@ describe('dependency cache', () => {
expect.stringMatching(/^Cache saved with the key:.*/)
);
});
+ it('saves the maven wrapper distribution cache under its own key', async () => {
+ createFile(join(workspace, 'pom.xml'));
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-maven-wrapper':
+ return 'setup-java-maven-wrapper-key';
+ default:
+ return '';
+ }
+ });
+
+ await save('maven');
+ expect(spyCacheSave).toHaveBeenCalledWith(
+ ['wrapper-path'],
+ 'setup-java-maven-wrapper-key'
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ });
+ it('does not save the maven wrapper cache on an exact wrapper hit', async () => {
+ createFile(join(workspace, 'pom.xml'));
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-maven-wrapper':
+ case 'cache-matched-key-maven-wrapper':
+ return 'setup-java-maven-wrapper-key';
+ default:
+ return '';
+ }
+ });
+
+ await save('maven');
+ expect(spyCacheSave).not.toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'wrapper', 'dists')],
+ expect.any(String)
+ );
+ });
+ it('does not fail the post step when the wrapper distribution path is missing', async () => {
+ createFile(join(workspace, 'pom.xml'));
+ createDirectory(join(workspace, '.mvn'));
+ createDirectory(join(workspace, '.mvn', 'wrapper'));
+ createFile(
+ join(workspace, '.mvn', 'wrapper', 'maven-wrapper.properties')
+ );
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-maven-wrapper':
+ return 'setup-java-maven-wrapper-key';
+ default:
+ return '';
+ }
+ });
+ spyGlobCreate.mockResolvedValue({
+ glob: jest.fn(() => Promise.resolve([]))
+ });
+
+ await expect(save('maven')).resolves.toBeUndefined();
+ expect(spyCacheSave).not.toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'wrapper', 'dists')],
+ expect.any(String)
+ );
+ expect(spyCacheSave).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'repository')],
+ 'setup-java-cache-primary-key'
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ });
+ it('continues with primary cache save when additional cache save fails unexpectedly', async () => {
+ createFile(join(workspace, 'pom.xml'));
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-maven-wrapper':
+ return 'setup-java-maven-wrapper-key';
+ default:
+ return '';
+ }
+ });
+ spyCacheSave.mockImplementation((paths: string[], key: string) => {
+ if (paths[0] === 'wrapper-path') {
+ return Promise.reject(new Error('wrapper save exploded'));
+ }
+ return Promise.resolve(0);
+ });
+
+ await expect(save('maven')).resolves.toBeUndefined();
+ expect(spyWarning).toHaveBeenCalledWith(
+ 'Failed to save maven-wrapper cache: wrapper save exploded. Continuing with primary cache save.'
+ );
+ expect(spyCacheSave).toHaveBeenCalledWith(
+ [join(os.homedir(), '.m2', 'repository')],
+ 'setup-java-cache-primary-key'
+ );
+ });
});
describe('for gradle', () => {
it('uploads cache even if no build.gradle found', async () => {
@@ -379,6 +919,80 @@ describe('dependency cache', () => {
expect.stringMatching(/^Cache saved with the key:.*/)
);
});
+ it('saves the gradle wrapper distribution cache under its own key', async () => {
+ createFile(join(workspace, 'build.gradle'));
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-gradle-wrapper':
+ return 'setup-java-gradle-wrapper-key';
+ default:
+ return '';
+ }
+ });
+
+ await save('gradle');
+ expect(spyCacheSave).toHaveBeenCalledWith(
+ ['wrapper-path'],
+ 'setup-java-gradle-wrapper-key'
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ });
+ it('does not save the gradle wrapper cache on an exact wrapper hit', async () => {
+ createFile(join(workspace, 'build.gradle'));
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-gradle-wrapper':
+ case 'cache-matched-key-gradle-wrapper':
+ return 'setup-java-gradle-wrapper-key';
+ default:
+ return '';
+ }
+ });
+
+ await save('gradle');
+ expect(spyCacheSave).not.toHaveBeenCalledWith(
+ [join(os.homedir(), '.gradle', 'wrapper')],
+ expect.any(String)
+ );
+ });
+ it('does not fail the post step when the wrapper distribution path is missing', async () => {
+ createFile(join(workspace, 'build.gradle'));
+ createFile(join(workspace, 'gradle-wrapper.properties'));
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case 'cache-primary-key-gradle-wrapper':
+ return 'setup-java-gradle-wrapper-key';
+ default:
+ return '';
+ }
+ });
+ spyGlobCreate.mockResolvedValue({
+ glob: jest.fn(() => Promise.resolve([]))
+ });
+
+ await expect(save('gradle')).resolves.toBeUndefined();
+ expect(spyCacheSave).not.toHaveBeenCalledWith(
+ [join(os.homedir(), '.gradle', 'wrapper')],
+ expect.any(String)
+ );
+ expect(spyCacheSave).toHaveBeenCalledWith(
+ [join(os.homedir(), '.gradle', 'caches')],
+ 'setup-java-cache-primary-key'
+ );
+ expect(spyWarning).not.toHaveBeenCalled();
+ });
});
describe('for sbt', () => {
it('uploads cache even if no build.sbt found', async () => {
@@ -423,14 +1037,14 @@ describe('dependency cache', () => {
});
function resetState() {
- jest.spyOn(core, 'getState').mockReset();
+ (core.getState as jest.Mock).mockReset();
}
/**
* Create states to emulate a restore process without build file.
*/
function createStateForMissingBuildFile() {
- jest.spyOn(core, 'getState').mockImplementation(name => {
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
switch (name) {
case 'cache-primary-key':
return 'setup-java-cache-';
@@ -444,7 +1058,7 @@ function createStateForMissingBuildFile() {
* Create states to emulate a successful restore process.
*/
function createStateForSuccessfulRestore() {
- jest.spyOn(core, 'getState').mockImplementation(name => {
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
switch (name) {
case 'cache-primary-key':
return 'setup-java-cache-primary-key';
@@ -456,9 +1070,19 @@ function createStateForSuccessfulRestore() {
});
}
-function createFile(path: string) {
+function createFile(path: string, contents = '') {
core.info(`created a file at ${path}`);
- fs.writeFileSync(path, '');
+ fs.writeFileSync(path, contents);
+}
+
+function deferred() {
+ let resolve!: (value: T | PromiseLike) => void;
+ let reject!: (reason?: unknown) => void;
+ const promise = new Promise((promiseResolve, promiseReject) => {
+ resolve = promiseResolve;
+ reject = promiseReject;
+ });
+ return {promise, resolve, reject};
}
function createDirectory(path: string) {
diff --git a/__tests__/cache/gradle1/gradle/wrapper/gradle-wrapper.properties b/__tests__/cache/gradle1/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 000000000..e78380889
--- /dev/null
+++ b/__tests__/cache/gradle1/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
diff --git a/__tests__/cache/maven/.mvn/wrapper/maven-wrapper.properties b/__tests__/cache/maven/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 000000000..2b8cd3d63
--- /dev/null
+++ b/__tests__/cache/maven/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip
diff --git a/__tests__/cache/maven2/.gitignore b/__tests__/cache/maven2/.gitignore
new file mode 100644
index 000000000..0e13eebbe
--- /dev/null
+++ b/__tests__/cache/maven2/.gitignore
@@ -0,0 +1,11 @@
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
diff --git a/__tests__/cache/maven2/pom.xml b/__tests__/cache/maven2/pom.xml
new file mode 100644
index 000000000..70b8d0cc1
--- /dev/null
+++ b/__tests__/cache/maven2/pom.xml
@@ -0,0 +1,15 @@
+
+
+ 4.0.0
+ io.github.actions
+ setup-java-maven2-example
+ 1.0.0-SNAPSHOT
+ jar
+
+
+ org.apache.commons
+ commons-lang3
+ 3.12.0
+
+
+
diff --git a/__tests__/cache/sbt2/.gitignore b/__tests__/cache/sbt2/.gitignore
new file mode 100644
index 000000000..2f7896d1d
--- /dev/null
+++ b/__tests__/cache/sbt2/.gitignore
@@ -0,0 +1 @@
+target/
diff --git a/__tests__/cache/sbt2/build.sbt b/__tests__/cache/sbt2/build.sbt
new file mode 100644
index 000000000..c8737676e
--- /dev/null
+++ b/__tests__/cache/sbt2/build.sbt
@@ -0,0 +1,3 @@
+ThisBuild / scalaVersion := "2.12.15"
+
+libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "2.1.1"
diff --git a/__tests__/check-dir.sh b/__tests__/check-dir.sh
new file mode 100755
index 000000000..30da05fdc
--- /dev/null
+++ b/__tests__/check-dir.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+# Assert whether a directory exists, for use in the e2e cache workflows.
+#
+# Usage: check-dir.sh [present|absent]
+#
+# present (default): fail if does NOT exist, otherwise list its contents.
+# absent: fail if DOES exist.
+#
+# Call with already-expanded paths (e.g. "$HOME/.gradle/caches") to avoid
+# tilde-expansion pitfalls.
+set -eu
+
+if [ "$#" -lt 1 ]; then
+ echo "Usage: check-dir.sh [present|absent]" >&2
+ exit 2
+fi
+
+dir=$1
+mode=${2:-present}
+
+case "$mode" in
+ present)
+ if [ ! -d "$dir" ]; then
+ echo "::error::The $dir directory does not exist unexpectedly"
+ exit 1
+ fi
+ ls "$dir"
+ ;;
+ absent)
+ if [ -d "$dir" ]; then
+ echo "::error::The $dir directory exists unexpectedly"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "::error::Unknown mode '$mode' (expected 'present' or 'absent')"
+ exit 1
+ ;;
+esac
diff --git a/__tests__/checksum.test.ts b/__tests__/checksum.test.ts
new file mode 100644
index 000000000..b8e3f0185
--- /dev/null
+++ b/__tests__/checksum.test.ts
@@ -0,0 +1,130 @@
+import {afterEach, describe, expect, it, jest} from '@jest/globals';
+import {createHash} from 'crypto';
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+
+import {calculateChecksum, verifyChecksum} from '../src/checksum.js';
+import type {ChecksumMetadata} from '../src/distributions/base-models.js';
+
+const temporaryPaths: string[] = [];
+
+async function temporaryFile(contents: string): Promise {
+ const directory = await fs.promises.mkdtemp(
+ path.join(os.tmpdir(), 'setup-java-checksum-')
+ );
+ const file = path.join(directory, 'archive');
+ await fs.promises.writeFile(file, contents);
+ temporaryPaths.push(directory);
+ return file;
+}
+
+afterEach(async () => {
+ await Promise.all(
+ temporaryPaths
+ .splice(0)
+ .map(item => fs.promises.rm(item, {recursive: true, force: true}))
+ );
+ jest.restoreAllMocks();
+});
+
+describe('verifyChecksum', () => {
+ it.each(['sha256', 'sha512'] as const)(
+ 'verifies a matching %s digest',
+ async algorithm => {
+ const contents = `jdk archive for ${algorithm}`;
+ const file = await temporaryFile(contents);
+ const value = createHash(algorithm).update(contents).digest('hex');
+
+ await expect(
+ verifyChecksum(
+ file,
+ {algorithm, value: value.toUpperCase()},
+ {distribution: 'Test', version: '21.0.1'}
+ )
+ ).resolves.toBeUndefined();
+ }
+ );
+
+ it('reports mismatch context and both digests', async () => {
+ const file = await temporaryFile('corrupt archive');
+ const expected = 'a'.repeat(64);
+ const actual = await calculateChecksum(file, 'sha256');
+
+ await expect(
+ verifyChecksum(
+ file,
+ {algorithm: 'sha256', value: expected},
+ {distribution: 'Corretto', version: '21.0.8'}
+ )
+ ).rejects.toThrow(
+ `Checksum verification failed for Corretto version 21.0.8: sha256 expected ${expected}, actual ${actual}.`
+ );
+ });
+
+ it('rejects malformed digest metadata before reading the file', async () => {
+ await expect(
+ verifyChecksum(
+ '/missing/archive',
+ {algorithm: 'sha512', value: 'not-a-digest'},
+ {distribution: 'Test', version: '17'}
+ )
+ ).rejects.toThrow(
+ 'Malformed sha512 checksum metadata: expected a 128-character hexadecimal digest.'
+ );
+ });
+
+ it.each([undefined, null, 123])(
+ 'reports a malformed digest when the value is %p',
+ async value => {
+ const checksum = {
+ algorithm: 'sha256',
+ value
+ } as unknown as ChecksumMetadata;
+
+ await expect(
+ verifyChecksum('/missing/archive', checksum, {
+ distribution: 'Test',
+ version: '17'
+ })
+ ).rejects.toThrow(
+ 'Malformed sha256 checksum metadata: expected a 64-character hexadecimal digest.'
+ );
+ }
+ );
+
+ it('rejects unsupported algorithms without leaking source query parameters', async () => {
+ const checksum = {
+ algorithm: 'md5',
+ value: 'a'.repeat(32),
+ source: 'https://vendor.example/checksum.txt?token=secret-value#private'
+ } as unknown as ChecksumMetadata;
+
+ let message = '';
+ try {
+ await verifyChecksum('/missing/archive', checksum, {
+ distribution: 'Test',
+ version: '17'
+ });
+ } catch (error) {
+ message = (error as Error).message;
+ }
+
+ expect(message).toContain(
+ "Unsupported checksum algorithm 'md5' from https://vendor.example/checksum.txt"
+ );
+ expect(message).not.toContain('secret-value');
+ expect(message).not.toContain('token=');
+ expect(message).not.toContain('#private');
+ });
+
+ it('surfaces file read errors', async () => {
+ await expect(
+ verifyChecksum(
+ '/missing/archive',
+ {algorithm: 'sha256', value: 'a'.repeat(64)},
+ {distribution: 'Test', version: '17'}
+ )
+ ).rejects.toMatchObject({code: 'ENOENT'});
+ });
+});
diff --git a/__tests__/cleanup-java.test.ts b/__tests__/cleanup-java.test.ts
index 375a2ad15..36441fbf6 100644
--- a/__tests__/cleanup-java.test.ts
+++ b/__tests__/cleanup-java.test.ts
@@ -1,32 +1,111 @@
-import {run as cleanup} from '../src/cleanup-java';
-import * as core from '@actions/core';
-import * as cache from '@actions/cache';
-import * as util from '../src/util';
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+
+// Mock @actions/cache before importing source modules
+const real_cache_module = await import('@actions/cache');
+jest.unstable_mockModule('@actions/cache', () => ({
+ ...real_cache_module,
+ saveCache: jest.fn(),
+ restoreCache: jest.fn()
+}));
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../src/util.js');
+jest.unstable_mockModule('../src/util.js', () => ({
+ ...real_util_module,
+ extractJdkFile: jest.fn(),
+ getDownloadArchiveExtension: jest.fn(),
+ getToolcachePath: jest.fn(),
+ isJobStatusSuccess: jest.fn(),
+ renameWinArchive: jest.fn(),
+ isVersionSatisfies: real_util_module.isVersionSatisfies,
+ getTempDir: real_util_module.getTempDir
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const cache = await import('@actions/cache');
+const {run: cleanup} = await import('../src/cleanup-java.js');
+const util = await import('../src/util.js');
+const constants = await import('../src/constants.js');
+const {GPG_HOME_PREFIX} = await import('../src/gpg.js');
+const {registerJdk, buildJdkCacheKey} = await import('../src/jdk-cache.js');
+
+const jdkTempRoots: string[] = [];
describe('cleanup', () => {
- let spyWarning: jest.SpyInstance>;
- let spyInfo: jest.SpyInstance>;
- let spyCacheSave: jest.SpyInstance<
- ReturnType,
- Parameters
- >;
- let spyJobStatusSuccess: jest.SpyInstance;
+ let spyWarning: any;
+ let spyInfo: any;
+ let spyCacheSave: any;
+ let spyJobStatusSuccess: any;
+ let spyCoreError: any;
beforeEach(() => {
- spyWarning = jest.spyOn(core, 'warning');
+ spyWarning = core.warning as jest.Mock;
spyWarning.mockImplementation(() => null);
- spyInfo = jest.spyOn(core, 'info');
+
+ spyInfo = core.info as jest.Mock;
spyInfo.mockImplementation(() => null);
- spyCacheSave = jest.spyOn(cache, 'saveCache');
- spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
+
+ spyCacheSave = cache.saveCache as jest.Mock;
+
+ spyJobStatusSuccess = util.isJobStatusSuccess as jest.Mock;
spyJobStatusSuccess.mockReturnValue(true);
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
+
createStateForSuccessfulRestore();
});
+
afterEach(() => {
+ while (jdkTempRoots.length) {
+ fs.rmSync(jdkTempRoots.pop()!, {recursive: true, force: true});
+ }
resetState();
+ jest.resetAllMocks();
+ jest.clearAllMocks();
+ jest.restoreAllMocks();
});
- it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
+ it('does not warn/fail even when the save process throws a ReserveCacheError', async () => {
spyCacheSave.mockImplementation((paths: string[], key: string) =>
Promise.reject(
new cache.ReserveCacheError(
@@ -34,35 +113,230 @@ describe('cleanup', () => {
)
)
);
- jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
return name === 'cache' ? 'gradle' : '';
});
+
await cleanup();
expect(spyCacheSave).toHaveBeenCalled();
expect(spyWarning).not.toHaveBeenCalled();
});
+ it('removes the isolated GPG home without touching unrelated key material', async () => {
+ const tempDir = util.getTempDir();
+ fs.mkdirSync(tempDir, {recursive: true});
+ const gpgHome = fs.mkdtempSync(path.join(tempDir, GPG_HOME_PREFIX));
+ const unrelatedGpgHome = fs.mkdtempSync(
+ path.join(tempDir, 'user-gpg-home-')
+ );
+ fs.writeFileSync(
+ path.join(unrelatedGpgHome, 'private.key'),
+ 'pre-existing'
+ );
+ (core.getInput as jest.Mock).mockReturnValue('');
+ (core.getState as jest.Mock).mockImplementation((name: string) =>
+ name === constants.STATE_GPG_HOME ? gpgHome : ''
+ );
+
+ await cleanup();
+
+ expect(fs.existsSync(gpgHome)).toBe(false);
+ expect(
+ fs.readFileSync(path.join(unrelatedGpgHome, 'private.key'), 'utf8')
+ ).toBe('pre-existing');
+ fs.rmSync(unrelatedGpgHome, {recursive: true, force: true});
+ });
+
+ it('makes repeated cleanup of the same GPG home idempotent', async () => {
+ const tempDir = util.getTempDir();
+ fs.mkdirSync(tempDir, {recursive: true});
+ const gpgHome = fs.mkdtempSync(path.join(tempDir, GPG_HOME_PREFIX));
+ (core.getInput as jest.Mock).mockReturnValue('');
+ (core.getState as jest.Mock).mockImplementation((name: string) =>
+ name === constants.STATE_GPG_HOME ? gpgHome : ''
+ );
+
+ await cleanup();
+ await cleanup();
+
+ expect(fs.existsSync(gpgHome)).toBe(false);
+ expect(core.setFailed).not.toHaveBeenCalled();
+ });
+
+ it('skips GPG cleanup when no home was persisted', async () => {
+ (core.getInput as jest.Mock).mockReturnValue('');
+ (core.getState as jest.Mock).mockReturnValue('');
+
+ await cleanup();
+
+ expect(spyInfo).not.toHaveBeenCalledWith(
+ 'Removing private key from isolated GPG home'
+ );
+ expect(core.setFailed).not.toHaveBeenCalled();
+ });
+
it('does not fail even though the save process throws error', async () => {
spyCacheSave.mockImplementation((paths: string[], key: string) =>
Promise.reject(new Error('Unexpected error'))
);
- jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
return name === 'cache' ? 'gradle' : '';
});
await cleanup();
expect(spyCacheSave).toHaveBeenCalled();
});
+
+ it.each(['maven', 'gradle', 'sbt'])(
+ 'does not save the %s cache in read-only mode',
+ async packageManager => {
+ createStateForSuccessfulRestoreWithWrapper(packageManager);
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ switch (name) {
+ case 'cache':
+ return packageManager;
+ case 'cache-read-only':
+ return 'true';
+ default:
+ return '';
+ }
+ });
+
+ await cleanup();
+
+ expect(spyCacheSave).not.toHaveBeenCalled();
+ expect(core.getState).toHaveBeenCalledTimes(1);
+ expect(core.getState).toHaveBeenCalledWith(constants.STATE_GPG_HOME);
+ expect(spyInfo).toHaveBeenCalledWith(
+ 'Cache saving is skipped because cache-read-only is enabled.'
+ );
+ }
+ );
+
+ it('saves the cache when read-only mode is explicitly disabled', async () => {
+ spyCacheSave.mockResolvedValue(0);
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ switch (name) {
+ case 'cache':
+ return 'maven';
+ case 'cache-read-only':
+ return 'false';
+ default:
+ return '';
+ }
+ });
+
+ await cleanup();
+
+ expect(spyCacheSave).toHaveBeenCalled();
+ });
+
+ it('saves the JDK cache without dependency caching', async () => {
+ const {key, path: jdkPath, state} = createRegisteredJdk();
+ (core.getInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'cache-jdk' ? 'true' : ''
+ );
+ (core.getState as jest.Mock).mockImplementation((name: string) =>
+ name === 'jdk-caches' ? state : ''
+ );
+ spyCacheSave.mockResolvedValue(1);
+
+ await cleanup();
+
+ expect(spyCacheSave).toHaveBeenCalledWith([jdkPath], key);
+ });
+
+ it('does not save a JDK cache when cache-jdk is disabled', async () => {
+ (core.getInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'cache-jdk' ? 'false' : ''
+ );
+
+ await cleanup();
+
+ expect(spyCacheSave).not.toHaveBeenCalled();
+ });
+
+ it.each([
+ ['', '', false],
+ ['', 'true', true],
+ ['', 'false', false],
+ ['maven', '', true],
+ ['maven', 'true', true],
+ ['maven', 'false', false]
+ ])(
+ 'uses effective JDK caching for cache=%j and cache-jdk=%j',
+ async (cacheInput, cacheJdkInput, expectedJdkSave) => {
+ const {key: jdkKey, path: jdkPath, state} = createRegisteredJdk();
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ if (name === 'cache') return cacheInput;
+ if (name === 'cache-jdk') return cacheJdkInput;
+ return '';
+ });
+ (core.getState as jest.Mock).mockImplementation((name: string) =>
+ name === 'jdk-caches' ? state : ''
+ );
+ spyCacheSave.mockResolvedValue(1);
+
+ await cleanup();
+
+ const jdkSaveCalls = spyCacheSave.mock.calls.filter(
+ ([, key]) => key === jdkKey
+ );
+ expect(jdkSaveCalls).toHaveLength(expectedJdkSave ? 1 : 0);
+ if (expectedJdkSave) {
+ expect(spyCacheSave).toHaveBeenCalledWith([jdkPath], jdkKey);
+ }
+ }
+ );
+
+ it('keeps saving the remaining JDK caches when one save fails', async () => {
+ const first = createRegisteredJdk();
+ const second = createRegisteredJdk('17.0.19+9');
+ (core.getInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'cache-jdk' ? 'true' : ''
+ );
+ (core.getState as jest.Mock).mockImplementation((name: string) =>
+ name === 'jdk-caches' ? second.state : ''
+ );
+ spyCacheSave.mockImplementation(async (paths: string[]) => {
+ if (paths[0] === first.path) {
+ throw new Error('Unexpected save failure');
+ }
+ return 1;
+ });
+
+ await cleanup();
+
+ expect(spyCacheSave).toHaveBeenCalledWith([first.path], first.key);
+ expect(spyCacheSave).toHaveBeenCalledWith([second.path], second.key);
+ expect(spyCoreError).not.toHaveBeenCalled();
+ });
+
+ it('does not save a JDK installation that was replaced after registration', async () => {
+ const {key, path: jdkPath, state, replace} = createRegisteredJdk();
+ (core.getInput as jest.Mock).mockImplementation((name: string) =>
+ name === 'cache-jdk' ? 'true' : ''
+ );
+ (core.getState as jest.Mock).mockImplementation((name: string) =>
+ name === 'jdk-caches' ? state : ''
+ );
+ spyCacheSave.mockResolvedValue(1);
+ replace();
+
+ await cleanup();
+
+ expect(spyCacheSave).not.toHaveBeenCalledWith([jdkPath], key);
+ });
});
function resetState() {
- jest.spyOn(core, 'getState').mockReset();
+ (core.getState as jest.Mock).mockReset();
}
/**
* Create states to emulate a successful restore process.
*/
function createStateForSuccessfulRestore() {
- jest.spyOn(core, 'getState').mockImplementation(name => {
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
switch (name) {
case 'cache-primary-key':
return 'setup-java-cache-primary-key';
@@ -73,3 +347,64 @@ function createStateForSuccessfulRestore() {
}
});
}
+
+function createStateForSuccessfulRestoreWithWrapper(packageManager: string) {
+ (core.getState as jest.Mock).mockImplementation((name: any) => {
+ switch (name) {
+ case 'cache-primary-key':
+ return 'setup-java-cache-primary-key';
+ case 'cache-matched-key':
+ return 'setup-java-cache-matched-key';
+ case `cache-primary-key-${packageManager}-wrapper`:
+ return `setup-java-${packageManager}-wrapper-primary-key`;
+ default:
+ return '';
+ }
+ });
+}
+
+/**
+ * Register a real JDK installation in a temporary tool cache so the post-job
+ * save sees the same installation identity that setup recorded.
+ */
+function createRegisteredJdk(version = '21.0.8+9') {
+ const root = fs.mkdtempSync(
+ path.join(os.tmpdir(), 'setup-java-cleanup-jdk-')
+ );
+ jdkTempRoots.push(root);
+ const jdkPath = path.join(
+ root,
+ 'Java_temurin_jdk',
+ version.replace('+', '-')
+ );
+ const write = (marker: string) => {
+ const architecturePath = path.join(jdkPath, 'x64');
+ fs.rmSync(architecturePath, {recursive: true, force: true});
+ fs.rmSync(`${architecturePath}.complete`, {force: true});
+ fs.mkdirSync(architecturePath, {recursive: true});
+ fs.writeFileSync(path.join(architecturePath, 'release'), marker);
+ fs.writeFileSync(`${architecturePath}.complete`, marker);
+ };
+ write('installed');
+
+ const jdk = {
+ distribution: 'temurin',
+ packageType: 'jdk',
+ architecture: 'x64',
+ version,
+ source: `sha256:${path.basename(root)}`,
+ verification: 'disabled',
+ path: jdkPath
+ };
+ registerJdk(jdk);
+ const state = (
+ (core.saveState as jest.Mock).mock.calls.at(-1) as string[]
+ )[1];
+
+ return {
+ key: buildJdkCacheKey(jdk),
+ path: jdkPath,
+ state,
+ replace: () => write('replaced-by-a-later-step')
+ };
+}
diff --git a/__tests__/data/adopt.json b/__tests__/data/adopt.json
deleted file mode 100644
index bcf140309..000000000
--- a/__tests__/data/adopt.json
+++ /dev/null
@@ -1,909 +0,0 @@
-[
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 74181,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "09b7e6ab5d5eb4b73813f4caa793a0b616d33794a17988fa6a6b7c972e8f3dd3",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.tar.gz.sha256.txt",
- "download_count": 23872,
- "link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.tar.gz.json",
- "name": "OpenJDK14U-jdk_x64_mac_hotspot_14.0.2_12.tar.gz",
- "size": 195705010
- },
- "project": "jdk",
- "scm_ref": "jdk-14.0.2+12_adopt",
- "updated_at": "2020-07-16T08:55:45Z"
- }
- ],
- "download_count": 477080,
- "id": "MDc6UmVsZWFzZTI4NjIyMDc4.+ve8KojpqJUpsA==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/tag/jdk-14.0.2%2B12",
- "release_name": "jdk-14.0.2+12",
- "release_type": "ga",
- "timestamp": "2020-07-16T08:54:16Z",
- "updated_at": "2020-07-16T08:54:16Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 12,
- "major": 14,
- "minor": 0,
- "openjdk_version": "14.0.2+12",
- "security": 2,
- "semver": "14.0.2+12"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 58023,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "b11cb192312530bcd84607631203d0c1727e672af12813078e6b525e3cce862d",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_mac_hotspot_14.0.1_7.tar.gz.sha256.txt",
- "download_count": 25276,
- "link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_mac_hotspot_14.0.1_7.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_mac_hotspot_14.0.1_7.tar.gz.json",
- "name": "OpenJDK14U-jdk_x64_mac_hotspot_14.0.1_7.tar.gz",
- "size": 195769653
- },
- "project": "jdk",
- "scm_ref": "jdk-14.0.1+7_adopt",
- "updated_at": "2020-04-20T12:54:23Z"
- }
- ],
- "download_count": 198607,
- "id": "MDc6UmVsZWFzZTI1Njc4MzEw.z3NqYG25PFlG+Q==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/tag/jdk-14.0.1%2B7",
- "release_name": "jdk-14.0.1+7",
- "release_type": "ga",
- "timestamp": "2020-04-20T12:52:51Z",
- "updated_at": "2020-04-20T12:52:51Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 7,
- "major": 14,
- "minor": 0,
- "openjdk_version": "14.0.1+7",
- "security": 1,
- "semver": "14.0.1+7.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 30069,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "d358a7ff03905282348c6c80562a4da2e04eb377b60ad2152be4c90f8d580b7f",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7/OpenJDK15U-jdk_x64_mac_hotspot_15.0.2_7.tar.gz.sha256.txt",
- "download_count": 3718,
- "link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7/OpenJDK15U-jdk_x64_mac_hotspot_15.0.2_7.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.2%2B7/OpenJDK15U-jdk_x64_mac_hotspot_15.0.2_7.tar.gz.json",
- "name": "OpenJDK15U-jdk_x64_mac_hotspot_15.0.2_7.tar.gz",
- "size": 195232978
- },
- "project": "jdk",
- "scm_ref": "jdk-15.0.2+7_adopt",
- "updated_at": "2021-01-22T17:33:20Z"
- }
- ],
- "download_count": 124226,
- "id": "MDc6UmVsZWFzZTM2NzgwOTAw.X2+6VqPND3E8CA==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/tag/jdk-15.0.2%2B7",
- "release_name": "jdk-15.0.2+7",
- "release_type": "ga",
- "timestamp": "2021-01-22T17:31:37Z",
- "updated_at": "2021-01-22T17:31:37Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 7,
- "major": 15,
- "minor": 0,
- "openjdk_version": "15.0.2+7",
- "security": 2,
- "semver": "15.0.2+7"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 24542,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "b8c2e2ad31f3d6676ea665d9505b06df15e23741847556612b40e3ee329fc046",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9.1/OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz.sha256.txt",
- "download_count": 3274,
- "link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9.1/OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9.1/OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz.json",
- "name": "OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz",
- "size": 195872839
- },
- "project": "jdk",
- "scm_ref": "jdk-15.0.1+9_adopt",
- "updated_at": "2020-12-01T16:57:47Z"
- }
- ],
- "download_count": 25378,
- "id": "MDc6UmVsZWFzZTM0NjQ2MDU4.Yj2XZf+VBGAPtw==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/tag/jdk-15.0.1%2B9.1",
- "release_name": "jdk-15.0.1+9.1",
- "release_type": "ga",
- "timestamp": "2020-12-01T16:57:26Z",
- "updated_at": "2020-12-01T16:57:26Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 9,
- "major": 15,
- "minor": 0,
- "openjdk_version": "15.0.1+9",
- "security": 1,
- "semver": "15.0.1+9.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 21675,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "d32f9429c4992cef7be559a15c542011503d6bc38c89379800cd209a9d7ec539",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9/OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz.sha256.txt",
- "download_count": 11935,
- "link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9/OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15.0.1%2B9/OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz.json",
- "name": "OpenJDK15U-jdk_x64_mac_hotspot_15.0.1_9.tar.gz",
- "size": 195773522
- },
- "project": "jdk",
- "scm_ref": "jdk-15.0.1+9_adopt",
- "updated_at": "2020-10-23T20:48:09Z"
- }
- ],
- "download_count": 308690,
- "id": "MDc6UmVsZWFzZTMyOTk4MTUx.3oazo3YGfHhF3w==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/tag/jdk-15.0.1%2B9",
- "release_name": "jdk-15.0.1+9",
- "release_type": "ga",
- "timestamp": "2020-10-23T20:46:22Z",
- "updated_at": "2020-10-23T20:46:22Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 9,
- "major": 15,
- "minor": 0,
- "openjdk_version": "15.0.1+9",
- "security": 1,
- "semver": "15.0.1+9"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 51254,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "bd1fc774232e2dfee93056a01f5765bd92ffb19d68dd548c233a82bb5c162be4",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15%2B36/OpenJDK15U-jdk_x64_mac_hotspot_15_36.tar.gz.sha256.txt",
- "download_count": 5325,
- "link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15%2B36/OpenJDK15U-jdk_x64_mac_hotspot_15_36.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-15%2B36/OpenJDK15U-jdk_x64_mac_hotspot_15_36.tar.gz.json",
- "name": "OpenJDK15U-jdk_x64_mac_hotspot_15_36.tar.gz",
- "size": 195853361
- },
- "project": "jdk",
- "scm_ref": "jdk-15+36_adopt",
- "updated_at": "2020-09-17T07:43:54Z"
- }
- ],
- "download_count": 157313,
- "id": "MDc6UmVsZWFzZTMxNDUwMjA0.eYpt0EBEjldfEQ==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/tag/jdk-15%2B36",
- "release_name": "jdk-15+36",
- "release_type": "ga",
- "timestamp": "2020-09-17T07:42:21Z",
- "updated_at": "2020-09-17T07:42:21Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 36,
- "major": 15,
- "minor": 0,
- "openjdk_version": "15+36",
- "security": 0,
- "semver": "15.0.0+36"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 27428,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "aabc3aebb0abf1ba64d9bd5796d0c7eb7239983f6e4c0f015b5b88be5616e4bd",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36/OpenJDK14U-jdk_x64_mac_hotspot_14_36.tar.gz.sha256.txt",
- "download_count": 19544,
- "link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36/OpenJDK14U-jdk_x64_mac_hotspot_14_36.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14%2B36/OpenJDK14U-jdk_x64_mac_hotspot_14_36.tar.gz.json",
- "name": "OpenJDK14U-jdk_x64_mac_hotspot_14_36.tar.gz",
- "size": 201087797
- },
- "project": "jdk",
- "scm_ref": "jdk-14+36_adopt",
- "updated_at": "2020-03-18T12:13:05Z"
- }
- ],
- "download_count": 364816,
- "id": "MDc6UmVsZWFzZTI0NjMxMDAy.AY7rtvmrnWWlIg==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/tag/jdk-14%2B36",
- "release_name": "jdk-14+36",
- "release_type": "ga",
- "timestamp": "2020-03-18T12:11:08Z",
- "updated_at": "2020-03-18T12:11:08Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 36,
- "major": 14,
- "minor": 0,
- "openjdk_version": "14+36",
- "security": 0,
- "semver": "14.0.0+36.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 63201,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "0ddb24efdf5aab541898d19b7667b149a1a64a8bd039b708fc58ee0284fa7e07",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jdk_x64_mac_hotspot_13.0.2_8.tar.gz.sha256.txt",
- "download_count": 32531,
- "link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jdk_x64_mac_hotspot_13.0.2_8.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.2%2B8/OpenJDK13U-jdk_x64_mac_hotspot_13.0.2_8.tar.gz.json",
- "name": "OpenJDK13U-jdk_x64_mac_hotspot_13.0.2_8.tar.gz",
- "size": 198206427
- },
- "project": "jdk",
- "scm_ref": "jdk-13.0.2+8_adopt",
- "updated_at": "2020-01-20T16:46:24Z"
- }
- ],
- "download_count": 349677,
- "id": "MDc6UmVsZWFzZTIyOTgxNTM1.gtZYwGfBgkb3Gg==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/tag/jdk-13.0.2%2B8",
- "release_name": "jdk-13.0.2+8",
- "release_type": "ga",
- "timestamp": "2020-01-20T16:42:35Z",
- "updated_at": "2020-01-20T16:42:35Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 8,
- "major": 13,
- "minor": 0,
- "openjdk_version": "13.0.2+8",
- "security": 2,
- "semver": "13.0.2+8.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 41508,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "9c82de98ce9bc2353bcf314d85366c9a2c572db034e10a71aa47e804e13748c1",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.1%2B9/OpenJDK13U-jdk_x64_mac_hotspot_13.0.1_9.tar.gz.sha256.txt",
- "download_count": 32262,
- "link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.1%2B9/OpenJDK13U-jdk_x64_mac_hotspot_13.0.1_9.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13.0.1%2B9/OpenJDK13U-jdk_x64_mac_hotspot_13.0.1_9.tar.gz.json",
- "name": "OpenJDK13U-jdk_x64_mac_hotspot_13.0.1_9.tar.gz",
- "size": 198205689
- },
- "project": "jdk",
- "scm_ref": "jdk-13.0.1+9_adopt",
- "updated_at": "2019-10-26T14:44:27Z"
- }
- ],
- "download_count": 680021,
- "id": "MDc6UmVsZWFzZTIwOTk4NDA0.srlG2TmLho/j0w==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/tag/jdk-13.0.1%2B9",
- "release_name": "jdk-13.0.1+9",
- "release_type": "ga",
- "timestamp": "2019-10-26T14:43:52Z",
- "updated_at": "2019-10-26T14:43:52Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 9,
- "major": 13,
- "minor": 0,
- "openjdk_version": "13.0.1+9",
- "security": 1,
- "semver": "13.0.1+9.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 37738,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "f948be96daba250b6695e22cb51372d2ba3060e4d778dd09c89548889783099f",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13%2B33/OpenJDK13U-jdk_x64_mac_hotspot_13_33.tar.gz.sha256.txt",
- "download_count": 37738,
- "link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13%2B33/OpenJDK13U-jdk_x64_mac_hotspot_13_33.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/download/jdk-13%2B33/OpenJDK13U-jdk_x64_mac_hotspot_13_33.tar.gz.json",
- "name": "OpenJDK13U-jdk_x64_mac_hotspot_13_33.tar.gz",
- "size": 198189530
- },
- "project": "jdk",
- "scm_ref": "jdk-13+33_adopt",
- "updated_at": "2019-09-19T10:20:21Z"
- }
- ],
- "download_count": 226200,
- "id": "MDc6UmVsZWFzZTIwMTA0MTUy.trK7qCbNtlMWFw==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk13-binaries/releases/tag/jdk-13%2B33",
- "release_name": "jdk-13+33",
- "release_type": "ga",
- "timestamp": "2019-09-19T10:19:58Z",
- "updated_at": "2019-09-19T10:19:58Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 33,
- "major": 13,
- "minor": 0,
- "openjdk_version": "13+33",
- "security": 0,
- "semver": "13.0.0+33.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 24493,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "9919eee037554d40c7d2f219bbd654f2bf119e16a2f4d284d8dedaf525ee59e6",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.sha256.txt",
- "download_count": 22907,
- "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.json",
- "name": "OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "size": 198392994
- },
- "project": "jdk",
- "scm_ref": "jdk-12.0.2+10_adopt",
- "updated_at": "2019-07-18T20:27:24Z"
- }
- ],
- "download_count": 396318,
- "id": "MDc6UmVsZWFzZTE4NzE2Mzk5.S/VUFSgnrVIv8A==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12.0.2%2B10",
- "release_name": "jdk-12.0.2+10",
- "release_type": "ga",
- "timestamp": "2019-07-18T20:26:29Z",
- "updated_at": "2019-07-18T20:26:29Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 10,
- "major": 12,
- "minor": 0,
- "openjdk_version": "12.0.2+10",
- "security": 2,
- "semver": "12.0.2+10.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 5539,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "7acd697e816491d31b24d0ae1867fd63060aa738cfa388757946ae312a60b4f2",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10.3/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.sha256.txt",
- "download_count": 5539,
- "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10.3/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10.3/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.json",
- "name": "OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "size": 198429049
- },
- "project": "jdk",
- "scm_ref": "jdk-12.0.2+10_adopt",
- "updated_at": "2019-09-19T17:17:37Z"
- }
- ],
- "download_count": 5879,
- "id": "MDc6UmVsZWFzZTIwMTE2ODQ3.QGQl8Nj1qkma4Q==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12.0.2%2B10.3",
- "release_name": "jdk-12.0.2+10.3",
- "release_type": "ga",
- "timestamp": "2019-09-19T17:17:26Z",
- "updated_at": "2019-12-06T15:10:37Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 3,
- "build": 10,
- "major": 12,
- "minor": 0,
- "openjdk_version": "12.0.2+10",
- "security": 2,
- "semver": "12.0.2+10.3"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 22794,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "2c1a46c0fab6d4bdbc443f23c3f6a313c2de47fbbd9c16b5c1133a88f6c1ab8f",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10.2/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.sha256.txt",
- "download_count": 637,
- "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10.2/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10.2/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.json",
- "name": "OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "size": 198862174
- },
- "project": "jdk",
- "scm_ref": "jdk-12.0.2+10_adopt",
- "updated_at": "2019-08-06T10:41:10Z"
- }
- ],
- "download_count": 23563,
- "id": "MDc6UmVsZWFzZTE5MTAzMTI3.in65dKG+veAxOg==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12.0.2%2B10.2",
- "release_name": "jdk-12.0.2+10.2",
- "release_type": "ga",
- "timestamp": "2019-08-06T10:40:44Z",
- "updated_at": "2019-08-06T10:40:44Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 2,
- "build": 10,
- "major": 12,
- "minor": 0,
- "openjdk_version": "12.0.2+10",
- "security": 2,
- "semver": "12.0.2+10.2"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 24493,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "9919eee037554d40c7d2f219bbd654f2bf119e16a2f4d284d8dedaf525ee59e6",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.sha256.txt",
- "download_count": 22907,
- "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.2%2B10/OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz.json",
- "name": "OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.tar.gz",
- "size": 198392994
- },
- "project": "jdk",
- "scm_ref": "jdk-12.0.2+9_adopt",
- "updated_at": "2019-07-18T20:27:24Z"
- }
- ],
- "download_count": 396318,
- "id": "MDc6UmVsZWFzZTE4NzE2Mzk5.S/VUFSgnrVIv8A==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12.0.2%2B10",
- "release_name": "jdk-12.0.2+9",
- "release_type": "ga",
- "timestamp": "2019-07-18T20:26:29Z",
- "updated_at": "2019-07-18T20:26:29Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 10,
- "major": 12,
- "minor": 0,
- "openjdk_version": "12.0.2+9",
- "security": 2,
- "semver": "12.0.2+9.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 39519,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "dcb2ab681247298eda018df24166ba01674127083fb02892acf087e6181d8c56",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.1%2B12/OpenJDK12U-jdk_x64_mac_hotspot_12.0.1_12.tar.gz.sha256.txt",
- "download_count": 33306,
- "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12.0.1%2B12/OpenJDK12U-jdk_x64_mac_hotspot_12.0.1_12.tar.gz",
- "name": "OpenJDK12U-jdk_x64_mac_hotspot_12.0.1_12.tar.gz",
- "size": 198112975
- },
- "project": "jdk",
- "updated_at": "2019-04-21T15:12:34Z"
- }
- ],
- "download_count": 1038669,
- "id": "MDc6UmVsZWFzZTE2ODg3NDU3",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12.0.1%2B12",
- "release_name": "jdk-12.0.1+12",
- "release_type": "ga",
- "timestamp": "2019-04-21T15:11:56Z",
- "updated_at": "2019-04-21T15:11:56Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 12,
- "major": 12,
- "minor": 0,
- "openjdk_version": "12.0.1+12",
- "security": 1,
- "semver": "12.0.1+12"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 3136,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "985036459d4ef0867a3fe83b0bf87877d8e66a121c7b9c145bb97bd921aaf3f1",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12%2B33/OpenJDK12U-jdk_x64_mac_hotspot_12_33.tar.gz.sha256.txt",
- "download_count": 1905,
- "link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/download/jdk-12%2B33/OpenJDK12U-jdk_x64_mac_hotspot_12_33.tar.gz",
- "name": "OpenJDK12U-jdk_x64_mac_hotspot_12_33.tar.gz",
- "size": 198099074
- },
- "project": "jdk",
- "updated_at": "2019-03-22T12:09:13Z"
- }
- ],
- "download_count": 757289,
- "id": "MDc6UmVsZWFzZTE2MjgyMjM2",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk12-binaries/releases/tag/jdk-12%2B33",
- "release_name": "jdk-12+33",
- "release_type": "ga",
- "timestamp": "2019-03-22T12:08:43Z",
- "updated_at": "2019-03-22T12:08:43Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 33,
- "major": 12,
- "minor": 0,
- "openjdk_version": "12+33",
- "security": 0,
- "semver": "12.0.0+33"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 75576,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "ee7c98c9d79689aca6e717965747b8bf4eec5413e89d5444cc2bd6dbd59e3811",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_mac_hotspot_11.0.10_9.tar.gz.sha256.txt",
- "download_count": 17426,
- "link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_mac_hotspot_11.0.10_9.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_mac_hotspot_11.0.10_9.tar.gz.json",
- "name": "OpenJDK11U-jdk_x64_mac_hotspot_11.0.10_9.tar.gz",
- "size": 186160219
- },
- "project": "jdk",
- "scm_ref": "jdk-11.0.10+9_adopt",
- "updated_at": "2021-01-22T14:16:47Z"
- }
- ],
- "download_count": 636180,
- "id": "MDc6UmVsZWFzZTM2NzcwNDUy.hAVJRiZZTufG+w==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.10%2B9",
- "release_name": "jdk-11.0.10+9",
- "release_type": "ga",
- "timestamp": "2021-01-22T14:15:12Z",
- "updated_at": "2021-01-22T14:15:12Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 9,
- "major": 11,
- "minor": 0,
- "openjdk_version": "11.0.10+9",
- "security": 10,
- "semver": "11.0.10+9"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 108441,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "96bc469f9b02a3b84382a0685b0bd7935e1ad1bd82a0aab9befb5b42a17cbd77",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9.1%2B1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.tar.gz.sha256.txt",
- "download_count": 22211,
- "link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9.1%2B1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9.1%2B1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.tar.gz.json",
- "name": "OpenJDK11U-jdk_x64_mac_hotspot_11.0.9.1_1.tar.gz",
- "size": 185368626
- },
- "project": "jdk",
- "scm_ref": "jdk-11.0.9.1+1_adopt",
- "updated_at": "2020-11-12T14:10:45Z"
- }
- ],
- "download_count": 815676,
- "id": "MDc6UmVsZWFzZTMzODU4MDE1.94IbKUd3vvhzsA==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.9.1%2B1",
- "release_name": "jdk-11.0.9.1+1",
- "release_type": "ga",
- "timestamp": "2020-11-12T14:08:55Z",
- "updated_at": "2020-11-12T14:08:55Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 1,
- "major": 11,
- "minor": 0,
- "openjdk_version": "11.0.9.1+1",
- "patch": 1,
- "security": 9,
- "semver": "11.0.9+101"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 45450,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "7b21961ffb2649e572721a0dfad64169b490e987937b661cb4e13a594c21e764",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11.1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz.sha256.txt",
- "download_count": 11117,
- "link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11.1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11.1/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz.json",
- "name": "OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz",
- "size": 186006796
- },
- "project": "jdk",
- "scm_ref": "jdk-11.0.9+11_adopt",
- "updated_at": "2020-10-25T14:43:54Z"
- }
- ],
- "download_count": 423635,
- "id": "MDc6UmVsZWFzZTMzMDI4MDcz.dRvNNRwJCgY3Xw==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.9%2B11.1",
- "release_name": "jdk-11.0.9+11.1",
- "release_type": "ga",
- "timestamp": "2020-10-25T13:31:15Z",
- "updated_at": "2020-10-25T13:31:15Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "adopt_build_number": 1,
- "build": 11,
- "major": 11,
- "minor": 0,
- "openjdk_version": "11.0.9+11",
- "security": 9,
- "semver": "11.0.9+11.1"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 2456,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "e84b00d74f08f059829bbf121c8423dc37ff65135968c1fcda5839600be4f542",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz.sha256.txt",
- "download_count": 1046,
- "link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.9%2B11/OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz.json",
- "name": "OpenJDK11U-jdk_x64_mac_hotspot_11.0.9_11.tar.gz",
- "size": 185532704
- },
- "project": "jdk",
- "scm_ref": "jdk-11.0.9+11_adopt",
- "updated_at": "2020-10-25T13:28:33Z"
- }
- ],
- "download_count": 359580,
- "id": "MDc6UmVsZWFzZTMyOTk4MzM5.6h9TT9pzYTK2Kg==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.9%2B11",
- "release_name": "jdk-11.0.9+11",
- "release_type": "ga",
- "timestamp": "2020-10-23T20:52:14Z",
- "updated_at": "2020-10-23T20:52:14Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 11,
- "major": 11,
- "minor": 0,
- "openjdk_version": "11.0.9+11",
- "security": 9,
- "semver": "11.0.9+11"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 149393,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "4a8dadd58cdc32c7e59978971d56aec610be7ee0ddf0dc1d137bb8b78456499f",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz.sha256.txt",
- "download_count": 40158,
- "link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz.json",
- "name": "OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz",
- "size": 185054456
- },
- "project": "jdk",
- "scm_ref": "jdk-11.0.8+10_adopt",
- "updated_at": "2020-07-15T14:30:51Z"
- }
- ],
- "download_count": 1968658,
- "id": "MDc6UmVsZWFzZTI4NTg5Nzcz.pCNBA7G9E1o7pw==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.8%2B10",
- "release_name": "jdk-11.0.8+10",
- "release_type": "ga",
- "timestamp": "2020-07-15T14:29:27Z",
- "updated_at": "2020-07-15T14:29:27Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 10,
- "major": 11,
- "minor": 0,
- "openjdk_version": "11.0.8+10",
- "security": 8,
- "semver": "11.0.8+10"
- }
- },
- {
- "binaries": [],
- "download_count": 1968658,
- "id": "MDc6UmVsZWFzZTI4NTg5Nzcz.pCNBA7G9E1o7pw==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.8%2B10",
- "release_name": "jdk-11.0.8+10",
- "release_type": "ga",
- "timestamp": "2020-07-15T14:29:27Z",
- "updated_at": "2020-07-15T14:29:27Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 10,
- "major": 9,
- "minor": 0,
- "openjdk_version": "9.0.8+10",
- "security": 8,
- "semver": "9.0.8+10"
- }
- },
- {
- "binaries": [
- {
- "architecture": "x64",
- "download_count": 149393,
- "heap_size": "normal",
- "image_type": "jdk",
- "jvm_impl": "hotspot",
- "os": "mac",
- "package": {
- "checksum": "4a8dadd58cdc32c7e59978971d56aec610be7ee0ddf0dc1d137bb8b78456499f",
- "checksum_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz.sha256.txt",
- "download_count": 40158,
- "link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz",
- "metadata_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz.json",
- "name": "OpenJDK11U-jdk_x64_mac_hotspot_11.0.8_10.tar.gz",
- "size": 185054456
- },
- "project": "jdk",
- "scm_ref": "jdk-11.0.8+10_adopt",
- "updated_at": "2020-07-15T14:30:51Z"
- }
- ],
- "download_count": 1968658,
- "id": "MDc6UmVsZWFzZTI4NTg5Nzcz.pCNBA7G9E1o7pw==",
- "release_link": "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/tag/jdk-11.0.8%2B10",
- "release_name": "jdk-11.0.8+10",
- "release_type": "ga",
- "timestamp": "2020-07-15T14:29:27Z",
- "updated_at": "2020-07-15T14:29:27Z",
- "vendor": "adoptopenjdk",
- "version_data": {
- "build": 10,
- "major": 9,
- "minor": 0,
- "openjdk_version": "9.0.8+10",
- "security": 8,
- "semver": "9.0.7+10"
- }
- }
-]
\ No newline at end of file
diff --git a/__tests__/data/kona.json b/__tests__/data/kona.json
new file mode 100644
index 000000000..7dc24c38d
--- /dev/null
+++ b/__tests__/data/kona.json
@@ -0,0 +1,202 @@
+{
+ "8": [
+ {
+ "version": "8.0.20",
+ "jdkVersion": "8u432",
+ "latest": true,
+ "baseUrl": "https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/",
+ "files": [
+ {
+ "os": "linux",
+ "arch": "aarch64",
+ "filename": "TencentKona8.0.20.b1_jdk_linux-aarch64_8u432.tar.gz",
+ "checksum": "8e6ab38b17f98d7ba727037cb49bbd174f3103a6ddacafb1fb7c0231006a80a7"
+ },
+ {
+ "os": "linux",
+ "arch": "x86_64",
+ "filename": "TencentKona8.0.20.b1_jdk_linux-x86_64_8u432.tar.gz",
+ "checksum": "384cdb36b38993f4b7292682a5dfd8d5d33ba7bdbca2d95018d1341c792d2823"
+ },
+ {
+ "os": "macos",
+ "arch": "aarch64",
+ "filename": "TencentKona8.0.20.b1_jdk_macosx-aarch64_8u432_notarized.tar.gz",
+ "checksum": "829c46691a4b519f14fedfcdca32a94d7793d3570c4a51b3a5072cc394619f25"
+ },
+ {
+ "os": "macos",
+ "arch": "x86_64",
+ "filename": "TencentKona8.0.20.b1_jdk_macosx-x86_64_8u432_notarized.tar.gz",
+ "checksum": ""
+ },
+ {
+ "os": "windows",
+ "arch": "x86_64",
+ "filename": "TencentKona8.0.20.b1_jdk_windows-x86_64_8u432_signed.zip",
+ "checksum": "339646817254dbcb5c17904807bbfdeafaa8e4bac9f2aae25434870cdeaba296"
+ }
+ ]
+ }
+ ],
+ "11": [
+ {
+ "version": "11.0.25",
+ "jdkVersion": "11.0.25",
+ "latest": true,
+ "baseUrl": "https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/",
+ "files": [
+ {
+ "os": "linux",
+ "arch": "aarch64",
+ "filename": "TencentKona-11.0.25.b1-jdk_linux-aarch64.tar.gz",
+ "checksum": "887ca5eeb675dd9b9d22833a8b0c1031ee1a031227d6cf2d8c1920cc585d2b71"
+ },
+ {
+ "os": "linux",
+ "arch": "x86_64",
+ "filename": "TencentKona-11.0.25.b1-jdk_linux-x86_64.tar.gz",
+ "checksum": "6642d7cccf98f33b3ec55cdbf77979c614f0d3cbbd282e8d0df52233edc52f9a"
+ },
+ {
+ "os": "macos",
+ "arch": "aarch64",
+ "filename": "TencentKona-11.0.25.b1_jdk_macosx-aarch64_notarized.tar.gz",
+ "checksum": "8f07242d3191a35c3b2fca1122f315518c7312f0155e98ac7ae39ea083f93e21"
+ },
+ {
+ "os": "macos",
+ "arch": "x86_64",
+ "filename": "TencentKona-11.0.25.b1_jdk_macosx-x86_64_notarized.tar.gz",
+ "checksum": "0832b93d8d8122cb72db85321ddd85c9a6086e0f28327733fc2da3c0ecc9c455"
+ },
+ {
+ "os": "windows",
+ "arch": "x86_64",
+ "filename": "TencentKona-11.0.25.b1_jdk_windows-x86_64_signed.zip",
+ "checksum": "05c470c5da4b3bc1844117f611ecd241d3ae9e5d01c17ffafffde0f23825aad7"
+ }
+ ]
+ }
+ ],
+ "17": [
+ {
+ "version": "17.0.13",
+ "jdkVersion": "17.0.13",
+ "latest": true,
+ "baseUrl": "https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/",
+ "files": [
+ {
+ "os": "linux",
+ "arch": "aarch64",
+ "filename": "TencentKona-17.0.13.b1-jdk_linux-aarch64.tar.gz",
+ "checksum": "372411dff5b42f6e419f1dd40772d98141a15c3d180ed1af6f2b49bdbbd32d52"
+ },
+ {
+ "os": "linux",
+ "arch": "x86_64",
+ "filename": "TencentKona-17.0.13.b1-jdk_linux-x86_64.tar.gz",
+ "checksum": "b54bb023d1187737b23ca34d0857d2d40822b14e38d28c7948c8ff6b5927e523"
+ },
+ {
+ "os": "macos",
+ "arch": "aarch64",
+ "filename": "TencentKona-17.0.13.b1_jdk_macosx-aarch64_notarized.tar.gz",
+ "checksum": "22f5d296c407fc137e6af9ce275e662346ca82f1a5acfc407247efd8cedf5256"
+ },
+ {
+ "os": "macos",
+ "arch": "x86_64",
+ "filename": "TencentKona-17.0.13.b1_jdk_macosx-x86_64_notarized.tar.gz",
+ "checksum": "87ace41ac9718f2a9512b24bad0f735bc5ac61b8198b4cd5634199f124883b36"
+ },
+ {
+ "os": "windows",
+ "arch": "x86_64",
+ "filename": "TencentKona-17.0.13.b1_jdk_windows-x86_64_signed.zip",
+ "checksum": "616089018151e8e5daf8e88276063633a2cb28a718a2afce49bb8fc10541e83d"
+ }
+ ]
+ }
+ ],
+ "21": [
+ {
+ "version": "21.0.5",
+ "jdkVersion": "21.0.5",
+ "latest": true,
+ "baseUrl": "https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/",
+ "files": [
+ {
+ "os": "linux",
+ "arch": "aarch64",
+ "filename": "TencentKona-21.0.5.b1-jdk_linux-aarch64.tar.gz",
+ "checksum": "d8ca108147db3f19134d7aa995bac14e1fb3d124b0300a9a7893266a8f028104"
+ },
+ {
+ "os": "linux",
+ "arch": "x86_64",
+ "filename": "TencentKona-21.0.5.b1-jdk_linux-x86_64.tar.gz",
+ "checksum": "afae039d9666fadcb84940c5350b29cd061019b0cc43700f0bf0342320892adf"
+ },
+ {
+ "os": "macos",
+ "arch": "aarch64",
+ "filename": "TencentKona-21.0.5.b1_jdk_macosx-aarch64_notarized.tar.gz",
+ "checksum": "7621a218767bfbd3023b176dc6d9dd019677f8efec0d48a4eb2b2ed2b50bd1fb"
+ },
+ {
+ "os": "macos",
+ "arch": "x86_64",
+ "filename": "TencentKona-21.0.5.b1_jdk_macosx-x86_64_notarized.tar.gz",
+ "checksum": "6c54d46f979ad998b708f664c5aeeeef855660ef527d584a7c2930951cca9999"
+ },
+ {
+ "os": "windows",
+ "arch": "x86_64",
+ "filename": "TencentKona-21.0.5.b1_jdk_windows-x86_64_signed.zip",
+ "checksum": "ee1ee730fc5e02268d91b9df602b65122dad25b3d3898069331ebc8338005da1"
+ }
+ ]
+ }
+ ],
+ "25": [
+ {
+ "version": "25.0.3",
+ "jdkVersion": "25.0.3",
+ "latest": true,
+ "baseUrl": "https://github.com/Tencent/TencentKona-25/releases/download/TencentKona-25.0.3/",
+ "files": [
+ {
+ "os": "linux",
+ "arch": "aarch64",
+ "filename": "TencentKona-25.0.3.b1-jdk_linux-aarch64.tar.gz",
+ "checksum": "2fb77e3ba9c00045ca497ea22210f18dae4bf7df4c87029f5abadd42a5daf8c7"
+ },
+ {
+ "os": "linux",
+ "arch": "x86_64",
+ "filename": "TencentKona-25.0.3.b1-jdk_linux-x86_64.tar.gz",
+ "checksum": "47445e6fad020e834055a705bb48fa3cd0727a2c57ad6f1c5206a45f4efb2d67"
+ },
+ {
+ "os": "macos",
+ "arch": "aarch64",
+ "filename": "TencentKona-25.0.3.b1_jdk_macosx-aarch64_notarized.tar.gz",
+ "checksum": "e29405eff95da412ed7ecc890e6ef5ebbfcd9ab334005b3d32d1700bbe4204d2"
+ },
+ {
+ "os": "macos",
+ "arch": "x86_64",
+ "filename": "TencentKona-25.0.3.b1_jdk_macosx-x86_64_notarized.tar.gz",
+ "checksum": "d512db5c079db16bd3a9c86d9cb979808994e90e4de29e17d27e5219fe488659"
+ },
+ {
+ "os": "windows",
+ "arch": "x86_64",
+ "filename": "TencentKona-25.0.3.b1_jdk_windows-x86_64_signed.zip",
+ "checksum": "865bce92ccbbca75115076e618a98baa1d0f30fcccdce954c0a22bee33d6ae83"
+ }
+ ]
+ }
+ ]
+}
diff --git a/__tests__/data/liberica-nik.json b/__tests__/data/liberica-nik.json
new file mode 100644
index 000000000..e5d920515
--- /dev/null
+++ b/__tests__/data/liberica-nik.json
@@ -0,0 +1,739 @@
+[
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.1+3-25.0.1+16/bellsoft-liberica-vm-openjdk25.0.1+16-25.0.1+3-linux-amd64.tar.gz",
+ "version": "25.0.1+3",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "25.0.1+16",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.1.0+1-23+38/bellsoft-liberica-vm-openjdk23+38-24.1.0+1-linux-amd64.tar.gz",
+ "version": "24.1.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "23+38",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.2/bellsoft-liberica-vm-openjdk11.0.15.1+2-21.3.2+2-linux-amd64.tar.gz",
+ "version": "21.3.2+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.15.1+2",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.0/bellsoft-liberica-vm-openjdk17.0.5+8-22.3.0+2-linux-amd64.tar.gz",
+ "version": "22.3.0+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.5+8",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.9+1-17.0.16+13/bellsoft-liberica-vm-openjdk17.0.16+13-23.0.9+1-linux-amd64.tar.gz",
+ "version": "23.0.9+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.16+13",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-openjdk17.0.7+7-23.0.0+1-src.tar.gz",
+ "version": "23.0.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.7+7",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.2+1-25.0.2+13/bellsoft-liberica-vm-openjdk25.0.2+13-25.0.2+1-linux-amd64.tar.gz",
+ "version": "25.0.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "25.0.2+13",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.1.1+1-23.0.1+13/bellsoft-liberica-vm-openjdk23.0.1+13-24.1.1+1-linux-amd64.tar.gz",
+ "version": "24.1.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "23.0.1+13",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.12+1-17.0.19+12/bellsoft-liberica-vm-openjdk17.0.19+12-23.0.12+1-linux-amd64.tar.gz",
+ "version": "23.0.12+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.19+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.3+1-17.0.10+13/bellsoft-liberica-vm-openjdk17.0.10+13-23.0.3+1-linux-amd64.tar.gz",
+ "version": "23.0.3+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.10+13",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.2/bellsoft-liberica-vm-openjdk11-21.3.2-src.tar.gz",
+ "version": "21.3.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.15+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.3/bellsoft-liberica-vm-openjdk11.0.20+8-22.3.3+1-src.tar.gz",
+ "version": "22.3.3+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.20+8",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.8+1-17.0.15+10/bellsoft-liberica-vm-openjdk17.0.15+10-23.0.8+1-linux-amd64.tar.gz",
+ "version": "23.0.8+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.15+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.3/bellsoft-liberica-vm-openjdk17.0.4-21.3.3-src.tar.gz",
+ "version": "21.3.3+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.4+8",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.7+1-21.0.7+9/bellsoft-liberica-vm-openjdk21.0.7+9-23.1.7+1-linux-amd64.tar.gz",
+ "version": "23.1.7+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.7+9",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.8+1-21.0.8+13/bellsoft-liberica-vm-openjdk21.0.8+13-23.1.8+1-linux-amd64.tar.gz",
+ "version": "23.1.8+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.8+13",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.0.0.2/bellsoft-liberica-vm-openjdk11-21.0.0.2-src.tar.gz",
+ "version": "21.0.0.2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.10+9",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/23.0.1/bellsoft-liberica-vm-openjdk17.0.8+7-23.0.1+1-linux-amd64.tar.gz",
+ "version": "23.0.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.8+7",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.0.0+1-22+37/bellsoft-liberica-vm-openjdk22+37-24.0.0+1-linux-amd64.tar.gz",
+ "version": "24.0.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "22+37",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.1.0/bellsoft-liberica-vm-openjdk17-22.1.0-src.tar.gz",
+ "version": "22.1.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.3+7",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.0.2+1-22.0.2+11/bellsoft-liberica-vm-openjdk22.0.2+11-24.0.2+1-linux-amd64.tar.gz",
+ "version": "24.0.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "22.0.2+11",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/23.0.1/bellsoft-liberica-vm-openjdk20.0.2+10-23.0.1+1-src.tar.gz",
+ "version": "23.0.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "20.0.2+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/23.1.0/bellsoft-liberica-vm-openjdk21+37-23.1.0+1-linux-amd64.tar.gz",
+ "version": "23.1.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21+37",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.4+3-21.0.4+9/bellsoft-liberica-vm-openjdk21.0.4+9-23.1.4+3-linux-amd64.tar.gz",
+ "version": "23.1.4+3",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.4+9",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.3/bellsoft-liberica-vm-openjdk11.0.20.1+1-22.3.3+2-linux-amd64.tar.gz",
+ "version": "22.3.3+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.20.1+1",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.4+1-17.0.11+10/bellsoft-liberica-vm-openjdk17.0.11+10-23.0.4+1-linux-amd64.tar.gz",
+ "version": "23.0.4+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.11+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.1.2+1-23.0.2+9/bellsoft-liberica-vm-openjdk23.0.2+9-24.1.2+1-linux-amd64.tar.gz",
+ "version": "24.1.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "23.0.2+9",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.10+1-17.0.17+12/bellsoft-liberica-vm-openjdk17.0.17+12-23.0.10+1-linux-amd64.tar.gz",
+ "version": "23.0.10+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.17+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.1/bellsoft-liberica-vm-openjdk11.0.18+10-22.3.1+1-src.tar.gz",
+ "version": "22.3.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.18+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.0.0.2/bellsoft-liberica-vm-openjdk17-22.0.0.2-src.tar.gz",
+ "version": "22.0.0.2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.2+9",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.0.0.2/bellsoft-liberica-vm-openjdk11-22.0.0.2-linux-amd64.tar.gz",
+ "version": "22.0.0.2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.14.1+1",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.1+2-25.0.1+14/bellsoft-liberica-vm-openjdk25.0.1+14-25.0.1+2-linux-amd64.tar.gz",
+ "version": "25.0.1+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "25.0.1+14",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.3/bellsoft-liberica-vm-openjdk11.0.16-21.3.3-src.tar.gz",
+ "version": "21.3.3+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.16+8",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.5+1-21.0.5+11/bellsoft-liberica-vm-openjdk21.0.5+11-23.1.5+1-linux-amd64.tar.gz",
+ "version": "23.1.5+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.5+11",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.4/bellsoft-liberica-vm-openjdk17.0.9+11-22.3.4+1-linux-amd64.tar.gz",
+ "version": "22.3.4+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.9+11",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.0+1-25+37/bellsoft-liberica-vm-openjdk25+37-25.0.0+1-linux-amd64.tar.gz",
+ "version": "25.0.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "25+37",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.3/bellsoft-liberica-vm-openjdk17.0.8.1+1-22.3.3+2-linux-amd64.tar.gz",
+ "version": "22.3.3+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.8.1+1",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.3+1-21.0.3+10/bellsoft-liberica-vm-openjdk21.0.3+10-23.1.3+1-linux-amd64.tar.gz",
+ "version": "23.1.3+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.3+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.2.0+1-24+37/bellsoft-liberica-vm-openjdk24+37-24.2.0+1-linux-amd64.tar.gz",
+ "version": "24.2.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "24+37",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/23.1.1/bellsoft-liberica-vm-openjdk21.0.1+12-23.1.1+1-linux-amd64.tar.gz",
+ "version": "23.1.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.1+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.3/bellsoft-liberica-vm-openjdk17.0.4.1-21.3.3-src.tar.gz",
+ "version": "21.3.3+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.4.1+1",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.11+2-21.0.11+12/bellsoft-liberica-vm-openjdk21.0.11+12-23.1.11+2-linux-amd64.tar.gz",
+ "version": "23.1.11+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.11+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.2/bellsoft-liberica-vm-openjdk11.0.19+7-22.3.2+1-src.tar.gz",
+ "version": "22.3.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.19+7",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.4/bellsoft-liberica-vm-openjdk11.0.21+10-22.3.4+1-src.tar.gz",
+ "version": "22.3.4+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.21+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.3+2-25.0.3+12/bellsoft-liberica-vm-openjdk25.0.3+12-25.0.3+2-linux-amd64.tar.gz",
+ "version": "25.0.3+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "25.0.3+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.2/bellsoft-liberica-vm-openjdk17.0.3.1+2-21.3.2+2-linux-amd64.tar.gz",
+ "version": "21.3.2+2",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.3.1+2",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.2.1+1-24.0.1+11/bellsoft-liberica-vm-openjdk24.0.1+11-24.2.1+1-linux-amd64.tar.gz",
+ "version": "24.2.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "24.0.1+11",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.2.0/bellsoft-liberica-vm-openjdk11.0.16.1+1-22.2.0+3-linux-amd64.tar.gz",
+ "version": "22.2.0+3",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.16.1+1",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.6+1-17.0.13+12/bellsoft-liberica-vm-openjdk17.0.13+12-23.0.6+1-linux-amd64.tar.gz",
+ "version": "23.0.6+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.13+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/23.0.0/bellsoft-liberica-vm-openjdk20.0.1+10-23.0.0+1-linux-amd64.tar.gz",
+ "version": "23.0.0+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "20.0.1+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.10+1-21.0.10+11/bellsoft-liberica-vm-openjdk21.0.10+11-23.1.10+1-linux-amd64.tar.gz",
+ "version": "23.1.10+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.10+11",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/22.3.1/bellsoft-liberica-vm-openjdk17.0.6+10-22.3.1+1-src.tar.gz",
+ "version": "22.3.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.6+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.0/bellsoft-liberica-vm-openjdk17-21.3.0-src.tar.gz",
+ "version": "21.3.0",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.1+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.0/bellsoft-liberica-vm-openjdk11-21.3.0-src.tar.gz",
+ "version": "21.3.0",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.13+8",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.0.1+1-22.0.1+10/bellsoft-liberica-vm-openjdk22.0.1+10-24.0.1+1-linux-amd64.tar.gz",
+ "version": "24.0.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "22.0.1+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.7+1-17.0.14+10/bellsoft-liberica-vm-openjdk17.0.14+10-23.0.7+1-linux-amd64.tar.gz",
+ "version": "23.0.7+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.14+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.1.0/bellsoft-liberica-vm-openjdk11-21.1.0-src.tar.gz",
+ "version": "21.1.0",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.11+9",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.6+1-21.0.6+10/bellsoft-liberica-vm-openjdk21.0.6+10-23.1.6+1-linux-amd64.tar.gz",
+ "version": "23.1.6+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.6+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/25.0.1+1-25.0.1+12/bellsoft-liberica-vm-openjdk25.0.1+12-25.0.1+1-linux-amd64.tar.gz",
+ "version": "25.0.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "25.0.1+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.9+1-21.0.9+12/bellsoft-liberica-vm-openjdk21.0.9+12-23.1.9+1-linux-amd64.tar.gz",
+ "version": "23.1.9+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.9+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/22.3.5+1-11.0.22+12/bellsoft-liberica-vm-openjdk11.0.22+12-22.3.5+1-linux-amd64.tar.gz",
+ "version": "22.3.5+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.22+12",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.5+1-17.0.12+10/bellsoft-liberica-vm-openjdk17.0.12+10-23.0.5+1-linux-amd64.tar.gz",
+ "version": "23.0.5+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.12+10",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.3.3.1/bellsoft-liberica-vm-openjdk11.0.17+7-21.3.3.1+1-linux-amd64.tar.gz",
+ "version": "21.3.3.1+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.17+7",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://download.bell-sw.com/vm/21.2.0/bellsoft-liberica-vm-openjdk11-21.2.0-linux-amd64.tar.gz",
+ "version": "21.2.0",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "11.0.12+7",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.0.11+1-17.0.18+11/bellsoft-liberica-vm-openjdk17.0.18+11-23.0.11+1-linux-amd64.tar.gz",
+ "version": "23.0.11+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "17.0.18+11",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/23.1.2+1-21.0.2+14/bellsoft-liberica-vm-openjdk21.0.2+14-23.1.2+1-linux-amd64.tar.gz",
+ "version": "23.1.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "21.0.2+14",
+ "embedded": true
+ }
+ ]
+ },
+ {
+ "downloadUrl": "https://github.com/bell-sw/LibericaNIK/releases/download/24.2.2+1-24.0.2+13/bellsoft-liberica-vm-openjdk24.0.2+13-24.2.2+1-linux-amd64.tar.gz",
+ "version": "24.2.2+1",
+ "components": [
+ {
+ "component": "liberica",
+ "version": "24.0.2+13",
+ "embedded": true
+ }
+ ]
+ }
+]
diff --git a/__tests__/data/microsoft.json b/__tests__/data/microsoft.json
index b2f0e68a1..b67b9447d 100644
--- a/__tests__/data/microsoft.json
+++ b/__tests__/data/microsoft.json
@@ -79,6 +79,49 @@
}
]
},
+ {
+ "version": "17.0.18",
+ "stable": true,
+ "release_url": "https://aka.ms/download-jdk",
+ "files": [
+ {
+ "filename": "microsoft-jdk-17.0.18-macos-x64.tar.gz",
+ "arch": "x64",
+ "platform": "darwin",
+ "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-x64.tar.gz"
+ },
+ {
+ "filename": "microsoft-jdk-17.0.18-linux-x64.tar.gz",
+ "arch": "x64",
+ "platform": "linux",
+ "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-x64.tar.gz"
+ },
+ {
+ "filename": "microsoft-jdk-17.0.18-windows-x64.zip",
+ "arch": "x64",
+ "platform": "win32",
+ "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-x64.zip"
+ },
+ {
+ "filename": "microsoft-jdk-17.0.18-macos-aarch64.tar.gz",
+ "arch": "aarch64",
+ "platform": "darwin",
+ "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-aarch64.tar.gz"
+ },
+ {
+ "filename": "microsoft-jdk-17.0.18-linux-aarch64.tar.gz",
+ "arch": "aarch64",
+ "platform": "linux",
+ "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-aarch64.tar.gz"
+ },
+ {
+ "filename": "microsoft-jdk-17.0.18-windows-aarch64.zip",
+ "arch": "aarch64",
+ "platform": "win32",
+ "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-aarch64.zip"
+ }
+ ]
+ },
{
"version": "17.0.7",
"stable": true,
diff --git a/__tests__/data/redhat-package-details.json b/__tests__/data/redhat-package-details.json
new file mode 100644
index 000000000..5a954df45
--- /dev/null
+++ b/__tests__/data/redhat-package-details.json
@@ -0,0 +1,11 @@
+{
+ "result": [
+ {
+ "filename": "java-21-openjdk-21.0.8.0.9-1.portable.jdk.x86_64.tar.xz",
+ "direct_download_uri": "https://developers.redhat.com/content-gateway/file/pub/openjdk/java-21-openjdk-21.0.8.0.9-1.portable.jdk.x86_64.tar.xz",
+ "checksum": "91a6f3284cbded9de17f65985a4fca48dd4fd0aa295162178631c23ade335aad",
+ "checksum_type": "sha256"
+ }
+ ],
+ "message": ""
+}
diff --git a/__tests__/data/redhat-packages.json b/__tests__/data/redhat-packages.json
new file mode 100644
index 000000000..427551e32
--- /dev/null
+++ b/__tests__/data/redhat-packages.json
@@ -0,0 +1,71 @@
+{
+ "result": [
+ {
+ "id": "redhat-21.0.8-jdk-linux-x64",
+ "archive_type": "tar.xz",
+ "distribution": "redhat",
+ "java_version": "21.0.8+9",
+ "release_status": "ga",
+ "operating_system": "linux",
+ "architecture": "x64",
+ "package_type": "jdk",
+ "directly_downloadable": true
+ },
+ {
+ "id": "redhat-21.0.7-jdk-linux-x64",
+ "archive_type": "tar.xz",
+ "distribution": "redhat",
+ "java_version": "21.0.7+6",
+ "release_status": "ga",
+ "operating_system": "linux",
+ "architecture": "x64",
+ "package_type": "jdk",
+ "directly_downloadable": true
+ },
+ {
+ "id": "redhat-17.0.16-jdk-linux-x64",
+ "archive_type": "tar.xz",
+ "distribution": "redhat",
+ "java_version": "17.0.16+8",
+ "release_status": "ga",
+ "operating_system": "linux",
+ "architecture": "x64",
+ "package_type": "jdk",
+ "directly_downloadable": true
+ },
+ {
+ "id": "redhat-9-jdk-linux-x64",
+ "archive_type": "tar.xz",
+ "distribution": "redhat",
+ "java_version": "9+181",
+ "release_status": "ga",
+ "operating_system": "linux",
+ "architecture": "x64",
+ "package_type": "jdk",
+ "directly_downloadable": true
+ },
+ {
+ "id": "redhat-21.0.8-jre-linux-x64",
+ "archive_type": "tar.xz",
+ "distribution": "redhat",
+ "java_version": "21.0.8+9",
+ "release_status": "ga",
+ "operating_system": "linux",
+ "architecture": "x64",
+ "package_type": "jre",
+ "directly_downloadable": true
+ },
+ {
+ "id": "redhat-17.0.16-jdk-windows-x64",
+ "archive_type": "zip",
+ "distribution": "redhat",
+ "java_version": "17.0.16+8",
+ "release_status": "ga",
+ "operating_system": "windows",
+ "architecture": "x64",
+ "package_type": "jdk",
+ "directly_downloadable": true
+ }
+ ],
+ "message": "6 package(s) found"
+}
diff --git a/__tests__/data/sapmachine-release-classes.json b/__tests__/data/sapmachine-release-classes.json
new file mode 100644
index 000000000..79e88f6cd
--- /dev/null
+++ b/__tests__/data/sapmachine-release-classes.json
@@ -0,0 +1,73 @@
+{
+ "25": {
+ "lts": "false",
+ "updates": {
+ "25.0.2": {
+ "sapmachine-25.0.2": {
+ "release_url": "https://example.test/releases/25.0.2",
+ "ea": false,
+ "assets": {
+ "jdk": {
+ "linux-x64": {
+ "tar.gz": {
+ "name": "sapmachine-jdk-25.0.2_linux-x64_bin.tar.gz",
+ "checksum": "stable-boolean",
+ "url": "https://example.test/sapmachine-25.0.2-ga.tar.gz"
+ }
+ }
+ }
+ }
+ }
+ },
+ "25.0.1": {
+ "sapmachine-25.0.1": {
+ "release_url": "https://example.test/releases/25.0.1",
+ "ea": "false",
+ "assets": {
+ "jdk": {
+ "linux-x64": {
+ "tar.gz": {
+ "name": "sapmachine-jdk-25.0.1_linux-x64_bin.tar.gz",
+ "checksum": "stable-string",
+ "url": "https://example.test/sapmachine-25.0.1-ga.tar.gz"
+ }
+ }
+ }
+ }
+ }
+ },
+ "25": {
+ "sapmachine-25+11": {
+ "release_url": "https://example.test/releases/25+11",
+ "ea": true,
+ "assets": {
+ "jdk": {
+ "linux-x64": {
+ "tar.gz": {
+ "name": "sapmachine-jdk-25-ea.11_linux-x64_bin.tar.gz",
+ "checksum": "ea-boolean",
+ "url": "https://example.test/sapmachine-25-ea.11.tar.gz"
+ }
+ }
+ }
+ }
+ },
+ "sapmachine-25+10": {
+ "release_url": "https://example.test/releases/25+10",
+ "ea": "true",
+ "assets": {
+ "jdk": {
+ "linux-x64": {
+ "tar.gz": {
+ "name": "sapmachine-jdk-25-ea.10_linux-x64_bin.tar.gz",
+ "checksum": "ea-string",
+ "url": "https://example.test/sapmachine-25-ea.10.tar.gz"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/__tests__/data/sdkman-java-versions.csv b/__tests__/data/sdkman-java-versions.csv
index 5c75a44c9..edbdc265c 100644
--- a/__tests__/data/sdkman-java-versions.csv
+++ b/__tests__/data/sdkman-java-versions.csv
@@ -2,7 +2,7 @@
7.0.352-zulu, 7.0.352
8.0.282-trava, 8.0.282
8.0.432-albba, 8.0.432
-8.0.432-amzn, 8.0.432
+8.0.432-amzn, 8
8.0.432-kona, 8.0.432
8.0.432-librca, 8.0.432
8.0.432-sem, 8.0.432
@@ -10,7 +10,7 @@
8.0.432-zulu, 8.0.432
8.0.432.fx-librca, 8.0.432
8.0.432.fx-zulu, 8.0.432
-8.0.442-amzn, 8.0.442
+8.0.442-amzn, 8
8.0.442-librca, 8.0.442
8.0.442-tem, 8.0.442
8.0.442-zulu, 8.0.442
@@ -19,7 +19,7 @@
11.0.14.1-jbr, 11.0.14
11.0.15-trava, 11.0.15
11.0.25-albba, 11.0.25
-11.0.25-amzn, 11.0.25
+11.0.25-amzn, 11
11.0.25-kona, 11.0.25
11.0.25-librca, 11.0.25
11.0.25-ms, 11.0.25
@@ -29,7 +29,7 @@
11.0.25-zulu, 11.0.25
11.0.25.fx-librca, 11.0.25
11.0.25.fx-zulu, 11.0.25
-11.0.26-amzn, 11.0.26
+11.0.26-amzn, 11
11.0.26-librca, 11.0.26
11.0.26-ms, 11.0.26
11.0.26-sapmchn, 11.0.26
@@ -40,7 +40,7 @@
17.0.12-jbr, 17.0.12
17.0.12-oracle, 17.0.12
17.0.13-albba, 17.0.13
-17.0.13-amzn, 17.0.13
+17.0.13-amzn, 17
17.0.13-kona, 17.0.13
17.0.13-librca, 17.0.13
17.0.13-ms, 17.0.13
@@ -52,7 +52,7 @@
17.0.13.crac-zulu, 17.0.13
17.0.13.fx-librca, 17.0.13
17.0.13.fx-zulu, 17.0.13
-17.0.14-amzn, 17.0.14
+17.0.14-amzn, 17
17.0.14-librca, 17.0.14
17.0.14-ms, 17.0.14
17.0.14-sapmchn, 17.0.14
@@ -62,7 +62,7 @@
17.0.9-graalce, 17.0.9
21.0.2-graalce, 21.0.2
21.0.2-open, 21.0.2
-21.0.5-amzn, 21.0.5
+21.0.5-amzn, 21
21.0.5-graal, 21.0.5
21.0.5-jbr, 21.0.5
21.0.5-kona, 21.0.5
@@ -77,7 +77,7 @@
21.0.5.crac-zulu, 21.0.5
21.0.5.fx-librca, 21.0.5
21.0.5.fx-zulu, 21.0.5
-21.0.6-amzn, 21.0.6
+21.0.6-amzn, 21
21.0.6-graal, 21.0.6
21.0.6-librca, 21.0.6
21.0.6-ms, 21.0.6
@@ -94,7 +94,7 @@
22.3.5.r17-mandrel, 22.3.5
22.3.5.r17-nik, 22.3.5
23-open, 23
-23.0.1-amzn, 23.0.1
+23.0.1-amzn, 23
23.0.1-graal, 23.0.1
23.0.1-graalce, 23.0.1
23.0.1-librca, 23.0.1
@@ -106,7 +106,7 @@
23.0.1.crac-zulu, 23.0.1
23.0.1.fx-librca, 23.0.1
23.0.1.fx-zulu, 23.0.1
-23.0.2-amzn, 23.0.2
+23.0.2-amzn, 23
23.0.2-graal, 23.0.2
23.0.2-graalce, 23.0.2
23.0.2-librca, 23.0.2
diff --git a/__tests__/data/temurin.json b/__tests__/data/temurin.json
index 7ce00d2c7..cec2c631a 100644
--- a/__tests__/data/temurin.json
+++ b/__tests__/data/temurin.json
@@ -15,7 +15,8 @@
"link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz.json",
"name": "OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz",
- "size": 205463525
+ "size": 205463525,
+ "signature_link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_linux_hotspot_16.0.2_7.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-16.0.2+7_adopt",
@@ -44,7 +45,8 @@
"link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_mac_hotspot_16.0.2_7.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_mac_hotspot_16.0.2_7.tar.gz.json",
"name": "OpenJDK16U-jdk_x64_mac_hotspot_16.0.2_7.tar.gz",
- "size": 206621395
+ "size": 206621395,
+ "signature_link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_mac_hotspot_16.0.2_7.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-16.0.2+7_adopt",
@@ -73,7 +75,8 @@
"link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_windows_hotspot_16.0.2_7.zip",
"metadata_link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_windows_hotspot_16.0.2_7.zip.json",
"name": "OpenJDK16U-jdk_x64_windows_hotspot_16.0.2_7.zip",
- "size": 203448494
+ "size": 203448494,
+ "signature_link": "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_windows_hotspot_16.0.2_7.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-16.0.2+7_adopt",
@@ -113,7 +116,8 @@
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz.json",
"name": "OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz",
- "size": 102954777
+ "size": 102954777,
+ "signature_link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk8u302-b08",
@@ -142,7 +146,8 @@
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_mac_hotspot_8u302b08.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_mac_hotspot_8u302b08.tar.gz.json",
"name": "OpenJDK8U-jdk_x64_mac_hotspot_8u302b08.tar.gz",
- "size": 107303398
+ "size": 107303398,
+ "signature_link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_mac_hotspot_8u302b08.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk8u302-b08",
@@ -171,7 +176,8 @@
"link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_windows_hotspot_8u302b08.zip",
"metadata_link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_windows_hotspot_8u302b08.zip.json",
"name": "OpenJDK8U-jdk_x64_windows_hotspot_8u302b08.zip",
- "size": 104297671
+ "size": 104297671,
+ "signature_link": "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u302-b08/OpenJDK8U-jdk_x64_windows_hotspot_8u302b08.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk8u302-b08",
@@ -211,7 +217,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-31-00-07.tar.gz",
- "size": 188909250
+ "size": 188909250,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-16-ge39bf269d60",
@@ -240,7 +247,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-31-00-07.tar.gz",
- "size": 192952713
+ "size": 192952713,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-219-ge39bf269d60",
@@ -260,7 +268,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-31-00-07.tar.gz",
- "size": 188816971
+ "size": 188816971,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-16-ge39bf269d60",
@@ -280,7 +289,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-31-00-07.tar.gz",
- "size": 182299353
+ "size": 182299353,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-219-ge39bf269d60",
@@ -300,7 +310,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-31-00-07.tar.gz",
- "size": 187674392
+ "size": 187674392,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-46-gea8d2c72e83",
@@ -320,7 +331,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-31-00-07.tar.gz",
- "size": 179501342
+ "size": 179501342,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-21-ge39bf269d60",
@@ -340,7 +352,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-29-23-34.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-29-23-34.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-29-23-34.tar.gz",
- "size": 192126971
+ "size": 192126971,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-29-23-34.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-219-ge39bf269d60",
@@ -360,7 +373,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-31-00-07.tar.gz",
- "size": 192015878
+ "size": 192015878,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-21-ge39bf269d60",
@@ -389,7 +403,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-31-00-07.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-31-00-07.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-07-31-00-07.tar.gz",
- "size": 192422068
+ "size": 192422068,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-31-00-07.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-219-ge39bf269d60",
@@ -418,7 +433,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-31-00-07.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-31-00-07.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-31-00-07.zip",
- "size": 188694175
+ "size": 188694175,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-31-00-07.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-219-ge39bf269d60",
@@ -447,7 +463,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-31-00-07.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-31-00-07.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-31-00-07.zip",
- "size": 184618115
+ "size": 184618115,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-31-00-07.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+33_adopt-219-ge39bf269d60",
@@ -489,7 +506,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-27-23-34.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-27-23-34.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-27-23-34.tar.gz",
- "size": 192125161
+ "size": 192125161,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-31-00-07-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-27-23-34.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-242-gce1857dd7a1",
@@ -531,7 +549,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-23-03-09.tar.gz",
- "size": 188911467
+ "size": 188911467,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-42-g4596b4e9d4e",
@@ -560,7 +579,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-23-03-09.tar.gz",
- "size": 192950510
+ "size": 192950510,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-217-g4596b4e9d4e",
@@ -580,7 +600,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-23-03-09.tar.gz",
- "size": 188815685
+ "size": 188815685,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-36-g4596b4e9d4e",
@@ -600,7 +621,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-23-03-09.tar.gz",
- "size": 182307654
+ "size": 182307654,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-217-g4596b4e9d4e",
@@ -620,7 +642,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-23-03-09.tar.gz",
- "size": 187698851
+ "size": 187698851,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-36-g4596b4e9d4e",
@@ -640,7 +663,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-23-03-09.tar.gz",
- "size": 179501218
+ "size": 179501218,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-40-g4596b4e9d4e",
@@ -660,7 +684,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-22-23-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-22-23-30.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-22-23-30.tar.gz",
- "size": 192124471
+ "size": 192124471,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-22-23-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-217-g4596b4e9d4e",
@@ -680,7 +705,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-23-03-09.tar.gz",
- "size": 192015026
+ "size": 192015026,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-40-g4596b4e9d4e",
@@ -709,7 +735,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-23-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-23-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-07-23-03-09.tar.gz",
- "size": 193003513
+ "size": 193003513,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-23-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-217-g4596b4e9d4e",
@@ -738,7 +765,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-23-03-09.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-23-03-09.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-23-03-09.zip",
- "size": 188694996
+ "size": 188694996,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-23-03-09.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-217-g4596b4e9d4e",
@@ -767,7 +795,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-23-03-09.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-23-03-09.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-23-03-09.zip",
- "size": 184626937
+ "size": 184626937,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-23-03-09-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-23-03-09.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+32_adopt-217-g4596b4e9d4e",
@@ -809,7 +838,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-21-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-21-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-21-03-09.tar.gz",
- "size": 188891565
+ "size": 188891565,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-21-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "a342f28aaec",
@@ -829,7 +859,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-21-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-21-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-21-03-09.tar.gz",
- "size": 188790907
+ "size": 188790907,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-21-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "a342f28aaec",
@@ -849,7 +880,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-21-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-21-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-21-03-09.tar.gz",
- "size": 182276594
+ "size": 182276594,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-21-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-191-ga342f28aaec",
@@ -869,7 +901,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-21-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-21-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-21-03-09.tar.gz",
- "size": 187678422
+ "size": 187678422,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-21-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-26-ga342f28aaec",
@@ -889,7 +922,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-21-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-21-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-21-03-09.tar.gz",
- "size": 179475721
+ "size": 179475721,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-21-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-26-ga342f28aaec",
@@ -909,7 +943,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-20-23-34.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-20-23-34.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-20-23-34.tar.gz",
- "size": 192104689
+ "size": 192104689,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-20-23-34.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-191-ga342f28aaec",
@@ -929,7 +964,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-21-03-09.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-21-03-09.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-21-03-09.tar.gz",
- "size": 191982821
+ "size": 191982821,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-21-03-09.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "a342f28aaec",
@@ -958,7 +994,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-21-03-09.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-21-03-09.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-21-03-09.zip",
- "size": 188685330
+ "size": 188685330,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-21-03-09.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-191-ga342f28aaec",
@@ -987,7 +1024,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-21-03-09.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-21-03-09.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-21-03-09.zip",
- "size": 184607457
+ "size": 184607457,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-21-03-09-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-21-03-09.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-191-ga342f28aaec",
@@ -1029,7 +1067,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-16-10-58.tar.gz",
- "size": 188896773
+ "size": 188896773,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-14-g20418a26958",
@@ -1058,7 +1097,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-16-10-58.tar.gz",
- "size": 192948484
+ "size": 192948484,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-179-g20418a26958",
@@ -1078,7 +1118,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-16-10-58.tar.gz",
- "size": 188791964
+ "size": 188791964,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-14-g20418a26958",
@@ -1098,7 +1139,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-16-10-58.tar.gz",
- "size": 182281944
+ "size": 182281944,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-179-g20418a26958",
@@ -1118,7 +1160,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-16-10-58.tar.gz",
- "size": 187650365
+ "size": 187650365,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-23-g20418a26958",
@@ -1138,7 +1181,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-16-10-58.tar.gz",
- "size": 179483622
+ "size": 179483622,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-55-g20418a26958",
@@ -1158,7 +1202,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-15-23-34.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-15-23-34.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-15-23-34.tar.gz",
- "size": 192108731
+ "size": 192108731,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-15-23-34.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-179-g20418a26958",
@@ -1178,7 +1223,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-16-10-58.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-16-10-58.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-16-10-58.tar.gz",
- "size": 191985123
+ "size": 191985123,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-16-10-58.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-14-g20418a26958",
@@ -1207,7 +1253,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-16-10-58.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-16-10-58.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-16-10-58.zip",
- "size": 188688539
+ "size": 188688539,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-16-10-58.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-179-g20418a26958",
@@ -1236,7 +1283,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-16-10-58.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-16-10-58.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-16-10-58.zip",
- "size": 184612045
+ "size": 184612045,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-16-10-58-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-16-10-58.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+31_adopt-179-g20418a26958",
@@ -1278,7 +1326,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-14-11-30.tar.gz",
- "size": 188899456
+ "size": 188899456,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "ce22197617d",
@@ -1307,7 +1356,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-14-11-30.tar.gz",
- "size": 192953428
+ "size": 192953428,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-200-gce22197617d",
@@ -1327,7 +1377,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-14-11-30.tar.gz",
- "size": 188792852
+ "size": 188792852,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-66-gce22197617d",
@@ -1347,7 +1398,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-14-11-30.tar.gz",
- "size": 187678600
+ "size": 187678600,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "ce22197617d",
@@ -1367,7 +1419,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-14-11-30.tar.gz",
- "size": 179480996
+ "size": 179480996,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "ce22197617d",
@@ -1387,7 +1440,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-13-23-34.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-13-23-34.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-13-23-34.tar.gz",
- "size": 192105446
+ "size": 192105446,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-13-23-34.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-200-gce22197617d",
@@ -1407,7 +1461,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-14-11-30.tar.gz",
- "size": 191986856
+ "size": 191986856,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "ce22197617d",
@@ -1436,7 +1491,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-14-11-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-14-11-30.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-07-14-11-30.tar.gz",
- "size": 192995067
+ "size": 192995067,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-14-11-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-200-gce22197617d",
@@ -1465,7 +1521,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-14-11-30.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-14-11-30.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-14-11-30.zip",
- "size": 188686556
+ "size": 188686556,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-14-11-30.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-200-gce22197617d",
@@ -1494,7 +1551,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-14-11-30.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-14-11-30.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-14-11-30.zip",
- "size": 184620492
+ "size": 184620492,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-14-11-30-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-14-11-30.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-200-gce22197617d",
@@ -1536,7 +1594,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-09-12-54.tar.gz",
- "size": 188896299
+ "size": 188896299,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1565,7 +1624,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-09-12-54.tar.gz",
- "size": 192941671
+ "size": 192941671,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1585,7 +1645,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-09-12-54.tar.gz",
- "size": 188838708
+ "size": 188838708,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-161-g3e7e5bc2003",
@@ -1605,7 +1666,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-09-12-54.tar.gz",
- "size": 182274073
+ "size": 182274073,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-40-g3e7e5bc2003",
@@ -1625,7 +1687,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-09-12-54.tar.gz",
- "size": 187666608
+ "size": 187666608,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-40-g3e7e5bc2003",
@@ -1645,7 +1708,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-09-12-54.tar.gz",
- "size": 179472325
+ "size": 179472325,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-30-g3e7e5bc2003",
@@ -1665,7 +1729,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-08-23-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-08-23-35.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-08-23-35.tar.gz",
- "size": 192098387
+ "size": 192098387,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-08-23-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1685,7 +1750,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-09-12-54.tar.gz",
- "size": 191983708
+ "size": 191983708,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1714,7 +1780,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-09-12-54.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-09-12-54.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-07-09-12-54.tar.gz",
- "size": 193004476
+ "size": 193004476,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-09-12-54.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1743,7 +1810,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-09-12-54.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-09-12-54.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-09-12-54.zip",
- "size": 188681640
+ "size": 188681640,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-09-12-54.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1772,7 +1840,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-09-12-54.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-09-12-54.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-09-12-54.zip",
- "size": 184605514
+ "size": 184605514,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-09-12-54-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-09-12-54.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+30_adopt-164-g3e7e5bc2003",
@@ -1823,7 +1892,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-07-11-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-07-11-35.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-07-11-35.tar.gz",
- "size": 192962903
+ "size": 192962903,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-07-11-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-172-g06428c22b61",
@@ -1843,7 +1913,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-07-11-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-07-11-35.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-07-11-35.tar.gz",
- "size": 188800217
+ "size": 188800217,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-07-11-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "06428c22b61",
@@ -1863,7 +1934,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-07-11-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-07-11-35.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-07-11-35.tar.gz",
- "size": 187663978
+ "size": 187663978,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-07-11-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-78-g06428c22b61",
@@ -1883,7 +1955,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-07-11-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-07-11-35.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-07-11-35.tar.gz",
- "size": 179496669
+ "size": 179496669,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-07-11-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-78-g06428c22b61",
@@ -1903,7 +1976,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-06-23-34.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-06-23-34.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-06-23-34.tar.gz",
- "size": 192113242
+ "size": 192113242,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-06-23-34.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-172-g06428c22b61",
@@ -1923,7 +1997,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-07-11-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-07-11-35.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-07-11-35.tar.gz",
- "size": 192021951
+ "size": 192021951,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-07-11-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-172-g06428c22b61",
@@ -1952,7 +2027,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-07-11-35.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-07-11-35.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-07-07-11-35.tar.gz",
- "size": 193018554
+ "size": 193018554,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-07-11-35.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-172-g06428c22b61",
@@ -1981,7 +2057,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-07-11-35.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-07-11-35.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-07-11-35.zip",
- "size": 188702463
+ "size": 188702463,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-07-11-35-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-07-11-35.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-172-g06428c22b61",
@@ -2023,7 +2100,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-02-12-00.tar.gz",
- "size": 188953178
+ "size": 188953178,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2052,7 +2130,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-02-12-00.tar.gz",
- "size": 192957934
+ "size": 192957934,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2072,7 +2151,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-07-02-12-00.tar.gz",
- "size": 188797466
+ "size": 188797466,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-43-g6d3debb5c12",
@@ -2092,7 +2172,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-02-12-00.tar.gz",
- "size": 182292580
+ "size": 182292580,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2112,7 +2193,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-02-12-00.tar.gz",
- "size": 187684930
+ "size": 187684930,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-64-g6d3debb5c12",
@@ -2132,7 +2214,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-07-02-12-00.tar.gz",
- "size": 179484390
+ "size": 179484390,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-54-g6d3debb5c12",
@@ -2152,7 +2235,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-01-23-30.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-01-23-30.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-01-23-30.tar.gz",
- "size": 192114561
+ "size": 192114561,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-07-01-23-30.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2172,7 +2256,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-07-02-12-00.tar.gz",
- "size": 192014644
+ "size": 192014644,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2201,7 +2286,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-02-12-00.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-02-12-00.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-07-02-12-00.tar.gz",
- "size": 192425033
+ "size": 192425033,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-07-02-12-00.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2230,7 +2316,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-02-12-00.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-02-12-00.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-07-02-12-00.zip",
- "size": 188697393
+ "size": 188697393,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-07-02-12-00.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2259,7 +2346,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-02-12-00.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-02-12-00.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-02-12-00.zip",
- "size": 184618232
+ "size": 184618232,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-07-02-12-00-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-07-02-12-00.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+29_adopt-138-g6d3debb5c12",
@@ -2301,7 +2389,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_linux_hotspot_2021-06-30-09-16.tar.gz",
- "size": 188940191
+ "size": 188940191,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_aarch64_linux_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-130-g0fe0d0825e7",
@@ -2330,7 +2419,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_aarch64_mac_hotspot_2021-06-30-09-16.tar.gz",
- "size": 192953718
+ "size": 192953718,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_aarch64_mac_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-130-g0fe0d0825e7",
@@ -2350,7 +2440,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_arm_linux_hotspot_2021-06-30-09-16.tar.gz",
- "size": 188795343
+ "size": 188795343,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_arm_linux_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "0fe0d0825e7",
@@ -2370,7 +2461,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64_aix_hotspot_2021-06-30-09-16.tar.gz",
- "size": 182285782
+ "size": 182285782,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_ppc64_aix_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "0fe0d0825e7",
@@ -2390,7 +2482,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_ppc64le_linux_hotspot_2021-06-30-09-16.tar.gz",
- "size": 187652430
+ "size": 187652430,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_ppc64le_linux_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "0fe0d0825e7",
@@ -2410,7 +2503,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_s390x_linux_hotspot_2021-06-30-09-16.tar.gz",
- "size": 179489547
+ "size": 179489547,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_s390x_linux_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "0fe0d0825e7",
@@ -2430,7 +2524,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-06-29-23-33.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-06-29-23-33.tar.gz.json",
"name": "OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-06-29-23-33.tar.gz",
- "size": 192109453
+ "size": 192109453,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_alpine-linux_hotspot_2021-06-29-23-33.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-130-g0fe0d0825e7",
@@ -2450,7 +2545,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_x64_linux_hotspot_2021-06-30-09-16.tar.gz",
- "size": 192013559
+ "size": 192013559,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_linux_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-130-g0fe0d0825e7",
@@ -2479,7 +2575,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-06-30-09-16.tar.gz",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-06-30-09-16.tar.gz.json",
"name": "OpenJDK17-jdk_x64_mac_hotspot_2021-06-30-09-16.tar.gz",
- "size": 192419518
+ "size": 192419518,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_mac_hotspot_2021-06-30-09-16.tar.gz.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-130-g0fe0d0825e7",
@@ -2508,7 +2605,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-06-30-09-16.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-06-30-09-16.zip.json",
"name": "OpenJDK17-jdk_x64_windows_hotspot_2021-06-30-09-16.zip",
- "size": 188672489
+ "size": 188672489,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x64_windows_hotspot_2021-06-30-09-16.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-130-g0fe0d0825e7",
@@ -2537,7 +2635,8 @@
"link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-06-30-09-16.zip",
"metadata_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-06-30-09-16.zip.json",
"name": "OpenJDK17-jdk_x86-32_windows_hotspot_2021-06-30-09-16.zip",
- "size": 184626094
+ "size": 184626094,
+ "signature_link": "https://github.com/adoptium/temurin17-binaries/releases/download/jdk17-2021-06-30-09-16-beta/OpenJDK17-jdk_x86-32_windows_hotspot_2021-06-30-09-16.zip.sig"
},
"project": "jdk",
"scm_ref": "jdk-17+28_adopt-132-g23fbf51b850",
diff --git a/__tests__/data/zulu-linux.json b/__tests__/data/zulu-linux.json
index 1f2fa2716..c74487e2c 100644
--- a/__tests__/data/zulu-linux.json
+++ b/__tests__/data/zulu-linux.json
@@ -1,254 +1,686 @@
-[
+[
{
- "id": 10996,
- "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-linux.tar.gz",
+ "package_uuid": "test-uuid-10996",
"name": "zulu1.8.0_05-8.1.0.10-linux.tar.gz",
- "zulu_version": [8, 1, 0, 10],
- "jdk_version": [8, 0, 5, 13]
- },
- {
- "id": 10997,
- "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-linux.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-linux.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 8,
+ 1,
+ 0,
+ 10
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10997",
"name": "zulu1.8.0_11-8.2.0.1-linux.tar.gz",
- "zulu_version": [8, 2, 0, 1],
- "jdk_version": [8, 0, 11, 12]
- },
- {
- "id": 10346,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-linux.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 11
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 8,
+ 2,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10346",
"name": "zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz",
- "zulu_version": [8, 21, 0, 1],
- "jdk_version": [8, 0, 131, 11]
- },
- {
- "id": 10362,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 131
+ ],
+ "openjdk_build_number": 11,
+ "distro_version": [
+ 8,
+ 21,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10362",
"name": "zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
- "zulu_version": [8, 23, 0, 3],
- "jdk_version": [8, 0, 144, 1]
- },
- {
- "id": 10399,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 144
+ ],
+ "openjdk_build_number": 1,
+ "distro_version": [
+ 8,
+ 23,
+ 0,
+ 3
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10399",
"name": "zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz",
- "zulu_version": [8, 25, 0, 1],
- "jdk_version": [8, 0, 152, 16]
- },
- {
- "id": 11355,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 152
+ ],
+ "openjdk_build_number": 16,
+ "distro_version": [
+ 8,
+ 25,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11355",
"name": "zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz",
- "zulu_version": [8, 46, 0, 19],
- "jdk_version": [8, 0, 252, 14]
- },
- {
- "id": 11481,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 252
+ ],
+ "openjdk_build_number": 14,
+ "distro_version": [
+ 8,
+ 46,
+ 0,
+ 19
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11481",
"name": "zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz",
- "zulu_version": [8, 48, 0, 47],
- "jdk_version": [8, 0, 262, 17]
- },
- {
- "id": 11622,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 17,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 47
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11622",
"name": "zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz",
- "zulu_version": [8, 48, 0, 51],
- "jdk_version": [8, 0, 262, 19]
- },
- {
- "id": 11535,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 19,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 51
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11535",
"name": "zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz",
- "zulu_version": [8, 48, 0, 49],
- "jdk_version": [8, 0, 262, 18]
- },
- {
- "id": 12424,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 18,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 49
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12424",
"name": "zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz",
- "zulu_version": [8, 52, 0, 23],
- "jdk_version": [8, 0, 282, 8]
- },
- {
- "id": 10383,
- "url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 282
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 8,
+ 52,
+ 0,
+ 23
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10383",
"name": "zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz",
- "zulu_version": [9, 0, 0, 15],
- "jdk_version": [9, 0, 0, 0]
- },
- {
- "id": 10413,
- "url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz",
+ "java_version": [
+ 9,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 0,
+ "distro_version": [
+ 9,
+ 0,
+ 0,
+ 15
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10413",
"name": "zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz",
- "zulu_version": [9, 0, 1, 3],
- "jdk_version": [9, 0, 1, 0]
- },
- {
- "id": 10503,
- "url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 9,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 0,
+ "distro_version": [
+ 9,
+ 0,
+ 1,
+ 3
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10503",
"name": "zulu10.2+3-jdk10.0.1-linux_x64.tar.gz",
- "zulu_version": [10, 2, 3, 0],
- "jdk_version": [10, 0, 1, 9]
- },
- {
- "id": 10541,
- "url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 10,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 10,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10541",
"name": "zulu10.3+5-jdk10.0.2-linux_x64.tar.gz",
- "zulu_version": [10, 3, 5, 0],
- "jdk_version": [10, 0, 2, 13]
- },
- {
- "id": 10576,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-linux_x64.tar.gz",
+ "java_version": [
+ 10,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 10,
+ 3,
+ 5,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10576",
"name": "zulu11.2.3-jdk11.0.1-linux_x64.tar.gz",
- "zulu_version": [11, 2, 3, 0],
- "jdk_version": [11, 0, 1, 13]
- },
- {
- "id": 10604,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 11,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10604",
"name": "zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz",
- "zulu_version": [11, 29, 3, 0],
- "jdk_version": [11, 0, 2, 7]
- },
- {
- "id": 10687,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 11,
+ 29,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10687",
"name": "zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz",
- "zulu_version": [11, 31, 11, 0],
- "jdk_version": [11, 0, 3, 7]
- },
- {
- "id": 10856,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 3
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 11,
+ 31,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10856",
"name": "zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz",
- "zulu_version": [11, 35, 13, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 10933,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 13,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10933",
"name": "zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
- "zulu_version": [11, 35, 15, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 10933,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10933",
"name": "zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
- "zulu_version": [11, 35, 11, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 12397,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12397",
"name": "zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz",
- "zulu_version": [11, 45, 27, 0],
- "jdk_version": [11, 0, 10, 9]
- },
- {
- "id": 10667,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 10
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 11,
+ 45,
+ 27,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10667",
"name": "zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz",
- "zulu_version": [12, 1, 3, 0],
- "jdk_version": [12, 0, 0, 33]
- },
- {
- "id": 10710,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 33,
+ "distro_version": [
+ 12,
+ 1,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10710",
"name": "zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz",
- "zulu_version": [12, 2, 3, 0],
- "jdk_version": [12, 0, 1, 12]
- },
- {
- "id": 10780,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 12,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10780",
"name": "zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz",
- "zulu_version": [12, 3, 11, 0],
- "jdk_version": [12, 0, 2, 3]
- },
- {
- "id": 10846,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 3,
+ "distro_version": [
+ 12,
+ 3,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10846",
"name": "zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz",
- "zulu_version": [13, 27, 9, 0],
- "jdk_version": [13, 0, 0, 33]
- },
- {
- "id": 10888,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 33,
+ "distro_version": [
+ 13,
+ 27,
+ 9,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10888",
"name": "zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz",
- "zulu_version": [13, 28, 11, 0],
- "jdk_version": [13, 0, 1, 10]
- },
- {
- "id": 11073,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 13,
+ 28,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11073",
"name": "zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz",
- "zulu_version": [13, 29, 9, 0],
- "jdk_version": [13, 0, 2, 6]
- },
- {
- "id": 12408,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 6,
+ "distro_version": [
+ 13,
+ 29,
+ 9,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12408",
"name": "zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz",
- "zulu_version": [13, 37, 21, 0],
- "jdk_version": [13, 0, 6, 5]
- },
- {
- "id": 11236,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 6
+ ],
+ "openjdk_build_number": 5,
+ "distro_version": [
+ 13,
+ 37,
+ 21,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11236",
"name": "zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz",
- "zulu_version": [14, 27, 1, 0],
- "jdk_version": [14, 0, 0, 36]
- },
- {
- "id": 11349,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 36,
+ "distro_version": [
+ 14,
+ 27,
+ 1,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11349",
"name": "zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz",
- "zulu_version": [14, 28, 21, 0],
- "jdk_version": [14, 0, 1, 8]
- },
- {
- "id": 11513,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 14,
+ 28,
+ 21,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11513",
"name": "zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz",
- "zulu_version": [14, 29, 23, 0],
- "jdk_version": [14, 0, 2, 12]
- },
- {
- "id": 11780,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 14,
+ 29,
+ 23,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11780",
"name": "zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz",
- "zulu_version": [15, 27, 17, 0],
- "jdk_version": [15, 0, 0, 36]
- },
- {
- "id": 11924,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 36,
+ "distro_version": [
+ 15,
+ 27,
+ 17,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11924",
"name": "zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz",
- "zulu_version": [15, 28, 13, 0],
- "jdk_version": [15, 0, 1, 8]
- },
- {
- "id": 12101,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 15,
+ 28,
+ 13,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12101",
"name": "zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz",
- "zulu_version": [15, 28, 51, 0],
- "jdk_version": [15, 0, 1, 9]
- },
- {
- "id": 12445,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 15,
+ 28,
+ 51,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12445",
"name": "zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz",
- "zulu_version": [15, 29, 15, 0],
- "jdk_version": [15, 0, 2, 7]
- },
- {
- "id": 12447,
- "url": "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 15,
+ 29,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12447",
"name": "zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz",
- "zulu_version": [21, 32, 17, 0],
- "jdk_version": [21, 0, 2, 6]
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz",
+ "java_version": [
+ 21,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 6,
+ "distro_version": [
+ 21,
+ 32,
+ 17,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
}
-]
\ No newline at end of file
+]
diff --git a/__tests__/data/zulu-releases-default.json b/__tests__/data/zulu-releases-default.json
index f23a87d43..16ed97772 100644
--- a/__tests__/data/zulu-releases-default.json
+++ b/__tests__/data/zulu-releases-default.json
@@ -1,247 +1,667 @@
[
{
- "id": 10996,
- "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-macosx.tar.gz",
+ "package_uuid": "test-uuid-10996",
"name": "zulu1.8.0_05-8.1.0.10-macosx.tar.gz",
- "zulu_version": [8, 1, 0, 10],
- "jdk_version": [8, 0, 5, 13]
- },
- {
- "id": 10997,
- "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-macosx.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-macosx.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 8,
+ 1,
+ 0,
+ 10
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10997",
"name": "zulu1.8.0_11-8.2.0.1-macosx.tar.gz",
- "zulu_version": [8, 2, 0, 1],
- "jdk_version": [8, 0, 11, 12]
- },
- {
- "id": 10346,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-macosx.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 11
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 8,
+ 2,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10346",
"name": "zulu8.21.0.1-jdk8.0.131-macosx_x64.tar.gz",
- "zulu_version": [8, 21, 0, 1],
- "jdk_version": [8, 0, 131, 11]
- },
- {
- "id": 10362,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 131
+ ],
+ "openjdk_build_number": 11,
+ "distro_version": [
+ 8,
+ 21,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10362",
"name": "zulu8.23.0.3-jdk8.0.144-macosx_x64.tar.gz",
- "zulu_version": [8, 23, 0, 3],
- "jdk_version": [8, 0, 144, 1]
- },
- {
- "id": 10399,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 144
+ ],
+ "openjdk_build_number": 1,
+ "distro_version": [
+ 8,
+ 23,
+ 0,
+ 3
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10399",
"name": "zulu8.25.0.1-jdk8.0.152-macosx_x64.tar.gz",
- "zulu_version": [8, 25, 0, 1],
- "jdk_version": [8, 0, 152, 16]
- },
- {
- "id": 11355,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 152
+ ],
+ "openjdk_build_number": 16,
+ "distro_version": [
+ 8,
+ 25,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11355",
"name": "zulu8.46.0.19-ca-jdk8.0.252-macosx_x64.tar.gz",
- "zulu_version": [8, 46, 0, 19],
- "jdk_version": [8, 0, 252, 14]
- },
- {
- "id": 11481,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 252
+ ],
+ "openjdk_build_number": 14,
+ "distro_version": [
+ 8,
+ 46,
+ 0,
+ 19
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11481",
"name": "zulu8.48.0.47-ca-jdk8.0.262-macosx_x64.tar.gz",
- "zulu_version": [8, 48, 0, 47],
- "jdk_version": [8, 0, 262, 17]
- },
- {
- "id": 11622,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 17,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 47
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11622",
"name": "zulu8.48.0.51-ca-jdk8.0.262-macosx_x64.tar.gz",
- "zulu_version": [8, 48, 0, 51],
- "jdk_version": [8, 0, 262, 19]
- },
- {
- "id": 11535,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 19,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 51
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11535",
"name": "zulu8.48.0.49-ca-jdk8.0.262-macosx_x64.tar.gz",
- "zulu_version": [8, 48, 0, 49],
- "jdk_version": [8, 0, 262, 18]
- },
- {
- "id": 12424,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 18,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 49
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12424",
"name": "zulu8.52.0.23-ca-jdk8.0.282-macosx_x64.tar.gz",
- "zulu_version": [8, 52, 0, 23],
- "jdk_version": [8, 0, 282, 8]
- },
- {
- "id": 10383,
- "url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-macosx_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 282
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 8,
+ 52,
+ 0,
+ 23
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10383",
"name": "zulu9.0.0.15-jdk9.0.0-macosx_x64.tar.gz",
- "zulu_version": [9, 0, 0, 15],
- "jdk_version": [9, 0, 0, 0]
- },
- {
- "id": 10413,
- "url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-macosx_x64.tar.gz",
+ "java_version": [
+ 9,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 0,
+ "distro_version": [
+ 9,
+ 0,
+ 0,
+ 15
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10413",
"name": "zulu9.0.1.3-jdk9.0.1-macosx_x64.tar.gz",
- "zulu_version": [9, 0, 1, 3],
- "jdk_version": [9, 0, 1, 0]
- },
- {
- "id": 10503,
- "url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 9,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 0,
+ "distro_version": [
+ 9,
+ 0,
+ 1,
+ 3
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10503",
"name": "zulu10.2+3-jdk10.0.1-macosx_x64.tar.gz",
- "zulu_version": [10, 2, 3, 0],
- "jdk_version": [10, 0, 1, 9]
- },
- {
- "id": 10541,
- "url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 10,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 10,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10541",
"name": "zulu10.3+5-jdk10.0.2-macosx_x64.tar.gz",
- "zulu_version": [10, 3, 5, 0],
- "jdk_version": [10, 0, 2, 13]
- },
- {
- "id": 10576,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-macosx_x64.tar.gz",
+ "java_version": [
+ 10,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 10,
+ 3,
+ 5,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10576",
"name": "zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz",
- "zulu_version": [11, 2, 3, 0],
- "jdk_version": [11, 0, 1, 13]
- },
- {
- "id": 10604,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 11,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10604",
"name": "zulu11.29.3-ca-jdk11.0.2-macosx_x64.tar.gz",
- "zulu_version": [11, 29, 3, 0],
- "jdk_version": [11, 0, 2, 7]
- },
- {
- "id": 10687,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 11,
+ 29,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10687",
"name": "zulu11.31.11-ca-jdk11.0.3-macosx_x64.tar.gz",
- "zulu_version": [11, 31, 11, 0],
- "jdk_version": [11, 0, 3, 7]
- },
- {
- "id": 10856,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 3
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 11,
+ 31,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10856",
"name": "zulu11.35.13-ca-jdk11.0.5-macosx_x64.tar.gz",
- "zulu_version": [11, 35, 13, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 10933,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 13,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10933",
"name": "zulu11.35.15-ca-jdk11.0.5-macosx_x64.tar.gz",
- "zulu_version": [11, 35, 15, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 10933,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10933",
"name": "zulu11.35.15-ca-jdk11.0.5-macosx_x64.tar.gz",
- "zulu_version": [11, 35, 11, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 12397,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12397",
"name": "zulu11.45.27-ca-jdk11.0.10-macosx_x64.tar.gz",
- "zulu_version": [11, 45, 27, 0],
- "jdk_version": [11, 0, 10, 9]
- },
- {
- "id": 10667,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-macosx_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 10
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 11,
+ 45,
+ 27,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10667",
"name": "zulu12.1.3-ca-jdk12.0.0-macosx_x64.tar.gz",
- "zulu_version": [12, 1, 3, 0],
- "jdk_version": [12, 0, 0, 33]
- },
- {
- "id": 10710,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-macosx_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 33,
+ "distro_version": [
+ 12,
+ 1,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10710",
"name": "zulu12.2.3-ca-jdk12.0.1-macosx_x64.tar.gz",
- "zulu_version": [12, 2, 3, 0],
- "jdk_version": [12, 0, 1, 12]
- },
- {
- "id": 10780,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 12,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10780",
"name": "zulu12.3.11-ca-jdk12.0.2-macosx_x64.tar.gz",
- "zulu_version": [12, 3, 11, 0],
- "jdk_version": [12, 0, 2, 3]
- },
- {
- "id": 10846,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-macosx_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 3,
+ "distro_version": [
+ 12,
+ 3,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10846",
"name": "zulu13.27.9-ca-jdk13.0.0-macosx_x64.tar.gz",
- "zulu_version": [13, 27, 9, 0],
- "jdk_version": [13, 0, 0, 33]
- },
- {
- "id": 10888,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-macosx_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 33,
+ "distro_version": [
+ 13,
+ 27,
+ 9,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10888",
"name": "zulu13.28.11-ca-jdk13.0.1-macosx_x64.tar.gz",
- "zulu_version": [13, 28, 11, 0],
- "jdk_version": [13, 0, 1, 10]
- },
- {
- "id": 11073,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 13,
+ 28,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11073",
"name": "zulu13.29.9-ca-jdk13.0.2-macosx_x64.tar.gz",
- "zulu_version": [13, 29, 9, 0],
- "jdk_version": [13, 0, 2, 6]
- },
- {
- "id": 12408,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-macosx_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 6,
+ "distro_version": [
+ 13,
+ 29,
+ 9,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12408",
"name": "zulu13.37.21-ca-jdk13.0.6-macosx_x64.tar.gz",
- "zulu_version": [13, 37, 21, 0],
- "jdk_version": [13, 0, 6, 5]
- },
- {
- "id": 11236,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-macosx_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 6
+ ],
+ "openjdk_build_number": 5,
+ "distro_version": [
+ 13,
+ 37,
+ 21,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11236",
"name": "zulu14.27.1-ca-jdk14.0.0-macosx_x64.tar.gz",
- "zulu_version": [14, 27, 1, 0],
- "jdk_version": [14, 0, 0, 36]
- },
- {
- "id": 11349,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-macosx_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 36,
+ "distro_version": [
+ 14,
+ 27,
+ 1,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11349",
"name": "zulu14.28.21-ca-jdk14.0.1-macosx_x64.tar.gz",
- "zulu_version": [14, 28, 21, 0],
- "jdk_version": [14, 0, 1, 8]
- },
- {
- "id": 11513,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 14,
+ 28,
+ 21,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11513",
"name": "zulu14.29.23-ca-jdk14.0.2-macosx_x64.tar.gz",
- "zulu_version": [14, 29, 23, 0],
- "jdk_version": [14, 0, 2, 12]
- },
- {
- "id": 11780,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-macosx_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 14,
+ 29,
+ 23,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11780",
"name": "zulu15.27.17-ca-jdk15.0.0-macosx_x64.tar.gz",
- "zulu_version": [15, 27, 17, 0],
- "jdk_version": [15, 0, 0, 36]
- },
- {
- "id": 11924,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-macosx_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 36,
+ "distro_version": [
+ 15,
+ 27,
+ 17,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11924",
"name": "zulu15.28.13-ca-jdk15.0.1-macosx_x64.tar.gz",
- "zulu_version": [15, 28, 13, 0],
- "jdk_version": [15, 0, 1, 8]
- },
- {
- "id": 12101,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 15,
+ 28,
+ 13,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12101",
"name": "zulu15.28.51-ca-jdk15.0.1-macosx_x64.tar.gz",
- "zulu_version": [15, 28, 51, 0],
- "jdk_version": [15, 0, 1, 9]
- },
- {
- "id": 12445,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-macosx_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-macosx_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 15,
+ 28,
+ 51,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12445",
"name": "zulu15.29.15-ca-jdk15.0.2-macosx_x64.tar.gz",
- "zulu_version": [15, 29, 15, 0],
- "jdk_version": [15, 0, 2, 7]
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-macosx_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 15,
+ 29,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
}
]
diff --git a/__tests__/data/zulu-windows.json b/__tests__/data/zulu-windows.json
index e4ce99538..dcfb9462f 100644
--- a/__tests__/data/zulu-windows.json
+++ b/__tests__/data/zulu-windows.json
@@ -1,254 +1,686 @@
-[
+[
{
- "id": 10996,
- "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-windows.tar.gz",
+ "package_uuid": "test-uuid-10996",
"name": "zulu1.8.0_05-8.1.0.10-windows.tar.gz",
- "zulu_version": [8, 1, 0, 10],
- "jdk_version": [8, 0, 5, 13]
- },
- {
- "id": 10997,
- "url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-windows.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-windows.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 8,
+ 1,
+ 0,
+ 10
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10997",
"name": "zulu1.8.0_11-8.2.0.1-windows.tar.gz",
- "zulu_version": [8, 2, 0, 1],
- "jdk_version": [8, 0, 11, 12]
- },
- {
- "id": 10346,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-windows.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 11
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 8,
+ 2,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10346",
"name": "zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz",
- "zulu_version": [8, 21, 0, 1],
- "jdk_version": [8, 0, 131, 11]
- },
- {
- "id": 10362,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 131
+ ],
+ "openjdk_build_number": 11,
+ "distro_version": [
+ 8,
+ 21,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10362",
"name": "zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz",
- "zulu_version": [8, 23, 0, 3],
- "jdk_version": [8, 0, 144, 1]
- },
- {
- "id": 10399,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 144
+ ],
+ "openjdk_build_number": 1,
+ "distro_version": [
+ 8,
+ 23,
+ 0,
+ 3
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10399",
"name": "zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz",
- "zulu_version": [8, 25, 0, 1],
- "jdk_version": [8, 0, 152, 16]
- },
- {
- "id": 11355,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 152
+ ],
+ "openjdk_build_number": 16,
+ "distro_version": [
+ 8,
+ 25,
+ 0,
+ 1
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11355",
"name": "zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz",
- "zulu_version": [8, 46, 0, 19],
- "jdk_version": [8, 0, 252, 14]
- },
- {
- "id": 11481,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 252
+ ],
+ "openjdk_build_number": 14,
+ "distro_version": [
+ 8,
+ 46,
+ 0,
+ 19
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11481",
"name": "zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz",
- "zulu_version": [8, 48, 0, 47],
- "jdk_version": [8, 0, 262, 17]
- },
- {
- "id": 11622,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 17,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 47
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11622",
"name": "zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz",
- "zulu_version": [8, 48, 0, 51],
- "jdk_version": [8, 0, 262, 19]
- },
- {
- "id": 11535,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 19,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 51
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11535",
"name": "zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz",
- "zulu_version": [8, 48, 0, 49],
- "jdk_version": [8, 0, 262, 18]
- },
- {
- "id": 12424,
- "url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 262
+ ],
+ "openjdk_build_number": 18,
+ "distro_version": [
+ 8,
+ 48,
+ 0,
+ 49
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12424",
"name": "zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz",
- "zulu_version": [8, 52, 0, 23],
- "jdk_version": [8, 0, 282, 8]
- },
- {
- "id": 10383,
- "url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz",
+ "java_version": [
+ 8,
+ 0,
+ 282
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 8,
+ 52,
+ 0,
+ 23
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10383",
"name": "zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz",
- "zulu_version": [9, 0, 0, 15],
- "jdk_version": [9, 0, 0, 0]
- },
- {
- "id": 10413,
- "url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz",
+ "java_version": [
+ 9,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 0,
+ "distro_version": [
+ 9,
+ 0,
+ 0,
+ 15
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10413",
"name": "zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz",
- "zulu_version": [9, 0, 1, 3],
- "jdk_version": [9, 0, 1, 0]
- },
- {
- "id": 10503,
- "url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 9,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 0,
+ "distro_version": [
+ 9,
+ 0,
+ 1,
+ 3
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10503",
"name": "zulu10.2+3-jdk10.0.1-windows_x64.tar.gz",
- "zulu_version": [10, 2, 3, 0],
- "jdk_version": [10, 0, 1, 9]
- },
- {
- "id": 10541,
- "url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 10,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 10,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10541",
"name": "zulu10.3+5-jdk10.0.2-windows_x64.tar.gz",
- "zulu_version": [10, 3, 5, 0],
- "jdk_version": [10, 0, 2, 13]
- },
- {
- "id": 10576,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-windows_x64.tar.gz",
+ "java_version": [
+ 10,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 10,
+ 3,
+ 5,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10576",
"name": "zulu11.2.3-jdk11.0.1-windows_x64.tar.gz",
- "zulu_version": [11, 2, 3, 0],
- "jdk_version": [11, 0, 1, 13]
- },
- {
- "id": 10604,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 13,
+ "distro_version": [
+ 11,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10604",
"name": "zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz",
- "zulu_version": [11, 29, 3, 0],
- "jdk_version": [11, 0, 2, 7]
- },
- {
- "id": 10687,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 11,
+ 29,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10687",
"name": "zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz",
- "zulu_version": [11, 31, 11, 0],
- "jdk_version": [11, 0, 3, 7]
- },
- {
- "id": 10856,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 3
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 11,
+ 31,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10856",
"name": "zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz",
- "zulu_version": [11, 35, 13, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 10933,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 13,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10933",
"name": "zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
- "zulu_version": [11, 35, 15, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 10933,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10933",
"name": "zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
- "zulu_version": [11, 35, 11, 0],
- "jdk_version": [11, 0, 5, 10]
- },
- {
- "id": 12397,
- "url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 5
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 11,
+ 35,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12397",
"name": "zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz",
- "zulu_version": [11, 45, 27, 0],
- "jdk_version": [11, 0, 10, 9]
- },
- {
- "id": 10667,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz",
+ "java_version": [
+ 11,
+ 0,
+ 10
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 11,
+ 45,
+ 27,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10667",
"name": "zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz",
- "zulu_version": [12, 1, 3, 0],
- "jdk_version": [12, 0, 0, 33]
- },
- {
- "id": 10710,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 33,
+ "distro_version": [
+ 12,
+ 1,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10710",
"name": "zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz",
- "zulu_version": [12, 2, 3, 0],
- "jdk_version": [12, 0, 1, 12]
- },
- {
- "id": 10780,
- "url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 12,
+ 2,
+ 3,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10780",
"name": "zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz",
- "zulu_version": [12, 3, 11, 0],
- "jdk_version": [12, 0, 2, 3]
- },
- {
- "id": 10846,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz",
+ "java_version": [
+ 12,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 3,
+ "distro_version": [
+ 12,
+ 3,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10846",
"name": "zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz",
- "zulu_version": [13, 27, 9, 0],
- "jdk_version": [13, 0, 0, 33]
- },
- {
- "id": 10888,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 33,
+ "distro_version": [
+ 13,
+ 27,
+ 9,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-10888",
"name": "zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz",
- "zulu_version": [13, 28, 11, 0],
- "jdk_version": [13, 0, 1, 10]
- },
- {
- "id": 11073,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 10,
+ "distro_version": [
+ 13,
+ 28,
+ 11,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11073",
"name": "zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz",
- "zulu_version": [13, 29, 9, 0],
- "jdk_version": [13, 0, 2, 6]
- },
- {
- "id": 12408,
- "url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 6,
+ "distro_version": [
+ 13,
+ 29,
+ 9,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12408",
"name": "zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz",
- "zulu_version": [13, 37, 21, 0],
- "jdk_version": [13, 0, 6, 5]
- },
- {
- "id": 11236,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz",
+ "java_version": [
+ 13,
+ 0,
+ 6
+ ],
+ "openjdk_build_number": 5,
+ "distro_version": [
+ 13,
+ 37,
+ 21,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11236",
"name": "zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz",
- "zulu_version": [14, 27, 1, 0],
- "jdk_version": [14, 0, 0, 36]
- },
- {
- "id": 11349,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 36,
+ "distro_version": [
+ 14,
+ 27,
+ 1,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11349",
"name": "zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz",
- "zulu_version": [14, 28, 21, 0],
- "jdk_version": [14, 0, 1, 8]
- },
- {
- "id": 11513,
- "url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 14,
+ 28,
+ 21,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11513",
"name": "zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz",
- "zulu_version": [14, 29, 23, 0],
- "jdk_version": [14, 0, 2, 12]
- },
- {
- "id": 11780,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz",
+ "java_version": [
+ 14,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 12,
+ "distro_version": [
+ 14,
+ 29,
+ 23,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11780",
"name": "zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz",
- "zulu_version": [15, 27, 17, 0],
- "jdk_version": [15, 0, 0, 36]
- },
- {
- "id": 11924,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 0
+ ],
+ "openjdk_build_number": 36,
+ "distro_version": [
+ 15,
+ 27,
+ 17,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-11924",
"name": "zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz",
- "zulu_version": [15, 28, 13, 0],
- "jdk_version": [15, 0, 1, 8]
- },
- {
- "id": 12101,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 8,
+ "distro_version": [
+ 15,
+ 28,
+ 13,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12101",
"name": "zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz",
- "zulu_version": [15, 28, 51, 0],
- "jdk_version": [15, 0, 1, 9]
- },
- {
- "id": 12445,
- "url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 1
+ ],
+ "openjdk_build_number": 9,
+ "distro_version": [
+ 15,
+ 28,
+ 51,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12445",
"name": "zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz",
- "zulu_version": [15, 29, 15, 0],
- "jdk_version": [15, 0, 2, 7]
- },
- {
- "id": 12446,
- "url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
- "name": "zulu17.48.15-ca-jdk17.0.10-win_aarhc4.zip",
- "zulu_version": [17, 48, 15, 0],
- "jdk_version": [17, 0, 10, 7]
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz",
+ "java_version": [
+ 15,
+ 0,
+ 2
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 15,
+ 29,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
+ },
+ {
+ "package_uuid": "test-uuid-12446",
+ "name": "zulu17.48.15-ca-jdk17.0.10-win_aarch64.zip",
+ "download_url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
+ "java_version": [
+ 17,
+ 0,
+ 10
+ ],
+ "openjdk_build_number": 7,
+ "distro_version": [
+ 17,
+ 48,
+ 15,
+ 0
+ ],
+ "latest": false,
+ "availability_type": "ca"
}
-]
\ No newline at end of file
+]
diff --git a/__tests__/distributors/adopt-installer.test.ts b/__tests__/distributors/adopt-installer.test.ts
deleted file mode 100644
index 0b35c3d3e..000000000
--- a/__tests__/distributors/adopt-installer.test.ts
+++ /dev/null
@@ -1,299 +0,0 @@
-import {HttpClient} from '@actions/http-client';
-import {IAdoptAvailableVersions} from '../../src/distributions/adopt/models';
-import {
- AdoptDistribution,
- AdoptImplementation
-} from '../../src/distributions/adopt/installer';
-import {JavaInstallerOptions} from '../../src/distributions/base-models';
-
-import os from 'os';
-
-import manifestData from '../data/adopt.json';
-
-describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
-
- beforeEach(() => {
- spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
- spyHttpClient.mockReturnValue({
- statusCode: 200,
- headers: {},
- result: []
- });
- });
-
- afterEach(() => {
- jest.resetAllMocks();
- jest.clearAllMocks();
- jest.restoreAllMocks();
- });
-
- it.each([
- [
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot,
- 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
- ],
- [
- {
- version: '11',
- architecture: 'x86',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot,
- 'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
- ],
- [
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jre',
- checkLatest: false
- },
- AdoptImplementation.Hotspot,
- 'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
- ],
- [
- {
- version: '11-ea',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot,
- 'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=hotspot&page_size=20&page=0'
- ],
- [
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.OpenJ9,
- 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
- ],
- [
- {
- version: '11',
- architecture: 'x86',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.OpenJ9,
- 'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
- ],
- [
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jre',
- checkLatest: false
- },
- AdoptImplementation.OpenJ9,
- 'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
- ],
- [
- {
- version: '11-ea',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.OpenJ9,
- 'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=openj9&page_size=20&page=0'
- ]
- ])(
- 'build correct url for %s',
- async (
- installerOptions: JavaInstallerOptions,
- impl: AdoptImplementation,
- expectedParameters
- ) => {
- const distribution = new AdoptDistribution(installerOptions, impl);
- const baseUrl =
- 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
- const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
- distribution['getPlatformOption'] = () => 'mac';
-
- await distribution['getAvailableVersions']();
-
- expect(spyHttpClient.mock.calls).toHaveLength(1);
- expect(spyHttpClient.mock.calls[0][0]).toBe(expectedUrl);
- }
- );
-
- it('load available versions', async () => {
- spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
- spyHttpClient
- .mockReturnValueOnce({
- statusCode: 200,
- headers: {},
- result: manifestData as any
- })
- .mockReturnValueOnce({
- statusCode: 200,
- headers: {},
- result: manifestData as any
- })
- .mockReturnValueOnce({
- statusCode: 200,
- headers: {},
- result: []
- });
-
- const distribution = new AdoptDistribution(
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot
- );
- const availableVersions = await distribution['getAvailableVersions']();
- expect(availableVersions).not.toBeNull();
- expect(availableVersions.length).toBe(manifestData.length * 2);
- });
-
- it.each([
- [AdoptImplementation.Hotspot, 'jdk', 'Java_Adopt_jdk'],
- [AdoptImplementation.Hotspot, 'jre', 'Java_Adopt_jre'],
- [AdoptImplementation.OpenJ9, 'jdk', 'Java_Adopt-OpenJ9_jdk'],
- [AdoptImplementation.OpenJ9, 'jre', 'Java_Adopt-OpenJ9_jre']
- ])(
- 'find right toolchain folder',
- (impl: AdoptImplementation, packageType: string, expected: string) => {
- const distribution = new AdoptDistribution(
- {
- version: '11',
- architecture: 'x64',
- packageType: packageType,
- checkLatest: false
- },
- impl
- );
-
- // @ts-ignore - because it is protected
- expect(distribution.toolcacheFolderName).toBe(expected);
- }
- );
-
- it.each([
- ['amd64', 'x64'],
- ['arm64', 'aarch64']
- ])(
- 'defaults to os.arch(): %s mapped to distro arch: %s',
- async (osArch: string, distroArch: string) => {
- jest
- .spyOn(os, 'arch')
- .mockReturnValue(osArch as ReturnType);
-
- const installerOptions: JavaInstallerOptions = {
- version: '17',
- architecture: '', // to get default value
- packageType: 'jdk',
- checkLatest: false
- };
-
- const expectedParameters = `os=mac&architecture=${distroArch}&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0`;
-
- const distribution = new AdoptDistribution(
- installerOptions,
- AdoptImplementation.Hotspot
- );
- const baseUrl =
- 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
- const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
- distribution['getPlatformOption'] = () => 'mac';
-
- await distribution['getAvailableVersions']();
-
- expect(spyHttpClient.mock.calls).toHaveLength(1);
- expect(spyHttpClient.mock.calls[0][0]).toBe(expectedUrl);
- }
- );
-});
-
-describe('findPackageForDownload', () => {
- it.each([
- ['9', '9.0.7+10'],
- ['15', '15.0.2+7'],
- ['15.0', '15.0.2+7'],
- ['15.0.2', '15.0.2+7'],
- ['15.0.1', '15.0.1+9.1'],
- ['11.x', '11.0.10+9'],
- ['x', '15.0.2+7'],
- ['12', '12.0.2+10.3'], // make sure that '12.0.2+10.1', '12.0.2+10.3', '12.0.2+10.2' are sorted correctly
- ['12.0.2+10.1', '12.0.2+10.1'],
- ['15.0.1+9', '15.0.1+9'],
- ['15.0.1+9.1', '15.0.1+9.1']
- ])('version is resolved correctly %s -> %s', async (input, expected) => {
- const distribution = new AdoptDistribution(
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot
- );
- distribution['getAvailableVersions'] = async () => manifestData as any;
- const resolvedVersion = await distribution['findPackageForDownload'](input);
- expect(resolvedVersion.version).toBe(expected);
- });
-
- it('version is found but binaries list is empty', async () => {
- const distribution = new AdoptDistribution(
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot
- );
- distribution['getAvailableVersions'] = async () => manifestData as any;
- await expect(
- distribution['findPackageForDownload']('9.0.8')
- ).rejects.toThrow(/Could not find satisfied version for SemVer */);
- });
-
- it('version is not found', async () => {
- const distribution = new AdoptDistribution(
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot
- );
- distribution['getAvailableVersions'] = async () => manifestData as any;
- await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
- );
- });
-
- it('version list is empty', async () => {
- const distribution = new AdoptDistribution(
- {
- version: '11',
- architecture: 'x64',
- packageType: 'jdk',
- checkLatest: false
- },
- AdoptImplementation.Hotspot
- );
- distribution['getAvailableVersions'] = async () => [];
- await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
- );
- });
-});
diff --git a/__tests__/distributors/base-installer.test.ts b/__tests__/distributors/base-installer.test.ts
index 08a95828c..1016a8fe6 100644
--- a/__tests__/distributors/base-installer.test.ts
+++ b/__tests__/distributors/base-installer.test.ts
@@ -1,19 +1,113 @@
-import * as tc from '@actions/tool-cache';
-import * as core from '@actions/core';
-import * as util from '../../src/util';
-
-import path from 'path';
-import * as semver from 'semver';
-
-import {JavaBase} from '../../src/distributions/base-installer';
import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {
JavaDownloadRelease,
JavaInstallerOptions,
JavaInstallerResults
-} from '../../src/distributions/base-models';
+} from '../../src/distributions/base-models.js';
+
+import path from 'path';
+import * as semver from 'semver';
+import fs from 'fs';
+import {createHash} from 'crypto';
+import {HttpClient} from '@actions/http-client';
import os from 'os';
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ find: jest.fn(),
+ findAllVersions: jest.fn(),
+ downloadTool: jest.fn(),
+ extractZip: jest.fn(),
+ extractTar: jest.fn(),
+ extract7z: jest.fn(),
+ extractXar: jest.fn(),
+ cacheDir: jest.fn(),
+ cacheFile: jest.fn(),
+ getManifestFromRepo: jest.fn(),
+ findFromManifest: jest.fn(),
+ evaluateVersions: jest.fn(),
+ HTTPError: class HTTPError extends Error {
+ httpStatusCode: number;
+ constructor(statusCode: number) {
+ super(`HTTP Error: ${statusCode}`);
+ this.httpStatusCode = statusCode;
+ }
+ }
+}));
+
+jest.unstable_mockModule('../../src/jdk-cache.js', () => ({
+ getJdkVerificationIdentity: jest.fn(
+ (verified: boolean, enforced: boolean, key?: string) =>
+ verified
+ ? `${enforced ? 'enforced' : 'check-and-warn'}:${key ? 'custom' : 'bundled'}`
+ : 'disabled'
+ ),
+ registerJdk: jest.fn(),
+ restoreJdk: jest.fn()
+}));
+
+jest.unstable_mockModule('../../src/jdk-resolution-cache.js', () => ({
+ registerJdkResolution: jest.fn(),
+ restoreJdkResolution: jest.fn()
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ extractJdkFile: jest.fn(),
+ getDownloadArchiveExtension: jest.fn(),
+ getToolcachePath: jest.fn(),
+ isJobStatusSuccess: jest.fn(),
+ renameWinArchive: jest.fn(),
+ isVersionSatisfies: real_util_module.isVersionSatisfies,
+ getTempDir: real_util_module.getTempDir
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const tc = await import('@actions/tool-cache');
+const util = await import('../../src/util.js');
+const jdkCache = await import('../../src/jdk-cache.js');
+const jdkResolutionCache = await import('../../src/jdk-resolution-cache.js');
+const {getJavaPlatformIdentity} =
+ await import('../../src/distributions/platform-types.js');
+const {JavaBase} = await import('../../src/distributions/base-installer.js');
+
class EmptyJavaBase extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) {
super('Empty', installerOptions);
@@ -38,7 +132,7 @@ class EmptyJavaBase extends JavaBase {
): Promise {
const availableVersion = '11.0.9';
if (!semver.satisfies(availableVersion, range)) {
- throw new Error('Available version not found');
+ throw this.createVersionNotFoundError(range, [availableVersion]);
}
return {
@@ -46,6 +140,58 @@ class EmptyJavaBase extends JavaBase {
url: `some/random_url/java/${availableVersion}`
};
}
+
+ public downloadRelease(javaRelease: JavaDownloadRelease): Promise {
+ return this.downloadAndVerify(javaRelease);
+ }
+
+ public fetchChecksumForTest(
+ checksumUrl: string,
+ algorithm: 'sha256' | 'sha512' | ('sha256' | 'sha512')[]
+ ) {
+ return this.fetchChecksum(checksumUrl, algorithm);
+ }
+}
+
+class FloatingJavaBase extends JavaBase {
+ static actualVersion = '21.0.8+9';
+ static checksum: string | undefined = 'artifact-one';
+ static fingerprint: string | undefined = undefined;
+
+ constructor(installerOptions: JavaInstallerOptions) {
+ super('Floating', installerOptions);
+ }
+
+ protected async downloadTool(): Promise {
+ return {
+ version: FloatingJavaBase.actualVersion,
+ path: path.join(
+ 'toolcache',
+ this.toolcacheFolderName,
+ FloatingJavaBase.actualVersion.replace('+', '-'),
+ this.architecture
+ )
+ };
+ }
+
+ protected async findPackageForDownload(): Promise {
+ return {
+ version: '21',
+ url: 'https://example.com/java/21/latest/jdk-21.tar.gz',
+ checksum: FloatingJavaBase.checksum
+ ? {
+ algorithm: 'sha256',
+ value: FloatingJavaBase.checksum
+ }
+ : undefined,
+ floating: true,
+ fingerprint: FloatingJavaBase.fingerprint
+ };
+ }
+
+ protected requiresRemoteResolution(): boolean {
+ return true;
+ }
}
describe('findInToolcache', () => {
@@ -53,12 +199,12 @@ describe('findInToolcache', () => {
const javaPath = path.join('Java_Empty_jdk', actualJavaVersion, 'x64');
let mockJavaBase: EmptyJavaBase;
- let spyGetToolcachePath: jest.SpyInstance;
- let spyTcFindAllVersions: jest.SpyInstance;
+ let spyGetToolcachePath: any;
+ let spyTcFindAllVersions: any;
beforeEach(() => {
- spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
- spyTcFindAllVersions = jest.spyOn(tc, 'findAllVersions');
+ spyGetToolcachePath = util.getToolcachePath as jest.Mock;
+ spyTcFindAllVersions = tc.findAllVersions as jest.Mock;
});
afterEach(() => {
@@ -241,16 +387,23 @@ describe('setupJava', () => {
let mockJavaBase: EmptyJavaBase;
- let spyGetToolcachePath: jest.SpyInstance;
- let spyTcFindAllVersions: jest.SpyInstance;
- let spyCoreDebug: jest.SpyInstance;
- let spyCoreInfo: jest.SpyInstance;
- let spyCoreExportVariable: jest.SpyInstance;
- let spyCoreAddPath: jest.SpyInstance;
- let spyCoreSetOutput: jest.SpyInstance;
+ let spyGetToolcachePath: any;
+ let spyTcFindAllVersions: any;
+ let spyCoreDebug: any;
+ let spyCoreInfo: any;
+ let spyCoreExportVariable: any;
+ let spyCoreAddPath: any;
+ let spyCoreSetOutput: any;
+ let spyCoreError: any;
beforeEach(() => {
- spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
+ (jdkCache.getJdkVerificationIdentity as jest.Mock).mockImplementation(
+ (verified: boolean, enforced: boolean, key?: string) =>
+ verified
+ ? `${enforced ? 'enforced' : 'check-and-warn'}:${key ? 'custom' : 'bundled'}`
+ : 'disabled'
+ );
+ spyGetToolcachePath = util.getToolcachePath as jest.Mock;
spyGetToolcachePath.mockImplementation(
(toolname: string, javaVersion: string, architecture: string) => {
const semverVersion = new semver.Range(javaVersion);
@@ -268,26 +421,31 @@ describe('setupJava', () => {
}
);
- spyTcFindAllVersions = jest.spyOn(tc, 'findAllVersions');
+ spyTcFindAllVersions = tc.findAllVersions as jest.Mock;
spyTcFindAllVersions.mockReturnValue([installedJavaVersion]);
// Spy on core methods
- spyCoreDebug = jest.spyOn(core, 'debug');
+ spyCoreDebug = core.debug as jest.Mock;
spyCoreDebug.mockImplementation(() => undefined);
- spyCoreInfo = jest.spyOn(core, 'info');
+ spyCoreInfo = core.info as jest.Mock;
spyCoreInfo.mockImplementation(() => undefined);
- spyCoreAddPath = jest.spyOn(core, 'addPath');
+ spyCoreAddPath = core.addPath as jest.Mock;
spyCoreAddPath.mockImplementation(() => undefined);
- spyCoreExportVariable = jest.spyOn(core, 'exportVariable');
+ spyCoreExportVariable = core.exportVariable as jest.Mock;
spyCoreExportVariable.mockImplementation(() => undefined);
- spyCoreSetOutput = jest.spyOn(core, 'setOutput');
+ spyCoreSetOutput = core.setOutput as jest.Mock;
spyCoreSetOutput.mockImplementation(() => undefined);
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => undefined);
+
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType);
+ FloatingJavaBase.fingerprint = undefined;
});
afterEach(() => {
@@ -344,6 +502,438 @@ describe('setupJava', () => {
expect(spyCoreInfo).not.toHaveBeenCalledWith('Trying to download...');
});
+ it('should resolve the latest version from remote when java-version is "latest", even if a version is cached', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: 'latest',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: actualJavaVersion,
+ path: javaPathInstalled
+ });
+
+ // `latest` must bypass the tool-cache short-circuit and always resolve remotely
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ 'Trying to resolve the latest version from remote'
+ );
+ expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
+ expect(spyCoreInfo).not.toHaveBeenCalledWith(
+ `Resolved Java ${installedJavaVersion} from tool-cache`
+ );
+ });
+
+ describe('floating tool-cache reuse', () => {
+ let toolCacheRoot: string;
+
+ const installVersion = (toolcacheVersion: string): string => {
+ const architecturePath = path.join(
+ toolCacheRoot,
+ 'Java_Floating_jdk',
+ toolcacheVersion,
+ 'x64'
+ );
+ fs.mkdirSync(architecturePath, {recursive: true});
+ fs.writeFileSync(`${architecturePath}.complete`, '');
+ return architecturePath;
+ };
+
+ beforeEach(() => {
+ toolCacheRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-java-tc-'));
+ process.env['RUNNER_TOOL_CACHE'] = toolCacheRoot;
+ FloatingJavaBase.actualVersion = '21.0.8+9';
+ FloatingJavaBase.checksum = 'artifact-one';
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+ spyTcFindAllVersions.mockReturnValue([]);
+ });
+
+ afterEach(() => {
+ fs.rmSync(toolCacheRoot, {recursive: true, force: true});
+ delete process.env['RUNNER_TOOL_CACHE'];
+ });
+
+ const createDistribution = (forceDownload = false) =>
+ new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true,
+ forceDownload
+ });
+
+ it('reuses a tool-cache installation once the resolution cache identifies the floating version', async () => {
+ const installedPath = installVersion('21.0.8-9');
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: {version: '21.0.8+9'}
+ });
+ const distribution = createDistribution();
+ const downloadTool = jest.spyOn(distribution as any, 'downloadTool');
+
+ await expect(distribution.setupJava()).resolves.toEqual({
+ version: '21.0.8+9',
+ path: installedPath
+ });
+
+ // The artifact behind the mutable URL is already installed, so neither a
+ // download nor a cache round-trip is needed.
+ expect(downloadTool).not.toHaveBeenCalled();
+ expect(jdkCache.restoreJdk).not.toHaveBeenCalled();
+ });
+
+ it('ignores a tool-cache installation of a version the resolution cache did not vouch for', async () => {
+ installVersion('21.0.7-6');
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: {version: '21.0.8+9'}
+ });
+ const distribution = createDistribution();
+ const downloadTool = jest.spyOn(distribution as any, 'downloadTool');
+
+ await distribution.setupJava();
+
+ expect(downloadTool).toHaveBeenCalled();
+ });
+
+ it('never reuses the tool-cache for a floating artifact the resolution cache cannot identify', async () => {
+ installVersion('21.0.8-9');
+ spyTcFindAllVersions.mockReturnValue(['21.0.8-9']);
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue(
+ undefined
+ );
+ const distribution = createDistribution();
+ const downloadTool = jest.spyOn(distribution as any, 'downloadTool');
+
+ await distribution.setupJava();
+
+ // Nothing ties the installed bytes to what the URL serves right now.
+ expect(downloadTool).toHaveBeenCalled();
+ });
+
+ it('still downloads a resolution-cache-identified version when force-download is set', async () => {
+ installVersion('21.0.8-9');
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: {version: '21.0.8+9'}
+ });
+ const distribution = createDistribution(true);
+ const downloadTool = jest.spyOn(distribution as any, 'downloadTool');
+
+ await distribution.setupJava();
+
+ expect(downloadTool).toHaveBeenCalled();
+ });
+ });
+
+ it('uses the concrete versions of two different floating artifacts under the same major', async () => {
+ spyTcFindAllVersions.mockReturnValue(['21.0.8-9']);
+ spyGetToolcachePath.mockImplementation(
+ (_toolname: string, version: string, architecture: string) =>
+ path.join('toolcache', 'Java_Floating_jdk', version, architecture)
+ );
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue(
+ undefined
+ );
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+
+ FloatingJavaBase.actualVersion = '21.0.8+9';
+ FloatingJavaBase.checksum = 'artifact-one';
+ const first = new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ });
+ await expect(first.setupJava()).resolves.toEqual({
+ version: '21.0.8+9',
+ path: path.join('toolcache', 'Java_Floating_jdk', '21.0.8-9', 'x64')
+ });
+
+ FloatingJavaBase.actualVersion = '21.0.9+7';
+ FloatingJavaBase.checksum = 'artifact-two';
+ const second = new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ });
+ await expect(second.setupJava()).resolves.toEqual({
+ version: '21.0.9+7',
+ path: path.join('toolcache', 'Java_Floating_jdk', '21.0.9-7', 'x64')
+ });
+
+ expect(spyCoreSetOutput).toHaveBeenNthCalledWith(3, 'version', '21.0.8+9');
+ expect(spyCoreSetOutput).toHaveBeenNthCalledWith(6, 'version', '21.0.9+7');
+ expect(jdkCache.registerJdk).toHaveBeenNthCalledWith(
+ 1,
+ expect.objectContaining({
+ version: '21.0.8+9',
+ source: 'sha256:artifact-one'
+ })
+ );
+ expect(jdkCache.registerJdk).toHaveBeenNthCalledWith(
+ 2,
+ expect.objectContaining({
+ version: '21.0.9+7',
+ source: 'sha256:artifact-two'
+ })
+ );
+ expect(jdkResolutionCache.registerJdkResolution).toHaveBeenNthCalledWith(
+ 2,
+ expect.objectContaining({source: 'sha256:artifact-two'}),
+ expect.objectContaining({version: '21.0.9+7', floating: true})
+ );
+ });
+
+ it('does not trust a matching tool-cache version for a floating artifact', async () => {
+ spyTcFindAllVersions.mockReturnValue(['21.0.8-9']);
+ spyGetToolcachePath.mockReturnValue(
+ path.join('toolcache', 'Java_Floating_jdk', '21.0.8-9', 'x64')
+ );
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: {
+ version: '21.0.8+9',
+ url: 'https://example.com/java/21/latest/jdk-21.tar.gz',
+ checksum: {algorithm: 'sha256', value: 'artifact-republished'},
+ floating: true
+ },
+ fresh: true
+ });
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+ FloatingJavaBase.actualVersion = '21.0.8+9';
+ FloatingJavaBase.checksum = 'artifact-republished';
+ const distribution = new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ });
+ const downloadTool = jest.spyOn(distribution as any, 'downloadTool');
+
+ await distribution.setupJava();
+
+ expect(jdkCache.restoreJdk).toHaveBeenCalled();
+ expect(downloadTool).toHaveBeenCalled();
+ });
+
+ it('does not cache a floating artifact with no way to identify its bytes', async () => {
+ spyTcFindAllVersions.mockReturnValue(['21.0.8-9']);
+ spyGetToolcachePath.mockReturnValue(
+ path.join('toolcache', 'Java_Floating_jdk', '21.0.8-9', 'x64')
+ );
+ FloatingJavaBase.actualVersion = '21.0.8+9';
+ FloatingJavaBase.checksum = undefined;
+ FloatingJavaBase.fingerprint = undefined;
+ const distribution = new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ });
+
+ await distribution.setupJava();
+
+ expect(jdkResolutionCache.restoreJdkResolution).not.toHaveBeenCalled();
+ expect(jdkResolutionCache.registerJdkResolution).not.toHaveBeenCalled();
+ expect(jdkCache.restoreJdk).not.toHaveBeenCalled();
+ expect(jdkCache.registerJdk).not.toHaveBeenCalled();
+ });
+
+ it('caches a checksum-less floating artifact identified by its response fingerprint', async () => {
+ spyTcFindAllVersions.mockReturnValue([]);
+ spyGetToolcachePath.mockReturnValue(
+ path.join('toolcache', 'Java_Floating_jdk', '21.0.8-9', 'x64')
+ );
+ FloatingJavaBase.actualVersion = '21.0.8+9';
+ FloatingJavaBase.checksum = undefined;
+ FloatingJavaBase.fingerprint = 'etag:"artifact-one"';
+ const distribution = new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ });
+
+ await distribution.setupJava();
+
+ // The fingerprint changes when the vendor republishes, so it is a safe
+ // identity even though no checksum is available.
+ expect(jdkResolutionCache.registerJdkResolution).toHaveBeenCalledWith(
+ expect.objectContaining({source: 'etag:"artifact-one"'}),
+ expect.objectContaining({version: '21.0.8+9'})
+ );
+ expect(jdkCache.registerJdk).toHaveBeenCalledWith(
+ expect.objectContaining({source: 'etag:"artifact-one"'})
+ );
+ });
+
+ it('separates the cache identities of two builds served by the same floating URL', async () => {
+ const sources: string[] = [];
+ (jdkCache.registerJdk as jest.Mock).mockImplementation((entry: any) => {
+ sources.push(entry.source);
+ });
+ spyTcFindAllVersions.mockReturnValue([]);
+ spyGetToolcachePath.mockReturnValue(
+ path.join('toolcache', 'Java_Floating_jdk', '21.0.8-9', 'x64')
+ );
+ FloatingJavaBase.actualVersion = '21.0.8+9';
+ FloatingJavaBase.checksum = undefined;
+
+ for (const fingerprint of ['etag:"before"', 'etag:"after"']) {
+ FloatingJavaBase.fingerprint = fingerprint;
+ await new FloatingJavaBase({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ }).setupJava();
+ }
+
+ expect(sources).toEqual(['etag:"before"', 'etag:"after"']);
+ });
+
+ it('should download java when force-download is enabled, even if the version is cached', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: actualJavaVersion,
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ forceDownload: true,
+ cacheJdk: true
+ });
+
+ const findInToolcache = jest.fn(() => ({
+ version: actualJavaVersion,
+ path: javaPathInstalled
+ }));
+ mockJavaBase['findInToolcache'] = findInToolcache;
+
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: actualJavaVersion,
+ path: javaPathInstalled
+ });
+
+ expect(findInToolcache).not.toHaveBeenCalled();
+ expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ `Java ${actualJavaVersion} was downloaded`
+ );
+ expect(spyCoreInfo).not.toHaveBeenCalledWith(
+ `Resolved Java ${actualJavaVersion} from tool-cache`
+ );
+ expect(jdkCache.restoreJdk).not.toHaveBeenCalled();
+ expect(jdkCache.registerJdk).toHaveBeenCalledWith(
+ expect.objectContaining({
+ version: actualJavaVersion,
+ verification: 'disabled'
+ })
+ );
+ });
+
+ it.each([
+ [false, false, false, false],
+ [false, true, true, true],
+ [true, false, false, false],
+ [true, true, false, true]
+ ])(
+ 'handles force-download=%s and cache-jdk=%s',
+ async (forceDownload, cacheJdkEnabled, restores, registers) => {
+ mockJavaBase = new EmptyJavaBase({
+ version: actualJavaVersion,
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: true,
+ forceDownload,
+ cacheJdk: cacheJdkEnabled
+ });
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+
+ await mockJavaBase.setupJava();
+
+ expect(jdkCache.restoreJdk).toHaveBeenCalledTimes(restores ? 1 : 0);
+ expect(jdkCache.registerJdk).toHaveBeenCalledTimes(registers ? 1 : 0);
+ }
+ );
+
+ it('restores the exact resolved JDK before downloading', async () => {
+ const toolCachePath = path.join('toolcache');
+ jest.replaceProperty(process, 'env', {
+ ...process.env,
+ RUNNER_TOOL_CACHE: toolCachePath
+ });
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: true,
+ cacheJdk: true
+ });
+ const downloadTool = jest.spyOn(mockJavaBase as any, 'downloadTool');
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(true);
+ jest
+ .spyOn(mockJavaBase as any, 'getRestoredJdkPath')
+ .mockReturnValue(javaPathInstalled);
+
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: actualJavaVersion,
+ path: javaPathInstalled
+ });
+
+ expect(jdkCache.restoreJdk).toHaveBeenCalledWith({
+ distribution: 'Empty',
+ packageType: 'jdk',
+ architecture: 'x86',
+ version: actualJavaVersion,
+ source: `some/random_url/java/${actualJavaVersion}`,
+ verification: 'disabled',
+ path: path.join(toolCachePath, 'Java_Empty_jdk', actualJavaVersion)
+ });
+ expect(downloadTool).not.toHaveBeenCalled();
+ expect(spyCoreInfo).not.toHaveBeenCalledWith('Trying to download...');
+ // A restored entry is already stored under its key; it must not be
+ // re-registered for a post-job save.
+ expect(jdkCache.registerJdk).not.toHaveBeenCalled();
+ });
+
+ it('registers the downloaded JDK identity after a JDK cache miss', async () => {
+ const toolCachePath = path.join('toolcache');
+ jest.replaceProperty(process, 'env', {
+ ...process.env,
+ RUNNER_TOOL_CACHE: toolCachePath
+ });
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: true,
+ cacheJdk: true
+ });
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+
+ await mockJavaBase.setupJava();
+
+ const expectedIdentity = {
+ distribution: 'Empty',
+ packageType: 'jdk',
+ architecture: 'x86',
+ version: actualJavaVersion,
+ source: `some/random_url/java/${actualJavaVersion}`,
+ verification: 'disabled',
+ path: path.join(toolCachePath, 'Java_Empty_jdk', actualJavaVersion)
+ };
+ expect(jdkCache.restoreJdk).toHaveBeenCalledWith(expectedIdentity);
+ // Registration happens after the installation exists, so the post-job save
+ // can detect a later step replacing it.
+ expect(jdkCache.registerJdk).toHaveBeenCalledWith(expectedIdentity);
+ expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
+ });
+
it.each([
[
{
@@ -459,6 +1049,49 @@ describe('setupJava', () => {
}
);
+ it('should fail when verify-signature is enabled for unsupported distributions', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ });
+
+ await expect(mockJavaBase.setupJava()).rejects.toThrow(
+ "Input 'verify-signature' is not supported for distribution 'Empty'."
+ );
+ expect(spyTcFindAllVersions).not.toHaveBeenCalled();
+ expect(spyCoreAddPath).not.toHaveBeenCalled();
+ expect(spyCoreExportVariable).not.toHaveBeenCalled();
+ expect(spyCoreSetOutput).not.toHaveBeenCalled();
+ });
+
+ it('should not repeat version resolution when downloadTool fails', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ forceDownload: true
+ });
+ const findPackageForDownload = jest.fn(async () => ({
+ version: '11.0.9',
+ url: 'https://example.com/jdk.tar.gz'
+ }));
+ const downloadError = new Error('download failed');
+ const downloadTool = jest.fn(async () => {
+ throw downloadError;
+ });
+ mockJavaBase['findPackageForDownload'] = findPackageForDownload;
+ mockJavaBase['downloadTool'] = downloadTool;
+
+ await expect(mockJavaBase.setupJava()).rejects.toBe(downloadError);
+
+ expect(findPackageForDownload).toHaveBeenCalledTimes(1);
+ expect(downloadTool).toHaveBeenCalledTimes(1);
+ });
+
it.each([
[
{
@@ -530,30 +1163,606 @@ describe('setupJava', () => {
checkLatest: false
}
]
- ])(
- 'should throw an error for Available version not found for %s',
- async input => {
- mockJavaBase = new EmptyJavaBase(input);
+ ])('should throw an error for version not found for %s', async input => {
+ mockJavaBase = new EmptyJavaBase(input);
+ await expect(mockJavaBase.setupJava()).rejects.toThrow(
+ `No matching version found for SemVer '${input.version}'`
+ );
+ expect(spyTcFindAllVersions).toHaveBeenCalled();
+ expect(spyCoreAddPath).not.toHaveBeenCalled();
+ expect(spyCoreExportVariable).not.toHaveBeenCalled();
+ expect(spyCoreSetOutput).not.toHaveBeenCalled();
+ });
+
+ it('should not set JAVA_HOME and PATH when setDefault is false', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ setDefault: false
+ });
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: installedJavaVersion,
+ path: javaPath
+ });
+ expect(spyCoreExportVariable).not.toHaveBeenCalledWith(
+ 'JAVA_HOME',
+ expect.anything()
+ );
+ expect(spyCoreAddPath).not.toHaveBeenCalled();
+ expect(spyCoreExportVariable).toHaveBeenCalledWith(
+ 'JAVA_HOME_11_X86',
+ javaPath
+ );
+ expect(spyCoreSetOutput).toHaveBeenCalledWith(
+ 'version',
+ installedJavaVersion
+ );
+ expect(spyCoreSetOutput).toHaveBeenCalledWith('path', javaPath);
+ expect(spyCoreSetOutput).toHaveBeenCalledWith('distribution', 'Empty');
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ `Installing Java ${installedJavaVersion} (not setting as default)`
+ );
+ });
+
+ it('should set JAVA_HOME and PATH when setDefault is true', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ setDefault: true
+ });
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: installedJavaVersion,
+ path: javaPath
+ });
+ expect(spyCoreExportVariable).toHaveBeenCalledWith('JAVA_HOME', javaPath);
+ expect(spyCoreAddPath).toHaveBeenCalledWith(path.join(javaPath, 'bin'));
+ expect(spyCoreExportVariable).toHaveBeenCalledWith(
+ 'JAVA_HOME_11_X86',
+ javaPath
+ );
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ `Setting Java ${installedJavaVersion} as the default`
+ );
+ });
+
+ it('should default to setting as default when setDefault is not specified', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: installedJavaVersion,
+ path: javaPath
+ });
+ expect(spyCoreExportVariable).toHaveBeenCalledWith('JAVA_HOME', javaPath);
+ expect(spyCoreAddPath).toHaveBeenCalledWith(path.join(javaPath, 'bin'));
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ `Setting Java ${installedJavaVersion} as the default`
+ );
+ });
+
+ it('should download and not set default when setDefault is false', async () => {
+ mockJavaBase = new EmptyJavaBase({
+ version: '11',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ setDefault: false
+ });
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: '11.0.9',
+ path: path.join('toolcache', 'Java_Empty_jdk', '11.0.9', 'x64')
+ });
+ expect(spyCoreExportVariable).not.toHaveBeenCalledWith(
+ 'JAVA_HOME',
+ expect.anything()
+ );
+ expect(spyCoreAddPath).not.toHaveBeenCalled();
+ expect(spyCoreExportVariable).toHaveBeenCalledWith(
+ 'JAVA_HOME_11_X64',
+ path.join('toolcache', 'Java_Empty_jdk', '11.0.9', 'x64')
+ );
+ expect(spyCoreSetOutput).toHaveBeenCalledWith('version', '11.0.9');
+ expect(spyCoreSetOutput).toHaveBeenCalledWith(
+ 'path',
+ path.join('toolcache', 'Java_Empty_jdk', '11.0.9', 'x64')
+ );
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ 'Installing Java 11.0.9 (not setting as default)'
+ );
+ });
+
+ describe('resolution cache', () => {
+ // 11.0.9 is not in the mocked tool-cache, so the tool-cache short-circuit
+ // misses and the release has to be resolved, exactly as it does for every
+ // distribution that is not preinstalled on hosted runners.
+ const options: JavaInstallerOptions = {
+ version: '11.0.9',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ cacheJdk: true
+ };
+ const cachedRelease = {
+ version: '11.0.9',
+ url: 'https://example.com/java/11.0.9'
+ };
+
+ const expectedRequest = {
+ distribution: 'Empty',
+ packageType: 'jdk',
+ platform: getJavaPlatformIdentity(),
+ architecture: 'x86',
+ versionSpec: '11.0.9',
+ stable: true
+ };
+
+ beforeEach(() => {
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue(
+ undefined
+ );
+ });
+
+ it('skips the metadata API on a fresh cached resolution', async () => {
+ mockJavaBase = new EmptyJavaBase(options);
+ const findPackageForDownload = jest.spyOn(
+ mockJavaBase as any,
+ 'findPackageForDownload'
+ );
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: cachedRelease,
+ fresh: true
+ });
+
+ await mockJavaBase.setupJava();
+
+ expect(jdkResolutionCache.restoreJdkResolution).toHaveBeenCalledWith(
+ expectedRequest
+ );
+ expect(findPackageForDownload).not.toHaveBeenCalled();
+ expect(jdkResolutionCache.registerJdkResolution).not.toHaveBeenCalled();
+ expect(spyCoreInfo).toHaveBeenCalledWith(
+ 'Resolved Empty 11.0.9 from the resolution cache'
+ );
+ });
+
+ it('re-resolves and records the release on a miss', async () => {
+ mockJavaBase = new EmptyJavaBase(options);
+
+ await mockJavaBase.setupJava();
+
+ expect(jdkResolutionCache.registerJdkResolution).toHaveBeenCalledWith(
+ expectedRequest,
+ {version: '11.0.9', url: 'some/random_url/java/11.0.9'}
+ );
+ });
+
+ it('re-resolves when the cached resolution is stale', async () => {
+ mockJavaBase = new EmptyJavaBase(options);
+ const findPackageForDownload = jest.spyOn(
+ mockJavaBase as any,
+ 'findPackageForDownload'
+ );
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: cachedRelease,
+ fresh: false
+ });
+
+ await mockJavaBase.setupJava();
+
+ expect(findPackageForDownload).toHaveBeenCalled();
+ expect(jdkResolutionCache.registerJdkResolution).toHaveBeenCalled();
+ });
+
+ it('falls back to a stale resolution when the metadata API fails', async () => {
+ mockJavaBase = new EmptyJavaBase(options);
+ const downloadTool = jest
+ .spyOn(mockJavaBase as any, 'downloadTool')
+ .mockResolvedValue({version: '11.0.9', path: javaPathInstalled});
+ jest
+ .spyOn(mockJavaBase as any, 'findPackageForDownload')
+ .mockRejectedValue(new Error('503 Service Unavailable'));
+ (jdkResolutionCache.restoreJdkResolution as jest.Mock).mockResolvedValue({
+ release: cachedRelease,
+ fresh: false
+ });
+
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: '11.0.9',
+ path: javaPathInstalled
+ });
+
+ expect(downloadTool).toHaveBeenCalledWith(cachedRelease);
+ expect(jdkResolutionCache.registerJdkResolution).not.toHaveBeenCalled();
+ expect(core.warning).toHaveBeenCalledWith(
+ expect.stringContaining('falling back to the cached resolution')
+ );
+ });
+
+ it('fails when the metadata API fails and nothing was cached', async () => {
+ mockJavaBase = new EmptyJavaBase(options);
+ jest
+ .spyOn(mockJavaBase as any, 'findPackageForDownload')
+ .mockRejectedValue(new Error('503 Service Unavailable'));
+
await expect(mockJavaBase.setupJava()).rejects.toThrow(
- 'Available version not found'
+ '503 Service Unavailable'
+ );
+ });
+
+ it('records the concrete version for a checksum-bound floating release', async () => {
+ mockJavaBase = new EmptyJavaBase(options);
+ jest
+ .spyOn(mockJavaBase as any, 'findPackageForDownload')
+ .mockResolvedValue({
+ version: '11.0.9',
+ url: 'https://example.com/java/11/latest/jdk-11.tar.gz',
+ checksum: {algorithm: 'sha256', value: 'abc'},
+ floating: true
+ });
+
+ await mockJavaBase.setupJava();
+
+ expect(jdkResolutionCache.registerJdkResolution).toHaveBeenCalledWith(
+ {
+ distribution: 'Empty',
+ packageType: 'jdk',
+ platform: getJavaPlatformIdentity(),
+ architecture: 'x86',
+ versionSpec: '11.0.9',
+ stable: true,
+ source: 'sha256:abc'
+ },
+ {
+ version: '11.0.9',
+ url: 'https://example.com/java/11/latest/jdk-11.tar.gz',
+ checksum: {algorithm: 'sha256', value: 'abc'},
+ floating: true
+ }
+ );
+ });
+
+ it.each([
+ ['cache-jdk is disabled', {cacheJdk: false}],
+ ['check-latest is enabled', {checkLatest: true}],
+ ['force-download is enabled', {forceDownload: true}],
+ ['java-version is "latest"', {version: 'latest'}]
+ ])('is bypassed when %s', async (_name, overrides) => {
+ mockJavaBase = new EmptyJavaBase({...options, ...overrides});
+
+ await mockJavaBase.setupJava();
+
+ expect(jdkResolutionCache.restoreJdkResolution).not.toHaveBeenCalled();
+ expect(jdkResolutionCache.registerJdkResolution).not.toHaveBeenCalled();
+ });
+ });
+});
+
+describe('downloadAndVerify', () => {
+ const options: JavaInstallerOptions = {
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ };
+ let temporaryDirectory: string;
+ let archivePath: string;
+
+ beforeEach(async () => {
+ temporaryDirectory = await fs.promises.mkdtemp(
+ path.join(os.tmpdir(), 'setup-java-base-')
+ );
+ archivePath = path.join(temporaryDirectory, 'archive');
+ await fs.promises.writeFile(archivePath, 'downloaded archive');
+ (tc.downloadTool as jest.Mock).mockResolvedValue(archivePath);
+ });
+
+ afterEach(async () => {
+ await fs.promises.rm(temporaryDirectory, {recursive: true, force: true});
+ jest.resetAllMocks();
+ });
+
+ it('returns a download after successful verification', async () => {
+ const distribution = new EmptyJavaBase(options);
+ const result = await distribution.downloadRelease({
+ version: '21.0.8',
+ url: 'https://vendor.example/jdk.tar.gz',
+ checksum: {
+ algorithm: 'sha256',
+ value: createHash('sha256').update('downloaded archive').digest('hex')
+ }
+ });
+
+ expect(result).toBe(archivePath);
+ expect(fs.existsSync(archivePath)).toBe(true);
+ expect(core.debug).toHaveBeenCalledWith(
+ 'Verified sha256 checksum for Empty version 21.0.8.'
+ );
+ });
+
+ it('removes the download after verification failure', async () => {
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.downloadRelease({
+ version: '21.0.8',
+ url: 'https://vendor.example/jdk.tar.gz?token=secret',
+ checksum: {algorithm: 'sha256', value: 'a'.repeat(64)}
+ })
+ ).rejects.toThrow('Checksum verification failed for Empty version 21.0.8');
+
+ expect(fs.existsSync(archivePath)).toBe(false);
+ });
+
+ it('preserves the verification error when removing the download fails', async () => {
+ const distribution = new EmptyJavaBase(options);
+ const cleanupError = new Error('cleanup failed');
+ jest.spyOn(fs.promises, 'rm').mockRejectedValueOnce(cleanupError);
+
+ const result = distribution.downloadRelease({
+ version: '21.0.8',
+ url: 'https://vendor.example/jdk.tar.gz',
+ checksum: {algorithm: 'sha256', value: 'a'.repeat(64)}
+ });
+
+ await expect(result).rejects.toMatchObject({
+ message: expect.stringContaining(
+ 'Failed to remove the downloaded archive after verification failure: cleanup failed'
+ ),
+ cause: expect.objectContaining({
+ message: expect.stringContaining(
+ 'Checksum verification failed for Empty version 21.0.8'
+ )
+ })
+ });
+ });
+
+ it('logs when authoritative checksum metadata is unavailable', async () => {
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.downloadRelease({
+ version: '21.0.8',
+ url: 'https://vendor.example/jdk.tar.gz'
+ })
+ ).resolves.toBe(archivePath);
+
+ expect(core.debug).toHaveBeenCalledWith(
+ 'No authoritative checksum is available for Empty version 21.0.8; skipping checksum verification.'
+ );
+ });
+
+ it.each([undefined, '', ' '])(
+ 'skips verification when the vendor digest is %p',
+ async value => {
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.downloadRelease({
+ version: '21.0.8',
+ url: 'https://vendor.example/jdk.tar.gz',
+ checksum: {
+ algorithm: 'sha256',
+ value
+ } as JavaDownloadRelease['checksum']
+ })
+ ).resolves.toBe(archivePath);
+
+ expect(core.debug).toHaveBeenCalledWith(
+ 'No authoritative checksum is available for Empty version 21.0.8; skipping checksum verification.'
);
- expect(spyTcFindAllVersions).toHaveBeenCalled();
- expect(spyCoreAddPath).not.toHaveBeenCalled();
- expect(spyCoreExportVariable).not.toHaveBeenCalled();
- expect(spyCoreSetOutput).not.toHaveBeenCalled();
}
);
});
+describe('fetchChecksum', () => {
+ const options: JavaInstallerOptions = {
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ };
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ function mockGet(statusCode: number, body: string) {
+ return jest.spyOn(HttpClient.prototype, 'get').mockResolvedValue({
+ message: {statusCode},
+ readBody: async () => body
+ } as any);
+ }
+
+ it('parses a bare hex digest', async () => {
+ const digest = 'a'.repeat(64);
+ const spy = mockGet(200, digest);
+ const distribution = new EmptyJavaBase(options);
+
+ const checksum = await distribution.fetchChecksumForTest(
+ 'https://vendor.example/jdk.tar.gz.sha256',
+ 'sha256'
+ );
+
+ expect(spy).toHaveBeenCalledWith(
+ 'https://vendor.example/jdk.tar.gz.sha256'
+ );
+ expect(checksum).toEqual({
+ algorithm: 'sha256',
+ value: digest,
+ source: 'https://vendor.example/jdk.tar.gz.sha256'
+ });
+ });
+
+ it('parses only the first token of a GNU-style checksum file', async () => {
+ const digest = 'b'.repeat(128);
+ mockGet(200, `${digest} jbrsdk-21.0.3-linux-x64-b465.3.tar.gz\n`);
+ const distribution = new EmptyJavaBase(options);
+
+ const checksum = await distribution.fetchChecksumForTest(
+ 'https://vendor.example/jdk.tar.gz.checksum',
+ 'sha512'
+ );
+
+ expect(checksum).toEqual({
+ algorithm: 'sha512',
+ value: digest,
+ source: 'https://vendor.example/jdk.tar.gz.checksum'
+ });
+ });
+
+ it('trims surrounding whitespace and newlines', async () => {
+ const digest = 'c'.repeat(64);
+ mockGet(200, `\n ${digest} \n`);
+ const distribution = new EmptyJavaBase(options);
+
+ const checksum = await distribution.fetchChecksumForTest(
+ 'https://vendor.example/jdk.tar.gz.sha256',
+ 'sha256'
+ );
+
+ expect(checksum.value).toBe(digest);
+ });
+
+ it('skips verification when the sibling checksum is not published', async () => {
+ mockGet(404, 'Not Found');
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.fetchChecksumForTest(
+ 'https://vendor.example/jdk.tar.gz.sha256',
+ 'sha256'
+ )
+ ).resolves.toBeUndefined();
+ expect(core.debug).toHaveBeenCalledWith(
+ 'No authoritative sha256 checksum is available for Empty from https://vendor.example/jdk.tar.gz.sha256; skipping checksum verification.'
+ );
+ });
+
+ it('surfaces unexpected HTTP failures without query parameters', async () => {
+ mockGet(500, 'Server Error');
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.fetchChecksumForTest(
+ 'https://vendor.example/jdk.tar.gz.sha256?token=secret',
+ 'sha256'
+ )
+ ).rejects.toThrow(
+ 'Failed to fetch the authoritative sha256 checksum for Empty from https://vendor.example/jdk.tar.gz.sha256 (HTTP 500).'
+ );
+ });
+
+ it('rejects an empty successful checksum response', async () => {
+ mockGet(200, ' \n');
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.fetchChecksumForTest(
+ 'https://vendor.example/jdk.tar.gz.sha256',
+ 'sha256'
+ )
+ ).rejects.toThrow(
+ 'Received an empty authoritative sha256 checksum for Empty from https://vendor.example/jdk.tar.gz.sha256.'
+ );
+ });
+
+ describe('with a list of candidate algorithms', () => {
+ it('infers sha512 when the digest is 128 hex characters', async () => {
+ const digest = 'd'.repeat(128);
+ mockGet(200, `${digest} jbrsdk.tar.gz\n`);
+ const distribution = new EmptyJavaBase(options);
+
+ const checksum = await distribution.fetchChecksumForTest(
+ 'https://vendor.example/jbrsdk.tar.gz.checksum',
+ ['sha512', 'sha256']
+ );
+
+ expect(checksum).toEqual({
+ algorithm: 'sha512',
+ value: digest,
+ source: 'https://vendor.example/jbrsdk.tar.gz.checksum'
+ });
+ });
+
+ it('infers sha256 when the digest is 64 hex characters, even though sha512 was preferred', async () => {
+ // Reproduces older JetBrains JBR builds (e.g. JBR 11), which publish a
+ // SHA-256 digest at the generic `.checksum` sibling instead of SHA-512.
+ const digest = 'e'.repeat(64);
+ mockGet(200, `${digest} jbrsdk_nomod-11_0_16-osx-x64-b2043.64.tar.gz\n`);
+ const distribution = new EmptyJavaBase(options);
+
+ const checksum = await distribution.fetchChecksumForTest(
+ 'https://vendor.example/jbrsdk_nomod-11_0_16-osx-x64-b2043.64.tar.gz.checksum',
+ ['sha512', 'sha256']
+ );
+
+ expect(checksum).toEqual({
+ algorithm: 'sha256',
+ value: digest,
+ source:
+ 'https://vendor.example/jbrsdk_nomod-11_0_16-osx-x64-b2043.64.tar.gz.checksum'
+ });
+ });
+
+ it('falls back to the first candidate algorithm when the digest length matches none of them', async () => {
+ const digest = 'f'.repeat(40); // e.g. sha1, not supported
+ mockGet(200, `${digest} jbrsdk.tar.gz\n`);
+ const distribution = new EmptyJavaBase(options);
+
+ const checksum = await distribution.fetchChecksumForTest(
+ 'https://vendor.example/jbrsdk.tar.gz.checksum',
+ ['sha512', 'sha256']
+ );
+
+ // No candidate algorithm matches, so the first-listed one is kept;
+ // downstream verification will reject it as malformed.
+ expect(checksum.algorithm).toBe('sha512');
+ expect(checksum.value).toBe(digest);
+ });
+
+ it('reports the checksum as unavailable using a combined algorithm label on 404', async () => {
+ mockGet(404, 'Not Found');
+ const distribution = new EmptyJavaBase(options);
+
+ await expect(
+ distribution.fetchChecksumForTest(
+ 'https://vendor.example/jbrsdk.tar.gz.checksum',
+ ['sha512', 'sha256']
+ )
+ ).resolves.toBeUndefined();
+ expect(core.debug).toHaveBeenCalledWith(
+ 'No authoritative sha512 or sha256 checksum is available for Empty from https://vendor.example/jbrsdk.tar.gz.checksum; skipping checksum verification.'
+ );
+ });
+ });
+});
+
describe('normalizeVersion', () => {
const DummyJavaBase = JavaBase as any;
it.each([
- ['11', {version: '11', stable: true}],
- ['11.0', {version: '11.0', stable: true}],
- ['11.0.10', {version: '11.0.10', stable: true}],
- ['11-ea', {version: '11', stable: false}],
- ['11.0.2-ea', {version: '11.0.2', stable: false}]
+ ['11', {version: '11', stable: true, latest: false}],
+ ['11.0', {version: '11.0', stable: true, latest: false}],
+ ['11.0.10', {version: '11.0.10', stable: true, latest: false}],
+ ['11-ea', {version: '11', stable: false, latest: false}],
+ ['11.0.2-ea', {version: '11.0.2', stable: false, latest: false}],
+ ['18.0.1.1', {version: '18.0.1+1', stable: true, latest: false}],
+ ['11.0.9.1', {version: '11.0.9+1', stable: true, latest: false}],
+ ['12.0.2.1.0', {version: '12.0.2+1.0', stable: true, latest: false}],
+ ['18.0.1.1-ea', {version: '18.0.1+1', stable: false, latest: false}],
+ ['26.0.2.1+1', {version: '26.0.2+1.1', stable: true, latest: false}],
+ ['25.0.4.1+1', {version: '25.0.4+1.1', stable: true, latest: false}],
+ ['latest', {version: 'x', stable: true, latest: true}],
+ ['LATEST', {version: 'x', stable: true, latest: true}],
+ [' Latest ', {version: 'x', stable: true, latest: true}]
])('normalizeVersion from %s to %s', (input, expected) => {
expect(DummyJavaBase.prototype.normalizeVersion.call(null, input)).toEqual(
expected
@@ -568,6 +1777,108 @@ describe('normalizeVersion', () => {
`The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information`
);
});
+
+ it.each(['latest-ea', 'latest.1', 'LATEST-EA', ' latest-ea '])(
+ 'normalizeVersion should throw a targeted error for latest combined with a qualifier (%s)',
+ version => {
+ expect(
+ DummyJavaBase.prototype.normalizeVersion.bind(null, version)
+ ).toThrow(
+ `The 'latest' alias resolves stable (GA) releases only and cannot be combined with '-ea' or other qualifiers (received '${version}'). Use 'latest' on its own, or specify a concrete version.`
+ );
+ }
+ );
+});
+
+describe('createVersionNotFoundError', () => {
+ it('should include all required fields in error message without available versions', () => {
+ const mockJavaBase = new EmptyJavaBase({
+ version: '17.0.5',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const error = (mockJavaBase as any).createVersionNotFoundError('17.0.5');
+
+ expect(error.message).toContain(
+ "No matching version found for SemVer '17.0.5'"
+ );
+ expect(error.message).toContain('Distribution: Empty');
+ expect(error.message).toContain('Package type: jdk');
+ expect(error.message).toContain('Architecture: x64');
+ });
+
+ it('should include available versions when provided', () => {
+ const mockJavaBase = new EmptyJavaBase({
+ version: '17.0.5',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const availableVersions = ['11.0.1', '11.0.2', '17.0.1', '17.0.2'];
+ const error = (mockJavaBase as any).createVersionNotFoundError(
+ '17.0.5',
+ availableVersions
+ );
+
+ expect(error.message).toContain(
+ "No matching version found for SemVer '17.0.5'"
+ );
+ expect(error.message).toContain('Distribution: Empty');
+ expect(error.message).toContain('Package type: jdk');
+ expect(error.message).toContain('Architecture: x64');
+ expect(error.message).toContain(
+ 'Available versions: 11.0.1, 11.0.2, 17.0.1, 17.0.2'
+ );
+ });
+
+ it('should truncate available versions when there are many', () => {
+ const mockJavaBase = new EmptyJavaBase({
+ version: '17.0.5',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ // Create 60 versions to test truncation
+ const availableVersions = Array.from({length: 60}, (_, i) => `11.0.${i}`);
+ const error = (mockJavaBase as any).createVersionNotFoundError(
+ '17.0.5',
+ availableVersions
+ );
+
+ expect(error.message).toContain('Available versions:');
+ expect(error.message).toContain('...');
+ expect(error.message).toContain('(showing first 50 of 60 versions');
+ });
+
+ it('should include additional context when provided', () => {
+ const mockJavaBase = new EmptyJavaBase({
+ version: '17.0.5',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const availableVersions = ['11.0.1', '11.0.2'];
+ const additionalContext = 'Platform: linux';
+ const error = (mockJavaBase as any).createVersionNotFoundError(
+ '17.0.5',
+ availableVersions,
+ additionalContext
+ );
+
+ expect(error.message).toContain(
+ "No matching version found for SemVer '17.0.5'"
+ );
+ expect(error.message).toContain('Distribution: Empty');
+ expect(error.message).toContain('Package type: jdk');
+ expect(error.message).toContain('Architecture: x64');
+ expect(error.message).toContain('Platform: linux');
+ expect(error.message).toContain('Available versions: 11.0.1, 11.0.2');
+ });
});
describe('getToolcacheVersionName', () => {
diff --git a/__tests__/distributors/corretto-installer.test.ts b/__tests__/distributors/corretto-installer.test.ts
index 1da5e393e..416c21607 100644
--- a/__tests__/distributors/corretto-installer.test.ts
+++ b/__tests__/distributors/corretto-installer.test.ts
@@ -1,16 +1,63 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import fs from 'fs';
+import type {JavaInstallerOptions} from '../../src/distributions/base-models.js';
import {HttpClient} from '@actions/http-client';
-import {JavaInstallerOptions} from '../../src/distributions/base-models';
-import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
-import * as util from '../../src/util';
import os from 'os';
-import {isGeneratorFunction} from 'util/types';
-import manifestData from '../data/corretto.json';
+import manifestData from '../data/corretto.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ getDownloadArchiveExtension: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {CorrettoDistribution} =
+ await import('../../src/distributions/corretto/installer.js');
+const util = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
- let spyGetDownloadArchiveExtension: jest.SpyInstance;
+ let spyHttpClient: ReturnType;
+ let spyGetDownloadArchiveExtension: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -19,10 +66,12 @@ describe('getAvailableVersions', () => {
headers: {},
result: manifestData
});
- spyGetDownloadArchiveExtension = jest.spyOn(
- util,
- 'getDownloadArchiveExtension'
- );
+ spyGetDownloadArchiveExtension =
+ util.getDownloadArchiveExtension as jest.Mock;
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -154,6 +203,30 @@ describe('getAvailableVersions', () => {
await distribution['findPackageForDownload'](version);
expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink);
+ expect(availableVersion.checksum).toEqual({
+ algorithm: 'sha256',
+ value: expect.stringMatching(/^[a-f0-9]{64}$/),
+ source:
+ 'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json'
+ });
+ });
+
+ it('with latest resolves to the newest available major version', async () => {
+ const distribution = new CorrettoDistribution({
+ version: 'latest',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+
+ const availableVersion =
+ await distribution['findPackageForDownload']('x');
+ expect(availableVersion).not.toBeNull();
+ // 18 is the newest major present in the mocked Corretto index
+ expect(availableVersion.url).toBe(
+ 'https://corretto.aws/downloads/resources/18.0.0.37.1/amazon-corretto-18.0.0.37.1-linux-x64.tar.gz'
+ );
});
it('with unstable version expect to throw not supported error', async () => {
@@ -171,19 +244,282 @@ describe('getAvailableVersions', () => {
).rejects.toThrow('Early access versions are not supported');
});
- it('with non major version expect to throw not supported error', async () => {
- const version = '18.0.1';
+ it.each(['18.0.1', '17.0.13.11', '17.0.13.11.1.1'])(
+ 'rejects partial or malformed release %s',
+ async version => {
+ const distribution = new CorrettoDistribution({
+ version,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+
+ await expect(
+ distribution['findPackageForDownload'](version)
+ ).rejects.toThrow(
+ 'Specify a major version or a full Corretto release, such as 25.0.5.0.10'
+ );
+ }
+ );
+
+ it.each([
+ [
+ '25.0.5.0.10',
+ 'linux',
+ 'x64',
+ 'jdk',
+ '25.0.5+0.10',
+ 'https://corretto.aws/downloads/resources/25.0.5.0.10/amazon-corretto-25.0.5.0.10-linux-x64.tar.gz'
+ ],
+ [
+ '25.0.5+0.10',
+ 'macos',
+ 'arm64',
+ 'jdk',
+ '25.0.5+0.10',
+ 'https://corretto.aws/downloads/resources/25.0.5.0.10/amazon-corretto-25.0.5.0.10-macosx-aarch64.tar.gz'
+ ],
+ [
+ '17.0.2.8.1',
+ 'windows',
+ 'x64',
+ 'jdk',
+ '17.0.2+8.1',
+ 'https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-windows-x64-jdk.zip'
+ ],
+ [
+ '25.0.5.0.10',
+ 'alpine',
+ 'aarch64',
+ 'jdk',
+ '25.0.5+0.10',
+ 'https://corretto.aws/downloads/resources/25.0.5.0.10/amazon-corretto-25.0.5.0.10-alpine-linux-aarch64.tar.gz'
+ ],
+ [
+ '11.0.14.10.1',
+ 'linux',
+ 'armv7',
+ 'jdk',
+ '11.0.14+10.1',
+ 'https://corretto.aws/downloads/resources/11.0.14.10.1/amazon-corretto-11.0.14.10.1-linux-armv7.tar.gz'
+ ],
+ [
+ '8.472.8+1',
+ 'linux',
+ 'x64',
+ 'jdk',
+ '8.472.8+1',
+ 'https://corretto.aws/downloads/resources/8.472.08.1/amazon-corretto-8.472.08.1-linux-x64.tar.gz'
+ ],
+ [
+ '8.472.08.1',
+ 'linux',
+ 'x64',
+ 'jdk',
+ '8.472.8+1',
+ 'https://corretto.aws/downloads/resources/8.472.08.1/amazon-corretto-8.472.08.1-linux-x64.tar.gz'
+ ],
+ [
+ '8.472.08.1',
+ 'windows',
+ 'x86',
+ 'jre',
+ '8.472.8+1',
+ 'https://corretto.aws/downloads/resources/8.472.08.1/amazon-corretto-8.472.08.1-windows-x86-jre.zip'
+ ]
+ ])(
+ 'resolves exact release %s on %s/%s (%s)',
+ async (
+ requestedVersion,
+ platform,
+ architecture,
+ packageType,
+ expectedVersion,
+ url
+ ) => {
+ const checksum = 'a'.repeat(64);
+ spyHttpClient.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {
+ body: `|JDK|[archive](${url})|\`md5\` /
\`${checksum}\`|`
+ }
+ });
+ const distribution = new CorrettoDistribution({
+ version: requestedVersion,
+ architecture,
+ packageType,
+ checkLatest: false
+ });
+ mockPlatform(distribution, platform);
+
+ const release = await distribution['findPackageForDownload'](
+ distribution['version']
+ );
+ const rawVersion = new URL(url).pathname.split('/')[3];
+ const source = `https://api.github.com/repos/corretto/corretto-${rawVersion.split('.')[0]}/releases/tags/${rawVersion}`;
+ expect(release).toEqual({
+ version: expectedVersion,
+ url,
+ checksum: {algorithm: 'sha256', value: checksum, source}
+ });
+ expect(spyHttpClient).toHaveBeenCalledTimes(1);
+ expect(spyHttpClient).toHaveBeenCalledWith(
+ source,
+ expect.objectContaining({accept: 'application/vnd.github+json'})
+ );
+ }
+ );
+
+ it('rejects exact releases without an archive for the requested platform', async () => {
+ spyHttpClient.mockResolvedValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: {
+ body:
+ '|[other archive](https://example.com/archive)|`' +
+ 'a'.repeat(64) +
+ '`|'
+ }
+ });
const distribution = new CorrettoDistribution({
- version,
+ version: '25.0.5.0.10',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow(
+ 'No linux/x64 jdk archive is listed for Corretto 25.0.5.0.10'
+ );
+ });
+
+ it('rejects historical archives with only an MD5 checksum', async () => {
+ spyHttpClient.mockResolvedValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: {
+ body:
+ '|[archive](https://corretto.aws/downloads/resources/17.0.1.12.1/amazon-corretto-17.0.1.12.1-linux-x64.tar.gz)|`' +
+ 'a'.repeat(32) +
+ '`|'
+ }
+ });
+ const distribution = new CorrettoDistribution({
+ version: '17.0.1.12.1',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
mockPlatform(distribution, 'linux');
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow(
+ 'No SHA-256 checksum is published for Corretto 17.0.1.12.1 (linux, x64, jdk)'
+ );
+ });
+ it('does not substitute a JDK for an exact Linux JRE request', async () => {
+ const distribution = new CorrettoDistribution({
+ version: '25.0.5.0.10',
+ architecture: 'x64',
+ packageType: 'jre',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
await expect(
- distribution['findPackageForDownload'](version)
- ).rejects.toThrow('Only major versions are supported');
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow('Corretto JRE archives are only available for Windows');
+ expect(spyHttpClient).not.toHaveBeenCalled();
+ });
+
+ it('resolves catalog-only releases without a GitHub release', async () => {
+ spyHttpClient.mockResolvedValueOnce({
+ statusCode: 404,
+ headers: {},
+ result: null
+ });
+ const distribution = new CorrettoDistribution({
+ version: '15.0.2.7.1',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+ expect(
+ await distribution['findPackageForDownload'](distribution['version'])
+ ).toEqual({
+ version: '15.0.2+7.1',
+ url: 'https://corretto.aws/downloads/resources/15.0.2.7.1/amazon-corretto-15.0.2.7.1-linux-x64.tar.gz',
+ checksum: {
+ algorithm: 'sha256',
+ value: manifestData.linux.x64.jdk['15']['tar.gz'].checksum_sha256,
+ source:
+ 'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json'
+ }
+ });
+ });
+
+ it('falls back to the catalog when the GitHub lookup fails', async () => {
+ spyHttpClient.mockRejectedValueOnce(new Error('GitHub rate limit'));
+ const distribution = new CorrettoDistribution({
+ version: '15.0.2.7.1',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+
+ expect(
+ await distribution['findPackageForDownload'](distribution['version'])
+ ).toEqual({
+ version: '15.0.2+7.1',
+ url: 'https://corretto.aws/downloads/resources/15.0.2.7.1/amazon-corretto-15.0.2.7.1-linux-x64.tar.gz',
+ checksum: {
+ algorithm: 'sha256',
+ value: manifestData.linux.x64.jdk['15']['tar.gz'].checksum_sha256,
+ source:
+ 'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json'
+ }
+ });
+ expect(spyHttpClient).toHaveBeenCalledTimes(2);
+ });
+
+ it('reports missing release metadata without substituting the latest release', async () => {
+ spyHttpClient.mockResolvedValueOnce({
+ statusCode: 404,
+ headers: {},
+ result: null
+ });
+ const distribution = new CorrettoDistribution({
+ version: '17.0.0.0.999',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow(
+ "Corretto release 17.0.0.0.999 was not found in Amazon's GitHub releases or current download catalog"
+ );
+ });
+
+ it('does not normalize zero-padded major-only inputs', () => {
+ expect(
+ () =>
+ new CorrettoDistribution({
+ version: '08',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ })
+ ).toThrow(
+ "The string '08' is not valid SemVer notation for a Java version"
+ );
});
it('with unfound version throw could not find error', async () => {
@@ -198,7 +534,7 @@ describe('getAvailableVersions', () => {
await expect(
distribution['findPackageForDownload'](version)
- ).rejects.toThrow("Could not find satisfied version for SemVer '4'");
+ ).rejects.toThrow("No matching version found for SemVer '4'");
});
it.each([
@@ -227,10 +563,23 @@ describe('getAvailableVersions', () => {
expect(availableVersion.url).toBe(expectedLink);
}
);
+
+ it('keeps the canonical ARM runner value separate from the vendor value', () => {
+ jest.spyOn(os, 'arch').mockReturnValue('arm');
+ const distribution = new CorrettoDistribution({
+ version: '11',
+ architecture: '',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(distribution['architecture']).toBe('armv7');
+ expect(distribution['distributionArchitecture']()).toBe('arm');
+ });
});
const mockPlatform = (
- distribution: CorrettoDistribution,
+ distribution: InstanceType,
platform: string
) => {
distribution['getPlatformOption'] = () => platform;
@@ -238,3 +587,50 @@ describe('getAvailableVersions', () => {
spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension);
};
});
+
+describe('Corretto getPlatformOption libc selection', () => {
+ const originalPlatform = Object.getOwnPropertyDescriptor(
+ process,
+ 'platform'
+ ) as PropertyDescriptor;
+
+ const setPlatform = (platform: NodeJS.Platform) =>
+ Object.defineProperty(process, 'platform', {
+ ...originalPlatform,
+ value: platform
+ });
+
+ const distribution = new CorrettoDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ afterEach(() => {
+ Object.defineProperty(process, 'platform', originalPlatform);
+ jest.restoreAllMocks();
+ });
+
+ it('selects the musl artifacts on Alpine', () => {
+ setPlatform('linux');
+ jest.spyOn(fs, 'existsSync').mockReturnValue(true);
+
+ expect(distribution['getPlatformOption']()).toBe('alpine');
+ });
+
+ it('selects the glibc artifacts on other Linux runners', () => {
+ setPlatform('linux');
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+
+ expect(distribution['getPlatformOption']()).toBe('linux');
+ });
+
+ it('does not probe for Alpine off Linux', () => {
+ setPlatform('darwin');
+ const existsSync = jest.spyOn(fs, 'existsSync');
+
+ expect(distribution['getPlatformOption']()).toBe('macos');
+ expect(existsSync).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/distributors/distribution-factory.lazy-loading.test.ts b/__tests__/distributors/distribution-factory.lazy-loading.test.ts
new file mode 100644
index 000000000..a87cc13bb
--- /dev/null
+++ b/__tests__/distributors/distribution-factory.lazy-loading.test.ts
@@ -0,0 +1,23 @@
+import {jest, describe, it, expect} from '@jest/globals';
+
+jest.unstable_mockModule('../../src/distributions/zulu/installer.js', () => {
+ throw new Error(
+ 'Zulu installer module must not be imported on the Temurin fast path'
+ );
+});
+
+const {getJavaDistribution} =
+ await import('../../src/distributions/distribution-factory.js');
+
+describe('distribution factory lazy loading', () => {
+ it('does not load non-selected distribution installers for Temurin', async () => {
+ const distribution = await getJavaDistribution('temurin', {
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(distribution).not.toBeNull();
+ });
+});
diff --git a/__tests__/distributors/distribution-factory.test.ts b/__tests__/distributors/distribution-factory.test.ts
new file mode 100644
index 000000000..c60e7f75b
--- /dev/null
+++ b/__tests__/distributors/distribution-factory.test.ts
@@ -0,0 +1,160 @@
+import {getJavaDistribution} from '../../src/distributions/distribution-factory.js';
+import {RetryingHttpClient} from '../../src/retrying-http-client.js';
+import {
+ JAVA_PACKAGE_CAPABILITIES,
+ JavaDistribution
+} from '../../src/distributions/package-types.js';
+import os from 'os';
+import {validateJavaPlatform} from '../../src/distributions/platform-types.js';
+import {normalizeArchitecture} from '../../src/distributions/platform-types.js';
+
+const supportedDistributionsOnCurrentPlatform = Object.values(
+ JavaDistribution
+).filter(distributionName => {
+ try {
+ validateJavaPlatform(distributionName, process.platform, 'x64', '25');
+ return distributionName !== JavaDistribution.JdkFile;
+ } catch {
+ return false;
+ }
+});
+
+const installerOptions = (packageType: string, version = '25') => ({
+ version,
+ architecture: 'x64',
+ packageType,
+ checkLatest: false
+});
+
+describe('getJavaDistribution', () => {
+ it.each(supportedDistributionsOnCurrentPlatform)(
+ 'uses the shared retrying HTTP client for %s',
+ async distributionName => {
+ const distribution = await getJavaDistribution(distributionName, {
+ version: '25',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(distribution).not.toBeNull();
+ expect(distribution!['http']).toBeInstanceOf(RetryingHttpClient);
+ }
+ );
+
+ it.each(
+ Object.entries(JAVA_PACKAGE_CAPABILITIES).flatMap(
+ ([distributionName, packageTypes]) =>
+ supportedDistributionsOnCurrentPlatform.includes(
+ distributionName as JavaDistribution
+ ) || distributionName === JavaDistribution.JdkFile
+ ? packageTypes.map(packageType => [distributionName, packageType])
+ : []
+ )
+ )(
+ 'accepts %s with java-package %s',
+ async (distributionName, packageType) => {
+ expect(
+ await getJavaDistribution(
+ distributionName,
+ installerOptions(packageType as string)
+ )
+ ).not.toBeNull();
+ }
+ );
+
+ it.each(Object.entries(JAVA_PACKAGE_CAPABILITIES))(
+ 'rejects unsupported java-package values for %s',
+ async (distributionName, packageTypes) => {
+ await expect(
+ getJavaDistribution(distributionName, installerOptions('jdk+typo'))
+ ).rejects.toThrow(
+ `Java package 'jdk+typo' is not supported for distribution '${distributionName}'. Supported package types: ${packageTypes.join(', ')}.`
+ );
+ }
+ );
+
+ it("rejects java-package 'jdk+jmods' for non-Temurin distributions", async () => {
+ await expect(
+ getJavaDistribution('zulu', installerOptions('jdk+jmods'))
+ ).rejects.toThrow(
+ "Java package 'jdk+jmods' is not supported for distribution 'zulu'. Supported package types: jdk, jre, jdk+fx, jre+fx, jdk+crac, jre+crac."
+ );
+ });
+
+ it.each(['8', '23.x', '23.0.1.1', '23.0.1.1+1', '<24'])(
+ "rejects Temurin java-package 'jdk+jmods' for version %s",
+ async version => {
+ await expect(
+ getJavaDistribution(
+ JavaDistribution.Temurin,
+ installerOptions('jdk+jmods', version)
+ )
+ ).rejects.toThrow(
+ `Java package 'jdk+jmods' is not supported for distribution 'temurin'. Supported package types: jdk, jre, jdk+jmods. Package 'jdk+jmods' requires Java 24 or later; requested version '${version}'.`
+ );
+ }
+ );
+
+ it.each(['24', '24.0.1.1', '25.0.4.1+1', '25-ea', '>=21', 'latest'])(
+ "accepts Temurin java-package 'jdk+jmods' for version %s",
+ async version => {
+ expect(
+ await getJavaDistribution(
+ JavaDistribution.Temurin,
+ installerOptions('jdk+jmods', version)
+ )
+ ).not.toBeNull();
+ }
+ );
+
+ it('preserves unsupported distribution handling', async () => {
+ expect(
+ await getJavaDistribution(
+ 'not-a-distribution',
+ installerOptions('not-a-package')
+ )
+ ).toBeNull();
+ });
+
+ it.each(['adopt', 'adopt-hotspot', 'adopt-openj9'])(
+ 'does not support legacy Adopt distribution %s',
+ async distributionName => {
+ expect(
+ await getJavaDistribution(distributionName, installerOptions('jdk'))
+ ).toBeNull();
+ }
+ );
+
+ it.each([
+ ['amd64', 'x64'],
+ ['ia32', 'x86'],
+ ['arm64', 'aarch64']
+ ])('passes normalized architecture %s as %s', async (input, expected) => {
+ const normalized = await getJavaDistribution(JavaDistribution.JdkFile, {
+ ...installerOptions('jdk'),
+ architecture: input
+ });
+
+ expect(normalized!['architecture']).toBe(expected);
+ });
+
+ it('uses the runner architecture when the input is empty', async () => {
+ const distribution = await getJavaDistribution(JavaDistribution.Temurin, {
+ ...installerOptions('jdk'),
+ architecture: ''
+ });
+
+ const expected = normalizeArchitecture(os.arch());
+ expect(distribution!['architecture']).toBe(expected);
+ });
+
+ it('rejects an unsupported combination before creating an HTTP client', async () => {
+ await expect(
+ getJavaDistribution(JavaDistribution.Oracle, {
+ ...installerOptions('jdk'),
+ architecture: 'x86'
+ })
+ ).rejects.toThrow(/does not support operating system/);
+ });
+});
diff --git a/__tests__/distributors/dragonwell-installer.test.ts b/__tests__/distributors/dragonwell-installer.test.ts
index 627a96ab3..143d82666 100644
--- a/__tests__/distributors/dragonwell-installer.test.ts
+++ b/__tests__/distributors/dragonwell-installer.test.ts
@@ -1,12 +1,60 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import fs from 'fs';
import {HttpClient} from '@actions/http-client';
-import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
-import * as utils from '../../src/util';
-import manifestData from '../data/dragonwell.json';
+import manifestData from '../data/dragonwell.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ getDownloadArchiveExtension: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {DragonwellDistribution} =
+ await import('../../src/distributions/dragonwell/installer.js');
+const utils = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
- let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyUtilGetDownloadArchiveExtension: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -16,11 +64,13 @@ describe('getAvailableVersions', () => {
result: manifestData
});
- spyUtilGetDownloadArchiveExtension = jest.spyOn(
- utils,
- 'getDownloadArchiveExtension'
- );
+ spyUtilGetDownloadArchiveExtension =
+ utils.getDownloadArchiveExtension as jest.Mock;
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -30,7 +80,7 @@ describe('getAvailableVersions', () => {
});
const mockPlatform = (
- distribution: DragonwellDistribution,
+ distribution: InstanceType,
platform: string
) => {
distribution['getPlatformOption'] = () => platform;
@@ -210,6 +260,10 @@ describe('getAvailableVersions', () => {
await distribution['findPackageForDownload'](jdkVersion);
expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink);
+ expect(availableVersion.checksum).toEqual({
+ algorithm: 'sha256',
+ value: expect.stringMatching(/^[a-f0-9]{64}$/)
+ });
}
);
@@ -219,7 +273,7 @@ describe('getAvailableVersions', () => {
['11', 'macos', 'aarch64'],
['17', 'linux', 'riscv']
])(
- 'should throw when required version of JDK can not be found in the JSON',
+ 'should throw when required version of JDK cannot be found in the JSON',
async (jdkVersion: string, platform: string, arch: string) => {
const distribution = new DragonwellDistribution({
version: jdkVersion,
@@ -232,7 +286,7 @@ describe('getAvailableVersions', () => {
await expect(
distribution['findPackageForDownload'](jdkVersion)
).rejects.toThrow(
- `Couldn't find any satisfied version for the specified java-version: "${jdkVersion}" and architecture: "${arch}".`
+ `No matching version found for SemVer '${jdkVersion}'`
);
}
);
@@ -254,3 +308,50 @@ describe('getAvailableVersions', () => {
});
});
});
+
+describe('Dragonwell getPlatformOption libc selection', () => {
+ const originalPlatform = Object.getOwnPropertyDescriptor(
+ process,
+ 'platform'
+ ) as PropertyDescriptor;
+
+ const setPlatform = (platform: NodeJS.Platform) =>
+ Object.defineProperty(process, 'platform', {
+ ...originalPlatform,
+ value: platform
+ });
+
+ const distribution = new DragonwellDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ afterEach(() => {
+ Object.defineProperty(process, 'platform', originalPlatform);
+ jest.restoreAllMocks();
+ });
+
+ it('selects the musl artifacts on Alpine', () => {
+ setPlatform('linux');
+ jest.spyOn(fs, 'existsSync').mockReturnValue(true);
+
+ expect(distribution['getPlatformOption']()).toBe('alpine-linux');
+ });
+
+ it('selects the glibc artifacts on other Linux runners', () => {
+ setPlatform('linux');
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+
+ expect(distribution['getPlatformOption']()).toBe('linux');
+ });
+
+ it('does not probe for Alpine off Linux', () => {
+ setPlatform('win32');
+ const existsSync = jest.spyOn(fs, 'existsSync');
+
+ expect(distribution['getPlatformOption']()).toBe('windows');
+ expect(existsSync).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/distributors/graalvm-installer.test.ts b/__tests__/distributors/graalvm-installer.test.ts
index d2dda9f6d..16b2c42cb 100644
--- a/__tests__/distributors/graalvm-installer.test.ts
+++ b/__tests__/distributors/graalvm-installer.test.ts
@@ -1,47 +1,117 @@
-import * as core from '@actions/core';
-import * as tc from '@actions/tool-cache';
-import * as http from '@actions/http-client';
-import fs from 'fs';
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
import path from 'path';
-import {GraalVMDistribution} from '../../src/distributions/graalvm/installer';
-import {JavaInstallerOptions} from '../../src/distributions/base-models';
-import * as util from '../../src/util';
-jest.mock('@actions/core');
-jest.mock('@actions/tool-cache');
-jest.mock('@actions/http-client');
+// Mock @actions modules
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ find: jest.fn(),
+ findAllVersions: jest.fn(),
+ downloadTool: jest.fn(),
+ extractZip: jest.fn(),
+ extractTar: jest.fn(),
+ extract7z: jest.fn(),
+ extractXar: jest.fn(),
+ cacheDir: jest.fn(),
+ cacheFile: jest.fn(),
+ getManifestFromRepo: jest.fn(),
+ findFromManifest: jest.fn(),
+ evaluateVersions: jest.fn()
+}));
-jest.mock('../../src/util', () => ({
- ...jest.requireActual('../../src/util'),
+jest.unstable_mockModule('@actions/http-client', () => ({
+ HttpClient: jest.fn().mockImplementation(() => ({
+ getJson: jest.fn(),
+ head: jest.fn(),
+ get: jest.fn()
+ })),
+ HttpClientError: class HttpClientError extends Error {
+ statusCode: number;
+ constructor(message: string, statusCode: number) {
+ super(message);
+ this.statusCode = statusCode;
+ }
+ },
+ HttpCodes: {OK: 200, NotFound: 404, Unauthorized: 401, Forbidden: 403}
+}));
+
+// Get real util first, then mock specific functions
+const realUtil = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...realUtil,
extractJdkFile: jest.fn(),
getDownloadArchiveExtension: jest.fn(),
+ getJavaVersionFromReleaseFile: jest.fn(),
renameWinArchive: jest.fn(),
getGitHubHttpHeaders: jest.fn().mockReturnValue({Accept: 'application/json'})
}));
-jest.mock('fs', () => ({
- ...jest.requireActual('fs'),
+const real_fs_module = await import('fs');
+jest.unstable_mockModule('fs', () => ({
+ ...real_fs_module,
+ default: {
+ ...real_fs_module.default,
+ readdirSync: jest.fn(),
+ existsSync: jest.fn()
+ },
readdirSync: jest.fn(),
existsSync: jest.fn()
}));
-beforeAll(() => {
- process.env.NODE_ENV = 'test';
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const tc = await import('@actions/tool-cache');
+const http = await import('@actions/http-client');
+const fs = (await import('fs')).default;
+const util = await import('../../src/util.js');
+const {GraalVMCommunityDistribution, GraalVMDistribution} =
+ await import('../../src/distributions/graalvm/installer.js');
+const {getJavaDistribution} =
+ await import('../../src/distributions/distribution-factory.js');
- if (!jest.isMockFunction(http.HttpClient)) {
- throw new Error('HTTP client must be mocked in tests!');
- }
-
- if (!jest.isMockFunction(tc.downloadTool)) {
- throw new Error('Tool cache downloadTool must be mocked in tests!');
- }
+import type {JavaInstallerOptions} from '../../src/distributions/base-models.js';
+beforeAll(() => {
+ process.env.NODE_ENV = 'test';
console.log('✅ All external dependencies are properly mocked');
});
describe('GraalVMDistribution', () => {
- let distribution: GraalVMDistribution;
- let mockHttpClient: jest.Mocked;
+ let distribution: InstanceType;
+ let communityDistribution: InstanceType;
+ let mockHttpClient: any;
+ let spyCoreError: any;
const defaultOptions: JavaInstallerOptions = {
version: '17',
@@ -54,19 +124,30 @@ describe('GraalVMDistribution', () => {
jest.clearAllMocks();
distribution = new GraalVMDistribution(defaultOptions);
+ communityDistribution = new GraalVMCommunityDistribution(defaultOptions);
- mockHttpClient = new http.HttpClient() as jest.Mocked;
+ mockHttpClient = new (http.HttpClient as any)();
(distribution as any).http = mockHttpClient;
+ (communityDistribution as any).http = mockHttpClient;
+
+ // Default checksum sibling response for `${url}.sha256` requests made by
+ // GraalVM (Oracle) and GraalVM EA. Individual tests override this when
+ // they need to assert the exact URL/digest contract.
+ mockHttpClient.get.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: jest.fn().mockResolvedValue('a'.repeat(64))
+ });
+
+ (util.getDownloadArchiveExtension as jest.Mock).mockReturnValue(
+ 'tar.gz'
+ );
- (util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterAll(() => {
- expect(jest.isMockFunction(http.HttpClient)).toBe(true);
-
- expect(jest.isMockFunction(tc.downloadTool)).toBe(true);
- expect(jest.isMockFunction(tc.cacheDir)).toBe(true);
-
jest.restoreAllMocks();
jest.clearAllMocks();
});
@@ -94,6 +175,29 @@ describe('GraalVMDistribution', () => {
});
});
+ describe('setJavaDefault', () => {
+ it('should set GRAALVM_HOME for Oracle GraalVM', () => {
+ (distribution as any).setJavaDefault('17.0.5', '/cached/java/path');
+
+ expect(core.exportVariable).toHaveBeenCalledWith(
+ 'GRAALVM_HOME',
+ '/cached/java/path'
+ );
+ });
+
+ it('should set GRAALVM_HOME for GraalVM Community', () => {
+ (communityDistribution as any).setJavaDefault(
+ '17.0.5',
+ '/cached/java/path'
+ );
+
+ expect(core.exportVariable).toHaveBeenCalledWith(
+ 'GRAALVM_HOME',
+ '/cached/java/path'
+ );
+ });
+ });
+
describe('downloadTool', () => {
const javaRelease = {
version: '17.0.5',
@@ -101,20 +205,24 @@ describe('GraalVMDistribution', () => {
};
beforeEach(() => {
- (tc.downloadTool as jest.Mock).mockResolvedValue('/tmp/archive.tar.gz');
- (tc.cacheDir as jest.Mock).mockResolvedValue('/cached/java/path');
+ (tc.downloadTool as any).mockResolvedValue('/tmp/archive.tar.gz');
+ (tc.cacheDir as any).mockResolvedValue('/cached/java/path');
- (util.extractJdkFile as jest.Mock).mockResolvedValue('/tmp/extracted');
+ (util.extractJdkFile as any).mockResolvedValue('/tmp/extracted');
// Mock renameWinArchive - it returns the same path (no renaming)
- (util.renameWinArchive as jest.Mock).mockImplementation((p: string) => p);
+ (util.renameWinArchive as any).mockImplementation((p: string) => p);
- (util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
+ (util.getDownloadArchiveExtension as jest.Mock).mockReturnValue(
+ 'tar.gz'
+ );
// Mock fs.existsSync to return true for extracted path
- (fs.existsSync as jest.Mock).mockReturnValue(true);
+ (fs.existsSync as jest.Mock).mockReturnValue(true);
- (fs.readdirSync as jest.Mock).mockReturnValue(['graalvm-jdk-17.0.5']);
+ (fs.readdirSync as jest.Mock).mockReturnValue([
+ 'graalvm-jdk-17.0.5'
+ ]);
jest
.spyOn(distribution as any, 'getToolcacheVersionName')
@@ -161,7 +269,7 @@ describe('GraalVMDistribution', () => {
});
it('should throw error when extracted path does not exist', async () => {
- (fs.existsSync as jest.Mock).mockReturnValue(false);
+ (fs.existsSync as jest.Mock).mockReturnValue(false);
await expect(
(distribution as any).downloadTool(javaRelease)
@@ -175,8 +283,8 @@ describe('GraalVMDistribution', () => {
});
it('should throw error when extracted directory is empty', async () => {
- (fs.existsSync as jest.Mock).mockReturnValue(true);
- (fs.readdirSync as jest.Mock).mockReturnValue([]);
+ (fs.existsSync as jest.Mock).mockReturnValue(true);
+ (fs.readdirSync as jest.Mock).mockReturnValue([]);
await expect(
(distribution as any).downloadTool(javaRelease)
@@ -191,7 +299,7 @@ describe('GraalVMDistribution', () => {
it('should handle download errors', async () => {
const downloadError = new Error('Network error during download');
- (tc.downloadTool as jest.Mock).mockRejectedValue(downloadError);
+ (tc.downloadTool as any).mockRejectedValue(downloadError);
await expect(
(distribution as any).downloadTool(javaRelease)
@@ -204,7 +312,7 @@ describe('GraalVMDistribution', () => {
it('should handle extraction errors', async () => {
const extractError = new Error('Failed to extract archive');
- (util.extractJdkFile as jest.Mock).mockRejectedValue(extractError);
+ (util.extractJdkFile as any).mockRejectedValue(extractError);
await expect(
(distribution as any).downloadTool(javaRelease)
@@ -217,8 +325,10 @@ describe('GraalVMDistribution', () => {
it('should handle different archive extensions', async () => {
// Test with a .zip file
- (util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('zip');
- (tc.downloadTool as jest.Mock).mockResolvedValue('/tmp/archive.zip');
+ (util.getDownloadArchiveExtension as jest.Mock).mockReturnValue(
+ 'zip'
+ );
+ (tc.downloadTool as any).mockResolvedValue('/tmp/archive.zip');
const zipRelease = {
version: '17.0.5',
@@ -237,6 +347,47 @@ describe('GraalVMDistribution', () => {
path: '/cached/java/path'
});
});
+
+ it('should use a dedicated toolcache folder for GraalVM Community', async () => {
+ const result = await (communityDistribution as any).downloadTool(
+ javaRelease
+ );
+
+ expect(tc.cacheDir).toHaveBeenCalledWith(
+ path.join('/tmp/extracted', 'graalvm-jdk-17.0.5'),
+ 'Java_GraalVM_Community_jdk',
+ '17.0.5',
+ 'x64'
+ );
+ expect(result).toEqual({
+ version: '17.0.5',
+ path: '/cached/java/path'
+ });
+ });
+
+ it('caches Oracle GraalVM floating artifacts under their installed version', async () => {
+ (util.getJavaVersionFromReleaseFile as jest.Mock).mockReturnValue(
+ '21.0.9+7'
+ );
+ const floatingRelease = {
+ version: '21',
+ url: 'https://example.com/graalvm/latest/graalvm-jdk-21.tar.gz',
+ floating: true
+ };
+
+ const result = await (distribution as any).downloadTool(floatingRelease);
+
+ expect(tc.cacheDir).toHaveBeenCalledWith(
+ path.join('/tmp/extracted', 'graalvm-jdk-17.0.5'),
+ 'Java_GraalVM_jdk',
+ '21.0.9+7',
+ 'x64'
+ );
+ expect(result).toEqual({
+ version: '21.0.9+7',
+ path: '/cached/java/path'
+ });
+ });
});
describe('findPackageForDownload', () => {
@@ -280,7 +431,7 @@ describe('GraalVMDistribution', () => {
it('should construct correct URL for specific version', async () => {
const mockResponse = {
message: {statusCode: 200}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload(
@@ -289,25 +440,69 @@ describe('GraalVMDistribution', () => {
expect(result).toEqual({
url: 'https://download.oracle.com/graalvm/17/archive/graalvm-jdk-17.0.5_linux-x64_bin.tar.gz',
- version: '17.0.5'
+ version: '17.0.5',
+ checksum: {
+ algorithm: 'sha256',
+ value: 'a'.repeat(64),
+ source:
+ 'https://download.oracle.com/graalvm/17/archive/graalvm-jdk-17.0.5_linux-x64_bin.tar.gz.sha256'
+ },
+ floating: false
});
expect(mockHttpClient.head).toHaveBeenCalledWith(result.url);
+ expect(mockHttpClient.get).toHaveBeenCalledWith(`${result.url}.sha256`);
});
it('should construct correct URL for major version (latest)', async () => {
const mockResponse = {
message: {statusCode: 200}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload('21');
expect(result).toEqual({
url: 'https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz',
- version: '21'
+ version: '21',
+ checksum: {
+ algorithm: 'sha256',
+ value: 'a'.repeat(64),
+ source:
+ 'https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz.sha256'
+ },
+ // A major-only range resolves to the floating `/latest/` URL, so the
+ // release must not be reused by a later job.
+ floating: true
});
});
+ it.each([
+ ['21', 'etag:"graalvm-latest"'],
+ ['17.0.5', undefined]
+ ])(
+ 'fingerprints only the floating artifact for version %s',
+ async (input, expected) => {
+ mockHttpClient.head.mockResolvedValue({
+ message: {statusCode: 200, headers: {etag: '"graalvm-latest"'}}
+ } as any);
+
+ const result = await (distribution as any).findPackageForDownload(
+ input
+ );
+
+ // Without a fingerprint the constant `/latest/` URL would key a cache
+ // entry that never invalidates when Oracle republishes the artifact.
+ expect(result.fingerprint).toBe(expected);
+ }
+ );
+
+ it('always resolves Oracle GraalVM major-only requests remotely', () => {
+ expect((distribution as any).requiresRemoteResolution()).toBe(true);
+ expect((communityDistribution as any).requiresRemoteResolution()).toBe(
+ false
+ );
+ });
+
it('should throw error for unsupported architecture', async () => {
distribution = new GraalVMDistribution({
...defaultOptions,
@@ -322,6 +517,68 @@ describe('GraalVMDistribution', () => {
);
});
+ describe('latest alias', () => {
+ it('resolves the newest major version from the Adoptium API', async () => {
+ const latestDistribution = new GraalVMDistribution({
+ ...defaultOptions,
+ version: 'latest'
+ });
+ (latestDistribution as any).http = mockHttpClient;
+ jest
+ .spyOn(latestDistribution, 'getPlatform')
+ .mockReturnValue('linux');
+ mockHttpClient.getJson.mockResolvedValue({
+ statusCode: 200,
+ result: {most_recent_feature_release: 25},
+ headers: {}
+ });
+ mockHttpClient.head.mockResolvedValue({
+ message: {statusCode: 200}
+ });
+
+ const result = await (
+ latestDistribution as any
+ ).findPackageForDownload('x');
+
+ expect(result).toEqual({
+ url: 'https://download.oracle.com/graalvm/25/latest/graalvm-jdk-25_linux-x64_bin.tar.gz',
+ version: '25',
+ checksum: {
+ algorithm: 'sha256',
+ value: 'a'.repeat(64),
+ source:
+ 'https://download.oracle.com/graalvm/25/latest/graalvm-jdk-25_linux-x64_bin.tar.gz.sha256'
+ },
+ floating: true
+ });
+ });
+
+ it('throws an actionable error when the latest major is not yet available', async () => {
+ const latestDistribution = new GraalVMDistribution({
+ ...defaultOptions,
+ version: 'latest'
+ });
+ (latestDistribution as any).http = mockHttpClient;
+ jest
+ .spyOn(latestDistribution, 'getPlatform')
+ .mockReturnValue('linux');
+ mockHttpClient.getJson.mockResolvedValue({
+ statusCode: 200,
+ result: {most_recent_feature_release: 25},
+ headers: {}
+ });
+ mockHttpClient.head.mockResolvedValue({
+ message: {statusCode: 404}
+ });
+
+ await expect(
+ (latestDistribution as any).findPackageForDownload('x')
+ ).rejects.toThrow(
+ /is not yet available for the GraalVM distribution/
+ );
+ });
+ });
+
it('should throw error for JDK versions less than 17', async () => {
await expect(
(distribution as any).findPackageForDownload('11')
@@ -345,20 +602,28 @@ describe('GraalVMDistribution', () => {
it('should throw error when file not found (404)', async () => {
const mockResponse = {
message: {statusCode: 404}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
+ // Verify the error is thrown with the expected message
await expect(
(distribution as any).findPackageForDownload('17.0.99')
- ).rejects.toThrow(
- 'Could not find GraalVM for SemVer 17.0.99. Please check if this version is available at https://download.oracle.com/graalvm'
- );
+ ).rejects.toThrow("No matching version found for SemVer '17.0.99'");
+ // Verify distribution info is included
+ await expect(
+ (distribution as any).findPackageForDownload('17.0.99')
+ ).rejects.toThrow('GraalVM');
+
+ // Verify the hint about checking the base URL is included
+ await expect(
+ (distribution as any).findPackageForDownload('17.0.99')
+ ).rejects.toThrow('https://www.graalvm.org/downloads/');
});
it('should throw error for unauthorized access (401)', async () => {
const mockResponse = {
message: {statusCode: 401}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
@@ -371,7 +636,7 @@ describe('GraalVMDistribution', () => {
it('should throw error for forbidden access (403)', async () => {
const mockResponse = {
message: {statusCode: 403}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
@@ -387,7 +652,7 @@ describe('GraalVMDistribution', () => {
statusCode: 500,
statusMessage: 'Internal Server Error'
}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
@@ -400,7 +665,7 @@ describe('GraalVMDistribution', () => {
it('should throw error for other HTTP errors without status message', async () => {
const mockResponse = {
message: {statusCode: 500}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
@@ -456,13 +721,20 @@ describe('GraalVMDistribution', () => {
expect(result).toEqual({
url: 'https://example.com/download/graalvm-jdk-23_linux-x64_bin.tar.gz',
- version: '23-ea-20240716'
+ version: '23-ea-20240716',
+ checksum: {
+ algorithm: 'sha256',
+ value: 'a'.repeat(64),
+ source:
+ 'https://example.com/download/graalvm-jdk-23_linux-x64_bin.tar.gz.sha256'
+ }
});
expect(mockHttpClient.getJson).toHaveBeenCalledWith(
'https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/23-ea.json?ref=main',
{Accept: 'application/json'}
);
+ expect(mockHttpClient.get).toHaveBeenCalledWith(`${result.url}.sha256`);
});
it('should throw error when no latest EA version found', async () => {
@@ -496,12 +768,19 @@ describe('GraalVMDistribution', () => {
await expect(
(distribution as any).findPackageForDownload('23')
- ).rejects.toThrow("Unable to find latest version for '23-ea'");
+ ).rejects.toThrow("No matching version found for SemVer '23-ea'");
- // Verify error logging
- expect(core.error).toHaveBeenCalledWith(
- 'Available versions: 23-ea-20240716'
+ await expect(
+ (distribution as any).findPackageForDownload('23')
+ ).rejects.toThrow(
+ 'Note: No EA build is marked as latest for this version.'
);
+
+ await expect(
+ (distribution as any).findPackageForDownload('23')
+ ).rejects.toThrow('23-ea-20240716');
+
+ // Verify error logging - removed as we now use the helper method which doesn't call core.error
});
it('should throw error when no matching file for architecture in EA build', async () => {
@@ -669,7 +948,7 @@ describe('GraalVMDistribution', () => {
}
];
- let fetchEASpy: jest.SpyInstance;
+ let fetchEASpy: any;
beforeEach(() => {
fetchEASpy = jest.spyOn(distribution as any, 'fetchEAJson');
@@ -688,8 +967,15 @@ describe('GraalVMDistribution', () => {
expect(fetchEASpy).toHaveBeenCalledWith('23-ea');
expect(result).toEqual({
url: 'https://example.com/download/graalvm-jdk-23_linux-x64_bin.tar.gz',
- version: '23-ea-20240716'
+ version: '23-ea-20240716',
+ checksum: {
+ algorithm: 'sha256',
+ value: 'a'.repeat(64),
+ source:
+ 'https://example.com/download/graalvm-jdk-23_linux-x64_bin.tar.gz.sha256'
+ }
});
+ expect(mockHttpClient.get).toHaveBeenCalledWith(`${result.url}.sha256`);
// Verify debug logging
expect(core.debug).toHaveBeenCalledWith('Searching for EA build: 23-ea');
@@ -708,11 +994,19 @@ describe('GraalVMDistribution', () => {
await expect(
(distribution as any).findEABuildDownloadUrl('23-ea')
- ).rejects.toThrow("Unable to find latest version for '23-ea'");
+ ).rejects.toThrow("No matching version found for SemVer '23-ea'");
- expect(core.error).toHaveBeenCalledWith(
- 'Available versions: 23-ea-20240716, 23-ea-20240709'
+ await expect(
+ (distribution as any).findEABuildDownloadUrl('23-ea')
+ ).rejects.toThrow(
+ 'Note: No EA build is marked as latest for this version.'
);
+
+ await expect(
+ (distribution as any).findEABuildDownloadUrl('23-ea')
+ ).rejects.toThrow('23-ea-20240716');
+
+ // Verify error logging - removed as we now use the helper method which doesn't call core.error
});
it('should throw error when no matching file for architecture', async () => {
@@ -780,7 +1074,13 @@ describe('GraalVMDistribution', () => {
expect(result).toEqual({
url: 'https://example.com/download/graalvm-jdk-23_linux-aarch64_bin.tar.gz',
- version: '23-ea-20240716'
+ version: '23-ea-20240716',
+ checksum: {
+ algorithm: 'sha256',
+ value: 'a'.repeat(64),
+ source:
+ 'https://example.com/download/graalvm-jdk-23_linux-aarch64_bin.tar.gz.sha256'
+ }
});
});
@@ -880,7 +1180,7 @@ describe('GraalVMDistribution', () => {
const mockResponse = {
message: {statusCode: 200}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload('17');
@@ -908,7 +1208,7 @@ describe('GraalVMDistribution', () => {
const mockResponse = {
message: {statusCode: 200}
- } as http.HttpClientResponse;
+ } as any;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload('17');
@@ -920,5 +1220,252 @@ describe('GraalVMDistribution', () => {
configurable: true
});
});
+
+ describe('GraalVMCommunityDistribution', () => {
+ beforeEach(() => {
+ jest
+ .spyOn(communityDistribution, 'getPlatform')
+ .mockReturnValue('linux');
+ });
+
+ it('should resolve an exact GraalVM Community version from GitHub releases', async () => {
+ mockHttpClient.getJson.mockResolvedValue({
+ result: [
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await (
+ communityDistribution as any
+ ).findPackageForDownload('21.0.2');
+
+ expect(result).toEqual({
+ url: 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ version: '21.0.2'
+ });
+ // The asset had no `digest` field, so no checksum should be attached,
+ // and the checksum sibling-URL fetch path (used by Oracle GraalVM)
+ // must not be consulted for GraalVM Community.
+ expect(result.checksum).toBeUndefined();
+ expect(mockHttpClient.get).not.toHaveBeenCalled();
+ });
+
+ it('strips the `sha256:` prefix from a GitHub release asset digest', async () => {
+ const digest = 'd'.repeat(64);
+ mockHttpClient.getJson.mockResolvedValue({
+ result: [
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ digest: `sha256:${digest}`
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await (
+ communityDistribution as any
+ ).findPackageForDownload('21.0.2');
+
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: digest,
+ source:
+ 'https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=100'
+ });
+ // The digest came from the release listing itself, so no additional
+ // HTTP request should be made to resolve the checksum.
+ expect(mockHttpClient.get).not.toHaveBeenCalled();
+ });
+
+ it('safely skips a missing or malformed release asset digest', async () => {
+ mockHttpClient.getJson.mockResolvedValue({
+ result: [
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ digest: 'md5:not-a-sha256-digest'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await (
+ communityDistribution as any
+ ).findPackageForDownload('21.0.2');
+
+ expect(result.checksum).toBeUndefined();
+ expect(mockHttpClient.get).not.toHaveBeenCalled();
+ expect(core.debug).toHaveBeenCalledWith(
+ expect.stringContaining(
+ 'No authoritative sha256 digest is available for graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
+ )
+ );
+ });
+
+ it('should resolve the latest GraalVM Community release for a major version', async () => {
+ mockHttpClient.getJson.mockResolvedValue({
+ result: [
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-21.0.1_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.1/graalvm-community-jdk-21.0.1_linux-x64_bin.tar.gz'
+ }
+ ]
+ },
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await (
+ communityDistribution as any
+ ).findPackageForDownload('21');
+
+ expect(result).toEqual({
+ url: 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ version: '21.0.2'
+ });
+ });
+
+ it('resolves latest to the newest GA across all Community majors without calling Adoptium', async () => {
+ const latestCommunity = new GraalVMCommunityDistribution({
+ ...defaultOptions,
+ version: 'latest'
+ });
+ (latestCommunity as any).http = mockHttpClient;
+ jest.spyOn(latestCommunity, 'getPlatform').mockReturnValue('linux');
+
+ mockHttpClient.getJson.mockResolvedValue({
+ result: [
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
+ }
+ ]
+ },
+ {
+ draft: false,
+ prerelease: false,
+ assets: [
+ {
+ name: 'graalvm-community-jdk-24.0.1_linux-x64_bin.tar.gz',
+ browser_download_url:
+ 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-24.0.1/graalvm-community-jdk-24.0.1_linux-x64_bin.tar.gz'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await (latestCommunity as any).findPackageForDownload(
+ 'x'
+ );
+
+ expect(result).toEqual({
+ url: 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-24.0.1/graalvm-community-jdk-24.0.1_linux-x64_bin.tar.gz',
+ version: '24.0.1'
+ });
+ // The Community release list is authoritative, so the Adoptium
+ // most_recent_feature_release endpoint must not be consulted.
+ expect(mockHttpClient.getJson).toHaveBeenCalledTimes(1);
+ expect(mockHttpClient.getJson).toHaveBeenCalledWith(
+ expect.stringContaining('graalvm-ce-builds/releases'),
+ expect.anything()
+ );
+ });
+
+ it('should reject GraalVM Community early access requests', async () => {
+ (communityDistribution as any).stable = false;
+
+ await expect(
+ (communityDistribution as any).findPackageForDownload('23')
+ ).rejects.toThrow(
+ 'GraalVM Community does not provide early access builds'
+ );
+ });
+
+ it('should surface an error when the releases listing is not an array', async () => {
+ mockHttpClient.getJson.mockResolvedValue({
+ result: {message: 'API rate limit exceeded'},
+ statusCode: 403,
+ headers: {}
+ });
+
+ await expect(
+ (communityDistribution as any).findPackageForDownload('21')
+ ).rejects.toThrow(
+ /Unexpected response while listing GraalVM Community releases.*HTTP status code: 403/s
+ );
+ });
+ });
+ });
+});
+
+describe('distribution factory', () => {
+ const defaultOptions: JavaInstallerOptions = {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ };
+
+ it('should map graalvm-community to the community installer', async () => {
+ const community = await getJavaDistribution(
+ 'graalvm-community',
+ defaultOptions
+ );
+
+ expect(community).toBeInstanceOf(GraalVMCommunityDistribution);
});
});
diff --git a/__tests__/distributors/jetbrains-installer.test.ts b/__tests__/distributors/jetbrains-installer.test.ts
index 44d8ef896..9c3b5abf6 100644
--- a/__tests__/distributors/jetbrains-installer.test.ts
+++ b/__tests__/distributors/jetbrains-installer.test.ts
@@ -1,23 +1,117 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
import https from 'https';
-import {HttpClient} from '@actions/http-client';
-import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer';
-
-import manifestData from '../data/jetbrains.json';
+import fs from 'fs';
import os from 'os';
+import path from 'path';
+import {HttpClient, HttpClientResponse} from '@actions/http-client';
+import type {IncomingMessage} from 'http';
+import {Readable} from 'stream';
+
+import manifestData from '../data/jetbrains.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {JetBrainsDistribution} =
+ await import('../../src/distributions/jetbrains/installer.js');
+const {RetryingHttpClient} = await import('../../src/retrying-http-client.js');
+const {MAX_PAGINATION_PAGES} = await import('../../src/util.js');
+
+const JETBRAINS_RELEASES_URL =
+ 'https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?per_page=100';
+
+function release(tagName: string, prerelease: boolean) {
+ return {
+ tag_name: tagName,
+ name: tagName,
+ prerelease
+ };
+}
+
+function nextPageHeader(page: number) {
+ return {
+ link: `<${JETBRAINS_RELEASES_URL}&page=${page}>; rel="next"`
+ };
+}
+
+function response(
+ statusCode: number,
+ body = '',
+ headers: IncomingMessage['headers'] = {}
+): HttpClientResponse {
+ const message = Readable.from([Buffer.from(body)]) as IncomingMessage;
+ message.statusCode = statusCode;
+ message.headers = headers;
+ return new HttpClientResponse(message);
+}
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
+ jest.setTimeout(10_000);
+
+ let spyHttpClient: any;
+ let spyHttpClientHead: any;
+ let spyCoreError: any;
+ const originalGitHubToken = process.env.GITHUB_TOKEN;
beforeEach(() => {
+ delete process.env.GITHUB_TOKEN;
+ (core.getInput as jest.Mock).mockReturnValue('');
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: []
});
+ spyHttpClientHead = jest.spyOn(HttpClient.prototype, 'head');
+ spyHttpClientHead.mockResolvedValue({
+ message: {statusCode: 200}
+ } as any);
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
+ if (originalGitHubToken === undefined) {
+ delete process.env.GITHUB_TOKEN;
+ } else {
+ process.env.GITHUB_TOKEN = originalGitHubToken;
+ }
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
@@ -25,11 +119,17 @@ describe('getAvailableVersions', () => {
it('load available versions', async () => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
- spyHttpClient.mockReturnValueOnce({
- statusCode: 200,
- headers: {},
- result: manifestData as any
- });
+ spyHttpClient
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: manifestData as any
+ })
+ .mockReturnValue({
+ statusCode: 200,
+ headers: {},
+ result: []
+ });
const distribution = new JetBrainsDistribution({
version: '17',
@@ -40,13 +140,287 @@ describe('getAvailableVersions', () => {
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();
- const length =
- os.platform() === 'win32' ? manifestData.length : manifestData.length + 2;
- expect(availableVersions.length).toBe(length);
+ expect(availableVersions.length).toBe(manifestData.length + 2);
}, 10_000);
+
+ it('continues a stable request after an all-prerelease page', async () => {
+ jest.spyOn(HttpClient.prototype, 'head').mockResolvedValue({
+ message: {statusCode: 200}
+ } as any);
+ spyHttpClient
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: nextPageHeader(2),
+ result: [release('jbr-release-26.0.0b1.1', true)]
+ })
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: [release('jbr-release-21.0.11b1163.116', false)]
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const availableVersions = await distribution['getAvailableVersions']();
+
+ expect(availableVersions.map(version => version.tag_name)).toContain(
+ 'jbr-release-21.0.11b1163.116'
+ );
+ expect(availableVersions.map(version => version.tag_name)).not.toContain(
+ 'jbr-release-26.0.0b1.1'
+ );
+ expect(spyHttpClient).toHaveBeenCalledTimes(2);
+ });
+
+ it('continues an EA request after an all-stable page', async () => {
+ jest.spyOn(HttpClient.prototype, 'head').mockResolvedValue({
+ message: {statusCode: 200}
+ } as any);
+ spyHttpClient
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: nextPageHeader(2),
+ result: [release('jbr-release-21.0.11b1163.116', false)]
+ })
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: [release('jbr-release-26.0.0b1.1', true)]
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '26-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const availableVersions = await distribution['getAvailableVersions']();
+
+ expect(availableVersions.map(version => version.tag_name)).toEqual([
+ 'jbr-release-26.0.0b1.1'
+ ]);
+ expect(spyHttpClient).toHaveBeenCalledTimes(2);
+ });
+
+ it('uses the token input for every paginated GitHub Releases request', async () => {
+ (core.getInput as jest.Mock).mockReturnValue('input-token');
+ spyHttpClient
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: nextPageHeader(2),
+ result: [release('jbr-release-21.0.11b1163.116', false)]
+ })
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: [release('jbr-release-21.0.10b1087.6', false)]
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenNthCalledWith(1, JETBRAINS_RELEASES_URL, {
+ Accept: 'application/vnd.github+json',
+ Authorization: 'Bearer input-token'
+ });
+ expect(spyHttpClient).toHaveBeenNthCalledWith(
+ 2,
+ `${JETBRAINS_RELEASES_URL}&page=2`,
+ {
+ Accept: 'application/vnd.github+json',
+ Authorization: 'Bearer input-token'
+ }
+ );
+ });
+
+ it('prefers the token input over the environment fallback', async () => {
+ (core.getInput as jest.Mock).mockReturnValue('input-token');
+ process.env.GITHUB_TOKEN = 'environment-token';
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledWith(JETBRAINS_RELEASES_URL, {
+ Accept: 'application/vnd.github+json',
+ Authorization: 'Bearer input-token'
+ });
+ });
+
+ it('falls back to GITHUB_TOKEN when the token input is empty', async () => {
+ process.env.GITHUB_TOKEN = 'environment-token';
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledWith(JETBRAINS_RELEASES_URL, {
+ Accept: 'application/vnd.github+json',
+ Authorization: 'Bearer environment-token'
+ });
+ });
+
+ it('omits authorization when no GitHub token is available', async () => {
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledWith(JETBRAINS_RELEASES_URL, {
+ Accept: 'application/vnd.github+json'
+ });
+ });
+
+ it('stops pagination when a raw GitHub page is empty', async () => {
+ spyHttpClient
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: nextPageHeader(2),
+ result: [release('jbr-release-21.0.11b1163.116', false)]
+ })
+ .mockResolvedValueOnce({
+ statusCode: 200,
+ headers: nextPageHeader(3),
+ result: []
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '26-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledTimes(2);
+ });
+
+ it('stops at the pagination safeguard', async () => {
+ spyHttpClient.mockResolvedValue({
+ statusCode: 200,
+ headers: nextPageHeader(2),
+ result: [release('jbr-release-21.0.11b1163.116', false)]
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '26-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const availableVersions = await distribution['getAvailableVersions']();
+
+ expect(availableVersions).toEqual([]);
+ expect(spyHttpClient).toHaveBeenCalledTimes(MAX_PAGINATION_PAGES);
+ expect(core.warning).toHaveBeenCalledWith(
+ `Reached pagination safeguard limit (${MAX_PAGINATION_PAGES} pages) while listing JetBrains Runtime releases.`
+ );
+ });
+
+ it('ignores pagination links with an unexpected origin', async () => {
+ spyHttpClient.mockResolvedValueOnce({
+ statusCode: 200,
+ headers: {
+ link: '; rel="next"'
+ },
+ result: [release('jbr-release-21.0.11b1163.116', false)]
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '26-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledTimes(1);
+ expect(core.warning).toHaveBeenCalledWith(
+ 'Ignoring pagination link with unexpected origin: https://example.com/releases?page=2'
+ );
+ });
+
+ it('retries a GitHub rate limit using Retry-After', async () => {
+ spyHttpClient.mockRestore();
+ spyHttpClientHead.mockRestore();
+ const sleep = jest.fn(async () => undefined);
+ const requestRaw = jest
+ .spyOn(HttpClient.prototype, 'requestRaw')
+ .mockResolvedValueOnce(response(429, '', {'retry-after': '2'}))
+ .mockResolvedValueOnce(response(200, '[]'))
+ .mockResolvedValueOnce(response(200))
+ .mockResolvedValueOnce(response(200));
+ const distribution = new JetBrainsDistribution({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['http'] = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0
+ });
+
+ const availableVersions = await distribution['getAvailableVersions']();
+
+ expect(availableVersions).toHaveLength(2);
+ expect(requestRaw).toHaveBeenCalledTimes(4);
+ expect(requestRaw.mock.calls[0][0].options.path).toBe(
+ requestRaw.mock.calls[1][0].options.path
+ );
+ expect(requestRaw.mock.calls[0][0].options.path).toContain(
+ '/repos/JetBrains/JetBrainsRuntime/releases'
+ );
+ expect(sleep).toHaveBeenCalledWith(2000);
+ expect(core.info).toHaveBeenCalledWith(
+ 'Request attempt 1 of 4 failed (HTTP 429); retrying in 2000 ms'
+ );
+ });
});
describe('findPackageForDownload', () => {
+ let spyHttpClientGet: any;
+
+ const JETBRAINS_CHECKSUM = 'c'.repeat(128);
+
+ beforeEach(() => {
+ // Every resolved release fetches `${url}.checksum` (sha512, GNU
+ // ` ` format); stub it so tests never reach the real
+ // network, except the dedicated 'version %s can be downloaded' test
+ // below which intentionally exercises real HTTPS HEAD requests.
+ spyHttpClientGet = jest
+ .spyOn(HttpClient.prototype, 'get')
+ .mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () => `${JETBRAINS_CHECKSUM} jbrsdk.tar.gz\n`
+ } as any);
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
it.each([
['17', '17.0.11+1207.24'],
['11.0', '11.0.16+2043.64'],
@@ -81,14 +455,133 @@ describe('findPackageForDownload', () => {
const url = resolvedVersion.url;
const options = {method: 'HEAD'};
- https.request(url, options, res => {
- // JetBrains uses 403 for inexistent packages
- expect(res.statusCode).not.toBe(403);
- res.resume();
+ await new Promise((resolve, reject) => {
+ const request = https.request(url, options, res => {
+ let assertionError: unknown;
+
+ try {
+ // JetBrains uses 403 for non-existent packages
+ expect(res.statusCode).not.toBe(403);
+ } catch (error) {
+ assertionError = error;
+ }
+
+ res.resume();
+ res.once('error', reject);
+ res.once('end', () =>
+ assertionError ? reject(assertionError as Error) : resolve()
+ );
+ });
+
+ request.on('error', reject);
+ request.end();
});
}
);
+ describe('hotfix releases', () => {
+ beforeEach(() => {
+ jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: [
+ release('jbr-release-25.0.4b508.27', false),
+ release('jbr-release-25.0.4.1b635.9', false),
+ release('jbr-release-25.0.4.1b635.79', false),
+ release('jbr-release-25.0.3.2b1000.1', false)
+ ]
+ });
+ jest.spyOn(HttpClient.prototype, 'head').mockResolvedValue(response(200));
+ });
+
+ it.each(['linux', 'osx', 'windows'])(
+ 'selects the patched JBR archive and checksum on %s',
+ async platform => {
+ const distribution = new JetBrainsDistribution({
+ version: '25',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: true
+ });
+ distribution['getPlatformOption'] = () => platform;
+ const url = `https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-25.0.4.1-${platform}-x64-b635.79.tar.gz`;
+
+ const result = await distribution['findPackageForDownload']('25');
+
+ expect(result).toEqual({
+ version: '25.0.4+1.635.79',
+ url,
+ checksum: {
+ algorithm: 'sha512',
+ value: JETBRAINS_CHECKSUM,
+ source: `${url}.checksum`
+ }
+ });
+ expect(HttpClient.prototype.head).toHaveBeenCalledWith(url);
+ expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
+ expect(spyHttpClientGet).toHaveBeenCalledWith(`${url}.checksum`);
+ }
+ );
+
+ it.each([
+ ['latest', '25.0.4+1.635.79'],
+ ['25.0.4', '25.0.4+1.635.79'],
+ ['25.0.4.0', '25.0.4+508.27'],
+ ['25.0.4.1', '25.0.4+1.635.79'],
+ ['25.0.4.1+635.79', '25.0.4+1.635.79'],
+ ['25.0.4+1.635.9', '25.0.4+1.635.9'],
+ ['25.0.4+508.27', '25.0.4+508.27']
+ ])('resolves %s to %s', async (input, expected) => {
+ const distribution = new JetBrainsDistribution({
+ version: input,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: true
+ });
+
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).resolves.toMatchObject({version: expected});
+ });
+
+ it('resolves early-access hotfix releases separately', async () => {
+ jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: [
+ release('jbr-release-25.0.4.1b635.79', true),
+ release('jbr-release-25.0.4.2b636.1', false)
+ ]
+ });
+ const distribution = new JetBrainsDistribution({
+ version: '25.0.4.1-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: true
+ });
+
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).resolves.toMatchObject({version: '25.0.4+1.635.79'});
+ });
+
+ it.each(['25.0.4.2', '25.0.4.1+635.80'])(
+ 'does not substitute another patch or build for %s',
+ async input => {
+ const distribution = new JetBrainsDistribution({
+ version: input,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: true
+ });
+
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow(/No matching version found/);
+ }
+ );
+ });
+
it('version is not found', async () => {
const distribution = new JetBrainsDistribution({
version: '8.0.452',
@@ -98,7 +591,7 @@ describe('findPackageForDownload', () => {
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
);
});
@@ -111,7 +604,155 @@ describe('findPackageForDownload', () => {
});
distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
+ );
+ });
+
+ it('fetches the authoritative sha512 checksum only for the resolved version', async () => {
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData as any;
+
+ const result = await distribution['findPackageForDownload']('21');
+
+ expect(result.checksum).toEqual({
+ algorithm: 'sha512',
+ value: JETBRAINS_CHECKSUM,
+ source: `${result.url}.checksum`
+ });
+ // Only the single resolved/winning version's checksum is requested,
+ // not one per candidate considered during version resolution.
+ expect(spyHttpClientGet).toHaveBeenCalledWith(`${result.url}.checksum`);
+ expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
+ });
+
+ it('parses only the first whitespace-delimited token from the GNU checksum payload', async () => {
+ spyHttpClientGet.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () => `${JETBRAINS_CHECKSUM} jbrsdk-21.tar.gz\n`
+ } as any);
+
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData as any;
+
+ const result = await distribution['findPackageForDownload']('21');
+
+ expect(result.checksum?.value).toBe(JETBRAINS_CHECKSUM);
+ });
+
+ it('falls back to a sha256 checksum for older JBR builds that only publish one', async () => {
+ // Older JBR 11 builds (e.g. jbrsdk_nomod-11_0_16-*-b2043.64.tar.gz) publish
+ // a SHA-256 digest at the generic `.checksum` sibling instead of SHA-512.
+ const sha256Checksum = 'a'.repeat(64);
+ spyHttpClientGet.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () =>
+ `${sha256Checksum} jbrsdk_nomod-11_0_16-osx-x64-b2043.64.tar.gz\n`
+ } as any);
+
+ const distribution = new JetBrainsDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData as any;
+
+ const result = await distribution['findPackageForDownload']('21');
+
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: sha256Checksum,
+ source: `${result.url}.checksum`
+ });
+ });
+
+ describe('compareVersions', () => {
+ it.each([
+ ['25.0.4+1.635.79', '25.0.4+508.27', 1],
+ ['25.0.5+1.1', '25.0.4+1.635.79', 1],
+ ['25.0.4+10.1.1', '25.0.4+2.999.99', 1],
+ ['25.0.4+1.635.79', '25.0.4+1.635.9', 1],
+ ['25.0.4+1.636.1', '25.0.4+1.635.79', 1],
+ ['25.0.4+0.635.79', '25.0.4+635.79', 0],
+ ['11.0.11+1522', '11.0.11+1522.1', -1],
+ ['25.0.4', '25.0.4+508.27', -1]
+ ])('compares %s with %s', (first, second, expected) => {
+ const distribution = new JetBrainsDistribution({
+ version: '25',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(Math.sign(distribution['compareVersions'](first, second))).toBe(
+ expected
+ );
+ expect(
+ Math.sign(distribution['compareVersions'](second, first)) || 0
+ ).toBe(-expected || 0);
+ });
+ });
+
+ describe('hotfix releases in the tool cache', () => {
+ let cacheRoot: string;
+ const previousToolcache = process.env['RUNNER_TOOL_CACHE'];
+
+ beforeEach(async () => {
+ cacheRoot = await fs.promises.mkdtemp(
+ path.join(os.tmpdir(), 'jetbrains-')
+ );
+ process.env['RUNNER_TOOL_CACHE'] = cacheRoot;
+ for (const version of ['25.0.4-508.27', '25.0.4-1.635.79']) {
+ const javaPath = path.join(
+ cacheRoot,
+ 'Java_JetBrains_jdk',
+ version,
+ 'x64'
+ );
+ await fs.promises.mkdir(javaPath, {recursive: true});
+ await fs.promises.writeFile(`${javaPath}.complete`, '');
+ }
+ });
+
+ afterEach(async () => {
+ if (previousToolcache === undefined) {
+ delete process.env['RUNNER_TOOL_CACHE'];
+ } else {
+ process.env['RUNNER_TOOL_CACHE'] = previousToolcache;
+ }
+ await fs.promises.rm(cacheRoot, {recursive: true, force: true});
+ });
+
+ it.each(['25', '25.0.4.1', '25.0.4.1+635.79'])(
+ 'reuses the patched JBR for %s',
+ input => {
+ const distribution = new JetBrainsDistribution({
+ version: input,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(distribution['findInToolcache']()).toEqual({
+ version: '25.0.4+1.635.79',
+ path: path.join(
+ cacheRoot,
+ 'Java_JetBrains_jdk',
+ '25.0.4-1.635.79',
+ 'x64'
+ )
+ });
+ }
);
});
});
diff --git a/__tests__/distributors/kona-installer.test.ts b/__tests__/distributors/kona-installer.test.ts
new file mode 100644
index 000000000..ba5a83266
--- /dev/null
+++ b/__tests__/distributors/kona-installer.test.ts
@@ -0,0 +1,265 @@
+import {KonaDistribution} from '../../src/distributions/kona/installer.js';
+
+import manifestData from '../data/kona.json' with {type: 'json'};
+
+function mockDistr(
+ version: string,
+ os: string,
+ arch: string,
+ packageType: string
+): KonaDistribution {
+ const distribution = new KonaDistribution({
+ version: version,
+ architecture: arch,
+ packageType: packageType,
+ checkLatest: false
+ });
+
+ distribution['getOs'] = () => os;
+ distribution['fetchReleaseInfo'] = async () => manifestData;
+
+ return distribution;
+}
+
+describe('Check getAvailableReleases', () => {
+ it.each([
+ ['8', 'linux', 'aarch64', 'linux-aarch64'],
+ ['8.0.20', 'macos', 'x86_64', 'macosx-x86_64'],
+ ['11', 'linux', 'x86_64', 'linux-x86_64'],
+ ['11.0.25', 'macos', 'aarch64', 'macosx-aarch64'],
+ ['17.0.13', 'windows', 'x86_64', 'windows-x86_64'],
+ ['21.0.5', 'linux', 'x86_64', 'linux-x86_64'],
+ ['25', 'linux', 'aarch64', 'linux-aarch64'],
+ ['25.0.3', 'macos', 'x86_64', 'macosx-x86_64']
+ ])(
+ 'should get releases with the specified version "%s", OS "%s" and arch "%s"',
+ async (
+ version: string,
+ os: string,
+ arch: string,
+ expectedPattern: string
+ ) => {
+ const distribution = mockDistr(version, os, arch, 'jdk');
+
+ const releases = await distribution['getAvailableReleases']();
+ expect(releases).not.toBeNull();
+ expect(releases.length).toBe(5);
+ releases.forEach(release =>
+ expect(release.downloadUrl).toContain(expectedPattern)
+ );
+ }
+ );
+});
+
+describe('Check findPackageForDownload', () => {
+ it.each([
+ [
+ '8',
+ 'linux',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_linux-aarch64_8u432.tar.gz'
+ ],
+ [
+ '8.0.20',
+ 'linux',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_linux-x86_64_8u432.tar.gz'
+ ],
+ [
+ '8.0.20',
+ 'macos',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_macosx-aarch64_8u432_notarized.tar.gz'
+ ],
+ [
+ '8.0.20',
+ 'macos',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_macosx-x86_64_8u432_notarized.tar.gz'
+ ],
+ [
+ '8.0.20',
+ 'windows',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-8/releases/download/8.0.20-GA/TencentKona8.0.20.b1_jdk_windows-x86_64_8u432_signed.zip'
+ ],
+
+ [
+ '11',
+ 'linux',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1-jdk_linux-aarch64.tar.gz'
+ ],
+ [
+ '11.0.25',
+ 'linux',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1-jdk_linux-x86_64.tar.gz'
+ ],
+ [
+ '11.0.25',
+ 'macos',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1_jdk_macosx-aarch64_notarized.tar.gz'
+ ],
+ [
+ '11.0.25',
+ 'macos',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1_jdk_macosx-x86_64_notarized.tar.gz'
+ ],
+ [
+ '11.0.25',
+ 'windows',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-11/releases/download/kona11.0.25/TencentKona-11.0.25.b1_jdk_windows-x86_64_signed.zip'
+ ],
+
+ [
+ '17',
+ 'linux',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1-jdk_linux-aarch64.tar.gz'
+ ],
+ [
+ '17.0.13',
+ 'linux',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1-jdk_linux-x86_64.tar.gz'
+ ],
+ [
+ '17.0.13',
+ 'macos',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1_jdk_macosx-aarch64_notarized.tar.gz'
+ ],
+ [
+ '17.0.13',
+ 'macos',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1_jdk_macosx-x86_64_notarized.tar.gz'
+ ],
+ [
+ '17.0.13',
+ 'windows',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-17/releases/download/TencentKona-17.0.13/TencentKona-17.0.13.b1_jdk_windows-x86_64_signed.zip'
+ ],
+
+ [
+ '21',
+ 'linux',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1-jdk_linux-aarch64.tar.gz'
+ ],
+ [
+ '21.0.5',
+ 'linux',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1-jdk_linux-x86_64.tar.gz'
+ ],
+ [
+ '21.0.5',
+ 'macos',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1_jdk_macosx-aarch64_notarized.tar.gz'
+ ],
+ [
+ '21.0.5',
+ 'macos',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1_jdk_macosx-x86_64_notarized.tar.gz'
+ ],
+ [
+ '21.0.5',
+ 'windows',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-21/releases/download/TencentKona-21.0.5/TencentKona-21.0.5.b1_jdk_windows-x86_64_signed.zip'
+ ],
+
+ [
+ '25',
+ 'linux',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-25/releases/download/TencentKona-25.0.3/TencentKona-25.0.3.b1-jdk_linux-aarch64.tar.gz'
+ ],
+ [
+ '25.0.3',
+ 'linux',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-25/releases/download/TencentKona-25.0.3/TencentKona-25.0.3.b1-jdk_linux-x86_64.tar.gz'
+ ],
+ [
+ '25.0.3',
+ 'macos',
+ 'aarch64',
+ 'https://github.com/Tencent/TencentKona-25/releases/download/TencentKona-25.0.3/TencentKona-25.0.3.b1_jdk_macosx-aarch64_notarized.tar.gz'
+ ],
+ [
+ '25.0.3',
+ 'macos',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-25/releases/download/TencentKona-25.0.3/TencentKona-25.0.3.b1_jdk_macosx-x86_64_notarized.tar.gz'
+ ],
+ [
+ '25.0.3',
+ 'windows',
+ 'x86_64',
+ 'https://github.com/Tencent/TencentKona-25/releases/download/TencentKona-25.0.3/TencentKona-25.0.3.b1_jdk_windows-x86_64_signed.zip'
+ ]
+ ])(
+ 'should return the download URL with the specified version "%s", OS "%s" and arch "%s"',
+ async (version: string, os: string, arch: string, expectedUrl: string) => {
+ const distribution = mockDistr(version, os, arch, 'jdk');
+
+ const availableRelease =
+ await distribution['findPackageForDownload'](version);
+ expect(availableRelease).not.toBeNull();
+ expect(availableRelease.url).toBe(expectedUrl);
+ if (availableRelease.checksum) {
+ expect(availableRelease.checksum).toEqual({
+ algorithm: 'sha256',
+ value: expect.stringMatching(/^[a-f0-9]{64}$/),
+ source: 'https://tencent.github.io/konajdk/releases/kona-v1.json'
+ });
+ } else {
+ expect(version).toBe('8.0.20');
+ }
+ }
+ );
+});
+
+describe('No release is found', () => {
+ it.each([
+ ['8', 'linux', 'x86'],
+ ['8.0.0', 'linux', 'x86_64'],
+ ['11', 'linux', 'ppc64'],
+ ['17', 'solaris', 'x86_64'],
+ ['17', 'windows', 'aarch64'],
+ ['22', 'macos', 'x86_64']
+ ])(
+ `should throw an error due to no release with the specified version "%s", os "%s" and arch "%s"`,
+ async (version: string, os: string, arch: string) => {
+ const distribution = mockDistr(version, os, arch, 'jdk');
+
+ await expect(
+ distribution['findPackageForDownload'](version)
+ ).rejects.toThrow(
+ `No Kona release for the specified version "${version}" on OS "${os}" and arch "${arch}".`
+ );
+ }
+ );
+});
+
+describe('The package type must be jdk', () => {
+ it('should throw an error due to the specified package type is not jdk', async () => {
+ const version = '8.0.20';
+ const os = 'linux';
+ const arch = 'x86_64';
+ const distribution = mockDistr(version, os, arch, 'jre');
+
+ await expect(
+ distribution['findPackageForDownload'](version)
+ ).rejects.toThrow('Kona provides jdk only');
+ });
+});
diff --git a/__tests__/distributors/liberica-installer.test.ts b/__tests__/distributors/liberica-installer.test.ts
index 5e664d5f3..105a555c0 100644
--- a/__tests__/distributors/liberica-installer.test.ts
+++ b/__tests__/distributors/liberica-installer.test.ts
@@ -1,15 +1,58 @@
-import {LibericaDistributions} from '../../src/distributions/liberica/installer';
import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import fs from 'fs';
+import type {
ArchitectureOptions,
LibericaVersion
-} from '../../src/distributions/liberica/models';
+} from '../../src/distributions/liberica/models.js';
import {HttpClient} from '@actions/http-client';
import os from 'os';
+import path from 'path';
-import manifestData from '../data/liberica.json';
+import manifestData from '../data/liberica.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {LibericaDistributions} =
+ await import('../../src/distributions/liberica/installer.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -18,6 +61,10 @@ describe('getAvailableVersions', () => {
headers: {},
result: manifestData as LibericaVersion[]
});
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -178,7 +225,7 @@ describe('getArchitectureOptions', () => {
});
describe('findPackageForDownload', () => {
- let distribution: LibericaDistributions;
+ let distribution: InstanceType;
beforeEach(() => {
distribution = new LibericaDistributions({
@@ -207,14 +254,331 @@ describe('findPackageForDownload', () => {
expect(result.version).toBe(expected);
});
+ describe.each([
+ [17, 20],
+ [25, 4]
+ ])('patch releases for Java %s.0.%s', (featureVersion, updateVersion) => {
+ const mainVersion = `${featureVersion}.0.${updateVersion}`;
+
+ beforeEach(() => {
+ distribution['getAvailableVersions'] = async () =>
+ ['+1', '+10', '.1+1', '.1+2', '.1+10', '.2+1', '.10+1'].map(suffix => ({
+ featureVersion,
+ interimVersion: 0,
+ updateVersion,
+ buildVersion: Number(suffix.split('+')[1]),
+ version: `${mainVersion}${suffix}`,
+ downloadUrl: `https://download.bell-sw.com/java/${mainVersion}${suffix}/bellsoft-jdk${mainVersion}${suffix}-macos-aarch64.tar.gz`
+ }));
+ });
+
+ it.each([
+ [`${mainVersion}+1.1`, `${mainVersion}+1.1`, '.1+1'],
+ [`${mainVersion}+1.2`, `${mainVersion}+1.2`, '.1+2'],
+ [`${mainVersion}+1.10`, `${mainVersion}+1.10`, '.1+10'],
+ [`${mainVersion}+1`, `${mainVersion}+1`, '+1'],
+ [mainVersion, `${mainVersion}+10.1`, '.10+1'],
+ [`${featureVersion}`, `${mainVersion}+10.1`, '.10+1']
+ ])('version is %s -> %s', async (input, expected, suffix) => {
+ const result = await distribution['findPackageForDownload'](input);
+ expect(result).toEqual({
+ version: expected,
+ url: `https://download.bell-sw.com/java/${mainVersion}${suffix}/bellsoft-jdk${mainVersion}${suffix}-macos-aarch64.tar.gz`
+ });
+ });
+
+ it('sorts builds within the same patch numerically', async () => {
+ const versions = await distribution['getAvailableVersions']();
+ distribution['getAvailableVersions'] = async () =>
+ versions.filter(item => item.version.startsWith(`${mainVersion}.1+`));
+
+ const result = await distribution['findPackageForDownload'](mainVersion);
+ expect(result.version).toBe(`${mainVersion}+1.10`);
+ });
+
+ it('selects the newest build for a four-component patch-only request', async () => {
+ const patchDistribution = new LibericaDistributions({
+ version: `${mainVersion}.1`,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ patchDistribution['getAvailableVersions'] =
+ distribution['getAvailableVersions'];
+
+ await expect(
+ patchDistribution['findPackageForDownload'](
+ patchDistribution['version']
+ )
+ ).resolves.toMatchObject({version: `${mainVersion}+1.10`});
+ });
+
+ it('does not substitute a different compound build', async () => {
+ await expect(
+ distribution['findPackageForDownload'](`${mainVersion}+1.3`)
+ ).rejects.toThrow(/No matching version found for SemVer/);
+ });
+ });
+
+ it('selects the latest multi-component patch release for Java 25', async () => {
+ const releases: LibericaVersion[] = [
+ '25.0.5+11',
+ '25.0.5.0.2+5',
+ '25.0.5.0.3+5'
+ ].map(version => {
+ const [versionWithoutBuild, buildVersion] = version.split('+');
+ const [featureVersion, interimVersion, updateVersion] =
+ versionWithoutBuild.split('.').map(Number);
+ return {
+ version,
+ featureVersion,
+ interimVersion,
+ updateVersion,
+ buildVersion: Number(buildVersion),
+ downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
+ };
+ });
+ distribution['getAvailableVersions'] = async () => releases;
+
+ await expect(distribution['findPackageForDownload']('25')).resolves.toEqual(
+ {
+ version: '25.0.5+0.3.5',
+ url: 'https://download.bell-sw.com/java/25.0.5.0.3+5/jdk.tar.gz'
+ }
+ );
+ });
+
+ it('compares patch components before build numbers when patch lengths differ', async () => {
+ const releases: LibericaVersion[] = ['25.0.5.1+10', '25.0.5.1.1+1'].map(
+ version => {
+ const [versionWithoutBuild, buildVersion] = version.split('+');
+ const [featureVersion, interimVersion, updateVersion] =
+ versionWithoutBuild.split('.').map(Number);
+ return {
+ version,
+ featureVersion,
+ interimVersion,
+ updateVersion,
+ buildVersion: Number(buildVersion),
+ downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
+ };
+ }
+ );
+ distribution['getAvailableVersions'] = async () => releases;
+
+ await expect(
+ distribution['findPackageForDownload']('25.0.5')
+ ).resolves.toEqual({
+ version: '25.0.5+1.1.1',
+ url: 'https://download.bell-sw.com/java/25.0.5.1.1+1/jdk.tar.gz'
+ });
+ });
+
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('17')).rejects.toThrow(
- /Could not find satisfied version for semver */
+ /No matching version found for SemVer/
);
});
});
+describe('patch request resolution from the constructor', () => {
+ const releases: LibericaVersion[] = ['17.0.20+10', '17.0.20.1+1'].map(
+ version => ({
+ featureVersion: 17,
+ interimVersion: 0,
+ updateVersion: 20,
+ buildVersion: Number(version.split('+')[1]),
+ version,
+ downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
+ })
+ );
+ let cacheRoot: string;
+ let previousToolcache: string | undefined;
+
+ beforeEach(async () => {
+ previousToolcache = process.env['RUNNER_TOOL_CACHE'];
+ cacheRoot = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'liberica-'));
+ process.env['RUNNER_TOOL_CACHE'] = cacheRoot;
+ for (const version of ['17.0.20-10', '17.0.20-1.1']) {
+ const javaPath = path.join(
+ cacheRoot,
+ 'Java_Liberica_jdk',
+ version,
+ 'x64'
+ );
+ await fs.promises.mkdir(javaPath, {recursive: true});
+ await fs.promises.writeFile(`${javaPath}.complete`, '');
+ }
+ });
+
+ afterEach(async () => {
+ if (previousToolcache === undefined) {
+ delete process.env['RUNNER_TOOL_CACHE'];
+ } else {
+ process.env['RUNNER_TOOL_CACHE'] = previousToolcache;
+ }
+ await fs.promises.rm(cacheRoot, {recursive: true, force: true});
+ });
+
+ it.each([
+ ['17', '17.0.20+1.1', '17.0.20.1+1'],
+ ['17.0.20', '17.0.20+1.1', '17.0.20.1+1'],
+ ['17.0.20+10', '17.0.20+10', '17.0.20+10'],
+ ['17.0.20+1.1', '17.0.20+1.1', '17.0.20.1+1'],
+ ['17.0.20.1', '17.0.20+1.1', '17.0.20.1+1'],
+ ['17.0.20.1+1', '17.0.20+1.1', '17.0.20.1+1'],
+ ['17.0.20.0', '17.0.20+10', '17.0.20+10']
+ ])(
+ 'resolves %s consistently remotely and in cache',
+ async (input, expected, apiVersion) => {
+ const distribution = new LibericaDistributions({
+ version: input,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => releases;
+
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).resolves.toEqual({
+ version: expected,
+ url: `https://download.bell-sw.com/java/${apiVersion}/jdk.tar.gz`
+ });
+ expect(distribution['findInToolcache']()).toEqual({
+ version: expected,
+ path: path.join(
+ cacheRoot,
+ 'Java_Liberica_jdk',
+ expected.replace('+', '-'),
+ 'x64'
+ )
+ });
+ }
+ );
+
+ it.each(['17.0.20.2', '17.0.20+1.2'])(
+ 'does not substitute a different patch or exact build for %s',
+ async version => {
+ const distribution = new LibericaDistributions({
+ version,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => releases;
+
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow(/No matching version found/);
+ expect(distribution['findInToolcache']()).toBeNull();
+ }
+ );
+
+ it('keeps patch-only and exact-build resolution cache identities distinct', () => {
+ const distribution = new LibericaDistributions({
+ version: '17.0.20.1',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ expect(distribution['version']).toBe('17.0.20.1');
+ });
+
+ it('normalizes multi-component patch-only requests for exact matching', async () => {
+ const releases: LibericaVersion[] = ['25.0.5.0.2+5', '25.0.5.0.3+5'].map(
+ version => {
+ const [versionWithoutBuild, buildVersion] = version.split('+');
+ const [featureVersion, interimVersion, updateVersion] =
+ versionWithoutBuild.split('.').map(Number);
+ return {
+ version,
+ featureVersion,
+ interimVersion,
+ updateVersion,
+ buildVersion: Number(buildVersion),
+ downloadUrl: `https://download.bell-sw.com/java/${version}/jdk.tar.gz`
+ };
+ }
+ );
+ const distribution = new LibericaDistributions({
+ version: '25.0.5.0.3',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => releases;
+
+ expect(distribution['version']).toBe('25.0.5.0.3');
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).resolves.toEqual({
+ version: '25.0.5+0.3.5',
+ url: 'https://download.bell-sw.com/java/25.0.5.0.3+5/jdk.tar.gz'
+ });
+ });
+
+ it('orders main versions, patches, and builds consistently in cache', async () => {
+ for (const version of ['17.0.20-1.2', '17.0.20-1.10', '17.0.21-1']) {
+ const javaPath = path.join(
+ cacheRoot,
+ 'Java_Liberica_jdk',
+ version,
+ 'x64'
+ );
+ await fs.promises.mkdir(javaPath, {recursive: true});
+ await fs.promises.writeFile(`${javaPath}.complete`, '');
+ }
+
+ for (const [version, expected] of [
+ ['17', '17.0.21+1'],
+ ['17.0.20', '17.0.20+1.10'],
+ ['17.0.20.1', '17.0.20+1.10']
+ ]) {
+ const distribution = new LibericaDistributions({
+ version,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ expect(distribution['findInToolcache']()?.version).toBe(expected);
+ }
+ });
+
+ it('preserves early-access handling for patch-only requests', async () => {
+ const javaPath = path.join(
+ cacheRoot,
+ 'Java_Liberica_jdk',
+ '17.0.20-ea.1.2',
+ 'x64'
+ );
+ await fs.promises.mkdir(javaPath, {recursive: true});
+ await fs.promises.writeFile(`${javaPath}.complete`, '');
+ const distribution = new LibericaDistributions({
+ version: '17.0.20.1-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ expect(distribution['stable']).toBe(false);
+ expect(distribution['findInToolcache']()).toEqual({
+ version: '17.0.20+1.2',
+ path: javaPath
+ });
+ });
+});
+
describe('getPlatformOption', () => {
+ beforeEach(() => {
+ // The linux row below is glibc, so pin the Alpine probe rather than
+ // letting it depend on the machine running the suite.
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
@@ -279,6 +643,76 @@ describe('convertVersionToSemver', () => {
buildVersion: 13
},
'11.0.0+13'
+ ],
+ [
+ {
+ version: '17.0.20.1+1',
+ featureVersion: 17,
+ interimVersion: 0,
+ updateVersion: 20,
+ buildVersion: 1
+ },
+ '17.0.20+1.1'
+ ],
+ [
+ {
+ version: '25.0.4.1+1',
+ featureVersion: 25,
+ interimVersion: 0,
+ updateVersion: 4,
+ buildVersion: 1
+ },
+ '25.0.4+1.1'
+ ],
+ [
+ {
+ version: '25.0.5.0.3+5',
+ featureVersion: 25,
+ interimVersion: 0,
+ updateVersion: 5,
+ buildVersion: 5
+ },
+ '25.0.5+0.3.5'
+ ],
+ [
+ {
+ version: '17.0.20.1+2',
+ featureVersion: 17,
+ interimVersion: 0,
+ updateVersion: 20,
+ buildVersion: 2
+ },
+ '17.0.20+1.2'
+ ],
+ [
+ {
+ version: '25.0.4+1.1',
+ featureVersion: 25,
+ interimVersion: 0,
+ updateVersion: 4,
+ buildVersion: 1
+ },
+ '25.0.4+1.1'
+ ],
+ [
+ {
+ version: '25+36',
+ featureVersion: 25,
+ interimVersion: 0,
+ updateVersion: 0,
+ buildVersion: 36
+ },
+ '25.0.0+36'
+ ],
+ [
+ {
+ version: '8u202',
+ featureVersion: 8,
+ interimVersion: 0,
+ updateVersion: 202,
+ buildVersion: 8
+ },
+ '8.0.202+8'
]
])('%s -> %s', (input, expected) => {
const actual = distributions['convertVersionToSemver']({
@@ -290,3 +724,35 @@ describe('convertVersionToSemver', () => {
expect(actual).toEqual(expected);
});
});
+
+describe('Liberica getPlatformOption libc selection', () => {
+ const distributions = new LibericaDistributions({
+ architecture: 'x64',
+ version: '11',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it('selects the musl artifacts on Alpine', () => {
+ jest.spyOn(fs, 'existsSync').mockReturnValue(true);
+
+ expect(distributions['getPlatformOption']('linux')).toBe('linux-musl');
+ });
+
+ it('selects the glibc artifacts on other Linux runners', () => {
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+
+ expect(distributions['getPlatformOption']('linux')).toBe('linux');
+ });
+
+ it('does not probe for Alpine off Linux', () => {
+ const existsSync = jest.spyOn(fs, 'existsSync');
+
+ expect(distributions['getPlatformOption']('darwin')).toBe('macos');
+ expect(existsSync).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/distributors/liberica-linux-installer.test.ts b/__tests__/distributors/liberica-linux-installer.test.ts
index 58c4e4781..8ecb5b452 100644
--- a/__tests__/distributors/liberica-linux-installer.test.ts
+++ b/__tests__/distributors/liberica-linux-installer.test.ts
@@ -1,15 +1,56 @@
-import {LibericaDistributions} from '../../src/distributions/liberica/installer';
import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {
ArchitectureOptions,
LibericaVersion
-} from '../../src/distributions/liberica/models';
+} from '../../src/distributions/liberica/models.js';
import {HttpClient} from '@actions/http-client';
import os from 'os';
-import manifestData from '../data/liberica-linux.json';
+import manifestData from '../data/liberica-linux.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {LibericaDistributions} =
+ await import('../../src/distributions/liberica/installer.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -18,6 +59,10 @@ describe('getAvailableVersions', () => {
headers: {},
result: manifestData as LibericaVersion[]
});
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -178,7 +223,7 @@ describe('getArchitectureOptions', () => {
});
describe('findPackageForDownload', () => {
- let distribution: LibericaDistributions;
+ let distribution: InstanceType;
beforeEach(() => {
distribution = new LibericaDistributions({
@@ -209,7 +254,7 @@ describe('findPackageForDownload', () => {
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
- /Could not find satisfied version for semver */
+ /No matching version found for SemVer/
);
});
});
diff --git a/__tests__/distributors/liberica-nik-installer.test.ts b/__tests__/distributors/liberica-nik-installer.test.ts
new file mode 100644
index 000000000..8f1c9ae22
--- /dev/null
+++ b/__tests__/distributors/liberica-nik-installer.test.ts
@@ -0,0 +1,262 @@
+import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
+import fs from 'fs';
+import type {
+ ArchitectureOptions,
+ NikVersion
+} from '../../src/distributions/liberica-nik/models.js';
+import {HttpClient} from '@actions/http-client';
+
+import manifestData from '../data/liberica-nik.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const {LibericaNikDistributions} =
+ await import('../../src/distributions/liberica-nik/installer.js');
+
+const ADDITIONAL_PARAMS =
+ '&installation-type=archive&fields=downloadUrl%2Cversion%2Ccomponents%2Ccomponent%2Cembedded';
+
+describe('getAvailableVersions', () => {
+ let spyHttpClient: any;
+
+ beforeEach(() => {
+ spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
+ spyHttpClient.mockReturnValue({
+ statusCode: 200,
+ headers: {},
+ result: manifestData as NikVersion[]
+ });
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ jest.clearAllMocks();
+ jest.restoreAllMocks();
+ });
+
+ it.each([
+ [
+ {version: '21', architecture: 'x64', packageType: 'jdk'},
+ 'bundle-type=standard&bitness=64&arch=x86&build-type=all'
+ ],
+ [
+ {version: '21-ea', architecture: 'x64', packageType: 'jdk'},
+ 'bundle-type=standard&bitness=64&arch=x86&build-type=ea'
+ ],
+ [
+ {version: '21', architecture: 'aarch64', packageType: 'jdk'},
+ 'bundle-type=standard&bitness=64&arch=arm&build-type=all'
+ ],
+ [
+ {version: '21', architecture: 'x64', packageType: 'jdk+fx'},
+ 'bundle-type=full&bitness=64&arch=x86&build-type=all'
+ ]
+ ])('build correct url for %s -> %s', async (input, urlParams) => {
+ const distribution = new LibericaNikDistributions({
+ ...input,
+ checkLatest: false
+ });
+ distribution['getPlatformOption'] = () => 'linux';
+ const buildUrl = `https://api.bell-sw.com/v1/nik/releases?os=linux&${urlParams}${ADDITIONAL_PARAMS}`;
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient.mock.calls).toHaveLength(1);
+ expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
+ });
+
+ it('load available versions', async () => {
+ const distribution = new LibericaNikDistributions({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ const availableVersions = await distribution['getAvailableVersions']();
+ expect(availableVersions).toEqual(manifestData);
+ });
+});
+
+describe('getArchitectureOptions', () => {
+ it.each([
+ ['x64', {bitness: '64', arch: 'x86'}],
+ ['aarch64', {bitness: '64', arch: 'arm'}]
+ ] as [string, ArchitectureOptions][])(
+ 'parse architecture %s -> %s',
+ (input, expected) => {
+ const distributions = new LibericaNikDistributions({
+ architecture: input,
+ checkLatest: false,
+ packageType: 'jdk',
+ version: '21'
+ });
+
+ expect(distributions['getArchitectureOptions']()).toEqual(expected);
+ }
+ );
+
+ it.each(['x86', 'armv7', 's390x'])('not support architecture %s', input => {
+ const distributions = new LibericaNikDistributions({
+ architecture: input,
+ checkLatest: false,
+ packageType: 'jdk',
+ version: '21'
+ });
+
+ expect(() => distributions['getArchitectureOptions']()).toThrow(
+ /Architecture '\w+' is not supported\. Supported architectures: .*/
+ );
+ });
+});
+
+describe('findPackageForDownload', () => {
+ let distribution: InstanceType;
+
+ beforeEach(() => {
+ distribution = new LibericaNikDistributions({
+ version: '',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData;
+ });
+
+ // The user's java-version resolves against the embedded JDK version, not
+ // NIK's own GraalVM version.
+ it.each([
+ ['21', '21.0.11+12'],
+ ['17', '17.0.19+12'],
+ ['25', '25.0.3+12'],
+ ['11', '11.0.22+12'],
+ ['21.0.2', '21.0.2+14'],
+ ['23', '23.0.2+9'],
+ ['20.x', '20.0.2+10'],
+ ['25.0.1', '25.0.1+16']
+ ])('version is %s -> %s', async (input, expected) => {
+ const result = await distribution['findPackageForDownload'](input);
+ expect(result.version).toBe(expected);
+ });
+
+ it('should throw an error', async () => {
+ await expect(distribution['findPackageForDownload']('7')).rejects.toThrow(
+ /No matching version found for SemVer/
+ );
+ });
+});
+
+describe('getPlatformOption', () => {
+ beforeEach(() => {
+ // The linux row below is glibc, so pin the Alpine probe rather than
+ // letting it depend on the machine running the suite.
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ const distributions = new LibericaNikDistributions({
+ architecture: 'x64',
+ version: '21',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ it.each([
+ ['linux', 'linux'],
+ ['darwin', 'macos'],
+ ['win32', 'windows'],
+ ['cygwin', 'windows']
+ ])('os version %s -> %s', (input, expected) => {
+ const actual = distributions['getPlatformOption'](input as NodeJS.Platform);
+
+ expect(actual).toEqual(expected);
+ });
+
+ it.each(['sunos', 'aix', 'android', 'freebsd'])(
+ 'not support os version %s',
+ input => {
+ expect(() =>
+ distributions['getPlatformOption'](input as NodeJS.Platform)
+ ).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/);
+ }
+ );
+});
+
+describe('convertVersionToSemver', () => {
+ const distributions = new LibericaNikDistributions({
+ architecture: 'x64',
+ version: '21',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ it.each([
+ ['25.0.1+16', '25.0.1+16'],
+ ['21+37', '21.0.0+37'],
+ ['23+38', '23.0.0+38'],
+ ['11.0.15.1+2', '11.0.15+1.2'],
+ ['17.0.5', '17.0.5']
+ ])('%s -> %s', (input, expected) => {
+ const actual = distributions['convertVersionToSemver'](input);
+ expect(actual).toEqual(expected);
+ });
+});
+
+describe('Liberica NIK getPlatformOption libc selection', () => {
+ const distributions = new LibericaNikDistributions({
+ architecture: 'x64',
+ version: '21',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it('selects the musl artifacts on Alpine', () => {
+ jest.spyOn(fs, 'existsSync').mockReturnValue(true);
+
+ expect(distributions['getPlatformOption']('linux')).toBe('linux-musl');
+ });
+
+ it('selects the glibc artifacts on other Linux runners', () => {
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+
+ expect(distributions['getPlatformOption']('linux')).toBe('linux');
+ });
+
+ it('does not probe for Alpine off Linux', () => {
+ const existsSync = jest.spyOn(fs, 'existsSync');
+
+ expect(distributions['getPlatformOption']('darwin')).toBe('macos');
+ expect(existsSync).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/distributors/liberica-windows-installer.test.ts b/__tests__/distributors/liberica-windows-installer.test.ts
index 22d287410..a4fe5f591 100644
--- a/__tests__/distributors/liberica-windows-installer.test.ts
+++ b/__tests__/distributors/liberica-windows-installer.test.ts
@@ -1,15 +1,56 @@
-import {LibericaDistributions} from '../../src/distributions/liberica/installer';
import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {
ArchitectureOptions,
LibericaVersion
-} from '../../src/distributions/liberica/models';
+} from '../../src/distributions/liberica/models.js';
import {HttpClient} from '@actions/http-client';
import os from 'os';
-import manifestData from '../data/liberica-windows.json';
+import manifestData from '../data/liberica-windows.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {LibericaDistributions} =
+ await import('../../src/distributions/liberica/installer.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -18,6 +59,9 @@ describe('getAvailableVersions', () => {
headers: {},
result: manifestData as LibericaVersion[]
});
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -178,7 +222,7 @@ describe('getArchitectureOptions', () => {
});
describe('findPackageForDownload', () => {
- let distribution: LibericaDistributions;
+ let distribution: InstanceType;
beforeEach(() => {
distribution = new LibericaDistributions({
@@ -209,7 +253,7 @@ describe('findPackageForDownload', () => {
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
- /Could not find satisfied version for semver */
+ /No matching version found for SemVer/
);
});
});
diff --git a/__tests__/distributors/local-installer.test.ts b/__tests__/distributors/local-installer.test.ts
index 8e9d5d437..6d0521fc9 100644
--- a/__tests__/distributors/local-installer.test.ts
+++ b/__tests__/distributors/local-installer.test.ts
@@ -1,36 +1,114 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
import fs from 'fs';
-import * as tc from '@actions/tool-cache';
-import * as core from '@actions/core';
-
import path from 'path';
import * as semver from 'semver';
-import * as util from '../../src/util';
-
-import {LocalDistribution} from '../../src/distributions/local/installer';
+import os from 'os';
+
+const realStatSync = fs.statSync;
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ find: jest.fn(),
+ findAllVersions: jest.fn(),
+ downloadTool: jest.fn(),
+ extractZip: jest.fn(),
+ extractTar: jest.fn(),
+ extract7z: jest.fn(),
+ extractXar: jest.fn(),
+ cacheDir: jest.fn(),
+ cacheFile: jest.fn(),
+ getManifestFromRepo: jest.fn(),
+ findFromManifest: jest.fn(),
+ evaluateVersions: jest.fn()
+}));
+
+jest.unstable_mockModule('../../src/jdk-cache.js', () => ({
+ getJdkVerificationIdentity: jest.fn(() => 'disabled'),
+ registerJdk: jest.fn(),
+ restoreJdk: jest.fn()
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ extractJdkFile: jest.fn(),
+ getDownloadArchiveExtension: jest.fn(),
+ getToolcachePath: jest.fn(),
+ isJobStatusSuccess: jest.fn(),
+ renameWinArchive: jest.fn(),
+ isVersionSatisfies: real_util_module.isVersionSatisfies,
+ getTempDir: real_util_module.getTempDir
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const tc = await import('@actions/tool-cache');
+const util = await import('../../src/util.js');
+const jdkCache = await import('../../src/jdk-cache.js');
+const {LocalDistribution} =
+ await import('../../src/distributions/local/installer.js');
describe('setupJava', () => {
const actualJavaVersion = '11.1.10';
const javaPath = path.join('Java_jdkfile_jdk', actualJavaVersion, 'x86');
- let mockJavaBase: LocalDistribution;
-
- let spyGetToolcachePath: jest.SpyInstance;
- let spyTcCacheDir: jest.SpyInstance;
- let spyTcFindAllVersions: jest.SpyInstance;
- let spyCoreDebug: jest.SpyInstance;
- let spyCoreInfo: jest.SpyInstance;
- let spyCoreExportVariable: jest.SpyInstance;
- let spyCoreAddPath: jest.SpyInstance;
- let spyCoreSetOutput: jest.SpyInstance;
- let spyFsStat: jest.SpyInstance;
- let spyFsReadDir: jest.SpyInstance;
- let spyUtilsExtractJdkFile: jest.SpyInstance;
- let spyPathResolve: jest.SpyInstance;
+ let mockJavaBase: InstanceType;
+
+ let spyGetToolcachePath: any;
+ let spyTcCacheDir: any;
+ let spyTcFindAllVersions: any;
+ let spyCoreDebug: any;
+ let spyCoreInfo: any;
+ let spyCoreExportVariable: any;
+ let spyCoreAddPath: any;
+ let spyCoreSetOutput: any;
+ let spyFsStat: any;
+ let spyFsReadDir: any;
+ let spyUtilsExtractJdkFile: any;
+ let spyPathResolve: any;
+ let spyCoreError: any;
const expectedJdkFile = 'JavaLocalJdkFile';
beforeEach(() => {
- spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
+ (jdkCache.getJdkVerificationIdentity as jest.Mock).mockReturnValue(
+ 'disabled'
+ );
+ spyGetToolcachePath = util.getToolcachePath as jest.Mock;
spyGetToolcachePath.mockImplementation(
(toolname: string, javaVersion: string, architecture: string) => {
const semverVersion = new semver.Range(javaVersion);
@@ -48,7 +126,7 @@ describe('setupJava', () => {
}
);
- spyTcCacheDir = jest.spyOn(tc, 'cacheDir');
+ spyTcCacheDir = tc.cacheDir as jest.Mock;
spyTcCacheDir.mockImplementation(
(
archivePath: string,
@@ -58,23 +136,23 @@ describe('setupJava', () => {
) => path.join(toolcacheFolderName, version, architecture)
);
- spyTcFindAllVersions = jest.spyOn(tc, 'findAllVersions');
+ spyTcFindAllVersions = tc.findAllVersions as jest.Mock;
spyTcFindAllVersions.mockReturnValue([actualJavaVersion]);
// Spy on core methods
- spyCoreDebug = jest.spyOn(core, 'debug');
+ spyCoreDebug = core.debug as jest.Mock;
spyCoreDebug.mockImplementation(() => undefined);
- spyCoreInfo = jest.spyOn(core, 'info');
+ spyCoreInfo = core.info as jest.Mock;
spyCoreInfo.mockImplementation(() => undefined);
- spyCoreAddPath = jest.spyOn(core, 'addPath');
+ spyCoreAddPath = core.addPath as jest.Mock;
spyCoreAddPath.mockImplementation(() => undefined);
- spyCoreExportVariable = jest.spyOn(core, 'exportVariable');
+ spyCoreExportVariable = core.exportVariable as jest.Mock;
spyCoreExportVariable.mockImplementation(() => undefined);
- spyCoreSetOutput = jest.spyOn(core, 'setOutput');
+ spyCoreSetOutput = core.setOutput as jest.Mock;
spyCoreSetOutput.mockImplementation(() => undefined);
// Spy on fs methods
@@ -87,12 +165,16 @@ describe('setupJava', () => {
});
// Spy on util methods
- spyUtilsExtractJdkFile = jest.spyOn(util, 'extractJdkFile');
+ spyUtilsExtractJdkFile = util.extractJdkFile as jest.Mock;
spyUtilsExtractJdkFile.mockImplementation(() => 'some/random/path/');
// Spy on path methods
spyPathResolve = jest.spyOn(path, 'resolve');
spyPathResolve.mockImplementation((path: string) => path);
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -101,6 +183,20 @@ describe('setupJava', () => {
jest.restoreAllMocks();
});
+ it('throws for the latest alias since jdkfile has no version list', async () => {
+ const inputs = {
+ version: 'latest',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false
+ };
+
+ mockJavaBase = new LocalDistribution(inputs, expectedJdkFile);
+ await expect(mockJavaBase.setupJava()).rejects.toThrow(
+ "The 'latest' version alias is not supported for the 'jdkfile' distribution. Please specify a concrete version."
+ );
+ });
+
it('java is resolved from toolcache, jdkfile is untouched', async () => {
const inputs = {
version: actualJavaVersion,
@@ -125,6 +221,95 @@ describe('setupJava', () => {
);
});
+ it('java is unpacked from jdkfile when force-download is enabled', async () => {
+ const inputs = {
+ version: actualJavaVersion,
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ forceDownload: true
+ };
+
+ mockJavaBase = new LocalDistribution(inputs, expectedJdkFile);
+ await expect(mockJavaBase.setupJava()).resolves.toEqual({
+ version: actualJavaVersion,
+ path: javaPath
+ });
+
+ expect(spyGetToolcachePath).not.toHaveBeenCalled();
+ expect(spyUtilsExtractJdkFile).toHaveBeenCalledWith(expectedJdkFile);
+ expect(spyTcCacheDir).toHaveBeenCalled();
+ expect(spyCoreInfo).not.toHaveBeenCalledWith(
+ `Resolved Java ${actualJavaVersion} from tool-cache`
+ );
+ });
+
+ it.each([
+ [false, true, true],
+ [true, false, true]
+ ])(
+ 'handles jdkfile caching with force-download=%s',
+ async (forceDownload, restores, registers) => {
+ const temporaryDirectory = fs.mkdtempSync(
+ path.join(os.tmpdir(), 'setup-java-local-cache-')
+ );
+ const jdkFile = path.join(temporaryDirectory, 'java.tar.gz');
+ fs.writeFileSync(jdkFile, 'jdk archive');
+ spyGetToolcachePath.mockReturnValue('');
+ spyFsStat.mockImplementation((file: string) => realStatSync(file));
+ (jdkCache.restoreJdk as jest.Mock).mockResolvedValue(false);
+
+ try {
+ mockJavaBase = new LocalDistribution(
+ {
+ version: actualJavaVersion,
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ forceDownload,
+ cacheJdk: true
+ },
+ jdkFile
+ );
+
+ await mockJavaBase.setupJava();
+
+ expect(jdkCache.restoreJdk).toHaveBeenCalledTimes(restores ? 1 : 0);
+ expect(jdkCache.registerJdk).toHaveBeenCalledTimes(registers ? 1 : 0);
+ expect(
+ (jdkCache.restoreJdk as jest.Mock).mock.calls[0]?.[0] ??
+ (jdkCache.registerJdk as jest.Mock).mock.calls[0]?.[0]
+ ).toEqual(
+ expect.objectContaining({
+ distribution: 'jdkfile',
+ version: actualJavaVersion,
+ verification: 'disabled'
+ })
+ );
+ } finally {
+ fs.rmSync(temporaryDirectory, {recursive: true});
+ }
+ }
+ );
+
+ it('rejects signature verification for jdkfile archives', async () => {
+ mockJavaBase = new LocalDistribution(
+ {
+ version: actualJavaVersion,
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ },
+ expectedJdkFile
+ );
+
+ await expect(mockJavaBase.setupJava()).rejects.toThrow(
+ "Input 'verify-signature' is not supported for distribution 'jdkfile'."
+ );
+ expect(spyGetToolcachePath).not.toHaveBeenCalled();
+ });
+
it("java is resolved from toolcache, jdkfile doesn't exist", async () => {
const inputs = {
version: actualJavaVersion,
@@ -214,7 +399,7 @@ describe('setupJava', () => {
);
});
- it('java is resolved from toolcache including Contents/Home on MacOS', async () => {
+ it('java is resolved from toolcache including Contents/Home on macOS', async () => {
const inputs = {
version: actualJavaVersion,
architecture: 'x86',
@@ -257,7 +442,7 @@ describe('setupJava', () => {
});
});
- it('java is unpacked from jdkfile including Contents/Home on MacOS', async () => {
+ it('java is unpacked from jdkfile including Contents/Home on macOS', async () => {
const inputs = {
version: '11.0.289',
architecture: 'x86',
diff --git a/__tests__/distributors/microsoft-installer.test.ts b/__tests__/distributors/microsoft-installer.test.ts
index 16c436370..d0520577f 100644
--- a/__tests__/distributors/microsoft-installer.test.ts
+++ b/__tests__/distributors/microsoft-installer.test.ts
@@ -1,15 +1,118 @@
-import {MicrosoftDistributions} from '../../src/distributions/microsoft/installer';
-import os from 'os';
-import data from '../data/microsoft.json';
-import * as httpm from '@actions/http-client';
-import * as core from '@actions/core';
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import {HttpClient} from '@actions/http-client';
+import data from '../data/microsoft.json' with {type: 'json'};
+
+const mockOsArch = jest.fn(() => 'x64');
+const mockOsPlatform = jest.fn(() => 'linux');
+
+const real_os_module = await import('os');
+jest.unstable_mockModule('os', () => ({
+ ...real_os_module,
+ default: {
+ ...real_os_module.default,
+ arch: mockOsArch,
+ platform: mockOsPlatform,
+ homedir: real_os_module.default.homedir
+ },
+ arch: mockOsArch,
+ platform: mockOsPlatform
+}));
+
+const real_fs_module = await import('fs');
+const mockReaddirSync = jest.fn();
+jest.unstable_mockModule('fs', () => ({
+ ...real_fs_module,
+ default: {
+ ...real_fs_module.default,
+ readdirSync: mockReaddirSync
+ },
+ readdirSync: mockReaddirSync
+}));
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_tc_module = await import('@actions/tool-cache');
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ ...real_tc_module,
+ downloadTool: jest.fn(),
+ cacheDir: jest.fn(),
+ cacheFile: jest.fn()
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ extractJdkFile: jest.fn(),
+ getDownloadArchiveExtension: jest.fn(),
+ getToolcachePath: jest.fn(),
+ isJobStatusSuccess: jest.fn(),
+ renameWinArchive: jest.fn(),
+ isVersionSatisfies: real_util_module.isVersionSatisfies,
+ getTempDir: real_util_module.getTempDir
+}));
+
+jest.unstable_mockModule('../../src/gpg.js', () => ({
+ importKey: jest.fn(),
+ removeGpgHome: jest.fn(),
+ verifyPackageSignature: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const gpg = await import('../../src/gpg.js');
+const tc = await import('@actions/tool-cache');
+const os = (await import('os')).default;
+const fs = (await import('fs')).default;
+const {MicrosoftDistributions, MICROSOFT_PUBLIC_KEY} =
+ await import('../../src/distributions/microsoft/installer.js');
+const util = await import('../../src/util.js');
describe('findPackageForDownload', () => {
- let distribution: MicrosoftDistributions;
- let spyGetManifestFromRepo: jest.SpyInstance;
- let spyDebug: jest.SpyInstance;
+ let distribution: InstanceType;
+ let spyGetManifestFromRepo: any;
+ let spyHttpClientGet: any;
+ let spyDebug: any;
+ let spyCoreError: any;
+
+ const MICROSOFT_CHECKSUM = 'b'.repeat(64);
beforeEach(() => {
+ mockOsArch.mockReturnValue('x64');
+ mockOsPlatform.mockReturnValue(process.platform);
+
distribution = new MicrosoftDistributions({
version: '',
architecture: 'x64',
@@ -17,15 +120,28 @@ describe('findPackageForDownload', () => {
checkLatest: false
});
- spyGetManifestFromRepo = jest.spyOn(httpm.HttpClient.prototype, 'getJson');
+ spyGetManifestFromRepo = jest.spyOn(HttpClient.prototype, 'getJson');
spyGetManifestFromRepo.mockReturnValue({
result: data,
statusCode: 200,
headers: {}
});
- spyDebug = jest.spyOn(core, 'debug');
+ // Every resolved release fetches `${download_url}.sha256sum.txt`; stub
+ // it with a GNU-style ` ` payload so tests never reach
+ // the real network.
+ spyHttpClientGet = jest.spyOn(HttpClient.prototype, 'get');
+ spyHttpClientGet.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () => `${MICROSOFT_CHECKSUM} microsoft-jdk.tar.gz\n`
+ });
+
+ spyDebug = core.debug as jest.Mock;
spyDebug.mockImplementation(() => {});
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
it.each([
@@ -40,15 +156,20 @@ describe('findPackageForDownload', () => {
'https://aka.ms/download-jdk/microsoft-jdk-21.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[
- '17.0.1',
- '17.0.1+12.1',
- 'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
+ '17.x',
+ '17.0.18',
+ 'https://aka.ms/download-jdk/microsoft-jdk-17.0.18-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[
- '17.x',
+ '17.0.7',
'17.0.7',
'https://aka.ms/download-jdk/microsoft-jdk-17.0.7-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
+ [
+ '17.0.1',
+ '17.0.1+12.1',
+ 'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
+ ],
[
'16.0.x',
'16.0.2+7.1',
@@ -92,6 +213,173 @@ describe('findPackageForDownload', () => {
.replace('{{OS_TYPE}}', os)
.replace('{{ARCHIVE_TYPE}}', archive);
expect(result.url).toBe(url);
+ expect(result.signatureUrl).toBe(`${url}.sig`);
+ });
+
+ describe.each(['25.0.5.0.2', '25.0.5+0.2', '25.0.5'])(
+ 'version %s missing from the live manifest',
+ version => {
+ it.each([
+ ['darwin', 'x64', 'macos', 'tar.gz'],
+ ['linux', 'x64', 'linux', 'tar.gz'],
+ ['win32', 'x64', 'windows', 'zip'],
+ ['darwin', 'aarch64', 'macos', 'tar.gz'],
+ ['linux', 'aarch64', 'linux', 'tar.gz'],
+ ['win32', 'aarch64', 'windows', 'zip']
+ ])(
+ 'resolves the bundled release for %s/%s',
+ async (platform, architecture, osType, extension) => {
+ mockOsPlatform.mockReturnValue(platform);
+ const distro = new MicrosoftDistributions({
+ version,
+ architecture,
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const result = await distro['findPackageForDownload'](
+ distro['version']
+ );
+ const url = `https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-${osType}-${architecture}.${extension}`;
+
+ expect(result).toEqual({
+ version: '25.0.5+0.2',
+ url,
+ signatureUrl: `${url}.sig`,
+ checksum: {
+ algorithm: 'sha256',
+ value: MICROSOFT_CHECKSUM,
+ source: `${url}.sha256sum.txt`
+ }
+ });
+ expect(spyHttpClientGet).toHaveBeenCalledWith(`${url}.sha256sum.txt`);
+ }
+ );
+ }
+ );
+
+ it('prefers the live manifest when it contains the requested release', async () => {
+ mockOsPlatform.mockReturnValue('linux');
+ const url =
+ 'https://example.test/microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz';
+ spyGetManifestFromRepo.mockResolvedValue({
+ result: [
+ {
+ version: '25.0.5+0.2',
+ stable: true,
+ release_url: 'https://aka.ms/download-jdk',
+ files: [
+ {
+ filename: 'microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz',
+ arch: 'x64',
+ platform: 'linux',
+ download_url: url
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await distribution['findPackageForDownload']('25.0.5+0.2');
+
+ expect(result.version).toBe('25.0.5+0.2');
+ expect(result.url).toBe(url);
+ expect(spyGetManifestFromRepo).toHaveBeenCalledWith(
+ 'https://aka.ms/download-jdk/microsoft-openjdk-versions.json',
+ {accept: 'application/json'}
+ );
+ });
+
+ it('falls back to the bundled build when the live manifest has another build', async () => {
+ mockOsPlatform.mockReturnValue('linux');
+ spyGetManifestFromRepo.mockResolvedValue({
+ result: [
+ {
+ version: '25.0.5+0.3',
+ stable: true,
+ release_url: 'https://aka.ms/download-jdk',
+ files: [
+ {
+ filename: 'microsoft-jdk-25.0.5.0.3-linux-x64.tar.gz',
+ arch: 'x64',
+ platform: 'linux',
+ download_url:
+ 'https://example.test/microsoft-jdk-25.0.5.0.3-linux-x64.tar.gz'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+
+ const result = await distribution['findPackageForDownload']('25.0.5+0.2');
+
+ expect(result.version).toBe('25.0.5+0.2');
+ expect(result.url).toBe(
+ 'https://aka.ms/download-jdk/microsoft-jdk-25.0.5.0.2-linux-x64.tar.gz'
+ );
+ });
+
+ it('matches dotted Java versions without falling back to the base release', async () => {
+ mockOsPlatform.mockReturnValue('linux');
+ spyGetManifestFromRepo.mockResolvedValue({
+ result: [
+ {
+ version: '17.0.8',
+ stable: true,
+ release_url: 'https://aka.ms/download-jdk',
+ files: [
+ {
+ filename: 'microsoft-jdk-17.0.8-linux-x64.tar.gz',
+ arch: 'x64',
+ platform: 'linux',
+ download_url: 'https://example.test/microsoft-jdk-17.0.8.tar.gz'
+ }
+ ]
+ },
+ {
+ version: '17.0.8.1',
+ stable: true,
+ release_url: 'https://aka.ms/download-jdk',
+ files: [
+ {
+ filename: 'microsoft-jdk-17.0.8.1-linux-x64.tar.gz',
+ arch: 'x64',
+ platform: 'linux',
+ download_url: 'https://example.test/microsoft-jdk-17.0.8.1.tar.gz'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+ distribution = new MicrosoftDistributions({
+ version: '17.0.8.1',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const result = await distribution['findPackageForDownload'](
+ distribution['version']
+ );
+
+ expect(result.version).toBe('17.0.8+1');
+ expect(result.url).toBe(
+ 'https://example.test/microsoft-jdk-17.0.8.1.tar.gz'
+ );
+ });
+
+ it('preserves the error when the live manifest cannot be loaded', async () => {
+ spyGetManifestFromRepo.mockRejectedValue(new Error('Network error'));
+
+ await expect(
+ distribution['findPackageForDownload']('25.0.5+0.2')
+ ).rejects.toThrow('Could not load manifest for Microsoft Build of OpenJDK');
});
it.each([
@@ -100,10 +388,8 @@ describe('findPackageForDownload', () => {
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
- jest
- .spyOn(os, 'arch')
- .mockReturnValue(osArch as ReturnType);
- jest.spyOn(os, 'platform').mockReturnValue('darwin');
+ mockOsArch.mockReturnValue(osArch);
+ mockOsPlatform.mockReturnValue('darwin');
const version = '17';
const distro = new MicrosoftDistributions({
@@ -114,7 +400,7 @@ describe('findPackageForDownload', () => {
});
const result = await distro['findPackageForDownload'](version);
- const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-${distroArch}.tar.gz`;
+ const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-${distroArch}.tar.gz`;
expect(result.url).toBe(expectedUrl);
}
@@ -126,10 +412,8 @@ describe('findPackageForDownload', () => {
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
- jest
- .spyOn(os, 'arch')
- .mockReturnValue(osArch as ReturnType);
- jest.spyOn(os, 'platform').mockReturnValue('linux');
+ mockOsArch.mockReturnValue(osArch);
+ mockOsPlatform.mockReturnValue('linux');
const version = '17';
const distro = new MicrosoftDistributions({
@@ -140,7 +424,7 @@ describe('findPackageForDownload', () => {
});
const result = await distro['findPackageForDownload'](version);
- const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-${distroArch}.tar.gz`;
+ const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-${distroArch}.tar.gz`;
expect(result.url).toBe(expectedUrl);
}
@@ -152,10 +436,8 @@ describe('findPackageForDownload', () => {
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
- jest
- .spyOn(os, 'arch')
- .mockReturnValue(osArch as ReturnType);
- jest.spyOn(os, 'platform').mockReturnValue('win32');
+ mockOsArch.mockReturnValue(osArch);
+ mockOsPlatform.mockReturnValue('win32');
const version = '17';
const distro = new MicrosoftDistributions({
@@ -166,7 +448,7 @@ describe('findPackageForDownload', () => {
});
const result = await distro['findPackageForDownload'](version);
- const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-${distroArch}.zip`;
+ const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-${distroArch}.zip`;
expect(result.url).toBe(expectedUrl);
}
@@ -174,7 +456,239 @@ describe('findPackageForDownload', () => {
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
+ );
+ });
+
+ it('uses manifest-provided signature URL when available', async () => {
+ spyGetManifestFromRepo.mockReturnValue({
+ result: [
+ {
+ version: '17.0.10',
+ stable: true,
+ release_url: 'https://example.test',
+ files: [
+ {
+ filename: 'microsoft-jdk-17.0.10-linux-x64.tar.gz',
+ arch: 'x64',
+ platform: 'linux',
+ download_url: 'https://example.test/jdk.tar.gz',
+ signature_url: 'https://example.test/jdk.tar.gz.custom.sig'
+ }
+ ]
+ }
+ ],
+ statusCode: 200,
+ headers: {}
+ });
+ mockOsPlatform.mockReturnValue('linux');
+
+ const result = await distribution['findPackageForDownload']('17.0.10');
+
+ expect(result.signatureUrl).toBe(
+ 'https://example.test/jdk.tar.gz.custom.sig'
+ );
+ });
+
+ it('fetches the authoritative sha256 checksum from the GNU-style sibling file', async () => {
+ mockOsPlatform.mockReturnValue(process.platform);
+
+ const result = await distribution['findPackageForDownload']('17.0.7');
+
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: MICROSOFT_CHECKSUM,
+ source: `${result.url}.sha256sum.txt`
+ });
+ expect(spyHttpClientGet).toHaveBeenCalledWith(
+ `${result.url}.sha256sum.txt`
);
+ expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
+ });
+
+ it('parses only the first whitespace-delimited token from the GNU checksum payload', async () => {
+ spyHttpClientGet.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () =>
+ `${MICROSOFT_CHECKSUM} microsoft-jdk-17.0.7-linux-x64.tar.gz\n`
+ });
+
+ const result = await distribution['findPackageForDownload']('17.0.7');
+
+ expect(result.checksum?.value).toBe(MICROSOFT_CHECKSUM);
+ });
+});
+
+describe('downloadTool', () => {
+ let spyDownloadTool: any;
+ let spyExtractJdkFile: any;
+ let spyCacheDir: any;
+ let spyVerifySignature: any;
+ let distribution: InstanceType;
+
+ beforeEach(() => {
+ mockOsPlatform.mockReturnValue(process.platform);
+
+ distribution = new MicrosoftDistributions({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ spyDownloadTool = tc.downloadTool as jest.Mock;
+ spyDownloadTool.mockImplementation(async () => {
+ return '/tmp/jdk.tar.gz';
+ });
+
+ spyExtractJdkFile = util.extractJdkFile as jest.Mock;
+ spyExtractJdkFile.mockImplementation(async () => {
+ return '/tmp/unpacked';
+ });
+
+ mockReaddirSync.mockReturnValue(['jdk'] as any);
+ spyCacheDir = tc.cacheDir as jest.Mock;
+ spyCacheDir.mockImplementation(async () => {
+ return '/tmp/cached';
+ });
+
+ (util.renameWinArchive as jest.Mock).mockImplementation(
+ (archivePath: string) => `${archivePath}.zip`
+ );
+
+ spyVerifySignature = gpg.verifyPackageSignature as jest.Mock;
+ spyVerifySignature.mockImplementation(async () => {});
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it('verifies signatures by default', async () => {
+ const signedDistribution = new MicrosoftDistributions({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await signedDistribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ });
+
+ expect(spyVerifySignature).toHaveBeenCalledWith(
+ '/tmp/jdk.tar.gz',
+ 'https://example.com/jdk.tar.gz.sig',
+ MICROSOFT_PUBLIC_KEY
+ );
+ });
+
+ it('uses custom public key when verifySignaturePublicKey is provided', async () => {
+ const customKey =
+ '-----BEGIN PGP PUBLIC KEY BLOCK-----\ncustom\n-----END PGP PUBLIC KEY BLOCK-----';
+ const signedDistribution = new MicrosoftDistributions({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true,
+ verifySignaturePublicKey: customKey
+ });
+
+ await signedDistribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ });
+
+ expect(spyVerifySignature).toHaveBeenCalledWith(
+ '/tmp/jdk.tar.gz',
+ 'https://example.com/jdk.tar.gz.sig',
+ customKey
+ );
+ });
+
+ it('warns with key rotation recovery guidance when default verification fails', async () => {
+ spyVerifySignature.mockRejectedValue(new Error('bad signature'));
+ const signedDistribution = new MicrosoftDistributions({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await signedDistribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ });
+
+ expect(core.warning).toHaveBeenCalledWith(
+ expect.stringMatching(
+ /bad signature.*https:\/\/github\.com\/actions\/setup-java#download-integrity-and-signatures/
+ )
+ );
+ expect(spyExtractJdkFile).toHaveBeenCalled();
+ });
+
+ it('fails with recovery guidance when verification is explicitly enabled', async () => {
+ spyVerifySignature.mockRejectedValue(new Error('bad signature'));
+ const signedDistribution = new MicrosoftDistributions({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ });
+
+ await expect(
+ signedDistribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ })
+ ).rejects.toThrow(
+ /bad signature.*https:\/\/github\.com\/actions\/setup-java#download-integrity-and-signatures/
+ );
+ expect(spyExtractJdkFile).not.toHaveBeenCalled();
+ });
+
+ it('warns when the signature is missing during default verification', async () => {
+ await distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz'
+ });
+
+ expect(core.warning).toHaveBeenCalledWith(
+ "Input 'verify-signature' is enabled, but no signature URL was found for Microsoft Build of OpenJDK version 17.0.14+7."
+ );
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ expect(spyExtractJdkFile).toHaveBeenCalled();
+ });
+
+ it('fails when signature is missing and verification is enabled', async () => {
+ const signedDistribution = new MicrosoftDistributions({
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ });
+
+ await expect(
+ signedDistribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz'
+ })
+ ).rejects.toThrow(
+ "Input 'verify-signature' is enabled, but no signature URL was found for Microsoft Build of OpenJDK version 17.0.14+7."
+ );
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ });
+
+ it('supports signature verification', () => {
+ expect(distribution['supportsSignatureVerification']()).toBe(true);
});
});
diff --git a/__tests__/distributors/openjdk-installer.test.ts b/__tests__/distributors/openjdk-installer.test.ts
new file mode 100644
index 000000000..c1cf0faa1
--- /dev/null
+++ b/__tests__/distributors/openjdk-installer.test.ts
@@ -0,0 +1,246 @@
+import {afterEach, beforeEach, describe, expect, it, jest} from '@jest/globals';
+import {HttpClient} from '@actions/http-client';
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((value: string) => value),
+ toWin32Path: jest.fn((value: string) => value),
+ toPosixPath: jest.fn((value: string) => value)
+}));
+
+const {OpenJdkDistribution} =
+ await import('../../src/distributions/openjdk/installer.js');
+const {getJavaDistribution} =
+ await import('../../src/distributions/distribution-factory.js');
+
+const homePage = `
+ JDK 26
+ JDK
+ 27
+`;
+const currentPage = `
+ tar.gz
+ tar.gz
+`;
+const earlyAccessPage = `
+ tar.gz
+`;
+const archivePage = `
+ tar.gz
+ tar.gz
+ tar.gz
+ 9.0.4 (build 9.0.4+11) |
+ tar.gz
+`;
+const GA_CHECKSUM = 'c'.repeat(64);
+const EA_CHECKSUM = 'd'.repeat(64);
+const checksumPages: Record = {
+ 'https://download.java.net/java/GA/jdk26.0.2/hash/10/GPL/openjdk-26.0.2_linux-x64_bin.tar.gz.sha256':
+ GA_CHECKSUM,
+ 'https://download.java.net/java/early_access/jdk27/32/GPL/openjdk-27-ea+32_linux-x64_bin.tar.gz.sha256':
+ EA_CHECKSUM
+};
+
+function createDistribution(
+ version = '26',
+ architecture = 'x64',
+ packageType = 'jdk',
+ useFixturePlatform = true
+) {
+ const distribution = new OpenJdkDistribution({
+ version,
+ architecture,
+ packageType,
+ checkLatest: false
+ });
+ if (useFixturePlatform) {
+ distribution['getPlatform'] = jest.fn(() => 'linux');
+ }
+ return distribution;
+}
+
+describe('OpenJdkDistribution', () => {
+ let getSpy: jest.SpiedFunction;
+
+ beforeEach(() => {
+ getSpy = jest
+ .spyOn(HttpClient.prototype, 'get')
+ .mockImplementation(async url => {
+ const pages: Record = {
+ 'https://jdk.java.net/': homePage,
+ 'https://jdk.java.net/26/': currentPage,
+ 'https://jdk.java.net/27/': earlyAccessPage,
+ 'https://jdk.java.net/archive/': archivePage
+ };
+ if (url in pages) {
+ return {
+ message: {statusCode: 200},
+ readBody: async () => pages[url]
+ } as Awaited>;
+ }
+ // Any other GET is a `${archiveUrl}.sha256` checksum sibling request.
+ return {
+ message: {statusCode: 200},
+ readBody: async () => checksumPages[url] ?? 'e'.repeat(64)
+ } as Awaited>;
+ });
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it('resolves the newest matching GA release', async () => {
+ const result = await createDistribution()['findPackageForDownload']('26');
+
+ expect(result).toEqual({
+ version: '26.0.2+10',
+ url: 'https://download.java.net/java/GA/jdk26.0.2/hash/10/GPL/openjdk-26.0.2_linux-x64_bin.tar.gz',
+ checksum: {
+ algorithm: 'sha256',
+ value: GA_CHECKSUM,
+ source:
+ 'https://download.java.net/java/GA/jdk26.0.2/hash/10/GPL/openjdk-26.0.2_linux-x64_bin.tar.gz.sha256'
+ }
+ });
+ expect(getSpy).toHaveBeenCalledWith(`${result.url}.sha256`);
+ });
+
+ it('resolves an archived GA release', async () => {
+ const result =
+ await createDistribution('26.0.1')['findPackageForDownload']('26.0.1');
+
+ expect(result.version).toBe('26.0.1+8');
+ expect(result.url).toContain('/openjdk-26.0.1_linux-x64_bin.tar.gz');
+ });
+
+ it('resolves an exact GA build', async () => {
+ const result =
+ await createDistribution('26.0.2+10')['findPackageForDownload'](
+ '26.0.2+10'
+ );
+
+ expect(result.version).toBe('26.0.2+10');
+ });
+
+ it('resolves an exact build from a legacy archive heading', async () => {
+ const result =
+ await createDistribution('9.0.4+11')['findPackageForDownload'](
+ '9.0.4+11'
+ );
+
+ expect(result.version).toBe('9.0.4+11');
+ expect(result.url).toContain('/binaries/openjdk-9.0.4_linux-x64_bin');
+ });
+
+ it('resolves a four-field Java version', async () => {
+ const result =
+ await createDistribution('18.0.1.1')['findPackageForDownload'](
+ '18.0.1+1'
+ );
+
+ expect(result.version).toBe('18.0.1+1');
+ expect(result.url).toContain('/openjdk-18.0.1.1_linux-x64_bin.tar.gz');
+ });
+
+ it('resolves an early-access release without requesting the archive', async () => {
+ const result =
+ await createDistribution('27-ea')['findPackageForDownload']('27');
+
+ expect(result).toEqual({
+ version: '27.0.0+32',
+ url: 'https://download.java.net/java/early_access/jdk27/32/GPL/openjdk-27-ea+32_linux-x64_bin.tar.gz',
+ checksum: {
+ algorithm: 'sha256',
+ value: EA_CHECKSUM,
+ source:
+ 'https://download.java.net/java/early_access/jdk27/32/GPL/openjdk-27-ea+32_linux-x64_bin.tar.gz.sha256'
+ }
+ });
+ expect(getSpy).not.toHaveBeenCalledWith('https://jdk.java.net/archive/');
+ expect(getSpy).toHaveBeenCalledWith(`${result.url}.sha256`);
+ });
+
+ it('reports available versions when no release matches', async () => {
+ await expect(
+ createDistribution()['findPackageForDownload']('24')
+ ).rejects.toThrow(
+ "No matching version found for SemVer '24'.\nDistribution: Oracle OpenJDK"
+ );
+ });
+
+ it.each([
+ ['jre', 'Oracle OpenJDK provides only the `jdk` package type'],
+ ['jdk+fx', 'Oracle OpenJDK provides only the `jdk` package type']
+ ])('rejects the %s package type', async (packageType, message) => {
+ await expect(
+ createDistribution('26', 'x64', packageType)['findPackageForDownload'](
+ '26'
+ )
+ ).rejects.toThrow(message);
+ });
+
+ it('rejects unsupported architectures', async () => {
+ await expect(
+ createDistribution('26', 'x86')['findPackageForDownload']('26')
+ ).rejects.toThrow('Unsupported architecture: x86');
+ });
+
+ it('maps supported platforms', () => {
+ const distribution = createDistribution('26', 'x64', 'jdk', false);
+
+ expect(distribution['getPlatform']('linux')).toBe('linux');
+ expect(distribution['getPlatform']('darwin')).toBe('macos');
+ expect(distribution['getPlatform']('win32')).toBe('windows');
+ expect(() => distribution['getPlatform']('freebsd')).toThrow(
+ "Platform 'freebsd' is not supported"
+ );
+ });
+
+ it('parses legacy platform names and archive formats', () => {
+ const distribution = createDistribution();
+ const macRelease = distribution['parseReleases'](
+ 'tar.gz',
+ 'macos',
+ 'x64'
+ );
+ const windowsRelease = distribution['parseReleases'](
+ 'tar.gz',
+ 'windows',
+ 'x64'
+ );
+
+ expect(macRelease[0].version).toBe('16.0.0+7');
+ expect(windowsRelease[0].version).toBe('10.0.2+13');
+ expect(windowsRelease[0].url.endsWith('.tar.gz')).toBe(true);
+ });
+
+ it('is registered in the distribution factory', async () => {
+ const distribution = await getJavaDistribution('oracle-openjdk', {
+ version: '26',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(distribution).toBeInstanceOf(OpenJdkDistribution);
+ });
+});
diff --git a/__tests__/distributors/oracle-installer.test.ts b/__tests__/distributors/oracle-installer.test.ts
index 226eca905..36d4e9793 100644
--- a/__tests__/distributors/oracle-installer.test.ts
+++ b/__tests__/distributors/oracle-installer.test.ts
@@ -1,13 +1,56 @@
-import {OracleDistribution} from '../../src/distributions/oracle/installer';
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
import os from 'os';
-import * as core from '@actions/core';
-import {getDownloadArchiveExtension} from '../../src/util';
import {HttpClient} from '@actions/http-client';
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {OracleDistribution} =
+ await import('../../src/distributions/oracle/installer.js');
+const {getDownloadArchiveExtension} = await import('../../src/util.js');
+
describe('findPackageForDownload', () => {
- let distribution: OracleDistribution;
- let spyDebug: jest.SpyInstance;
- let spyHttpClient: jest.SpyInstance;
+ let distribution: InstanceType;
+ let spyDebug: any;
+ let spyHttpClient: any;
+ let spyHttpClientGet: any;
+ let spyCoreError: any;
+
+ const ORACLE_CHECKSUM = 'f'.repeat(64);
beforeEach(() => {
distribution = new OracleDistribution({
@@ -17,8 +60,20 @@ describe('findPackageForDownload', () => {
checkLatest: false
});
- spyDebug = jest.spyOn(core, 'debug');
+ spyDebug = core.debug as jest.Mock;
spyDebug.mockImplementation(() => {});
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
+
+ // Every resolved release fetches its `${url}.sha256` sibling checksum;
+ // stub it so tests never reach the real network.
+ spyHttpClientGet = jest.spyOn(HttpClient.prototype, 'get');
+ spyHttpClientGet.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () => ORACLE_CHECKSUM
+ });
});
it.each([
@@ -87,6 +142,71 @@ describe('findPackageForDownload', () => {
.replace('{{OS_TYPE}}', osType)
.replace('{{ARCHIVE_TYPE}}', archiveType);
expect(result.url).toBe(url);
+ // Only the `/latest/` path serves changing contents, so only it must be
+ // excluded from the resolution cache.
+ expect(result.floating).toBe(url.includes('/latest/'));
+ });
+
+ it.each([
+ ['21', 'etag:"oracle-latest"'],
+ ['21.0.1', undefined]
+ ])(
+ 'fingerprints only the floating artifact for version %s',
+ async (input, expected) => {
+ spyHttpClient = jest.spyOn(HttpClient.prototype, 'head');
+ spyHttpClient.mockResolvedValue({
+ message: {statusCode: 200, headers: {etag: '"oracle-latest"'}}
+ });
+
+ const result = await distribution['findPackageForDownload'](input);
+
+ jest.restoreAllMocks();
+
+ // Without a fingerprint the constant `/latest/` URL would key a cache
+ // entry that never invalidates when Oracle republishes the artifact.
+ expect(result.fingerprint).toBe(expected);
+ }
+ );
+
+ it('fetches the authoritative sha256 checksum for the resolved archive', async () => {
+ spyHttpClient = jest.spyOn(HttpClient.prototype, 'head');
+ spyHttpClient.mockResolvedValue({message: {statusCode: 200}});
+
+ const result = await distribution['findPackageForDownload']('21');
+
+ jest.restoreAllMocks();
+
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: ORACLE_CHECKSUM,
+ source: `${result.url}.sha256`
+ });
+ expect(spyHttpClientGet).toHaveBeenCalledWith(`${result.url}.sha256`);
+ expect(spyHttpClientGet).toHaveBeenCalledTimes(1);
+ });
+
+ it('warns when a major-only request falls back to the archived GA release', async () => {
+ spyHttpClient = jest.spyOn(HttpClient.prototype, 'head');
+ spyHttpClient
+ .mockResolvedValueOnce({message: {statusCode: 404}})
+ .mockResolvedValueOnce({message: {statusCode: 200}});
+
+ await distribution['findPackageForDownload']('21');
+
+ expect(core.warning).toHaveBeenCalledWith(
+ 'Oracle JDK 21 is no longer available from the latest endpoint. Falling back to its archived GA release, which may not include security updates.'
+ );
+ });
+
+ it('always resolves major-only requests remotely', () => {
+ expect(distribution['requiresRemoteResolution']()).toBe(true);
+ const exactDistribution = new OracleDistribution({
+ version: '21.0.8',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ expect(exactDistribution['requiresRemoteResolution']()).toBe(false);
});
it.each([
@@ -130,3 +250,63 @@ describe('findPackageForDownload', () => {
);
});
});
+describe('findPackageForDownload with latest', () => {
+ let spyHttpClientHead: any;
+ let spyHttpClientGetJson: any;
+
+ beforeEach(() => {
+ (core.debug as jest.Mock).mockImplementation(() => {});
+ (core.error as jest.Mock).mockImplementation(() => {});
+ spyHttpClientGetJson = jest.spyOn(HttpClient.prototype, 'getJson');
+ spyHttpClientGetJson.mockResolvedValue({
+ statusCode: 200,
+ result: {most_recent_feature_release: 25},
+ headers: {}
+ });
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it('resolves the newest major version from the Adoptium API', async () => {
+ spyHttpClientHead = jest.spyOn(HttpClient.prototype, 'head');
+ spyHttpClientHead.mockResolvedValue({message: {statusCode: 200}});
+ jest.spyOn(HttpClient.prototype, 'get').mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () => 'f'.repeat(64)
+ } as any);
+
+ const distribution = new OracleDistribution({
+ version: 'latest',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ const result = await distribution['findPackageForDownload']('x');
+ const osType = distribution.getPlatform();
+ const archiveType = getDownloadArchiveExtension();
+
+ expect(result.version).toBe('25');
+ expect(result.url).toBe(
+ `https://download.oracle.com/java/25/latest/jdk-25_${osType}-x64_bin.${archiveType}`
+ );
+ });
+
+ it('throws an actionable error when the latest major is not yet available', async () => {
+ spyHttpClientHead = jest.spyOn(HttpClient.prototype, 'head');
+ spyHttpClientHead.mockResolvedValue({message: {statusCode: 404}});
+
+ const distribution = new OracleDistribution({
+ version: 'latest',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await expect(distribution['findPackageForDownload']('x')).rejects.toThrow(
+ /is not yet available for the Oracle JDK distribution/
+ );
+ });
+});
diff --git a/__tests__/distributors/redhat-installer-download.test.ts b/__tests__/distributors/redhat-installer-download.test.ts
new file mode 100644
index 000000000..53dc202a1
--- /dev/null
+++ b/__tests__/distributors/redhat-installer-download.test.ts
@@ -0,0 +1,109 @@
+import {beforeEach, describe, expect, it, jest} from '@jest/globals';
+import path from 'path';
+
+const mockReaddirSync = jest.fn();
+const realFs = await import('fs');
+jest.unstable_mockModule('fs', () => ({
+ ...realFs,
+ default: {...realFs.default, readdirSync: mockReaddirSync},
+ readdirSync: mockReaddirSync
+}));
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ debug: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn()
+}));
+
+const realUtil = await import('../../src/util.js');
+const mockCacheJdkDir = jest.fn();
+const mockExtractJdkFile = jest.fn();
+const mockRenameWinArchive = jest.fn();
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...realUtil,
+ cacheJdkDir: mockCacheJdkDir,
+ extractJdkFile: mockExtractJdkFile,
+ renameWinArchive: mockRenameWinArchive
+}));
+
+const {RedHatDistribution} =
+ await import('../../src/distributions/redhat/installer.js');
+
+const release = {
+ version: '21.0.8+9',
+ url: 'https://developers.redhat.com/openjdk-21.tar.xz',
+ checksum: {
+ algorithm: 'sha256' as const,
+ value: 'a'.repeat(64)
+ }
+};
+
+const createDistribution = () =>
+ new RedHatDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+beforeEach(() => {
+ jest.clearAllMocks();
+ mockReaddirSync.mockReturnValue(['jdk-21']);
+ mockExtractJdkFile.mockResolvedValue('/tmp/extracted');
+ mockCacheJdkDir.mockResolvedValue('/toolcache/Java_RedHat_jdk/21.0.8-9/x64');
+ mockRenameWinArchive.mockReturnValue('/tmp/download.zip');
+});
+
+describe('Red Hat package installation', () => {
+ it('extracts and caches Linux tar.xz archives', async () => {
+ const distribution = createDistribution();
+ distribution['downloadAndVerify'] = jest
+ .fn()
+ .mockResolvedValue('/tmp/download');
+ distribution['getArchiveType'] = () => 'tar.xz';
+
+ const result = await distribution['downloadTool'](release);
+
+ expect(mockExtractJdkFile).toHaveBeenCalledWith('/tmp/download', 'tar.xz');
+ expect(mockRenameWinArchive).not.toHaveBeenCalled();
+ expect(mockCacheJdkDir).toHaveBeenCalledWith(
+ path.join('/tmp/extracted', 'jdk-21'),
+ 'Java_RedHat_jdk',
+ '21.0.8-9',
+ 'x64'
+ );
+ expect(result).toEqual({
+ version: '21.0.8+9',
+ path: '/toolcache/Java_RedHat_jdk/21.0.8-9/x64'
+ });
+ });
+
+ it('renames downloaded Windows ZIP archives before extraction', async () => {
+ const distribution = createDistribution();
+ distribution['downloadAndVerify'] = jest
+ .fn()
+ .mockResolvedValue('/tmp/download');
+ distribution['getArchiveType'] = () => 'zip';
+
+ await distribution['downloadTool'](release);
+
+ expect(mockRenameWinArchive).toHaveBeenCalledWith('/tmp/download');
+ expect(mockExtractJdkFile).toHaveBeenCalledWith('/tmp/download.zip', 'zip');
+ });
+
+ it('fails when the extracted archive is empty', async () => {
+ mockReaddirSync.mockReturnValue([]);
+ const distribution = createDistribution();
+ distribution['downloadAndVerify'] = jest
+ .fn()
+ .mockResolvedValue('/tmp/download');
+ distribution['getArchiveType'] = () => 'tar.xz';
+
+ await expect(distribution['downloadTool'](release)).rejects.toThrow(
+ 'The Red Hat archive for Java 21.0.8+9 was empty.'
+ );
+ expect(mockCacheJdkDir).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/distributors/redhat-installer.test.ts b/__tests__/distributors/redhat-installer.test.ts
new file mode 100644
index 000000000..0890f513a
--- /dev/null
+++ b/__tests__/distributors/redhat-installer.test.ts
@@ -0,0 +1,181 @@
+import {afterEach, describe, expect, it, jest} from '@jest/globals';
+import {HttpClient} from '@actions/http-client';
+import packageDetails from '../data/redhat-package-details.json' with {type: 'json'};
+import packages from '../data/redhat-packages.json' with {type: 'json'};
+import {RedHatDistribution} from '../../src/distributions/redhat/installer.js';
+
+const createDistribution = (
+ version: string,
+ packageType = 'jdk'
+): RedHatDistribution => {
+ const distribution = new RedHatDistribution({
+ version,
+ architecture: 'x64',
+ packageType,
+ checkLatest: false
+ });
+ distribution['getOperatingSystem'] = () => 'linux';
+ distribution['getArchiveType'] = () => 'tar.xz';
+ return distribution;
+};
+
+const mockDisco = (
+ packageResponse: unknown = packages,
+ detailsResponse: unknown = packageDetails
+) =>
+ jest.spyOn(HttpClient.prototype, 'getJson').mockImplementation(async url => ({
+ result: url.includes('/packages?') ? packageResponse : detailsResponse,
+ statusCode: 200,
+ headers: {}
+ }));
+
+afterEach(() => {
+ jest.restoreAllMocks();
+});
+
+describe('Red Hat package resolution', () => {
+ it('resolves the newest matching release and authoritative checksum', async () => {
+ const getJson = mockDisco();
+ const distribution = createDistribution('21');
+
+ const release = await distribution['findPackageForDownload']('21');
+
+ expect(release).toEqual({
+ version: '21.0.8+9',
+ url: packageDetails.result[0].direct_download_uri,
+ checksum: {
+ algorithm: 'sha256',
+ value: packageDetails.result[0].checksum,
+ source:
+ 'https://api.foojay.io/disco/v3.0/ids/redhat-21.0.8-jdk-linux-x64'
+ }
+ });
+ expect(getJson).toHaveBeenNthCalledWith(
+ 1,
+ expect.stringContaining(
+ 'distro=redhat&release_status=ga&operating_system=linux&architecture=x64&package_type=jdk&archive_type=tar.xz&directly_downloadable=true'
+ )
+ );
+ expect(getJson).toHaveBeenNthCalledWith(
+ 2,
+ 'https://api.foojay.io/disco/v3.0/ids/redhat-21.0.8-jdk-linux-x64'
+ );
+ });
+
+ it('normalizes feature-only Disco versions before matching', async () => {
+ mockDisco(undefined, {
+ result: [
+ {
+ ...packageDetails.result[0],
+ direct_download_uri: 'https://developers.redhat.com/openjdk-9.tar.xz'
+ }
+ ],
+ message: ''
+ });
+ const distribution = createDistribution('9');
+
+ const release = await distribution['findPackageForDownload']('9');
+
+ expect(release.version).toBe('9.0.0+181');
+ });
+
+ it('selects the requested package type', async () => {
+ const getJson = mockDisco();
+ const distribution = createDistribution('21', 'jre');
+
+ await distribution['findPackageForDownload']('21');
+
+ expect(getJson).toHaveBeenNthCalledWith(
+ 1,
+ expect.stringContaining('package_type=jre')
+ );
+ expect(getJson).toHaveBeenNthCalledWith(
+ 2,
+ 'https://api.foojay.io/disco/v3.0/ids/redhat-21.0.8-jre-linux-x64'
+ );
+ });
+
+ it('maps Windows to ZIP packages', async () => {
+ const getJson = mockDisco();
+ const distribution = createDistribution('17');
+ distribution['getOperatingSystem'] = () => 'windows';
+ distribution['getArchiveType'] = () => 'zip';
+
+ await distribution['findPackageForDownload']('17');
+
+ expect(getJson).toHaveBeenNthCalledWith(
+ 1,
+ expect.stringContaining(
+ 'operating_system=windows&architecture=x64&package_type=jdk&archive_type=zip'
+ )
+ );
+ expect(getJson).toHaveBeenNthCalledWith(
+ 2,
+ 'https://api.foojay.io/disco/v3.0/ids/redhat-17.0.16-jdk-windows-x64'
+ );
+ });
+
+ it('rejects Alpine before requesting glibc package metadata', async () => {
+ const getJson = mockDisco();
+ const distribution = new RedHatDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ expect(() => distribution['getOperatingSystem'](true)).toThrow(
+ "Distribution 'redhat' does not support Alpine Linux because Red Hat portable archives require glibc."
+ );
+ expect(getJson).not.toHaveBeenCalled();
+ });
+
+ it('rejects early-access versions before requesting metadata', async () => {
+ const getJson = mockDisco();
+ const distribution = createDistribution('21-ea');
+
+ await expect(distribution['findPackageForDownload']('21')).rejects.toThrow(
+ 'Early access versions are not supported'
+ );
+ expect(getJson).not.toHaveBeenCalled();
+ });
+
+ it('reports available versions when no release matches', async () => {
+ mockDisco();
+ const distribution = createDistribution('25');
+
+ await expect(distribution['findPackageForDownload']('25')).rejects.toThrow(
+ "No matching version found for SemVer '25'.\nDistribution: RedHat"
+ );
+ });
+
+ it('fails when the package detail has no direct Red Hat URL', async () => {
+ mockDisco(packages, {result: [], message: ''});
+ const distribution = createDistribution('21');
+
+ await expect(distribution['findPackageForDownload']('21')).rejects.toThrow(
+ 'returned no direct Red Hat download URL'
+ );
+ });
+
+ it('fails when the package detail has no SHA-256 checksum', async () => {
+ mockDisco(packages, {
+ result: [{...packageDetails.result[0], checksum: ''}],
+ message: ''
+ });
+ const distribution = createDistribution('21');
+
+ await expect(distribution['findPackageForDownload']('21')).rejects.toThrow(
+ 'returned no SHA-256 checksum'
+ );
+ });
+
+ it('fails with a targeted error when package metadata is missing', async () => {
+ mockDisco(null);
+ const distribution = createDistribution('21');
+
+ await expect(distribution['findPackageForDownload']('21')).rejects.toThrow(
+ 'Could not fetch Red Hat package metadata from Foojay Disco'
+ );
+ });
+});
diff --git a/__tests__/distributors/sapmachine-installer.test.ts b/__tests__/distributors/sapmachine-installer.test.ts
index 5073cd9fe..6eee0b945 100644
--- a/__tests__/distributors/sapmachine-installer.test.ts
+++ b/__tests__/distributors/sapmachine-installer.test.ts
@@ -1,12 +1,62 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
import {HttpClient} from '@actions/http-client';
-import {SapMachineDistribution} from '../../src/distributions/sapmachine/installer';
-import * as utils from '../../src/util';
-import manifestData from '../data/sapmachine.json';
+import manifestData from '../data/sapmachine.json' with {type: 'json'};
+import releaseClassManifestData from '../data/sapmachine-release-classes.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ getDownloadArchiveExtension: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {SapMachineDistribution} =
+ await import('../../src/distributions/sapmachine/installer.js');
+const utils = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
- let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyHttpGet: any;
+ let spyUtilGetDownloadArchiveExtension: any;
+ let spyCoreError: any;
+ const archiveChecksum = 'f'.repeat(64);
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -15,12 +65,19 @@ describe('getAvailableVersions', () => {
headers: {},
result: manifestData
});
+ spyHttpGet = jest.spyOn(HttpClient.prototype, 'get');
+ spyHttpGet.mockResolvedValue({
+ message: {statusCode: 200},
+ readBody: async () => `${archiveChecksum} archive`
+ });
- spyUtilGetDownloadArchiveExtension = jest.spyOn(
- utils,
- 'getDownloadArchiveExtension'
- );
+ spyUtilGetDownloadArchiveExtension =
+ utils.getDownloadArchiveExtension as jest.Mock;
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -30,7 +87,7 @@ describe('getAvailableVersions', () => {
});
const mockPlatform = (
- distribution: SapMachineDistribution,
+ distribution: InstanceType,
platform: string
) => {
distribution['getPlatformOption'] = () => platform;
@@ -76,9 +133,9 @@ describe('getAvailableVersions', () => {
['11', 'aarch64', 'linux', 54],
['17', 'riscv', 'linux', 0],
['16.0.1', 'x64', 'linux', 71],
- ['23-ea', 'x64', 'linux', 798],
+ ['23-ea', 'x64', 'linux', 727],
['23-ea', 'aarch64', 'windows', 0],
- ['23-ea', 'x64', 'windows', 750]
+ ['23-ea', 'x64', 'windows', 679]
])(
'should get right number of available versions from JSON',
async (
@@ -100,6 +157,45 @@ describe('getAvailableVersions', () => {
expect(availableVersions.length).toBe(len);
}
);
+
+ it.each([
+ [
+ '25',
+ [
+ 'https://example.test/sapmachine-25.0.2-ga.tar.gz',
+ 'https://example.test/sapmachine-25.0.1-ga.tar.gz'
+ ]
+ ],
+ [
+ '25-ea',
+ [
+ 'https://example.test/sapmachine-25-ea.11.tar.gz',
+ 'https://example.test/sapmachine-25-ea.10.tar.gz'
+ ]
+ ]
+ ])(
+ 'should classify boolean and string EA metadata for %s requests',
+ async (version: string, expectedLinks: string[]) => {
+ spyHttpClient.mockReturnValue({
+ statusCode: 200,
+ headers: {},
+ result: releaseClassManifestData
+ });
+ const distribution = new SapMachineDistribution({
+ version,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+
+ const availableVersions = await distribution['getAvailableVersions']();
+
+ expect(availableVersions.map(item => item.downloadLink)).toStrictEqual(
+ expectedLinks
+ );
+ }
+ );
});
describe('findPackageForDownload', () => {
@@ -233,9 +329,52 @@ describe('getAvailableVersions', () => {
await distribution['findPackageForDownload'](normalizedVersion);
expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink);
+ expect(availableVersion.checksum).toEqual({
+ algorithm: 'sha256',
+ value: archiveChecksum,
+ source: expectedLink.replace(/\.(?:tar\.gz|zip)$/, '.sha256.txt')
+ });
}
);
+ it('uses the checksum published beside the selected EA archive', async () => {
+ const distribution = new SapMachineDistribution({
+ version: '21-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+
+ const release = await distribution['findPackageForDownload']('21');
+
+ expect(spyHttpGet).toHaveBeenCalledWith(
+ release.url.replace(/\.(?:tar\.gz|zip)$/, '.sha256.txt')
+ );
+ expect(release.checksum?.value).toBe(archiveChecksum);
+ });
+
+ it('does not select a newer stable release for an EA request', async () => {
+ spyHttpClient.mockReturnValue({
+ statusCode: 200,
+ headers: {},
+ result: releaseClassManifestData
+ });
+ const distribution = new SapMachineDistribution({
+ version: '25-ea',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ mockPlatform(distribution, 'linux');
+
+ const release = await distribution['findPackageForDownload']('25');
+
+ expect(release.url).toBe(
+ 'https://example.test/sapmachine-25-ea.11.tar.gz'
+ );
+ });
+
it.each([
['8', 'linux', 'x64'],
['8', 'macos', 'aarch64'],
@@ -248,7 +387,7 @@ describe('getAvailableVersions', () => {
['21.0.3+8-ea', 'linux', 'x64', '21.0.3+8'],
['17', 'linux-muse', 'aarch64']
])(
- 'should throw when required version of JDK can not be found in the JSON',
+ 'should throw when required version of JDK cannot be found in the JSON',
async (
version: string,
platform: string,
@@ -266,7 +405,7 @@ describe('getAvailableVersions', () => {
await expect(
distribution['findPackageForDownload'](normalizedVersion)
).rejects.toThrow(
- `Couldn't find any satisfied version for the specified java-version: "${normalizedVersion}" and architecture: "${arch}".`
+ `No matching version found for SemVer '${normalizedVersion}'`
);
}
);
diff --git a/__tests__/distributors/semeru-installer.test.ts b/__tests__/distributors/semeru-installer.test.ts
index 690478f79..b1785e853 100644
--- a/__tests__/distributors/semeru-installer.test.ts
+++ b/__tests__/distributors/semeru-installer.test.ts
@@ -1,12 +1,53 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {JavaInstallerOptions} from '../../src/distributions/base-models.js';
import {HttpClient} from '@actions/http-client';
-import {JavaInstallerOptions} from '../../src/distributions/base-models';
-import {SemeruDistribution} from '../../src/distributions/semeru/installer';
+import manifestData from '../data/semeru.json' with {type: 'json'};
-import manifestData from '../data/semeru.json';
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {SemeruDistribution} =
+ await import('../../src/distributions/semeru/installer.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
+ let spyCoreWarning: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -15,6 +56,11 @@ describe('getAvailableVersions', () => {
headers: {},
result: []
});
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
+ spyCoreWarning = core.warning as jest.Mock;
+ spyCoreWarning.mockImplementation(() => {});
});
afterEach(() => {
@@ -77,22 +123,19 @@ describe('getAvailableVersions', () => {
);
it('load available versions', async () => {
+ const nextPageUrl =
+ 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D?page=1&page_size=20';
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient
.mockReturnValueOnce({
statusCode: 200,
- headers: {},
+ headers: {link: `<${nextPageUrl}>; rel="next"`},
result: manifestData as any
})
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData as any
- })
- .mockReturnValueOnce({
- statusCode: 200,
- headers: {},
- result: []
});
const distribution = new SemeruDistribution({
@@ -104,6 +147,31 @@ describe('getAvailableVersions', () => {
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();
expect(availableVersions.length).toBe(manifestData.length * 2);
+ expect(spyHttpClient).toHaveBeenNthCalledWith(2, nextPageUrl);
+ });
+
+ it('stops pagination after 1000 pages as a safeguard', async () => {
+ const nextPageUrl =
+ 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D?page=2&page_size=20';
+ spyHttpClient.mockReturnValue({
+ statusCode: 200,
+ headers: {link: `<${nextPageUrl}>; rel="next"`},
+ result: [{version_data: {semver: '17.0.1'}, binaries: []}] as any
+ });
+
+ const distribution = new SemeruDistribution({
+ version: '8',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledTimes(1000);
+ expect(spyCoreWarning).toHaveBeenCalledWith(
+ expect.stringContaining('Reached pagination safeguard limit (1000 pages)')
+ );
});
it.each([
@@ -140,6 +208,14 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload'](input);
expect(resolvedVersion.version).toBe(expected);
+ const vendorPackage = (manifestData as any[]).find(
+ item => item.version_data.semver === expected
+ ).binaries[0].package;
+ expect(resolvedVersion.checksum).toEqual({
+ algorithm: 'sha256',
+ value: vendorPackage.checksum,
+ source: vendorPackage.checksum_link
+ });
});
it('version is found but binaries list is empty', async () => {
@@ -152,7 +228,7 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(
distribution['findPackageForDownload']('9.0.8')
- ).rejects.toThrow(/Could not find satisfied version for SemVer */);
+ ).rejects.toThrow(/No matching version found for SemVer */);
});
it('version is not found', async () => {
@@ -164,7 +240,7 @@ describe('findPackageForDownload', () => {
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
);
});
@@ -177,7 +253,7 @@ describe('findPackageForDownload', () => {
});
distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
);
});
@@ -196,7 +272,7 @@ describe('findPackageForDownload', () => {
}
);
- it.each(['zos', 'z/OS', 'z/os', 'test0987654321=', '++=++', 'myArch'])(
+ it.each(['zos', 'myArch'])(
'incorrect Semeru `%s` architecture throws',
async (arch: string) => {
const distribution = new SemeruDistribution({
diff --git a/__tests__/distributors/temurin-installer.test.ts b/__tests__/distributors/temurin-installer.test.ts
index f540901eb..2d424b33c 100644
--- a/__tests__/distributors/temurin-installer.test.ts
+++ b/__tests__/distributors/temurin-installer.test.ts
@@ -1,15 +1,94 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {JavaInstallerOptions} from '../../src/distributions/base-models.js';
+import type {TemurinImplementation as TemurinImplementationType} from '../../src/distributions/temurin/installer.js';
import {HttpClient} from '@actions/http-client';
+import fs from 'fs';
import os from 'os';
-import {
- TemurinDistribution,
- TemurinImplementation
-} from '../../src/distributions/temurin/installer';
-import {JavaInstallerOptions} from '../../src/distributions/base-models';
+import path from 'path';
+
+import manifestData from '../data/temurin.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
-import manifestData from '../data/temurin.json';
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ find: jest.fn(),
+ findAllVersions: jest.fn(),
+ downloadTool: jest.fn(),
+ extractZip: jest.fn(),
+ extractTar: jest.fn(),
+ extract7z: jest.fn(),
+ extractXar: jest.fn(),
+ cacheDir: jest.fn(),
+ cacheFile: jest.fn(),
+ getManifestFromRepo: jest.fn(),
+ findFromManifest: jest.fn(),
+ evaluateVersions: jest.fn()
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ extractJdkFile: jest.fn(),
+ getDownloadArchiveExtension: jest.fn(),
+ getToolcachePath: jest.fn(),
+ isJobStatusSuccess: jest.fn(),
+ renameWinArchive: jest.fn(),
+ isVersionSatisfies: real_util_module.isVersionSatisfies,
+ getTempDir: real_util_module.getTempDir
+}));
+
+jest.unstable_mockModule('../../src/gpg.js', () => ({
+ importKey: jest.fn(),
+ removeGpgHome: jest.fn(),
+ isGpgAvailable: jest.fn(),
+ verifyPackageSignature: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const gpg = await import('../../src/gpg.js');
+const tc = await import('@actions/tool-cache');
+const {TemurinDistribution, TemurinImplementation, ADOPTIUM_PUBLIC_KEY} =
+ await import('../../src/distributions/temurin/installer.js');
+const util = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
+ let spyCoreWarning: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
@@ -18,6 +97,11 @@ describe('getAvailableVersions', () => {
headers: {},
result: []
});
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
+ spyCoreWarning = core.warning as jest.Mock;
+ spyCoreWarning.mockImplementation(() => {});
});
afterEach(() => {
@@ -37,6 +121,16 @@ describe('getAvailableVersions', () => {
TemurinImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
],
+ [
+ {
+ version: '25',
+ architecture: 'x64',
+ packageType: 'jdk+jmods',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot,
+ 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
+ ],
[
{
version: '16',
@@ -71,7 +165,7 @@ describe('getAvailableVersions', () => {
'build correct url for %s',
async (
installerOptions: JavaInstallerOptions,
- impl: TemurinImplementation,
+ impl: TemurinImplementationType,
expectedParameters
) => {
const distribution = new TemurinDistribution(installerOptions, impl);
@@ -87,23 +181,41 @@ describe('getAvailableVersions', () => {
}
);
+ it('requests the JMOD image type', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: '25',
+ architecture: 'x64',
+ packageType: 'jdk+jmods',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+ distribution['getPlatformOption'] = () => 'linux';
+
+ await distribution['getAvailableVersions']('jmods');
+
+ expect(spyHttpClient).toHaveBeenCalledWith(
+ expect.stringContaining(
+ 'os=linux&architecture=x64&image_type=jmods&release_type=ga'
+ )
+ );
+ });
+
it('load available versions', async () => {
+ const nextPageUrl =
+ 'https://api.adoptium.net/v3/assets/version/%5B1.0,100.0%5D?page=1&page_size=20';
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient
.mockReturnValueOnce({
statusCode: 200,
- headers: {},
+ headers: {link: `<${nextPageUrl}>; rel="next"`},
result: manifestData as any
})
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData as any
- })
- .mockReturnValueOnce({
- statusCode: 200,
- headers: {},
- result: []
});
const distribution = new TemurinDistribution(
@@ -118,14 +230,51 @@ describe('getAvailableVersions', () => {
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();
expect(availableVersions.length).toBe(manifestData.length * 2);
+ expect(spyHttpClient).toHaveBeenNthCalledWith(2, nextPageUrl);
+ });
+
+ it('stops pagination after 1000 pages as a safeguard', async () => {
+ const nextPageUrl =
+ 'https://api.adoptium.net/v3/assets/version/%5B1.0,100.0%5D?page=2&page_size=20';
+ spyHttpClient.mockReturnValue({
+ statusCode: 200,
+ headers: {link: `<${nextPageUrl}>; rel="next"`},
+ result: [{version_data: {semver: '17.0.1'}, binaries: []}] as any
+ });
+
+ const distribution = new TemurinDistribution(
+ {
+ version: '8',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await distribution['getAvailableVersions']();
+
+ expect(spyHttpClient).toHaveBeenCalledTimes(1000);
+ expect(spyCoreWarning).toHaveBeenCalledWith(
+ expect.stringContaining('Reached pagination safeguard limit (1000 pages)')
+ );
});
it.each([
[TemurinImplementation.Hotspot, 'jdk', 'Java_Temurin-Hotspot_jdk'],
- [TemurinImplementation.Hotspot, 'jre', 'Java_Temurin-Hotspot_jre']
+ [TemurinImplementation.Hotspot, 'jre', 'Java_Temurin-Hotspot_jre'],
+ [
+ TemurinImplementation.Hotspot,
+ 'jdk+jmods',
+ 'Java_Temurin-Hotspot_jdk+jmods'
+ ]
])(
'find right toolchain folder',
- (impl: TemurinImplementation, packageType: string, expected: string) => {
+ (
+ impl: TemurinImplementationType,
+ packageType: string,
+ expected: string
+ ) => {
const distribution = new TemurinDistribution(
{
version: '8',
@@ -143,7 +292,9 @@ describe('getAvailableVersions', () => {
it.each([
['amd64', 'x64'],
- ['arm64', 'aarch64']
+ ['arm', 'arm'],
+ ['arm64', 'aarch64'],
+ ['riscv64', 'riscv64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
@@ -198,6 +349,124 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload'](input);
expect(resolvedVersion.version).toBe(expected);
+ expect(resolvedVersion.signatureUrl).toBeDefined();
+ const vendorPackage = (manifestData as any[]).find(
+ item => item.version_data.semver === expected
+ ).binaries[0].package;
+ expect(resolvedVersion.checksum).toEqual({
+ algorithm: 'sha256',
+ value: vendorPackage.checksum,
+ source: vendorPackage.checksum_link
+ });
+ });
+
+ it('version "latest" is normalized to the newest available version', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: 'latest',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+ distribution['getAvailableVersions'] = async () => manifestData as any;
+ // normalizeVersion turns `latest` into the wildcard carried on `this.version`
+ const resolvedVersion = await distribution['findPackageForDownload'](
+ distribution['version']
+ );
+ expect(resolvedVersion.version).toBe('16.0.2+7');
+ });
+
+ describe('OpenJDK patch (respin) versions', () => {
+ const makeRelease = (
+ semverVersion: string,
+ openjdkVersion: string,
+ versionData: Record
+ ) => ({
+ binaries: [
+ {
+ package: {
+ link: `https://example.com/${openjdkVersion}.tar.gz`,
+ checksum: `checksum-${openjdkVersion}`,
+ checksum_link: `https://example.com/${openjdkVersion}.sha256.txt`
+ }
+ }
+ ],
+ version_data: {
+ semver: semverVersion,
+ openjdk_version: openjdkVersion,
+ minor: 0,
+ ...versionData
+ }
+ });
+
+ const respinManifest = [
+ makeRelease('26.0.2+101', '26.0.2.1+1', {
+ major: 26,
+ security: 2,
+ patch: 1,
+ build: 1
+ }),
+ makeRelease('26.0.2+10', '26.0.2+10', {
+ major: 26,
+ security: 2,
+ build: 10
+ }),
+ makeRelease('25.0.4+101.0.LTS', '25.0.4.1+1-LTS', {
+ major: 25,
+ security: 4,
+ patch: 1,
+ build: 1
+ }),
+ makeRelease('25.0.4+7.0.LTS', '25.0.4+7-LTS', {
+ major: 25,
+ security: 4,
+ build: 7
+ })
+ ];
+
+ it.each([
+ ['26.0.2.1+1', '26.0.2+101'],
+ ['26.0.2+10', '26.0.2+10'],
+ ['26', '26.0.2+101'],
+ ['26.0.2', '26.0.2+101'],
+ ['25.0.4.1+1', '25.0.4+101.0.LTS'],
+ ['25.0.4+7', '25.0.4+7.0.LTS'],
+ ['25.0.4', '25.0.4+101.0.LTS']
+ ])('%s resolves to %s', async (input, expected) => {
+ const distribution = new TemurinDistribution(
+ {
+ version: input,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+ distribution['getAvailableVersions'] = async () => respinManifest as any;
+ const resolvedVersion = await distribution['findPackageForDownload'](
+ distribution['version']
+ );
+ expect(resolvedVersion.version).toBe(expected);
+ expect(resolvedVersion).not.toHaveProperty('openjdkVersion');
+ });
+
+ it('does not match a non-existent respin', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: '26.0.2.2+1',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+ distribution['getAvailableVersions'] = async () => respinManifest as any;
+ await expect(
+ distribution['findPackageForDownload'](distribution['version'])
+ ).rejects.toThrow(/No matching version found for SemVer '26.0.2\+2.1'/);
+ });
});
it('version is found but binaries list is empty', async () => {
@@ -213,7 +482,7 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(
distribution['findPackageForDownload']('9.0.8')
- ).rejects.toThrow(/Could not find satisfied version for SemVer */);
+ ).rejects.toThrow(/No matching version found for SemVer */);
});
it('version is not found', async () => {
@@ -228,7 +497,7 @@ describe('findPackageForDownload', () => {
);
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
);
});
@@ -244,7 +513,319 @@ describe('findPackageForDownload', () => {
);
distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
- /Could not find satisfied version for SemVer */
+ /No matching version found for SemVer */
+ );
+ });
+});
+
+describe('downloadTool', () => {
+ let spyDownloadTool: any;
+ let spyVerifySignature: any;
+ let spyExtractJdkFile: any;
+ let spyCacheDir: any;
+ let spyReadDirSync: any;
+ let spyRenameWinArchive: any;
+ let spyCopySync: any;
+
+ beforeEach(() => {
+ spyDownloadTool = tc.downloadTool as jest.Mock;
+ spyDownloadTool.mockResolvedValue('/tmp/jdk.tar.gz');
+ (gpg.isGpgAvailable as jest.Mock).mockResolvedValue(true);
+ spyVerifySignature = gpg.verifyPackageSignature as jest.Mock;
+ spyVerifySignature.mockResolvedValue(undefined);
+ spyExtractJdkFile = util.extractJdkFile as jest.Mock;
+ spyExtractJdkFile.mockResolvedValue('/tmp/extracted');
+ spyCacheDir = tc.cacheDir as jest.Mock;
+ spyCacheDir.mockResolvedValue('/tmp/toolcache');
+ spyReadDirSync = jest.spyOn(fs, 'readdirSync');
+ spyReadDirSync.mockReturnValue(['jdk-17'] as any);
+ spyRenameWinArchive = util.renameWinArchive as jest.Mock;
+ spyRenameWinArchive.mockReturnValue('/tmp/jdk.tar.gz.zip');
+ spyCopySync = jest.spyOn(fs, 'cpSync');
+ spyCopySync.mockImplementation(() => undefined);
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ jest.clearAllMocks();
+ jest.restoreAllMocks();
+ });
+
+ it('verifies signatures by default', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ });
+
+ expect(spyVerifySignature).toHaveBeenCalledWith(
+ '/tmp/jdk.tar.gz',
+ 'https://example.com/jdk.tar.gz.sig',
+ ADOPTIUM_PUBLIC_KEY
+ );
+ });
+
+ it('does not verify signatures when explicitly disabled', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: false
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ });
+
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ });
+
+ it('skips implicit signature verification when gpg is unavailable', async () => {
+ (gpg.isGpgAvailable as jest.Mock).mockResolvedValue(false);
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await expect(
+ distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ })
+ ).resolves.toEqual({version: '17.0.14+7', path: '/tmp/toolcache'});
+
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ expect(core.warning).toHaveBeenCalledWith(
+ "Input 'verify-signature' is enabled, but gpg is not available."
+ );
+ });
+
+ it('fails when signature verification is explicitly enabled without gpg', async () => {
+ (gpg.isGpgAvailable as jest.Mock).mockResolvedValue(false);
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await expect(
+ distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ })
+ ).rejects.toThrow(
+ "Input 'verify-signature' is enabled, but gpg is not available."
+ );
+
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ });
+
+ it('warns when implicit signature verification fails', async () => {
+ spyVerifySignature.mockRejectedValue(new Error('bad signature'));
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await expect(
+ distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ })
+ ).resolves.toEqual({version: '17.0.14+7', path: '/tmp/toolcache'});
+
+ expect(core.warning).toHaveBeenCalledWith(
+ expect.stringContaining(
+ 'https://github.com/actions/setup-java#download-integrity-and-signatures'
+ )
+ );
+ });
+
+ it('fails when explicitly requested signature verification fails', async () => {
+ spyVerifySignature.mockRejectedValue(new Error('bad signature'));
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await expect(
+ distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ })
+ ).rejects.toThrow(
+ /Failed to verify signature for Temurin version 17\.0\.14\+7.*bad signature.*https:\/\/github\.com\/actions\/setup-java#download-integrity-and-signatures/
+ );
+ });
+
+ it('warns when a signature is missing and verification is implicit', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await expect(
+ distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz'
+ })
+ ).resolves.toEqual({version: '17.0.14+7', path: '/tmp/toolcache'});
+
+ expect(core.warning).toHaveBeenCalledWith(
+ "Input 'verify-signature' is enabled, but no signature URL was found for Temurin version 17.0.14+7."
+ );
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ });
+
+ it('downloads and adds matching JMODs to the JDK', async () => {
+ spyDownloadTool
+ .mockResolvedValueOnce('/tmp/jdk.tar.gz')
+ .mockResolvedValueOnce('/tmp/jmods.tar.gz');
+ spyExtractJdkFile
+ .mockResolvedValueOnce('/tmp/extracted')
+ .mockResolvedValueOnce('/tmp/extracted-jmods');
+ spyReadDirSync
+ .mockReturnValueOnce(['jdk-25'] as any)
+ .mockReturnValueOnce(['jdk-25-jmods'] as any);
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+
+ const distribution = new TemurinDistribution(
+ {
+ version: '25',
+ architecture: 'x64',
+ packageType: 'jdk+jmods',
+ checkLatest: false,
+ verifySignature: false
+ },
+ TemurinImplementation.Hotspot
+ );
+ distribution['resolvePackage'] = jest.fn().mockResolvedValue({
+ version: '25.0.3+9',
+ url: 'https://example.com/jmods.tar.gz'
+ });
+
+ await distribution['downloadTool']({
+ version: '25.0.3+9',
+ url: 'https://example.com/jdk.tar.gz'
+ });
+
+ expect(distribution['resolvePackage']).toHaveBeenCalledWith(
+ '25.0.3+9',
+ 'jmods'
+ );
+ expect(spyDownloadTool).toHaveBeenNthCalledWith(
+ 2,
+ 'https://example.com/jmods.tar.gz'
+ );
+ expect(spyCopySync).toHaveBeenCalledWith(
+ path.join('/tmp/extracted-jmods', 'jdk-25-jmods'),
+ process.platform === 'darwin'
+ ? path.join('/tmp/extracted', 'jdk-25', 'Contents', 'Home', 'jmods')
+ : path.join('/tmp/extracted', 'jdk-25', 'jmods'),
+ {recursive: true}
+ );
+ expect(spyCacheDir).toHaveBeenCalledWith(
+ path.join('/tmp/extracted', 'jdk-25'),
+ 'Java_Temurin-Hotspot_jdk+jmods',
+ '25.0.3-9',
+ 'x64'
+ );
+ });
+
+ it('fails when signature is missing and verification is enabled', async () => {
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await expect(
+ distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz'
+ })
+ ).rejects.toThrow(
+ "Input 'verify-signature' is enabled, but no signature URL was found"
+ );
+ expect(spyVerifySignature).not.toHaveBeenCalled();
+ });
+
+ it('uses custom public key when verifySignaturePublicKey is provided', async () => {
+ const customKey =
+ '-----BEGIN PGP PUBLIC KEY BLOCK-----\ncustom\n-----END PGP PUBLIC KEY BLOCK-----';
+ const distribution = new TemurinDistribution(
+ {
+ version: '17',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false,
+ verifySignature: true,
+ verifySignaturePublicKey: customKey
+ },
+ TemurinImplementation.Hotspot
+ );
+
+ await distribution['downloadTool']({
+ version: '17.0.14+7',
+ url: 'https://example.com/jdk.tar.gz',
+ signatureUrl: 'https://example.com/jdk.tar.gz.sig'
+ });
+
+ expect(spyVerifySignature).toHaveBeenCalledWith(
+ '/tmp/jdk.tar.gz',
+ 'https://example.com/jdk.tar.gz.sig',
+ customKey
);
});
});
diff --git a/__tests__/distributors/zulu-installer.test.ts b/__tests__/distributors/zulu-installer.test.ts
index 100429b30..7b7b1856d 100644
--- a/__tests__/distributors/zulu-installer.test.ts
+++ b/__tests__/distributors/zulu-installer.test.ts
@@ -1,28 +1,77 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import fs from 'fs';
+import type {IZuluVersions} from '../../src/distributions/zulu/models.js';
import {HttpClient} from '@actions/http-client';
-import {ZuluDistribution} from '../../src/distributions/zulu/installer';
-import {IZuluVersions} from '../../src/distributions/zulu/models';
-import * as utils from '../../src/util';
import os from 'os';
-import manifestData from '../data/zulu-releases-default.json';
+import manifestData from '../data/zulu-releases-default.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ getDownloadArchiveExtension: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {ZuluDistribution} =
+ await import('../../src/distributions/zulu/installer.js');
+const utils = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
- let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
- result: manifestData as IZuluVersions[]
+ result: [] as IZuluVersions[]
});
- spyUtilGetDownloadArchiveExtension = jest.spyOn(
- utils,
- 'getDownloadArchiveExtension'
+ (utils.getDownloadArchiveExtension as jest.Mock).mockReturnValue(
+ 'tar.gz'
);
- spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -39,7 +88,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -48,7 +97,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ea&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -57,7 +106,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -66,7 +115,7 @@ describe('getAvailableVersions', () => {
packageType: 'jre',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
+ '?os=macos&archive_type=tar.gz&java_package_type=jre&javafx_bundled=false&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -75,7 +124,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk+fx',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=true&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -84,7 +133,16 @@ describe('getAvailableVersions', () => {
packageType: 'jre+fx',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
+ '?os=macos&archive_type=tar.gz&java_package_type=jre&javafx_bundled=true&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
+ ],
+ [
+ {
+ version: '8',
+ architecture: 'x64',
+ packageType: 'jdk+crac',
+ checkLatest: false
+ },
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=true&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -93,7 +151,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=aarch64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -102,12 +160,12 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
+ '?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=arm&release_status=ga&availability_types=ca&page=1&page_size=100'
]
])('build correct url for %s -> %s', async (input, parsedUrl) => {
const distribution = new ZuluDistribution(input);
distribution['getPlatformOption'] = () => 'macos';
- const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`;
+ const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/${parsedUrl}`;
await distribution['getAvailableVersions']();
@@ -115,16 +173,12 @@ describe('getAvailableVersions', () => {
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
- type DistroArch = {
- bitness: string;
- arch: string;
- };
it.each([
- ['amd64', {bitness: '64', arch: 'x86'}],
- ['arm64', {bitness: '64', arch: 'arm'}]
+ ['amd64', 'x64'],
+ ['arm64', 'aarch64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
- async (osArch: string, distroArch: DistroArch) => {
+ async (osArch: string, distroArch: string) => {
jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType);
@@ -136,7 +190,7 @@ describe('getAvailableVersions', () => {
checkLatest: false
});
distribution['getPlatformOption'] = () => 'macos';
- const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
+ const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=macos&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=${distroArch}&release_status=ga&availability_types=ca&page=1&page_size=100`;
await distribution['getAvailableVersions']();
@@ -146,6 +200,18 @@ describe('getAvailableVersions', () => {
);
it('load available versions', async () => {
+ spyHttpClient
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: manifestData as IZuluVersions[]
+ })
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: [] as IZuluVersions[]
+ });
+
const distribution = new ZuluDistribution({
version: '11',
architecture: 'x86',
@@ -159,10 +225,11 @@ describe('getAvailableVersions', () => {
describe('getArchitectureOptions', () => {
it.each([
- [{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}],
- [{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}],
- [{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}],
- [{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}]
+ [{architecture: 'x64'}, 'x64'],
+ [{architecture: 'x86'}, 'i686'],
+ [{architecture: 'aarch64'}, 'aarch64'],
+ [{architecture: 'arm64'}, 'aarch64'],
+ [{architecture: 'arm'}, 'arm']
])('%s -> %s', (input, expected) => {
const distribution = new ZuluDistribution({
version: '11',
@@ -170,11 +237,31 @@ describe('getArchitectureOptions', () => {
packageType: 'jdk',
checkLatest: false
});
- expect(distribution['getArchitectureOptions']()).toEqual(expected);
+ expect(distribution['getArchitectureOptions']()).toBe(expected);
});
});
describe('findPackageForDownload', () => {
+ let spyPackageDetails: any;
+
+ const ZULU_CHECKSUM = 'a'.repeat(64);
+
+ beforeEach(() => {
+ // The resolved winning package fetches sha256_hash from the Azul
+ // package-details endpoint; stub it so tests never reach the real
+ // network.
+ spyPackageDetails = jest.spyOn(HttpClient.prototype, 'getJson');
+ spyPackageDetails.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {sha256_hash: ZULU_CHECKSUM}
+ });
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
it.each([
['8', '8.0.282+8'],
['11.x', '11.0.10+9'],
@@ -213,6 +300,101 @@ describe('findPackageForDownload', () => {
expect(result.url).toBe(
'https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-macosx_x64.tar.gz'
);
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: ZULU_CHECKSUM,
+ source: 'https://api.azul.com/metadata/v1/zulu/packages/test-uuid-10933'
+ });
+ // Only the winning package's UUID triggers a details request.
+ expect(spyPackageDetails).toHaveBeenCalledWith(
+ 'https://api.azul.com/metadata/v1/zulu/packages/test-uuid-10933'
+ );
+ expect(spyPackageDetails).toHaveBeenCalledTimes(1);
+ });
+
+ it('skips checksum verification when sha256_hash is missing or malformed', async () => {
+ spyPackageDetails.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {sha256_hash: 'not-a-valid-digest'}
+ });
+
+ const distribution = new ZuluDistribution({
+ version: '',
+ architecture: 'x86',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData;
+ const result = await distribution['findPackageForDownload']('11.0.5');
+
+ expect(result.checksum).toBeUndefined();
+ expect(core.debug).toHaveBeenCalledWith(
+ expect.stringContaining('No authoritative sha256 checksum')
+ );
+ });
+
+ describe('hotfix builds with a 4-segment java_version', () => {
+ // Mirrors the Azul Metadata API: 25.0.4.1 hotfix is reported as
+ // java_version=[25,0,4,1], openjdk_build_number=1 (SDKMAN '25.0.4+1.1').
+ const hotfixManifest = [
+ {
+ package_uuid: 'uuid-25.0.4+7',
+ name: 'zulu25.36.15-ca-jdk25.0.4-linux_x64.tar.gz',
+ download_url:
+ 'https://cdn.azul.com/zulu/bin/zulu25.36.15-ca-jdk25.0.4-linux_x64.tar.gz',
+ java_version: [25, 0, 4],
+ openjdk_build_number: 7,
+ distro_version: [25, 36, 15, 0],
+ latest: false,
+ availability_type: 'ca'
+ },
+ {
+ package_uuid: 'uuid-25.0.4+1.1',
+ name: 'zulu25.36.205-ca-jdk25.0.4.1-linux_x64.tar.gz',
+ download_url:
+ 'https://cdn.azul.com/zulu/bin/zulu25.36.205-ca-jdk25.0.4.1-linux_x64.tar.gz',
+ java_version: [25, 0, 4, 1],
+ openjdk_build_number: 1,
+ distro_version: [25, 36, 205, 0],
+ latest: true,
+ availability_type: 'ca'
+ },
+ {
+ package_uuid: 'uuid-25.0.3+9',
+ name: 'zulu25.34.17-ca-jdk25.0.3-linux_x64.tar.gz',
+ download_url:
+ 'https://cdn.azul.com/zulu/bin/zulu25.34.17-ca-jdk25.0.3-linux_x64.tar.gz',
+ java_version: [25, 0, 3],
+ openjdk_build_number: 9,
+ distro_version: [25, 34, 17, 0],
+ latest: false,
+ availability_type: 'ca'
+ }
+ ] as IZuluVersions[];
+
+ it.each([
+ ['25.0.4+1.1', '25.0.4+1.1', 'uuid-25.0.4+1.1'],
+ ['25', '25.0.4+1.1', 'uuid-25.0.4+1.1'],
+ ['25.0.4', '25.0.4+1.1', 'uuid-25.0.4+1.1'],
+ ['25.0.4+7', '25.0.4+7', 'uuid-25.0.4+7'],
+ ['25.0.3', '25.0.3+9', 'uuid-25.0.3+9']
+ ])('version is %s -> %s', async (input, expected, uuid) => {
+ const distribution = new ZuluDistribution({
+ version: input,
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => hotfixManifest;
+ const result = await distribution['findPackageForDownload'](
+ distribution['version']
+ );
+ expect(result.version).toBe(expected);
+ expect(result.url).toBe(
+ hotfixManifest.find(item => item.package_uuid === uuid)!.download_url
+ );
+ });
});
it('should throw an error', async () => {
@@ -225,6 +407,53 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData;
await expect(
distribution['findPackageForDownload'](distribution['version'])
- ).rejects.toThrow(/Could not find satisfied version for semver */);
+ ).rejects.toThrow(/No matching version found for SemVer/);
+ });
+});
+
+describe('Zulu getPlatformOption libc selection', () => {
+ const originalPlatform = Object.getOwnPropertyDescriptor(
+ process,
+ 'platform'
+ ) as PropertyDescriptor;
+
+ const setPlatform = (platform: NodeJS.Platform) =>
+ Object.defineProperty(process, 'platform', {
+ ...originalPlatform,
+ value: platform
+ });
+
+ const distribution = new ZuluDistribution({
+ version: '21',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+
+ afterEach(() => {
+ Object.defineProperty(process, 'platform', originalPlatform);
+ jest.restoreAllMocks();
+ });
+
+ it('selects the musl artifacts on Alpine', () => {
+ setPlatform('linux');
+ jest.spyOn(fs, 'existsSync').mockReturnValue(true);
+
+ expect(distribution['getPlatformOption']()).toBe('linux_musl');
+ });
+
+ it('selects the glibc artifacts on other Linux runners', () => {
+ setPlatform('linux');
+ jest.spyOn(fs, 'existsSync').mockReturnValue(false);
+
+ expect(distribution['getPlatformOption']()).toBe('linux_glibc');
+ });
+
+ it('does not probe for Alpine off Linux', () => {
+ setPlatform('win32');
+ const existsSync = jest.spyOn(fs, 'existsSync');
+
+ expect(distribution['getPlatformOption']()).toBe('windows');
+ expect(existsSync).not.toHaveBeenCalled();
});
});
diff --git a/__tests__/distributors/zulu-linux-installer.test.ts b/__tests__/distributors/zulu-linux-installer.test.ts
index a25344cbd..2b818c7de 100644
--- a/__tests__/distributors/zulu-linux-installer.test.ts
+++ b/__tests__/distributors/zulu-linux-installer.test.ts
@@ -1,29 +1,78 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {IZuluVersions} from '../../src/distributions/zulu/models.js';
import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
-import {ZuluDistribution} from '../../src/distributions/zulu/installer';
-import {IZuluVersions} from '../../src/distributions/zulu/models';
-import * as utils from '../../src/util';
import os from 'os';
-import manifestData from '../data/zulu-linux.json';
+import manifestData from '../data/zulu-linux.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ getDownloadArchiveExtension: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {ZuluDistribution} =
+ await import('../../src/distributions/zulu/installer.js');
+const utils = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
- let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyUtilGetDownloadArchiveExtension: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
- result: manifestData as IZuluVersions[]
+ result: [] as IZuluVersions[]
});
- spyUtilGetDownloadArchiveExtension = jest.spyOn(
- utils,
- 'getDownloadArchiveExtension'
- );
+ spyUtilGetDownloadArchiveExtension =
+ utils.getDownloadArchiveExtension as jest.Mock;
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -40,7 +89,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -49,7 +98,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ea&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -58,7 +107,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -67,7 +116,7 @@ describe('getAvailableVersions', () => {
packageType: 'jre',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jre&javafx_bundled=false&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -76,7 +125,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk+fx',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=true&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -85,7 +134,16 @@ describe('getAvailableVersions', () => {
packageType: 'jre+fx',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jre&javafx_bundled=true&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
+ ],
+ [
+ {
+ version: '8',
+ architecture: 'x64',
+ packageType: 'jdk+crac',
+ checkLatest: false
+ },
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=true&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -94,7 +152,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=aarch64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -103,12 +161,12 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
+ '?os=linux_glibc&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=arm&release_status=ga&availability_types=ca&page=1&page_size=100'
]
])('build correct url for %s -> %s', async (input, parsedUrl) => {
const distribution = new ZuluDistribution(input);
- distribution['getPlatformOption'] = () => 'linux';
- const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`;
+ distribution['getPlatformOption'] = () => 'linux_glibc';
+ const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/${parsedUrl}`;
await distribution['getAvailableVersions']();
@@ -116,16 +174,12 @@ describe('getAvailableVersions', () => {
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
- type DistroArch = {
- bitness: string;
- arch: string;
- };
it.each([
- ['amd64', {bitness: '64', arch: 'x86'}],
- ['arm64', {bitness: '64', arch: 'arm'}]
+ ['amd64', 'x64'],
+ ['arm64', 'aarch64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
- async (osArch: string, distroArch: DistroArch) => {
+ async (osArch: string, distroArch: string) => {
jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType);
@@ -136,10 +190,10 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
});
- distribution['getPlatformOption'] = () => 'linux';
+ distribution['getPlatformOption'] = () => 'linux_glibc';
// Override extension for linux default arch case to match util behavior
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
- const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=tar.gz&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
+ const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=linux_glibc&archive_type=tar.gz&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=${distroArch}&release_status=ga&availability_types=ca&page=1&page_size=100`;
await distribution['getAvailableVersions']();
@@ -149,6 +203,18 @@ describe('getAvailableVersions', () => {
);
it('load available versions', async () => {
+ spyHttpClient
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: manifestData as IZuluVersions[]
+ })
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: [] as IZuluVersions[]
+ });
+
const distribution = new ZuluDistribution({
version: '11',
architecture: 'x86',
@@ -162,10 +228,11 @@ describe('getAvailableVersions', () => {
describe('getArchitectureOptions', () => {
it.each([
- [{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}],
- [{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}],
- [{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}],
- [{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}]
+ [{architecture: 'x64'}, 'x64'],
+ [{architecture: 'x86'}, 'i686'],
+ [{architecture: 'aarch64'}, 'aarch64'],
+ [{architecture: 'arm64'}, 'aarch64'],
+ [{architecture: 'arm'}, 'arm']
])('%s -> %s', (input, expected) => {
const distribution = new ZuluDistribution({
version: '11',
@@ -173,11 +240,31 @@ describe('getArchitectureOptions', () => {
packageType: 'jdk',
checkLatest: false
});
- expect(distribution['getArchitectureOptions']()).toEqual(expected);
+ expect(distribution['getArchitectureOptions']()).toBe(expected);
});
});
describe('findPackageForDownload', () => {
+ let spyPackageDetails: any;
+
+ const ZULU_CHECKSUM = 'a'.repeat(64);
+
+ beforeEach(() => {
+ // The resolved winning package fetches sha256_hash from the Azul
+ // package-details endpoint; stub it so tests never reach the real
+ // network.
+ spyPackageDetails = jest.spyOn(HttpClient.prototype, 'getJson');
+ spyPackageDetails.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {sha256_hash: ZULU_CHECKSUM}
+ });
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
it.each([
['8', '8.0.282+8'],
['11.x', '11.0.10+9'],
@@ -216,6 +303,38 @@ describe('findPackageForDownload', () => {
expect(result.url).toBe(
'https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz'
);
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: ZULU_CHECKSUM,
+ source: 'https://api.azul.com/metadata/v1/zulu/packages/test-uuid-12447'
+ });
+ // Only the winning package's UUID triggers a details request.
+ expect(spyPackageDetails).toHaveBeenCalledWith(
+ 'https://api.azul.com/metadata/v1/zulu/packages/test-uuid-12447'
+ );
+ expect(spyPackageDetails).toHaveBeenCalledTimes(1);
+ });
+
+ it('skips checksum verification when sha256_hash is missing or malformed', async () => {
+ spyPackageDetails.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {}
+ });
+
+ const distribution = new ZuluDistribution({
+ version: '',
+ architecture: 'arm64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData;
+ const result = await distribution['findPackageForDownload']('21.0.2');
+
+ expect(result.checksum).toBeUndefined();
+ expect(core.debug).toHaveBeenCalledWith(
+ expect.stringContaining('No authoritative sha256 checksum')
+ );
});
it('should throw an error', async () => {
@@ -228,6 +347,6 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData;
await expect(
distribution['findPackageForDownload'](distribution['version'])
- ).rejects.toThrow(/Could not find satisfied version for semver */);
+ ).rejects.toThrow(/No matching version found for SemVer/);
});
});
diff --git a/__tests__/distributors/zulu-windows-installer.test.ts b/__tests__/distributors/zulu-windows-installer.test.ts
index a3511ac90..c90890d5a 100644
--- a/__tests__/distributors/zulu-windows-installer.test.ts
+++ b/__tests__/distributors/zulu-windows-installer.test.ts
@@ -1,29 +1,77 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import type {IZuluVersions} from '../../src/distributions/zulu/models.js';
import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
-import {ZuluDistribution} from '../../src/distributions/zulu/installer';
-import {IZuluVersions} from '../../src/distributions/zulu/models';
-import * as utils from '../../src/util';
import os from 'os';
-import manifestData from '../data/zulu-windows.json';
+import manifestData from '../data/zulu-windows.json' with {type: 'json'};
+
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const real_util_module = await import('../../src/util.js');
+jest.unstable_mockModule('../../src/util.js', () => ({
+ ...real_util_module,
+ getDownloadArchiveExtension: jest.fn()
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const {ZuluDistribution} =
+ await import('../../src/distributions/zulu/installer.js');
+const utils = await import('../../src/util.js');
describe('getAvailableVersions', () => {
- let spyHttpClient: jest.SpyInstance;
- let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
+ let spyHttpClient: any;
+ let spyCoreError: any;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
- result: manifestData as IZuluVersions[]
+ result: [] as IZuluVersions[]
});
- spyUtilGetDownloadArchiveExtension = jest.spyOn(
- utils,
- 'getDownloadArchiveExtension'
+ (utils.getDownloadArchiveExtension as jest.Mock).mockReturnValue(
+ 'zip'
);
- spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
+
+ // Mock core.error to suppress error logs
+ spyCoreError = core.error as jest.Mock;
+ spyCoreError.mockImplementation(() => {});
});
afterEach(() => {
@@ -40,7 +88,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -49,7 +97,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=i686&release_status=ea&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -58,7 +106,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -67,7 +115,7 @@ describe('getAvailableVersions', () => {
packageType: 'jre',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
+ '?os=windows&archive_type=zip&java_package_type=jre&javafx_bundled=false&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -76,7 +124,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk+fx',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=true&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -85,7 +133,16 @@ describe('getAvailableVersions', () => {
packageType: 'jre+fx',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
+ '?os=windows&archive_type=zip&java_package_type=jre&javafx_bundled=true&crac_supported=false&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
+ ],
+ [
+ {
+ version: '8',
+ architecture: 'x64',
+ packageType: 'jdk+crac',
+ checkLatest: false
+ },
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=true&arch=x64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -94,7 +151,7 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=aarch64&release_status=ga&availability_types=ca&page=1&page_size=100'
],
[
{
@@ -103,12 +160,12 @@ describe('getAvailableVersions', () => {
packageType: 'jdk',
checkLatest: false
},
- '?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
+ '?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=arm&release_status=ga&availability_types=ca&page=1&page_size=100'
]
])('build correct url for %s -> %s', async (input, parsedUrl) => {
const distribution = new ZuluDistribution(input);
distribution['getPlatformOption'] = () => 'windows';
- const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`;
+ const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/${parsedUrl}`;
await distribution['getAvailableVersions']();
@@ -116,16 +173,12 @@ describe('getAvailableVersions', () => {
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
- type DistroArch = {
- bitness: string;
- arch: string;
- };
it.each([
- ['amd64', {bitness: '64', arch: 'x86'}],
- ['arm64', {bitness: '64', arch: 'arm'}]
+ ['amd64', 'x64'],
+ ['arm64', 'aarch64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
- async (osArch: string, distroArch: DistroArch) => {
+ async (osArch: string, distroArch: string) => {
jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType);
@@ -137,7 +190,7 @@ describe('getAvailableVersions', () => {
checkLatest: false
});
distribution['getPlatformOption'] = () => 'windows';
- const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
+ const buildUrl = `https://api.azul.com/metadata/v1/zulu/packages/?os=windows&archive_type=zip&java_package_type=jdk&javafx_bundled=false&crac_supported=false&arch=${distroArch}&release_status=ga&availability_types=ca&page=1&page_size=100`;
await distribution['getAvailableVersions']();
@@ -147,6 +200,18 @@ describe('getAvailableVersions', () => {
);
it('load available versions', async () => {
+ spyHttpClient
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: manifestData as IZuluVersions[]
+ })
+ .mockReturnValueOnce({
+ statusCode: 200,
+ headers: {},
+ result: [] as IZuluVersions[]
+ });
+
const distribution = new ZuluDistribution({
version: '11',
architecture: 'x86',
@@ -160,10 +225,11 @@ describe('getAvailableVersions', () => {
describe('getArchitectureOptions', () => {
it.each([
- [{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}],
- [{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}],
- [{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}],
- [{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}]
+ [{architecture: 'x64'}, 'x64'],
+ [{architecture: 'x86'}, 'i686'],
+ [{architecture: 'aarch64'}, 'aarch64'],
+ [{architecture: 'arm64'}, 'aarch64'],
+ [{architecture: 'arm'}, 'arm']
])('%s -> %s', (input, expected) => {
const distribution = new ZuluDistribution({
version: '11',
@@ -171,11 +237,31 @@ describe('getArchitectureOptions', () => {
packageType: 'jdk',
checkLatest: false
});
- expect(distribution['getArchitectureOptions']()).toEqual(expected);
+ expect(distribution['getArchitectureOptions']()).toBe(expected);
});
});
describe('findPackageForDownload', () => {
+ let spyPackageDetails: any;
+
+ const ZULU_CHECKSUM = 'a'.repeat(64);
+
+ beforeEach(() => {
+ // The resolved winning package fetches sha256_hash from the Azul
+ // package-details endpoint; stub it so tests never reach the real
+ // network.
+ spyPackageDetails = jest.spyOn(HttpClient.prototype, 'getJson');
+ spyPackageDetails.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {sha256_hash: ZULU_CHECKSUM}
+ });
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
it.each([
['8', '8.0.282+8'],
['11.x', '11.0.10+9'],
@@ -214,6 +300,38 @@ describe('findPackageForDownload', () => {
expect(result.url).toBe(
'https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip'
);
+ expect(result.checksum).toEqual({
+ algorithm: 'sha256',
+ value: ZULU_CHECKSUM,
+ source: 'https://api.azul.com/metadata/v1/zulu/packages/test-uuid-12446'
+ });
+ // Only the winning package's UUID triggers a details request.
+ expect(spyPackageDetails).toHaveBeenCalledWith(
+ 'https://api.azul.com/metadata/v1/zulu/packages/test-uuid-12446'
+ );
+ expect(spyPackageDetails).toHaveBeenCalledTimes(1);
+ });
+
+ it('skips checksum verification when sha256_hash is missing or malformed', async () => {
+ spyPackageDetails.mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {sha256_hash: '123'}
+ });
+
+ const distribution = new ZuluDistribution({
+ version: '',
+ architecture: 'arm64',
+ packageType: 'jdk',
+ checkLatest: false
+ });
+ distribution['getAvailableVersions'] = async () => manifestData;
+ const result = await distribution['findPackageForDownload']('17.0.10');
+
+ expect(result.checksum).toBeUndefined();
+ expect(core.debug).toHaveBeenCalledWith(
+ expect.stringContaining('No authoritative sha256 checksum')
+ );
});
it('should throw an error', async () => {
@@ -226,6 +344,6 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData;
await expect(
distribution['findPackageForDownload'](distribution['version'])
- ).rejects.toThrow(/Could not find satisfied version for semver */);
+ ).rejects.toThrow(/No matching version found for SemVer/);
});
});
diff --git a/__tests__/entrypoints.test.ts b/__tests__/entrypoints.test.ts
new file mode 100644
index 000000000..1fc07dd08
--- /dev/null
+++ b/__tests__/entrypoints.test.ts
@@ -0,0 +1,87 @@
+import {afterAll, beforeAll, describe, expect, it} from '@jest/globals';
+import {spawnSync} from 'child_process';
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+import {fileURLToPath, pathToFileURL} from 'url';
+
+const dist = fileURLToPath(new URL('../dist/', import.meta.url));
+let tempDir: string;
+let linkedDist: string;
+
+beforeAll(() => {
+ tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-java-entrypoints-'));
+ linkedDist = path.join(tempDir, 'linked # dist');
+ fs.symlinkSync(dist, linkedDist, 'junction');
+});
+
+afterAll(() => {
+ fs.rmSync(tempDir, {recursive: true, force: true});
+});
+
+function execute(args: string[], input?: string) {
+ return spawnSync(process.execPath, args, {
+ encoding: 'utf8',
+ input,
+ timeout: 10000,
+ env: {
+ PATH: process.env.PATH,
+ SystemRoot: process.env.SystemRoot
+ }
+ });
+}
+
+describe.each([
+ ['setup', 1, 'java-version or java-version-file input expected'],
+ ['cleanup', 0, '']
+] as const)('%s entrypoint', (name, exitCode, output) => {
+ it.each(['direct', 'symlink', 'preserved symlink'])(
+ 'executes through a %s path',
+ mode => {
+ const entry = path.join(
+ mode === 'direct' ? dist : linkedDist,
+ name,
+ 'index.js'
+ );
+ const args =
+ mode === 'preserved symlink'
+ ? ['--preserve-symlinks-main', entry]
+ : [entry];
+ const result = execute(args);
+
+ expect(result.error).toBeUndefined();
+ expect(result.status).toBe(exitCode);
+ expect(result.stderr).toBe('');
+ expect(result.stdout).not.toContain('skipping the execution');
+ if (output) {
+ expect(result.stdout).toContain(output);
+ } else {
+ expect(result.stdout).toBe('');
+ }
+ }
+ );
+
+ it.each(['eval', 'stdin', 'file'])(
+ 'does not execute when imported from %s',
+ mode => {
+ const moduleUrl = pathToFileURL(path.join(dist, name, 'index.js')).href;
+ const source = `const {run} = await import(${JSON.stringify(moduleUrl)}); console.log(typeof run);`;
+ const importer = path.join(tempDir, `${name}-importer.mjs`);
+ fs.writeFileSync(importer, source);
+ const args =
+ mode === 'file'
+ ? [importer]
+ : mode === 'eval'
+ ? ['--input-type=module', '-e', source]
+ : ['--input-type=module', '-'];
+ const result = execute(args, mode === 'stdin' ? source : undefined);
+
+ expect(result.error).toBeUndefined();
+ expect(result.status).toBe(0);
+ expect(result.stderr).toBe('');
+ expect(result.stdout).toContain('skipping the execution');
+ expect(result.stdout).toContain('function');
+ expect(result.stdout).not.toContain('::error::');
+ }
+ );
+});
diff --git a/__tests__/gpg.test.ts b/__tests__/gpg.test.ts
index 1c981b3f5..93c4593a6 100644
--- a/__tests__/gpg.test.ts
+++ b/__tests__/gpg.test.ts
@@ -1,20 +1,49 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterAll,
+ afterEach
+} from '@jest/globals';
+import {fileURLToPath} from 'url';
+import * as fs from 'fs';
+import * as os from 'os';
import * as path from 'path';
import * as io from '@actions/io';
-import * as exec from '@actions/exec';
-import * as gpg from '../src/gpg';
-jest.mock('@actions/exec', () => {
- return {
- exec: jest.fn()
- };
-});
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const mockTmpDir = jest.fn(os.tmpdir);
+
+jest.unstable_mockModule('os', () => ({
+ ...os,
+ default: {...os, tmpdir: mockTmpDir},
+ tmpdir: mockTmpDir
+}));
+
+jest.unstable_mockModule('@actions/exec', () => ({
+ exec: jest.fn()
+}));
+
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ downloadTool: jest.fn()
+}));
+
+const exec = await import('@actions/exec');
+const tc = await import('@actions/tool-cache');
+const gpg = await import('../src/gpg.js');
const tempDir = path.join(__dirname, 'runner', 'temp');
process.env['RUNNER_TEMP'] = tempDir;
describe('gpg tests', () => {
beforeEach(async () => {
+ await io.rmRF(tempDir);
await io.mkdirP(tempDir);
+ jest.clearAllMocks();
+ mockTmpDir.mockImplementation(os.tmpdir);
+ (exec.exec as jest.Mock).mockResolvedValue(0);
});
afterAll(async () => {
@@ -25,31 +54,338 @@ describe('gpg tests', () => {
}
});
+ describe('toGpgPath', () => {
+ const originalPlatform = process.platform;
+
+ afterEach(() => {
+ Object.defineProperty(process, 'platform', {value: originalPlatform});
+ });
+
+ it('returns path unchanged on non-Windows platforms', () => {
+ Object.defineProperty(process, 'platform', {value: 'linux'});
+ expect(gpg.toGpgPath('/tmp/some/path')).toBe('/tmp/some/path');
+ expect(gpg.toGpgPath('D:\\a\\_temp\\file')).toBe('D:\\a\\_temp\\file');
+ });
+
+ it('converts Windows backslashes and drive letter to POSIX path on Windows', () => {
+ Object.defineProperty(process, 'platform', {value: 'win32'});
+ expect(gpg.toGpgPath('D:\\a\\_temp\\gpg-home')).toBe(
+ '/d/a/_temp/gpg-home'
+ );
+ expect(
+ gpg.toGpgPath('C:\\Users\\runner\\AppData\\Local\\Temp\\key.asc')
+ ).toBe('/c/Users/runner/AppData/Local/Temp/key.asc');
+ });
+
+ it('handles uppercase and lowercase drive letters on Windows', () => {
+ Object.defineProperty(process, 'platform', {value: 'win32'});
+ expect(gpg.toGpgPath('d:\\a\\_temp\\file')).toBe('/d/a/_temp/file');
+ });
+ });
+
describe('importKey', () => {
- it('attempts to import private key and returns null key id on failure', async () => {
+ it('imports private keys into a unique isolated GPG home', async () => {
const privateKey = 'KEY CONTENTS';
- const keyId = await gpg.importKey(privateKey);
+ let privateKeyFile = '';
+ (exec.exec as jest.Mock).mockImplementation(
+ async (_command: string, _args: string[]) => {
+ const [createdGpgHome] = fs.readdirSync(tempDir);
+ privateKeyFile = path.join(
+ tempDir,
+ createdGpgHome,
+ fs
+ .readdirSync(path.join(tempDir, createdGpgHome))
+ .find(file => file.startsWith('private-key-')) ?? ''
+ );
+ expect(fs.readFileSync(privateKeyFile, 'utf8')).toBe(privateKey);
+ if (process.platform !== 'win32') {
+ expect(fs.statSync(privateKeyFile).mode & 0o777).toBe(0o600);
+ }
+ return 0;
+ }
+ );
- expect(keyId).toBeNull();
+ const gpgHome = await gpg.importKey(privateKey);
+ expect(path.dirname(gpgHome)).toBe(tempDir);
+ expect(path.basename(gpgHome).startsWith(gpg.GPG_HOME_PREFIX)).toBe(true);
+ expect(fs.existsSync(gpgHome)).toBe(true);
+ expect(fs.existsSync(privateKeyFile)).toBe(false);
+ if (process.platform !== 'win32') {
+ expect(fs.statSync(gpgHome).mode & 0o777).toBe(0o700);
+ }
expect(exec.exec).toHaveBeenCalledWith(
'gpg',
- expect.anything(),
- expect.anything()
+ [
+ '--homedir',
+ gpg.toGpgPath(gpgHome),
+ '--batch',
+ '--import',
+ gpg.toGpgPath(privateKeyFile)
+ ],
+ {silent: true}
);
});
+
+ it('removes the private-key file and isolated home when import fails', async () => {
+ let gpgHome = '';
+ let privateKeyFile = '';
+ (exec.exec as jest.Mock).mockImplementation(
+ async (_command: string, _args: string[]) => {
+ const [createdGpgHome] = fs.readdirSync(tempDir);
+ gpgHome = path.join(tempDir, createdGpgHome);
+ privateKeyFile = path.join(
+ gpgHome,
+ fs
+ .readdirSync(gpgHome)
+ .find(file => file.startsWith('private-key-')) ?? ''
+ );
+ expect(fs.existsSync(privateKeyFile)).toBe(true);
+ throw new Error('invalid key');
+ }
+ );
+
+ await expect(gpg.importKey('INVALID KEY')).rejects.toThrow('invalid key');
+
+ expect(fs.existsSync(privateKeyFile)).toBe(false);
+ expect(fs.existsSync(gpgHome)).toBe(false);
+ });
+
+ it('imports multi-key input without parsing or deleting fingerprints', async () => {
+ const privateKeys = 'KEY ONE\nKEY TWO';
+ (exec.exec as jest.Mock).mockImplementation(
+ async (_command: string, _args: string[]) => {
+ const [createdGpgHome] = fs.readdirSync(tempDir);
+ const keyFile = fs
+ .readdirSync(path.join(tempDir, createdGpgHome))
+ .find(file => file.startsWith('private-key-'));
+ expect(
+ fs.readFileSync(
+ path.join(tempDir, createdGpgHome, keyFile ?? ''),
+ 'utf8'
+ )
+ ).toBe(privateKeys);
+ return 0;
+ }
+ );
+
+ const gpgHome = await gpg.importKey(privateKeys);
+
+ expect(gpgHome).toContain(gpg.GPG_HOME_PREFIX);
+ expect(exec.exec).toHaveBeenCalledTimes(1);
+ expect((exec.exec as jest.Mock).mock.calls[0][1]).not.toContain(
+ '--delete-secret-and-public-key'
+ );
+ });
+
+ it('uses a separate GPG home for each invocation', async () => {
+ const firstGpgHome = await gpg.importKey('FIRST KEY');
+ const secondGpgHome = await gpg.importKey('SECOND KEY');
+
+ expect(firstGpgHome).not.toBe(secondGpgHome);
+ expect(fs.existsSync(firstGpgHome)).toBe(true);
+ expect(fs.existsSync(secondGpgHome)).toBe(true);
+ });
});
- describe('deleteKey', () => {
- it('deletes private key', async () => {
- const keyId = 'asdfhjkl';
- await gpg.deleteKey(keyId);
+ describe('removeGpgHome', () => {
+ it('removes only action-owned GPG homes and is idempotent', async () => {
+ const gpgHome = await gpg.importKey('KEY CONTENTS');
+ const unrelatedGpgHome = path.join(tempDir, 'user-gpg-home');
+ fs.mkdirSync(unrelatedGpgHome);
- expect(exec.exec).toHaveBeenCalledWith(
+ await gpg.removeGpgHome(gpgHome);
+ await gpg.removeGpgHome(gpgHome);
+
+ expect(exec.exec).toHaveBeenNthCalledWith(
+ 2,
+ 'gpgconf',
+ ['--homedir', gpg.toGpgPath(gpgHome), '--kill', 'gpg-agent'],
+ {silent: true, ignoreReturnCode: true}
+ );
+ expect(exec.exec).toHaveBeenCalledTimes(2);
+ expect(fs.existsSync(gpgHome)).toBe(false);
+ expect(fs.existsSync(unrelatedGpgHome)).toBe(true);
+ });
+
+ it('removes the GPG home when gpgconf is unavailable', async () => {
+ const gpgHome = await gpg.importKey('KEY CONTENTS');
+ (exec.exec as jest.Mock).mockRejectedValueOnce(
+ new Error('gpgconf not found')
+ );
+
+ await gpg.removeGpgHome(gpgHome);
+
+ expect(fs.existsSync(gpgHome)).toBe(false);
+ });
+
+ it('refuses to remove a GPG home it does not own', async () => {
+ const unrelatedGpgHome = path.join(tempDir, 'user-gpg-home');
+ fs.mkdirSync(unrelatedGpgHome, {recursive: true});
+
+ await expect(gpg.removeGpgHome(unrelatedGpgHome)).rejects.toThrow(
+ 'Refusing to remove unexpected GPG home'
+ );
+ expect(fs.existsSync(unrelatedGpgHome)).toBe(true);
+ });
+ });
+
+ describe('verifyPackageSignature', () => {
+ describe.each(['long', 'canonical macOS'])('%s TMPDIR', tempDirKind => {
+ afterEach(() => {
+ process.env['RUNNER_TEMP'] = tempDir;
+ });
+
+ it.each([
+ 'success',
+ 'import failure',
+ 'verification failure',
+ 'gpgconf unavailable'
+ ])(
+ 'uses a short macOS home or RUNNER_TEMP elsewhere and cleans up after %s',
+ async outcome => {
+ const longRunnerTemp = path.join(
+ tempDir,
+ 'long-runner-path-'.repeat(8)
+ );
+ const signaturePath = path.join(tempDir, 'jdk.tar.gz.sig');
+ const expectedParent =
+ process.platform === 'darwin' ? '/tmp' : longRunnerTemp;
+ let gpgHome = '';
+ process.env['RUNNER_TEMP'] = longRunnerTemp;
+ mockTmpDir.mockReturnValue(
+ tempDirKind === 'long'
+ ? longRunnerTemp
+ : `/private/var/folders/ab/${'c'.repeat(31)}/T`
+ );
+ fs.mkdirSync(longRunnerTemp, {recursive: true});
+ fs.writeFileSync(signaturePath, 'signature');
+ (tc.downloadTool as jest.Mock).mockResolvedValue(signaturePath);
+ (exec.exec as jest.Mock).mockImplementation(
+ async (command: string, args: string[]) => {
+ gpgHome = path.join(expectedParent, path.posix.basename(args[1]));
+ expect(args[1]).toBe(gpg.toGpgPath(gpgHome));
+ if (command === 'gpgconf') {
+ expect(fs.existsSync(gpgHome)).toBe(true);
+ if (outcome === 'gpgconf unavailable') {
+ throw new Error('gpgconf unavailable');
+ }
+ return 0;
+ }
+ if (process.platform === 'darwin') {
+ expect(
+ Buffer.byteLength(path.join(gpgHome, 'S.gpg-agent.browser'))
+ ).toBeLessThan(104);
+ }
+ expect(
+ fs.readFileSync(path.join(gpgHome, 'public-key-0.asc'), 'utf8')
+ ).toBe('public key');
+ if (process.platform !== 'win32') {
+ expect(fs.statSync(gpgHome).mode & 0o777).toBe(0o700);
+ }
+ if (
+ (outcome === 'import failure' && args.includes('--import')) ||
+ (outcome === 'verification failure' &&
+ args.includes('--verify'))
+ ) {
+ throw new Error(outcome);
+ }
+ return 0;
+ }
+ );
+
+ const verification = gpg.verifyPackageSignature(
+ path.join(tempDir, 'jdk.tar.gz'),
+ 'https://example.com/jdk.tar.gz.sig',
+ 'public key'
+ );
+ if (outcome === 'success' || outcome === 'gpgconf unavailable') {
+ await verification;
+ } else {
+ await expect(verification).rejects.toThrow(outcome);
+ }
+ expect(exec.exec).toHaveBeenCalledTimes(
+ outcome === 'import failure' ? 2 : 3
+ );
+ expect(exec.exec).toHaveBeenLastCalledWith(
+ 'gpgconf',
+ ['--homedir', gpg.toGpgPath(gpgHome), '--kill', 'gpg-agent'],
+ {silent: true, ignoreReturnCode: true}
+ );
+ expect(fs.existsSync(gpgHome)).toBe(false);
+ expect(fs.existsSync(signaturePath)).toBe(false);
+ expect(fs.readdirSync(longRunnerTemp)).toEqual([]);
+ }
+ );
+ });
+
+ it('imports bundled key and verifies package', async () => {
+ const publicKeyContent =
+ '-----BEGIN PGP PUBLIC KEY BLOCK-----\ntest\n-----END PGP PUBLIC KEY BLOCK-----';
+ (tc.downloadTool as jest.Mock).mockResolvedValue(
+ '/tmp/jdk.tar.gz.sig'
+ );
+ await gpg.verifyPackageSignature(
+ '/tmp/jdk.tar.gz',
+ 'https://example.com/jdk.tar.gz.sig',
+ publicKeyContent
+ );
+
+ expect(tc.downloadTool).toHaveBeenCalledWith(
+ 'https://example.com/jdk.tar.gz.sig'
+ );
+ expect(exec.exec).toHaveBeenNthCalledWith(
+ 1,
+ 'gpg',
+ [
+ '--homedir',
+ expect.any(String),
+ '--batch',
+ '--import',
+ expect.stringContaining('public-key-0.asc')
+ ],
+ expect.objectContaining({silent: true})
+ );
+ expect(exec.exec).toHaveBeenNthCalledWith(
+ 2,
+ 'gpg',
+ [
+ '--homedir',
+ expect.any(String),
+ '--batch',
+ '--verify',
+ '/tmp/jdk.tar.gz.sig',
+ '/tmp/jdk.tar.gz'
+ ],
+ expect.objectContaining({silent: true})
+ );
+ });
+
+ it('imports multiple bundled keys before verifying the package', async () => {
+ (tc.downloadTool as jest.Mock).mockResolvedValue(
+ '/tmp/jdk.tar.gz.sig'
+ );
+
+ await gpg.verifyPackageSignature(
+ '/tmp/jdk.tar.gz',
+ 'https://example.com/jdk.tar.gz.sig',
+ ['public-key-a', 'public-key-b']
+ );
+
+ expect(exec.exec).toHaveBeenNthCalledWith(
+ 1,
'gpg',
- expect.anything(),
- expect.anything()
+ [
+ '--homedir',
+ expect.any(String),
+ '--batch',
+ '--import',
+ expect.stringContaining('public-key-0.asc'),
+ expect.stringContaining('public-key-1.asc')
+ ],
+ expect.objectContaining({silent: true})
);
+ expect(exec.exec).toHaveBeenCalledTimes(3);
});
});
});
diff --git a/__tests__/is-main-module.test.ts b/__tests__/is-main-module.test.ts
new file mode 100644
index 000000000..42a5a2572
--- /dev/null
+++ b/__tests__/is-main-module.test.ts
@@ -0,0 +1,52 @@
+import {afterEach, beforeEach, describe, expect, it, jest} from '@jest/globals';
+import fs from 'fs';
+import {isMainModule} from '../src/is-main-module.js';
+
+describe('main module detection', () => {
+ const originalArgv = process.argv;
+
+ beforeEach(() => {
+ process.argv = [process.execPath, 'entrypoint.js'];
+ });
+
+ afterEach(() => {
+ process.argv = originalArgv;
+ jest.restoreAllMocks();
+ });
+
+ it.each([undefined, '-'])(
+ 'skips filesystem access when argv[1] is %s',
+ entrypoint => {
+ process.argv =
+ entrypoint === undefined
+ ? [process.execPath]
+ : [process.execPath, entrypoint];
+ const realpath = jest.spyOn(fs, 'realpathSync');
+
+ expect(isMainModule(import.meta.url)).toBe(false);
+ expect(realpath).not.toHaveBeenCalled();
+ }
+ );
+
+ it.each(['ENOENT', 'ENOTDIR'])(
+ 'treats a non-file entrypoint returning %s as an import',
+ code => {
+ jest.spyOn(fs, 'realpathSync').mockImplementation(() => {
+ throw Object.assign(new Error('No file-based entrypoint'), {code});
+ });
+
+ expect(isMainModule(import.meta.url)).toBe(false);
+ }
+ );
+
+ it('propagates unexpected filesystem errors', () => {
+ const error = Object.assign(new Error('Permission denied'), {
+ code: 'EACCES'
+ });
+ jest.spyOn(fs, 'realpathSync').mockImplementation(() => {
+ throw error;
+ });
+
+ expect(() => isMainModule(import.meta.url)).toThrow(error);
+ });
+});
diff --git a/__tests__/java-package-contract.test.ts b/__tests__/java-package-contract.test.ts
new file mode 100644
index 000000000..457b0a491
--- /dev/null
+++ b/__tests__/java-package-contract.test.ts
@@ -0,0 +1,82 @@
+import fs from 'fs';
+import path from 'path';
+import {
+ JAVA_PACKAGE_CAPABILITIES,
+ JavaDistribution
+} from '../src/distributions/package-types.js';
+
+const repositoryRoot = process.cwd();
+const readRepositoryFile = (filePath: string) =>
+ fs.readFileSync(path.join(repositoryRoot, filePath), 'utf8');
+const allPackageTypes = [
+ ...new Set(Object.values(JAVA_PACKAGE_CAPABILITIES).flat())
+];
+
+describe('java-package published contract', () => {
+ it.each(['action.yml', 'README.md'])(
+ 'documents every supported package type in %s',
+ filePath => {
+ const content = readRepositoryFile(filePath);
+ const contractLine =
+ filePath === 'action.yml'
+ ? content.match(/ {2}java-package:\n(?: {4}.+\n)+/)?.[0]
+ : content
+ .split('\n')
+ .find(line => line.includes('| `java-package` |'));
+
+ expect(contractLine).toBeDefined();
+ for (const packageType of allPackageTypes) {
+ expect(contractLine).toContain(`\`${packageType}\``);
+ }
+ }
+ );
+
+ it.each(Object.entries(JAVA_PACKAGE_CAPABILITIES))(
+ 'keeps the advanced compatibility table aligned for %s',
+ (distributionName, packageTypes) => {
+ const advancedUsage = readRepositoryFile('docs/advanced-usage.md');
+ const compatibilityTable = advancedUsage.slice(
+ advancedUsage.indexOf('### Package compatibility')
+ );
+ const compatibilityRow = compatibilityTable
+ .split('\n')
+ .find(
+ line =>
+ line.startsWith('|') && line.includes(`\`${distributionName}\``)
+ );
+
+ expect(compatibilityRow).toBeDefined();
+ for (const packageType of packageTypes) {
+ expect(compatibilityRow).toContain(`\`${packageType}\``);
+ }
+ }
+ );
+
+ it('only exercises supported distribution/package combinations in E2E', () => {
+ const workflow = readRepositoryFile('.github/workflows/e2e-versions.yml');
+ const defaultMatrix = workflow.match(
+ /distribution:\s*\n\s*\[([^\]]+)\]\s*\n\s*java-package:\s*\['([^']+)'\]/
+ );
+ expect(defaultMatrix).not.toBeNull();
+
+ const defaultDistributions = [
+ ...defaultMatrix![1].matchAll(/'([^']+)'/g)
+ ].map(match => match[1]);
+ const defaultPackage = defaultMatrix![2];
+ for (const distributionName of defaultDistributions) {
+ expect(supportedPackagesFor(distributionName)).toContain(defaultPackage);
+ }
+
+ const includedPackages = workflow.matchAll(
+ /- distribution: '([^']+)'\s*\n\s*java-package: ([^\s]+)/g
+ );
+ for (const match of includedPackages) {
+ const [, distributionName, packageType] = match;
+ expect(supportedPackagesFor(distributionName)).toContain(packageType);
+ }
+ });
+});
+
+function supportedPackagesFor(distributionName: string): readonly string[] {
+ return JAVA_PACKAGE_CAPABILITIES[distributionName as JavaDistribution] ?? [];
+}
diff --git a/__tests__/java-platform-contract.test.ts b/__tests__/java-platform-contract.test.ts
new file mode 100644
index 000000000..6dd9784f8
--- /dev/null
+++ b/__tests__/java-platform-contract.test.ts
@@ -0,0 +1,196 @@
+import fs from 'fs';
+import path from 'path';
+import {
+ getJavaPlatformIdentity,
+ isAlpineLinux,
+ JAVA_PLATFORM_CAPABILITIES,
+ normalizeArchitecture,
+ validateJavaPlatform
+} from '../src/distributions/platform-types.js';
+import {JavaDistribution} from '../src/distributions/package-types.js';
+
+describe('Java platform capabilities', () => {
+ it('declares a capability for every distribution', () => {
+ expect(Object.keys(JAVA_PLATFORM_CAPABILITIES).sort()).toEqual(
+ Object.values(JavaDistribution).sort()
+ );
+ });
+
+ it.each([
+ ['x64', 'x64'],
+ ['amd64', 'x64'],
+ ['x86', 'x86'],
+ ['ia32', 'x86'],
+ ['arm', 'armv7'],
+ ['aarch64', 'aarch64'],
+ ['arm64', 'aarch64'],
+ ['ppc64le', 'ppc64le'],
+ ['RiScV64', 'riscv64'],
+ ['s390x', 's390x']
+ ])('normalizes architecture %s to %s', (input, expected) => {
+ expect(normalizeArchitecture(input)).toBe(expected);
+ });
+
+ it.each(['constructor', 'Constructor'])(
+ 'preserves custom architecture token %s for jdkfile',
+ architecture => {
+ expect(normalizeArchitecture(architecture)).toBe(architecture);
+ expect(validateJavaPlatform('jdkfile', 'linux', architecture, '17')).toBe(
+ architecture
+ );
+ }
+ );
+
+ it.each([
+ 'x64< {
+ const message = `Unsupported architecture value: ${JSON.stringify(architecture)}`;
+
+ expect(() => normalizeArchitecture(architecture)).toThrow(message);
+ expect(() =>
+ validateJavaPlatform('jdkfile', 'linux', architecture, '17')
+ ).toThrow(message);
+ });
+
+ it.each([
+ ['linux', false, 'linux-glibc'],
+ ['linux', true, 'linux-musl'],
+ ['darwin', false, 'macos'],
+ ['win32', false, 'windows'],
+ // Exercises the normalizePlatform alias path and the `?? platform`
+ // fallback for a platform that has no Java alias.
+ ['sunos', false, 'solaris'],
+ ['aix', false, 'aix']
+ ] as const)(
+ 'identifies %s with Alpine release %s as %s',
+ (platform, alpineReleaseExists, expected) => {
+ expect(getJavaPlatformIdentity(platform, alpineReleaseExists)).toBe(
+ expected
+ );
+ }
+ );
+
+ // The platform check has to short-circuit before the filesystem probe, so a
+ // stray /etc/alpine-release can never make a non-Linux runner look like musl.
+ it.each([
+ ['linux', true, true],
+ ['linux', false, false],
+ ['darwin', true, false],
+ ['win32', true, false]
+ ] as const)(
+ 'treats %s with Alpine release %s as Alpine: %s',
+ (platform, alpineReleaseExists, expected) => {
+ expect(isAlpineLinux(platform, alpineReleaseExists)).toBe(expected);
+ }
+ );
+
+ it('uses the normalized architecture for validation', () => {
+ expect(validateJavaPlatform('microsoft', 'linux', 'arm64', '25')).toBe(
+ 'aarch64'
+ );
+ });
+
+ it('allows Temurin on Linux riscv64', () => {
+ expect(validateJavaPlatform('temurin', 'linux', 'riscv64', '25')).toBe(
+ 'riscv64'
+ );
+ });
+
+ it('rejects OS-specific restrictions with a consistent diagnostic', () => {
+ expect(() =>
+ validateJavaPlatform('oracle', 'win32', 'arm64', '21')
+ ).toThrow(
+ "Distribution 'oracle' does not support operating system 'windows' with architecture 'aarch64' for Java version '21'. Supported combinations: linux (x64, aarch64); macos (x64, aarch64); windows (x64)."
+ );
+ });
+
+ it('rejects version-dependent architecture restrictions', () => {
+ expect(() =>
+ validateJavaPlatform('corretto', 'linux', 'x86', '17')
+ ).toThrow(/x86 \(<12\)/);
+ expect(() =>
+ validateJavaPlatform('corretto', 'linux', 'x86', '17.0.2.8.1')
+ ).toThrow(/x86 \(<12\)/);
+ expect(validateJavaPlatform('corretto', 'linux', 'x86', '11')).toBe('x86');
+ });
+
+ it.each(['corretto', 'kona'])(
+ 'rejects Windows aarch64 for %s',
+ distributionName => {
+ expect(() =>
+ validateJavaPlatform(distributionName, 'win32', 'arm64', '21')
+ ).toThrow(/does not support operating system 'windows'/);
+ }
+ );
+
+ it('allows local archives on any platform and architecture', () => {
+ expect(validateJavaPlatform('jdkfile', 'aix', 'mips64', '21')).toBe(
+ 'mips64'
+ );
+ });
+
+ it('keeps the documented architecture contract aligned', () => {
+ const repositoryRoot = process.cwd();
+ const readRepositoryFile = (filePath: string) =>
+ fs.readFileSync(path.join(repositoryRoot, filePath), 'utf8');
+
+ for (const filePath of ['action.yml', 'README.md']) {
+ const content = readRepositoryFile(filePath);
+ for (const architecture of [
+ 'x86',
+ 'x64',
+ 'armv7',
+ 'aarch64',
+ 'ppc64le',
+ 'ppc64',
+ 'riscv64',
+ 's390x'
+ ]) {
+ expect(content).toContain(architecture);
+ }
+ }
+ });
+
+ it.each(Object.entries(JAVA_PLATFORM_CAPABILITIES))(
+ 'keeps the advanced compatibility table aligned for %s',
+ (distributionName, capability) => {
+ const advancedUsage = fs.readFileSync(
+ path.join(process.cwd(), 'docs/advanced-usage.md'),
+ 'utf8'
+ );
+ const compatibilityTable = advancedUsage.slice(
+ advancedUsage.indexOf('## Platform and architecture compatibility')
+ );
+ const compatibilityRow = compatibilityTable
+ .split('\n')
+ .find(
+ line =>
+ line.startsWith('|') && line.includes(`\`${distributionName}\``)
+ );
+
+ expect(compatibilityRow).toBeDefined();
+ if (!('platforms' in capability)) {
+ expect(compatibilityRow).toContain('Any');
+ return;
+ }
+
+ const architectures = new Set(
+ Object.values(capability.platforms)
+ .flat()
+ .map(item => (typeof item === 'string' ? item : item.architecture))
+ );
+ for (const architecture of architectures) {
+ expect(compatibilityRow).toContain(`\`${architecture}\``);
+ }
+ }
+ );
+});
diff --git a/__tests__/jdk-cache.test.ts b/__tests__/jdk-cache.test.ts
new file mode 100644
index 000000000..c5c3c4fb9
--- /dev/null
+++ b/__tests__/jdk-cache.test.ts
@@ -0,0 +1,352 @@
+import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+
+jest.unstable_mockModule('@actions/cache', () => ({
+ restoreCache: jest.fn(),
+ saveCache: jest.fn(),
+ ReserveCacheError: class ReserveCacheError extends Error {
+ constructor(message: string) {
+ super(message);
+ this.name = 'ReserveCacheError';
+ }
+ }
+}));
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/cache-feature.js', () => ({
+ isCacheFeatureAvailable: jest.fn()
+}));
+
+const cache = await import('@actions/cache');
+const core = await import('@actions/core');
+const cacheFeature = await import('../src/cache-feature.js');
+const {
+ buildJdkCacheKey,
+ getJdkVerificationIdentity,
+ registerJdk,
+ restoreJdk,
+ saveJdkCaches
+} = await import('../src/jdk-cache.js');
+
+const jdk = {
+ distribution: 'temurin',
+ packageType: 'jdk',
+ architecture: 'x64',
+ version: '21.0.8+9',
+ source: 'sha256:abc123',
+ verification: 'disabled',
+ path: '/toolcache/Java_temurin_jdk/21.0.8-9'
+};
+
+describe('JDK cache', () => {
+ const tempRoots: string[] = [];
+
+ const createInstallation = (marker = 'a'): string => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-java-jdk-'));
+ tempRoots.push(root);
+ const jdkPath = path.join(root, 'Java_temurin_jdk', '21.0.8-9');
+ writeInstallation(jdkPath, marker);
+ return jdkPath;
+ };
+
+ const writeInstallation = (jdkPath: string, marker: string): void => {
+ const architecturePath = path.join(jdkPath, 'x64');
+ fs.rmSync(architecturePath, {recursive: true, force: true});
+ fs.rmSync(`${architecturePath}.complete`, {force: true});
+ fs.mkdirSync(path.join(architecturePath, 'bin'), {recursive: true});
+ fs.writeFileSync(path.join(architecturePath, 'bin', 'java'), marker);
+ fs.writeFileSync(`${architecturePath}.complete`, marker);
+ };
+
+ const lastState = (): string =>
+ ((core.saveState as jest.Mock).mock.calls.at(-1) as string[])[1];
+
+ beforeEach(() => {
+ jest.resetAllMocks();
+ (cacheFeature.isCacheFeatureAvailable as jest.Mock).mockReturnValue(true);
+ process.env['RUNNER_OS'] = 'Linux';
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ delete process.env['RUNNER_OS'];
+ while (tempRoots.length) {
+ fs.rmSync(tempRoots.pop()!, {recursive: true, force: true});
+ }
+ });
+
+ it('builds distinct keys for incompatible JDK identities', () => {
+ const key = buildJdkCacheKey(jdk);
+
+ expect(key).toMatch(/^setup-java-jdk-v1-Linux-x64-[a-f0-9]{64}$/);
+ expect(buildJdkCacheKey({...jdk, architecture: 'aarch64'})).not.toBe(key);
+ expect(buildJdkCacheKey({...jdk, distribution: 'zulu'})).not.toBe(key);
+ expect(buildJdkCacheKey({...jdk, packageType: 'jre'})).not.toBe(key);
+ expect(buildJdkCacheKey({...jdk, version: '21.0.7+6'})).not.toBe(key);
+ expect(buildJdkCacheKey({...jdk, source: 'sha256:def456'})).not.toBe(key);
+ });
+
+ it('preserves canonical runner OS values and separates operating systems', () => {
+ process.env['RUNNER_OS'] = 'Linux';
+ const linux = buildJdkCacheKey(jdk);
+ process.env['RUNNER_OS'] = 'Windows';
+ const windows = buildJdkCacheKey(jdk);
+ process.env['RUNNER_OS'] = 'macOS';
+ const macos = buildJdkCacheKey(jdk);
+
+ expect(new Set([linux, windows, macos])).toHaveProperty('size', 3);
+ expect(linux).toMatch(/^setup-java-jdk-v1-Linux-x64-/);
+ expect(windows).toMatch(/^setup-java-jdk-v1-Windows-x64-/);
+ expect(macos).toMatch(/^setup-java-jdk-v1-macOS-x64-/);
+ });
+
+ it('falls back to process.platform without RUNNER_OS', () => {
+ delete process.env['RUNNER_OS'];
+
+ expect(buildJdkCacheKey(jdk)).toMatch(
+ new RegExp(`^setup-java-jdk-v1-${process.platform}-x64-`)
+ );
+ });
+
+ it('separates verification policies and keys', () => {
+ const disabled = getJdkVerificationIdentity(false, false);
+ const checkAndWarnBundled = getJdkVerificationIdentity(true, false);
+ const enforcedBundled = getJdkVerificationIdentity(true, true);
+ const customA = getJdkVerificationIdentity(
+ true,
+ true,
+ '-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nkey-a\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n'
+ );
+ const customANormalized = getJdkVerificationIdentity(
+ true,
+ true,
+ '-----BEGIN PGP PUBLIC KEY BLOCK-----\nkey-a\n-----END PGP PUBLIC KEY BLOCK-----'
+ );
+ const customB = getJdkVerificationIdentity(true, true, 'different-key');
+ const checkAndWarnCustomA = getJdkVerificationIdentity(
+ true,
+ false,
+ '-----BEGIN PGP PUBLIC KEY BLOCK-----\nkey-a\n-----END PGP PUBLIC KEY BLOCK-----'
+ );
+ const customList = getJdkVerificationIdentity(true, true, [
+ 'key-a',
+ 'key-b'
+ ]);
+ const customListWithDifferentBoundary = getJdkVerificationIdentity(
+ true,
+ true,
+ ['key-ak', 'ey-b']
+ );
+
+ expect(
+ new Set([
+ disabled,
+ checkAndWarnBundled,
+ enforcedBundled,
+ customA,
+ customB
+ ])
+ ).toHaveProperty('size', 5);
+ expect(disabled).toBe('disabled');
+ expect(checkAndWarnBundled).toBe('check-and-warn:bundled');
+ expect(enforcedBundled).toBe('enforced:bundled');
+ expect(checkAndWarnCustomA).not.toBe(customA);
+ expect(customA).toBe(customANormalized);
+ expect(customA).not.toContain('key-a');
+ expect(customList).not.toBe(customListWithDifferentBoundary);
+ expect(
+ new Set(
+ [disabled, checkAndWarnBundled, enforcedBundled, customA, customB].map(
+ verification => buildJdkCacheKey({...jdk, verification})
+ )
+ )
+ ).toHaveProperty('size', 5);
+ });
+
+ it('restores and records an exact JDK cache hit', async () => {
+ (cache.restoreCache as jest.Mock).mockResolvedValue(buildJdkCacheKey(jdk));
+ jest.spyOn(fs, 'existsSync').mockReturnValue(true);
+
+ await expect(restoreJdk(jdk)).resolves.toBe(true);
+
+ expect(cache.restoreCache).toHaveBeenCalledWith(
+ [jdk.path],
+ buildJdkCacheKey(jdk)
+ );
+ const architecturePath = path.join(jdk.path, 'x64');
+ expect(fs.existsSync).toHaveBeenCalledWith(architecturePath);
+ expect(fs.existsSync).toHaveBeenCalledWith(`${architecturePath}.complete`);
+ expect(core.saveState).toHaveBeenCalledWith(
+ 'jdk-caches',
+ expect.stringContaining(buildJdkCacheKey(jdk))
+ );
+ });
+
+ it('falls back to download when restoration fails', async () => {
+ (cache.restoreCache as jest.Mock).mockRejectedValue(
+ new Error('cache unavailable')
+ );
+
+ await expect(restoreJdk(jdk)).resolves.toBe(false);
+ expect(core.warning).toHaveBeenCalledWith(
+ 'Failed to restore JDK cache: cache unavailable'
+ );
+ });
+
+ it('saves a downloaded JDK registered after installation', async () => {
+ const jdkPath = createInstallation();
+ const installed = {...jdk, path: jdkPath};
+ const key = buildJdkCacheKey(installed);
+ (cache.restoreCache as jest.Mock).mockResolvedValue(undefined);
+
+ await restoreJdk(installed);
+ registerJdk(installed);
+ (core.getState as jest.Mock).mockReturnValue(lastState());
+ (cache.saveCache as jest.Mock).mockResolvedValue(1);
+
+ await saveJdkCaches();
+
+ expect(cache.saveCache).toHaveBeenCalledWith([jdkPath], key);
+ });
+
+ it('does not save an installation that was replaced after registration', async () => {
+ const jdkPath = createInstallation();
+ const installed = {...jdk, path: jdkPath};
+ const key = buildJdkCacheKey(installed);
+
+ registerJdk(installed);
+ (core.getState as jest.Mock).mockReturnValue(lastState());
+ writeInstallation(jdkPath, 'replaced-by-a-later-step');
+
+ await saveJdkCaches();
+
+ expect(cache.saveCache).not.toHaveBeenCalledWith([jdkPath], key);
+ expect(core.warning).toHaveBeenCalledWith(
+ expect.stringContaining('was replaced after it was registered')
+ );
+ });
+
+ it('saves only the key matching the installation that occupies the path', async () => {
+ const jdkPath = createInstallation();
+ const enforced = {...jdk, path: jdkPath, verification: 'enforced:bundled'};
+ const disabled = {...jdk, path: jdkPath};
+
+ registerJdk(enforced);
+ writeInstallation(jdkPath, 'force-downloaded-without-verification');
+ registerJdk(disabled);
+ (core.getState as jest.Mock).mockReturnValue(lastState());
+ (cache.saveCache as jest.Mock).mockResolvedValue(1);
+
+ await saveJdkCaches();
+
+ expect(cache.saveCache).not.toHaveBeenCalledWith(
+ [jdkPath],
+ buildJdkCacheKey(enforced)
+ );
+ expect(cache.saveCache).toHaveBeenCalledWith(
+ [jdkPath],
+ buildJdkCacheKey(disabled)
+ );
+ });
+
+ it('does not save a path that was never registered as installed', async () => {
+ const jdkPath = createInstallation();
+ const installed = {...jdk, path: jdkPath};
+ (cache.restoreCache as jest.Mock).mockResolvedValue(undefined);
+
+ await restoreJdk(installed);
+ (core.getState as jest.Mock).mockReturnValue(lastState());
+
+ await saveJdkCaches();
+
+ expect(cache.saveCache).not.toHaveBeenCalledWith(
+ [jdkPath],
+ buildJdkCacheKey(installed)
+ );
+ });
+
+ it('keeps saving the remaining JDK caches when one save fails', async () => {
+ const failingPath = createInstallation();
+ const succeedingPath = createInstallation();
+ const failing = {...jdk, path: failingPath};
+ const succeeding = {...jdk, path: succeedingPath, version: '17.0.19+9'};
+
+ registerJdk(failing);
+ registerJdk(succeeding);
+ (core.getState as jest.Mock).mockReturnValue(lastState());
+ (cache.saveCache as jest.Mock).mockImplementation(
+ async (paths: unknown) => {
+ if ((paths as string[])[0] === failingPath) {
+ throw new Error('cache service unavailable');
+ }
+ return 1;
+ }
+ );
+
+ await expect(saveJdkCaches()).resolves.toBeUndefined();
+
+ expect(cache.saveCache).toHaveBeenCalledWith(
+ [succeedingPath],
+ buildJdkCacheKey(succeeding)
+ );
+ expect(core.warning).toHaveBeenCalledWith(
+ expect.stringContaining('cache service unavailable')
+ );
+ expect(core.info).toHaveBeenCalledWith(
+ `JDK cache saved with the key: ${buildJdkCacheKey(succeeding)}`
+ );
+ });
+
+ it('reports a reserved cache key without failing the remaining saves', async () => {
+ const reservedPath = createInstallation();
+ const reserved = {...jdk, path: reservedPath};
+
+ registerJdk(reserved);
+ (core.getState as jest.Mock).mockReturnValue(lastState());
+ (cache.saveCache as jest.Mock).mockRejectedValue(
+ new cache.ReserveCacheError('Unable to reserve cache')
+ );
+
+ await expect(saveJdkCaches()).resolves.toBeUndefined();
+
+ expect(core.info).toHaveBeenCalledWith('Unable to reserve cache');
+ });
+
+ it('registers a force-downloaded JDK without restoring it', () => {
+ const jdkPath = createInstallation();
+ registerJdk({...jdk, path: jdkPath});
+
+ expect(cache.restoreCache).not.toHaveBeenCalled();
+ expect(core.saveState).toHaveBeenCalledWith(
+ 'jdk-caches',
+ expect.stringContaining(buildJdkCacheKey({...jdk, path: jdkPath}))
+ );
+ });
+
+ it('does not save an exact JDK cache hit again', async () => {
+ const key = buildJdkCacheKey(jdk);
+ (core.getState as jest.Mock).mockReturnValue(
+ JSON.stringify([
+ {
+ key,
+ path: jdk.path,
+ architecture: jdk.architecture,
+ matchedKey: key
+ }
+ ])
+ );
+
+ await saveJdkCaches();
+
+ expect(cache.saveCache).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/jdk-resolution-cache.test.ts b/__tests__/jdk-resolution-cache.test.ts
new file mode 100644
index 000000000..9c6703fc6
--- /dev/null
+++ b/__tests__/jdk-resolution-cache.test.ts
@@ -0,0 +1,416 @@
+import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+
+jest.unstable_mockModule('@actions/cache', () => ({
+ isFeatureAvailable: jest.fn(),
+ restoreCache: jest.fn(),
+ saveCache: jest.fn()
+}));
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn()
+}));
+
+const cache = await import('@actions/cache');
+const core = await import('@actions/core');
+const {restoreJdkResolution, registerJdkResolution, saveJdkResolutionCaches} =
+ await import('../src/jdk-resolution-cache.js');
+
+const request = {
+ distribution: 'Temurin-Hotspot',
+ packageType: 'jdk',
+ platform: 'linux-glibc',
+ architecture: 'x64',
+ versionSpec: '21',
+ stable: true
+};
+
+const release = {
+ version: '21.0.8+9',
+ url: 'https://example.com/jdk-21.0.8.tar.gz',
+ checksum: {algorithm: 'sha256' as const, value: 'abc123'}
+};
+
+const WEEK = 7 * 24 * 60 * 60 * 1000;
+const bucket = () =>
+ new Date(Math.floor(Date.now() / WEEK) * WEEK).toISOString().slice(0, 10);
+
+describe('JDK resolution cache', () => {
+ const tempRoots: string[] = [];
+ let originalTemp: string | undefined;
+ let originalOs: string | undefined;
+
+ const createRunnerTemp = (): string => {
+ const root = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-java-res-'));
+ tempRoots.push(root);
+ process.env['RUNNER_TEMP'] = root;
+ return root;
+ };
+
+ /** Emulates the cache service materializing the entry at the requested path. */
+ const restoreWith = (contents: string, matchedKey: string) => {
+ jest
+ .mocked(cache.restoreCache)
+ .mockImplementation(async (paths: string[]) => {
+ fs.mkdirSync(paths[0], {recursive: true});
+ fs.writeFileSync(path.join(paths[0], 'release.json'), contents);
+ return matchedKey;
+ });
+ };
+
+ beforeEach(() => {
+ originalTemp = process.env['RUNNER_TEMP'];
+ originalOs = process.env['RUNNER_OS'];
+ process.env['RUNNER_OS'] = 'Linux';
+ jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
+ jest.mocked(cache.restoreCache).mockResolvedValue(undefined);
+ jest.mocked(cache.saveCache).mockResolvedValue(1);
+ jest.mocked(core.getState).mockReturnValue('');
+ });
+
+ afterEach(() => {
+ process.env['RUNNER_TEMP'] = originalTemp;
+ process.env['RUNNER_OS'] = originalOs;
+ if (originalTemp === undefined) {
+ delete process.env['RUNNER_TEMP'];
+ }
+ if (originalOs === undefined) {
+ delete process.env['RUNNER_OS'];
+ }
+ while (tempRoots.length > 0) {
+ fs.rmSync(tempRoots.pop()!, {recursive: true, force: true});
+ }
+ jest.resetAllMocks();
+ });
+
+ describe('restoreJdkResolution', () => {
+ it('looks the entry up with a bucket-independent path', async () => {
+ const runnerTemp = createRunnerTemp();
+ await restoreJdkResolution(request);
+
+ const [paths, primaryKey, restoreKeys] = jest.mocked(cache.restoreCache)
+ .mock.calls[0] as [string[], string, string[]];
+ expect(paths).toHaveLength(1);
+ expect(
+ paths[0].startsWith(path.join(runnerTemp, 'setup-java-jdk-resolution'))
+ ).toBe(true);
+ expect(paths[0]).not.toContain(bucket());
+ expect(primaryKey).toBe(`${restoreKeys[0]}${bucket()}`);
+ expect(restoreKeys[0]).toMatch(
+ /^setup-java-jdkres-v2-Linux-x64-[0-9a-f]{64}-$/
+ );
+ });
+
+ it('separates glibc and musl Linux resolutions', async () => {
+ createRunnerTemp();
+ await restoreJdkResolution(request);
+ const [glibcPaths, glibcKey] = jest.mocked(cache.restoreCache).mock
+ .calls[0] as [string[], string];
+
+ await restoreJdkResolution({...request, platform: 'linux-musl'});
+ const [muslPaths, muslKey] = jest.mocked(cache.restoreCache).mock
+ .calls[1] as [string[], string];
+
+ expect(muslKey).not.toBe(glibcKey);
+ expect(muslPaths).not.toEqual(glibcPaths);
+ });
+
+ it('holds the key steady for a week and then rolls it', async () => {
+ createRunnerTemp();
+ const nowSpy = jest.spyOn(Date, 'now');
+ const keyAt = async (ms: number) => {
+ nowSpy.mockReturnValue(ms);
+ await restoreJdkResolution(request);
+ return jest.mocked(cache.restoreCache).mock.calls.at(-1)![1] as string;
+ };
+
+ // A window boundary, so the offsets below are unambiguous.
+ const windowStart = 2900 * WEEK;
+
+ const start = await keyAt(windowStart);
+ const sameWindow = await keyAt(windowStart + 6 * 24 * 60 * 60 * 1000);
+ const nextWindow = await keyAt(windowStart + WEEK);
+
+ expect(sameWindow).toBe(start);
+ expect(nextWindow).not.toBe(start);
+ nowSpy.mockRestore();
+ });
+
+ it('reports a hit on the current bucket as fresh', async () => {
+ createRunnerTemp();
+ const key = `setup-java-jdkres-v2-Linux-x64-${'0'.repeat(64)}-${bucket()}`;
+ restoreWith(JSON.stringify(release), key);
+
+ // The key the module computes is the one it passes to restoreCache, so
+ // echo it back to emulate an exact hit.
+ jest
+ .mocked(cache.restoreCache)
+ .mockImplementation(async (paths: string[], primaryKey: string) => {
+ fs.mkdirSync(paths[0], {recursive: true});
+ fs.writeFileSync(
+ path.join(paths[0], 'release.json'),
+ JSON.stringify(release)
+ );
+ return primaryKey;
+ });
+
+ const restored = await restoreJdkResolution(request);
+ expect(restored?.fresh).toBe(true);
+ expect(restored?.release).toEqual(release);
+ });
+
+ it('reports a hit on an older bucket as stale', async () => {
+ createRunnerTemp();
+ restoreWith(JSON.stringify(release), 'setup-java-jdkres-v2-old');
+
+ const restored = await restoreJdkResolution(request);
+ expect(restored?.fresh).toBe(false);
+ expect(restored?.release).toEqual(release);
+ });
+
+ it('returns nothing when the entry is missing', async () => {
+ createRunnerTemp();
+ await expect(restoreJdkResolution(request)).resolves.toBeUndefined();
+ });
+
+ it('returns nothing when the cache service is unavailable', async () => {
+ createRunnerTemp();
+ jest.mocked(cache.isFeatureAvailable).mockReturnValue(false);
+
+ await expect(restoreJdkResolution(request)).resolves.toBeUndefined();
+ expect(cache.restoreCache).not.toHaveBeenCalled();
+ });
+
+ it('returns nothing when RUNNER_TEMP is not set', async () => {
+ delete process.env['RUNNER_TEMP'];
+
+ await expect(restoreJdkResolution(request)).resolves.toBeUndefined();
+ expect(cache.restoreCache).not.toHaveBeenCalled();
+ });
+
+ it('does not fail the job when the restore throws', async () => {
+ createRunnerTemp();
+ jest
+ .mocked(cache.restoreCache)
+ .mockRejectedValue(new Error('service unavailable'));
+
+ await expect(restoreJdkResolution(request)).resolves.toBeUndefined();
+ });
+
+ it.each([
+ ['malformed JSON', 'not json'],
+ ['a non-object payload', '"nope"'],
+ [
+ 'a missing version',
+ JSON.stringify({url: 'https://example.com/a.tar.gz'})
+ ],
+ ['a missing url', JSON.stringify({version: '21.0.8+9'})],
+ [
+ 'a non-HTTPS url',
+ JSON.stringify({
+ version: '21.0.8+9',
+ url: 'http://example.com/a.tar.gz'
+ })
+ ],
+ [
+ 'a malformed url',
+ JSON.stringify({version: '21.0.8+9', url: 'not-a-url'})
+ ],
+ [
+ 'a non-HTTPS signature url',
+ JSON.stringify({
+ version: '21.0.8+9',
+ url: 'https://example.com/a.tar.gz',
+ signatureUrl: 'http://example.com/a.sig'
+ })
+ ],
+ [
+ 'an unsupported checksum algorithm',
+ JSON.stringify({
+ version: '21.0.8+9',
+ url: 'https://example.com/a.tar.gz',
+ checksum: {algorithm: 'md5', value: 'abc'}
+ })
+ ],
+ [
+ 'a checksum without a value',
+ JSON.stringify({
+ version: '21.0.8+9',
+ url: 'https://example.com/a.tar.gz',
+ checksum: {algorithm: 'sha256'}
+ })
+ ]
+ ])('rejects an entry with %s', async (_name, contents) => {
+ createRunnerTemp();
+ restoreWith(contents, 'setup-java-jdkres-v2-old');
+
+ await expect(restoreJdkResolution(request)).resolves.toBeUndefined();
+ });
+
+ it('keeps the optional fields of a valid entry', async () => {
+ createRunnerTemp();
+ const full = {
+ version: '21.0.8+9',
+ url: 'https://example.com/a.tar.gz',
+ signatureUrl: 'https://example.com/a.sig',
+ checksum: {
+ algorithm: 'sha512',
+ value: 'def456',
+ source: 'https://example.com/a.sha512'
+ },
+ floating: true
+ };
+ restoreWith(JSON.stringify(full), 'setup-java-jdkres-v2-old');
+
+ const restored = await restoreJdkResolution(request);
+ expect(restored?.release).toEqual(full);
+ });
+
+ it('ignores unknown fields rather than passing them through', async () => {
+ createRunnerTemp();
+ restoreWith(
+ JSON.stringify({...release, evil: 'payload'}),
+ 'setup-java-jdkres-v2-old'
+ );
+
+ const restored = await restoreJdkResolution(request);
+ expect(restored?.release).toEqual(release);
+ });
+ });
+
+ describe('registerJdkResolution', () => {
+ it('writes the release and records it under the current bucket', () => {
+ createRunnerTemp();
+ registerJdkResolution(request, release);
+
+ const state = JSON.parse(
+ jest.mocked(core.saveState).mock.calls.at(-1)![1] as string
+ );
+ const entry = state.at(-1);
+ expect(entry.key.endsWith(bucket())).toBe(true);
+ expect(
+ JSON.parse(
+ fs.readFileSync(path.join(entry.path, 'release.json'), 'utf8')
+ )
+ ).toEqual(release);
+ });
+
+ it('does nothing when the cache service is unavailable', () => {
+ createRunnerTemp();
+ jest.mocked(cache.isFeatureAvailable).mockReturnValue(false);
+
+ registerJdkResolution(request, release);
+ expect(core.saveState).not.toHaveBeenCalled();
+ });
+
+ it('does nothing when RUNNER_TEMP is not set', () => {
+ delete process.env['RUNNER_TEMP'];
+
+ registerJdkResolution(request, release);
+ expect(core.saveState).not.toHaveBeenCalled();
+ });
+
+ it('uses different keys for different requests', () => {
+ createRunnerTemp();
+ registerJdkResolution(request, release);
+ registerJdkResolution({...request, distribution: 'zulu'}, release);
+
+ const state = JSON.parse(
+ jest.mocked(core.saveState).mock.calls.at(-1)![1] as string
+ );
+ expect(new Set(state.map((item: {key: string}) => item.key)).size).toBe(
+ state.length
+ );
+ });
+
+ it('uses different keys for different floating artifact identities', () => {
+ createRunnerTemp();
+ registerJdkResolution({...request, source: 'sha256:first'}, release);
+ registerJdkResolution({...request, source: 'sha256:second'}, release);
+
+ const state = JSON.parse(
+ jest.mocked(core.saveState).mock.calls.at(-1)![1] as string
+ );
+ expect(new Set(state.map((item: {key: string}) => item.key)).size).toBe(
+ state.length
+ );
+ });
+ });
+
+ describe('saveJdkResolutionCaches', () => {
+ const stateFor = (cachePath: string) =>
+ JSON.stringify([
+ {
+ key: 'setup-java-jdkres-v2-key',
+ path: cachePath,
+ release: JSON.stringify(release)
+ }
+ ]);
+
+ it('does nothing without state', async () => {
+ await saveJdkResolutionCaches();
+ expect(cache.saveCache).not.toHaveBeenCalled();
+ });
+
+ it('saves a recorded entry', async () => {
+ const root = createRunnerTemp();
+ jest.mocked(core.getState).mockReturnValue(stateFor(root));
+
+ await saveJdkResolutionCaches();
+ expect(cache.saveCache).toHaveBeenCalledWith(
+ [root],
+ 'setup-java-jdkres-v2-key'
+ );
+ });
+
+ it('saves the payload the key was computed for, not the file on disk', async () => {
+ const root = createRunnerTemp();
+ jest.mocked(core.getState).mockReturnValue(stateFor(root));
+ // A restore performed by a later step replaces the file behind the key.
+ fs.writeFileSync(
+ path.join(root, 'release.json'),
+ JSON.stringify({version: '8.0.1+1', url: 'https://example.com/stale'})
+ );
+
+ await saveJdkResolutionCaches();
+
+ expect(
+ JSON.parse(fs.readFileSync(path.join(root, 'release.json'), 'utf8'))
+ ).toEqual(release);
+ expect(cache.saveCache).toHaveBeenCalled();
+ });
+
+ it('does not fail the job when the payload cannot be written', async () => {
+ const root = createRunnerTemp();
+ const blocked = path.join(root, 'blocked');
+ fs.writeFileSync(blocked, 'not a directory');
+ jest.mocked(core.getState).mockReturnValue(stateFor(blocked));
+
+ await expect(saveJdkResolutionCaches()).resolves.toBeUndefined();
+ expect(cache.saveCache).not.toHaveBeenCalled();
+ });
+
+ it('does not fail the job when the save throws', async () => {
+ const root = createRunnerTemp();
+ jest.mocked(core.getState).mockReturnValue(stateFor(root));
+ jest
+ .mocked(cache.saveCache)
+ .mockRejectedValue(new Error('already reserved'));
+
+ await expect(saveJdkResolutionCaches()).resolves.toBeUndefined();
+ });
+
+ it('does not fail the job on invalid state', async () => {
+ jest.mocked(core.getState).mockReturnValue('{}');
+
+ await expect(saveJdkResolutionCaches()).resolves.toBeUndefined();
+ expect(cache.saveCache).not.toHaveBeenCalled();
+ });
+ });
+});
diff --git a/__tests__/latest-versions-report.test.ts b/__tests__/latest-versions-report.test.ts
new file mode 100644
index 000000000..1f2cba123
--- /dev/null
+++ b/__tests__/latest-versions-report.test.ts
@@ -0,0 +1,361 @@
+import {afterEach, describe, expect, it, jest} from '@jest/globals';
+import {HttpClient} from '@actions/http-client';
+import {JavaBase} from '../src/distributions/base-installer.js';
+import {
+ classifyResolutionError,
+ getDefaultVersions,
+ getSupportedArchitectures,
+ renderMarkdownReport,
+ ResolutionReport,
+ resolveLatestVersions,
+ VersionResolution
+} from '../src/reports/latest-versions.js';
+
+function result(
+ overrides: Partial &
+ Pick
+): VersionResolution {
+ return {
+ platform: 'linux',
+ architecture: 'x64',
+ status: 'resolved',
+ ...overrides
+ };
+}
+
+function report(
+ platform: string,
+ results: VersionResolution[]
+): ResolutionReport {
+ return {platform, generatedAt: '2026-11-18T06:30:00.000Z', results};
+}
+
+function tableRows(markdown: string, distribution: string): string[] {
+ const section = markdown.split(`## \`${distribution}\``)[1].split('\n## ')[0];
+ return section.split('\n').filter(line => /^\| (?!Platform|---)/.test(line));
+}
+
+describe('latest versions report', () => {
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it('includes every major from Java 6 through GA, including non-LTS releases but not EA', async () => {
+ jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {
+ most_recent_feature_release: 27,
+ most_recent_feature_version: 28,
+ most_recent_lts: 25
+ }
+ });
+
+ await expect(getDefaultVersions(new HttpClient())).resolves.toEqual([
+ '6',
+ '7',
+ '8',
+ '9',
+ '10',
+ '11',
+ '12',
+ '13',
+ '14',
+ '15',
+ '16',
+ '17',
+ '18',
+ '19',
+ '20',
+ '21',
+ '22',
+ '23',
+ '24',
+ '25',
+ '26',
+ '27',
+ 'latest'
+ ]);
+ });
+
+ it('fails rather than publishing incomplete defaults when discovery fails', async () => {
+ jest
+ .spyOn(HttpClient.prototype, 'getJson')
+ .mockRejectedValue(new Error('Java release metadata is unavailable'));
+
+ await expect(getDefaultVersions(new HttpClient())).rejects.toThrow(
+ 'Java release metadata is unavailable'
+ );
+ });
+
+ it.each([5, 27.5, Infinity])(
+ 'rejects invalid newest major %s',
+ async major => {
+ jest.spyOn(HttpClient.prototype, 'getJson').mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: {most_recent_feature_release: major}
+ });
+
+ await expect(getDefaultVersions(new HttpClient())).rejects.toThrow(
+ 'Invalid newest Java feature release'
+ );
+ }
+ );
+
+ it('resolves Solaris metadata and combines its exact builds with every other platform', async () => {
+ const getJson = jest
+ .spyOn(HttpClient.prototype, 'getJson')
+ .mockResolvedValue({
+ statusCode: 200,
+ headers: {},
+ result: [
+ {
+ downloadUrl: 'https://example.com/solaris-jdk8-old.tar.gz',
+ version: '8.0.452+9',
+ featureVersion: 8,
+ interimVersion: 0,
+ updateVersion: 452,
+ buildVersion: 9
+ },
+ {
+ downloadUrl: 'https://example.com/solaris-jdk8.tar.gz',
+ version: '8.0.462+10',
+ featureVersion: 8,
+ interimVersion: 0,
+ updateVersion: 462,
+ buildVersion: 10
+ },
+ {
+ downloadUrl: 'https://example.com/solaris-jdk9.tar.gz',
+ version: '9.0.4+11',
+ featureVersion: 9,
+ interimVersion: 0,
+ updateVersion: 4,
+ buildVersion: 11
+ }
+ ]
+ });
+ const install = jest
+ .spyOn(JavaBase.prototype, 'setupJava')
+ .mockRejectedValue(new Error('The report must not install a JDK'));
+ const network = jest
+ .spyOn(HttpClient.prototype, 'request')
+ .mockRejectedValue(
+ new Error('Only the mocked metadata request is permitted')
+ );
+ const hostPlatform = process.platform;
+ const solaris = await resolveLatestVersions({
+ distributions: ['liberica'],
+ versions: ['8', '9', '11', 'latest'],
+ platform: 'solaris'
+ });
+
+ expect(solaris.platform).toBe('solaris');
+ expect(solaris.results).toEqual([
+ result({
+ distribution: 'liberica',
+ platform: 'solaris',
+ versionSpec: '8',
+ version: '8.0.462+10'
+ }),
+ result({
+ distribution: 'liberica',
+ platform: 'solaris',
+ versionSpec: '9',
+ version: '9.0.4+11'
+ }),
+ expect.objectContaining({
+ platform: 'solaris',
+ versionSpec: '11',
+ status: 'unavailable'
+ }),
+ result({
+ distribution: 'liberica',
+ platform: 'solaris',
+ versionSpec: 'latest',
+ version: '9.0.4+11'
+ })
+ ]);
+ expect(getJson).toHaveBeenCalledTimes(1);
+ const url = new URL(getJson.mock.calls[0][0]);
+ expect(url.origin).toBe('https://api.bell-sw.com');
+ expect(Object.fromEntries(url.searchParams)).toMatchObject({
+ os: 'solaris',
+ arch: 'x86',
+ bitness: '64',
+ 'bundle-type': 'jdk',
+ 'installation-type': 'archive'
+ });
+ expect(install).not.toHaveBeenCalled();
+ expect(network).not.toHaveBeenCalled();
+ expect(process.platform).toBe(hostPlatform);
+
+ const otherReports = ['linux', 'linux-musl', 'macos', 'windows'].map(
+ (platform, index) =>
+ report(
+ platform,
+ ['8', '9', '11', 'latest'].map(versionSpec =>
+ result({
+ distribution: 'liberica',
+ platform,
+ versionSpec,
+ version: `${versionSpec === 'latest' ? '11' : versionSpec}.0.1+${index + 1}`
+ })
+ )
+ )
+ );
+ const markdown = renderMarkdownReport([solaris, ...otherReports]);
+ expect(tableRows(markdown, 'liberica')).toEqual([
+ '| Linux x64 | `8.0.1+1` | `9.0.1+1` | `11.0.1+1` | `11.0.1+1` |',
+ '| Alpine Linux x64 | `8.0.1+2` | `9.0.1+2` | `11.0.1+2` | `11.0.1+2` |',
+ '| macOS x64 | `8.0.1+3` | `9.0.1+3` | `11.0.1+3` | `11.0.1+3` |',
+ '| Windows x64 | `8.0.1+4` | `9.0.1+4` | `11.0.1+4` | `11.0.1+4` |',
+ '| Solaris x64 | `8.0.462+10` | `9.0.4+11` | — | `9.0.4+11` |'
+ ]);
+ expect(markdown).not.toContain('Needs attention');
+ expect(markdown).not.toContain('Not checked');
+ });
+
+ it('classifies missing releases separately from lookup failures', () => {
+ const notFound = new Error("No matching version found for SemVer '8'.");
+ notFound.name = 'VersionNotFoundError';
+
+ expect(classifyResolutionError(notFound)).toBe('unavailable');
+ expect(
+ classifyResolutionError(
+ new Error('Oracle JDK is only supported for JDK 17 and later')
+ )
+ ).toBe('unavailable');
+ expect(
+ classifyResolutionError(
+ new Error(
+ 'No Kona release for the specified version "27" on OS "macos" and arch "aarch64".'
+ )
+ )
+ ).toBe('unavailable');
+ expect(classifyResolutionError(new Error('socket hang up'))).toBe('error');
+ });
+
+ it('resolves Alpine with the Linux architectures, including version-restricted ones', () => {
+ expect(getSupportedArchitectures('redhat', 'linux-musl')).toEqual([
+ 'x64',
+ 'aarch64',
+ 'ppc64le'
+ ]);
+ expect(getSupportedArchitectures('dragonwell', 'macos')).toEqual([]);
+ });
+
+ it('lists the exact version for every platform, ordered by operating system and architecture', () => {
+ const markdown = renderMarkdownReport([
+ report('macos', [
+ result({
+ distribution: 'temurin',
+ versionSpec: '21',
+ platform: 'macos',
+ architecture: 'aarch64',
+ version: '21.0.13+100000002.0.LTS'
+ })
+ ]),
+ report('linux', [
+ result({
+ distribution: 'temurin',
+ versionSpec: '21',
+ architecture: 's390x',
+ version: '21.0.12+7'
+ }),
+ result({
+ distribution: 'temurin',
+ versionSpec: '21',
+ version: '21.0.13+9'
+ })
+ ]),
+ report('linux-musl', [
+ result({
+ distribution: 'temurin',
+ versionSpec: '21',
+ platform: 'linux-musl',
+ version: '21.0.13+9'
+ })
+ ])
+ ]);
+
+ expect(tableRows(markdown, 'temurin')).toEqual([
+ '| Linux x64 | `21.0.13+9` |',
+ '| Linux s390x | `21.0.12+7` |',
+ '| Alpine Linux x64 | `21.0.13+9` |',
+ '| macOS aarch64 | `21.0.13+100000002.0.LTS` |'
+ ]);
+ expect(markdown).not.toContain('Needs attention');
+ expect(markdown).toContain(
+ 'Not checked, because no runner reported these platforms: Windows (x64, x86, aarch64).'
+ );
+ });
+
+ it('distinguishes unsupported, unpublished, and floating releases', () => {
+ const markdown = renderMarkdownReport([
+ report('linux', [
+ result({
+ distribution: 'redhat',
+ versionSpec: '11',
+ architecture: 'aarch64',
+ version: '11.0.29'
+ }),
+ result({
+ distribution: 'redhat',
+ versionSpec: '25',
+ architecture: 'aarch64',
+ status: 'unsupported'
+ }),
+ result({
+ distribution: 'oracle',
+ versionSpec: '11',
+ status: 'unavailable'
+ }),
+ result({
+ distribution: 'oracle',
+ versionSpec: '25',
+ version: '25',
+ floating: true,
+ advertisedVersion: '25.0.5.1',
+ publishedAt: '2026-10-27'
+ })
+ ])
+ ]);
+
+ expect(tableRows(markdown, 'redhat')).toEqual([
+ '| Linux aarch64 | `11.0.29` | n/a |'
+ ]);
+ expect(tableRows(markdown, 'oracle')).toEqual([
+ '| Linux x64 | — | `25.0.5.1` ¹ (published 2026-10-27) |'
+ ]);
+ expect(markdown).toContain('¹ Major-only requests download');
+ });
+
+ it('reports lookup errors and distributions that resolved nothing', () => {
+ const markdown = renderMarkdownReport([
+ report('linux', [
+ result({
+ distribution: 'oracle-openjdk',
+ versionSpec: '25',
+ status: 'unavailable'
+ }),
+ result({
+ distribution: 'zulu',
+ versionSpec: '25',
+ status: 'error',
+ message: 'socket hang up\nstack'
+ })
+ ])
+ ]);
+
+ expect(markdown).toContain('## `oracle-openjdk` ❗');
+ expect(tableRows(markdown, 'zulu')).toEqual(['| Linux x64 | ❗ error |']);
+ expect(markdown).toContain(
+ '| `oracle-openjdk` | all | all | No release matched any requested version'
+ );
+ expect(markdown).toContain(
+ '| `zulu` | `25` | Linux x64 | socket hang up |'
+ );
+ });
+});
diff --git a/__tests__/maven-args.test.ts b/__tests__/maven-args.test.ts
new file mode 100644
index 000000000..4ad6acd6c
--- /dev/null
+++ b/__tests__/maven-args.test.ts
@@ -0,0 +1,130 @@
+import {afterEach, beforeEach, describe, expect, it, jest} from '@jest/globals';
+
+const mockGetInput = jest.fn<(...args: any[]) => any>();
+const mockExportVariable = jest.fn<(...args: any[]) => any>();
+const mockInfo = jest.fn<(...args: any[]) => any>();
+const mockDebug = jest.fn<(...args: any[]) => any>();
+const mockWarning = jest.fn<(...args: any[]) => any>();
+
+jest.unstable_mockModule('@actions/core', () => ({
+ getInput: mockGetInput,
+ exportVariable: mockExportVariable,
+ info: mockInfo,
+ debug: mockDebug,
+ warning: mockWarning,
+ setSecret: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ addPath: jest.fn(),
+ getMultilineInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getState: jest.fn(),
+ saveState: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn(),
+ isDebug: jest.fn(),
+ setCommandEcho: jest.fn(),
+ getIDToken: jest.fn(),
+ ExitCode: {Success: 0, Failure: 1},
+ summary: {},
+ markdownSummary: {},
+ platform: {},
+ toPosixPath: jest.fn(),
+ toWin32Path: jest.fn(),
+ toPlatformPath: jest.fn()
+}));
+
+const {configureMavenArgs} = await import('../src/maven-args.js');
+const {
+ INPUT_SHOW_DOWNLOAD_PROGRESS,
+ MAVEN_ARGS_ENV,
+ MAVEN_NO_TRANSFER_PROGRESS_FLAG
+} = await import('../src/constants.js');
+
+describe('configureMavenArgs', () => {
+ let inputs: Record;
+ const originalMavenArgs = process.env[MAVEN_ARGS_ENV];
+
+ beforeEach(() => {
+ inputs = {};
+
+ mockGetInput.mockImplementation((name: string) => inputs[name] ?? '');
+ mockExportVariable.mockImplementation((name: string, value: string) => {
+ process.env[name] = value;
+ });
+ mockInfo.mockImplementation(() => undefined);
+ mockDebug.mockImplementation(() => undefined);
+
+ delete process.env[MAVEN_ARGS_ENV];
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ if (originalMavenArgs === undefined) {
+ delete process.env[MAVEN_ARGS_ENV];
+ } else {
+ process.env[MAVEN_ARGS_ENV] = originalMavenArgs;
+ }
+ });
+
+ it('sets MAVEN_ARGS with -ntp by default', () => {
+ configureMavenArgs();
+
+ expect(mockExportVariable).toHaveBeenCalledWith(
+ MAVEN_ARGS_ENV,
+ MAVEN_NO_TRANSFER_PROGRESS_FLAG
+ );
+ expect(process.env[MAVEN_ARGS_ENV]).toBe(MAVEN_NO_TRANSFER_PROGRESS_FLAG);
+ });
+
+ it('does not modify MAVEN_ARGS when show-download-progress is true', () => {
+ inputs[INPUT_SHOW_DOWNLOAD_PROGRESS] = 'true';
+
+ configureMavenArgs();
+
+ expect(mockExportVariable).not.toHaveBeenCalled();
+ expect(process.env[MAVEN_ARGS_ENV]).toBeUndefined();
+ });
+
+ it('preserves an existing MAVEN_ARGS value and appends -ntp', () => {
+ process.env[MAVEN_ARGS_ENV] = '-B -Dstyle.color=always';
+
+ configureMavenArgs();
+
+ expect(mockExportVariable).toHaveBeenCalledWith(
+ MAVEN_ARGS_ENV,
+ `-B -Dstyle.color=always ${MAVEN_NO_TRANSFER_PROGRESS_FLAG}`
+ );
+ });
+
+ it('does not duplicate the flag when -ntp is already present', () => {
+ process.env[MAVEN_ARGS_ENV] = '-B -ntp';
+
+ configureMavenArgs();
+
+ expect(mockExportVariable).not.toHaveBeenCalled();
+ expect(process.env[MAVEN_ARGS_ENV]).toBe('-B -ntp');
+ });
+
+ it('does not duplicate the flag when --no-transfer-progress is already present', () => {
+ process.env[MAVEN_ARGS_ENV] = '--no-transfer-progress -B';
+
+ configureMavenArgs();
+
+ expect(mockExportVariable).not.toHaveBeenCalled();
+ expect(process.env[MAVEN_ARGS_ENV]).toBe('--no-transfer-progress -B');
+ });
+
+ it('keeps the existing MAVEN_ARGS when show-download-progress is true', () => {
+ inputs[INPUT_SHOW_DOWNLOAD_PROGRESS] = 'true';
+ process.env[MAVEN_ARGS_ENV] = '-B';
+
+ configureMavenArgs();
+
+ expect(mockExportVariable).not.toHaveBeenCalled();
+ expect(process.env[MAVEN_ARGS_ENV]).toBe('-B');
+ });
+});
diff --git a/__tests__/maven-xml-loading.test.ts b/__tests__/maven-xml-loading.test.ts
new file mode 100644
index 000000000..8f42e5461
--- /dev/null
+++ b/__tests__/maven-xml-loading.test.ts
@@ -0,0 +1,56 @@
+import {describe, expect, it, jest} from '@jest/globals';
+
+const mockXmlBuilderFactory = jest.fn();
+const mockParse = jest.fn(() => ({
+ toolchains: {
+ toolchain: [
+ {
+ type: 'foo',
+ provides: {id: 'custom'},
+ configuration: {fooHome: '/opt/foo'}
+ }
+ ]
+ }
+}));
+
+jest.unstable_mockModule('fast-xml-parser', () => {
+ mockXmlBuilderFactory();
+ return {
+ XMLParser: jest.fn().mockImplementation(() => ({
+ parse: mockParse
+ }))
+ };
+});
+
+const toolchains = await import('../src/toolchains.js');
+
+describe('Maven XML loading', () => {
+ it('does not load fast-xml-parser for new toolchains.xml generation', async () => {
+ const xml = await toolchains.generateToolchainDefinition(
+ '',
+ '21',
+ 'temurin',
+ 'temurin_21',
+ '/opt/java/21'
+ );
+
+ expect(xml).toContain('temurin_21');
+ expect(mockXmlBuilderFactory).not.toHaveBeenCalled();
+ expect(mockParse).not.toHaveBeenCalled();
+ });
+
+ it('loads fast-xml-parser for existing toolchains.xml merge generation', async () => {
+ await expect(
+ toolchains.generateToolchainDefinition(
+ 'foo',
+ '21',
+ 'temurin',
+ 'temurin_21',
+ '/opt/java/21'
+ )
+ ).resolves.toContain('temurin_21');
+
+ expect(mockXmlBuilderFactory).toHaveBeenCalledTimes(1);
+ expect(mockParse).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/__tests__/problem-matcher.test.ts b/__tests__/problem-matcher.test.ts
new file mode 100644
index 000000000..80258ec0b
--- /dev/null
+++ b/__tests__/problem-matcher.test.ts
@@ -0,0 +1,53 @@
+import {afterEach, beforeEach, describe, expect, it, jest} from '@jest/globals';
+
+const mockGetInput = jest.fn<(...args: any[]) => any>();
+const mockInfo = jest.fn<(...args: any[]) => any>();
+const mockDebug = jest.fn<(...args: any[]) => any>();
+
+jest.unstable_mockModule('@actions/core', () => ({
+ getInput: mockGetInput,
+ info: mockInfo,
+ debug: mockDebug,
+ warning: jest.fn(),
+ setSecret: jest.fn()
+}));
+
+const {configureProblemMatcher} = await import('../src/problem-matcher.js');
+const {INPUT_PROBLEM_MATCHER} = await import('../src/constants.js');
+
+describe('configureProblemMatcher', () => {
+ let inputs: Record;
+
+ beforeEach(() => {
+ inputs = {};
+ mockGetInput.mockImplementation((name: string) => inputs[name] ?? '');
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ });
+
+ it('does not register the Java problem matcher by default', () => {
+ configureProblemMatcher('/matchers/java.json');
+
+ expect(mockInfo).not.toHaveBeenCalled();
+ expect(mockDebug).toHaveBeenCalledWith('Java problem matcher is disabled');
+ });
+
+ it('registers the Java problem matcher when explicitly enabled', () => {
+ inputs[INPUT_PROBLEM_MATCHER] = 'true';
+
+ configureProblemMatcher('/matchers/java.json');
+
+ expect(mockInfo).toHaveBeenCalledWith('##[add-matcher]/matchers/java.json');
+ });
+
+ it('does not register the Java problem matcher when disabled', () => {
+ inputs[INPUT_PROBLEM_MATCHER] = 'false';
+
+ configureProblemMatcher('/matchers/java.json');
+
+ expect(mockInfo).not.toHaveBeenCalled();
+ expect(mockDebug).toHaveBeenCalledWith('Java problem matcher is disabled');
+ });
+});
diff --git a/__tests__/retrying-http-client.test.ts b/__tests__/retrying-http-client.test.ts
new file mode 100644
index 000000000..b9fb63db1
--- /dev/null
+++ b/__tests__/retrying-http-client.test.ts
@@ -0,0 +1,251 @@
+import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
+import type {IncomingMessage} from 'http';
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn()
+}));
+
+const core = await import('@actions/core');
+const httpm = await import('@actions/http-client');
+const {RetryingHttpClient, isRetryableNetworkError, parseRetryAfter} =
+ await import('../src/retrying-http-client.js');
+
+function response(
+ statusCode: number,
+ retryAfter?: string
+): httpm.HttpClientResponse {
+ return {
+ message: {
+ statusCode,
+ headers: retryAfter ? {'retry-after': retryAfter} : {}
+ } as IncomingMessage,
+ readBody: jest.fn(async () => '')
+ } as unknown as httpm.HttpClientResponse;
+}
+
+describe('RetryingHttpClient', () => {
+ let request: ReturnType;
+ let sleep: jest.Mock<(delayMs: number) => Promise>;
+
+ beforeEach(() => {
+ request = jest.spyOn(httpm.HttpClient.prototype, 'request');
+ sleep = jest.fn(async () => undefined);
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ jest.clearAllMocks();
+ });
+
+ it('uses exponential backoff with jitter for retryable responses', async () => {
+ request
+ .mockResolvedValueOnce(response(503))
+ .mockResolvedValueOnce(response(502))
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0,
+ baseDelayMs: 1000,
+ maxDelayMs: 10000
+ });
+
+ await expect(client.get('https://example.com')).resolves.toBeDefined();
+
+ expect(request).toHaveBeenCalledTimes(3);
+ expect(sleep).toHaveBeenNthCalledWith(1, 500);
+ expect(sleep).toHaveBeenNthCalledWith(2, 1000);
+ expect(core.info).toHaveBeenNthCalledWith(
+ 1,
+ 'Request attempt 1 of 4 failed (HTTP 503); retrying in 500 ms'
+ );
+ expect(core.info).toHaveBeenNthCalledWith(
+ 2,
+ 'Request attempt 2 of 4 failed (HTTP 502); retrying in 1000 ms'
+ );
+ });
+
+ it('honors Retry-After delta-seconds over the client delay', async () => {
+ request
+ .mockResolvedValueOnce(response(429, '3'))
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0
+ });
+
+ await client.get('https://example.com');
+
+ expect(sleep).toHaveBeenCalledWith(3000);
+ });
+
+ it('honors Retry-After HTTP dates over the client delay', async () => {
+ const now = Date.parse('2026-07-29T00:00:00Z');
+ request
+ .mockResolvedValueOnce(response(503, new Date(now + 5000).toUTCString()))
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0,
+ now: () => now
+ });
+
+ await client.get('https://example.com');
+
+ expect(sleep).toHaveBeenCalledWith(5000);
+ });
+
+ it('caps Retry-After at the configured maximum delay', async () => {
+ request
+ .mockResolvedValueOnce(response(429, '60'))
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0,
+ maxDelayMs: 10000
+ });
+
+ await client.get('https://example.com');
+
+ expect(sleep).toHaveBeenCalledWith(10000);
+ });
+
+ it.each([429, 502, 503, 504, 522])(
+ 'retries HTTP %s responses',
+ async statusCode => {
+ request
+ .mockResolvedValueOnce(response(statusCode))
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0
+ });
+
+ await client.get('https://example.com');
+
+ expect(request).toHaveBeenCalledTimes(2);
+ }
+ );
+
+ it.each(['ETIMEDOUT', 'ECONNRESET', 'ENOTFOUND', 'ECONNREFUSED'])(
+ 'retries network errors with code %s',
+ async code => {
+ request
+ .mockRejectedValueOnce(Object.assign(new Error(code), {code}))
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0
+ });
+
+ await client.get('https://example.com');
+
+ expect(request).toHaveBeenCalledTimes(2);
+ }
+ );
+
+ it('retries retryable aggregate network errors', async () => {
+ const aggregateError = Object.assign(new Error('connection failed'), {
+ errors: [Object.assign(new Error('timed out'), {code: 'ETIMEDOUT'})]
+ });
+ request
+ .mockRejectedValueOnce(aggregateError)
+ .mockResolvedValueOnce(response(200));
+ const client = new RetryingHttpClient('test', {
+ sleep,
+ random: () => 0
+ });
+
+ await client.get('https://example.com');
+
+ expect(request).toHaveBeenCalledTimes(2);
+ expect(sleep).toHaveBeenCalledWith(500);
+ });
+
+ it('does not retry non-retryable responses or network errors', async () => {
+ request.mockResolvedValueOnce(response(500));
+ const client = new RetryingHttpClient('test', {sleep});
+
+ await expect(client.get('https://example.com')).resolves.toBeDefined();
+ expect(request).toHaveBeenCalledTimes(1);
+ expect(sleep).not.toHaveBeenCalled();
+
+ request.mockRejectedValueOnce(
+ Object.assign(new Error('certificate failed'), {code: 'CERT_HAS_EXPIRED'})
+ );
+ await expect(client.get('https://example.com')).rejects.toThrow(
+ 'certificate failed'
+ );
+ expect(request).toHaveBeenCalledTimes(2);
+ expect(sleep).not.toHaveBeenCalled();
+ });
+
+ it('stops after the configured total attempt count', async () => {
+ request
+ .mockResolvedValueOnce(response(503))
+ .mockResolvedValueOnce(response(503));
+ const client = new RetryingHttpClient('test', {
+ maxAttempts: 2,
+ sleep,
+ random: () => 0
+ });
+
+ const finalResponse = await client.get('https://example.com');
+
+ expect(finalResponse.message.statusCode).toBe(503);
+ expect(request).toHaveBeenCalledTimes(2);
+ expect(sleep).toHaveBeenCalledTimes(1);
+ });
+
+ it('propagates the final network error after exhausting attempts', async () => {
+ const finalError = Object.assign(new Error('still unavailable'), {
+ code: 'ECONNREFUSED'
+ });
+ request
+ .mockRejectedValueOnce(
+ Object.assign(new Error('unavailable'), {code: 'ECONNREFUSED'})
+ )
+ .mockRejectedValueOnce(finalError);
+ const client = new RetryingHttpClient('test', {
+ maxAttempts: 2,
+ sleep,
+ random: () => 0
+ });
+
+ await expect(client.get('https://example.com')).rejects.toBe(finalError);
+
+ expect(request).toHaveBeenCalledTimes(2);
+ expect(sleep).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not retry write requests', async () => {
+ request.mockResolvedValueOnce(response(503));
+ const client = new RetryingHttpClient('test', {sleep});
+
+ await client.post('https://example.com', '{}');
+
+ expect(request).toHaveBeenCalledTimes(1);
+ expect(sleep).not.toHaveBeenCalled();
+ });
+});
+
+describe('retry classification', () => {
+ it('parses valid Retry-After values and ignores invalid or past values', () => {
+ const now = Date.parse('2026-07-29T00:00:00Z');
+
+ expect(parseRetryAfter('7', now)).toBe(7000);
+ expect(parseRetryAfter(new Date(now + 3000).toUTCString(), now)).toBe(3000);
+ expect(parseRetryAfter(new Date(now - 3000).toUTCString(), now)).toBe(
+ undefined
+ );
+ expect(parseRetryAfter('not-a-date', now)).toBe(undefined);
+ });
+
+ it('recognizes direct and nested retryable network error codes', () => {
+ expect(isRetryableNetworkError({code: 'ECONNRESET'})).toBe(true);
+ expect(
+ isRetryableNetworkError({errors: [{code: 'ENOTFOUND'}, {code: 'OTHER'}]})
+ ).toBe(true);
+ expect(isRetryableNetworkError({code: 'CERT_HAS_EXPIRED'})).toBe(false);
+ expect(isRetryableNetworkError(new Error('unknown'))).toBe(false);
+ });
+});
diff --git a/__tests__/setup-java.module-loading.test.ts b/__tests__/setup-java.module-loading.test.ts
new file mode 100644
index 000000000..e8c1e7d2e
--- /dev/null
+++ b/__tests__/setup-java.module-loading.test.ts
@@ -0,0 +1,121 @@
+import {jest, describe, it, expect, beforeEach} from '@jest/globals';
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((value: string) => value),
+ toWin32Path: jest.fn((value: string) => value),
+ toPosixPath: jest.fn((value: string) => value)
+}));
+
+jest.unstable_mockModule('fs', () => ({
+ default: {
+ ...jest.requireActual('fs'),
+ readFileSync: jest.fn()
+ }
+}));
+
+jest.unstable_mockModule('../src/util.js', () => ({
+ getBooleanInput: jest.fn(),
+ getVersionFromFileContent: jest.fn(),
+ isJdkCacheEnabled: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/toolchains.js', () => ({
+ validateToolchainIds: jest.fn(),
+ configureToolchains: jest.fn()
+}));
+
+jest.unstable_mockModule(
+ '../src/distributions/distribution-factory.js',
+ () => ({
+ getJavaDistribution: jest.fn()
+ })
+);
+
+jest.unstable_mockModule('../src/auth.js', () => ({
+ configureAuthentication: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/maven-args.js', () => ({
+ configureMavenArgs: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/problem-matcher.js', () => ({
+ configureProblemMatcher: jest.fn()
+}));
+
+// These modules should never be imported when `cache` input is empty.
+jest.unstable_mockModule('../src/cache-feature.js', () => {
+ throw new Error('cache-feature module should not be loaded');
+});
+jest.unstable_mockModule('../src/cache.js', () => {
+ throw new Error('cache module should not be loaded');
+});
+
+const core = await import('@actions/core');
+const util = await import('../src/util.js');
+const toolchains = await import('../src/toolchains.js');
+const factory = await import('../src/distributions/distribution-factory.js');
+const {run} = await import('../src/setup-java.js');
+
+describe('setup-java conditional module loading', () => {
+ const inputs = new Map();
+ const multilineInputs = new Map();
+ const booleanInputs = new Map();
+
+ beforeEach(() => {
+ jest.resetAllMocks();
+ inputs.clear();
+ multilineInputs.clear();
+ booleanInputs.clear();
+
+ (core.getInput as jest.Mock).mockImplementation((name: unknown) => {
+ return inputs.get(name as string) ?? '';
+ });
+ (core.getMultilineInput as jest.Mock).mockImplementation(
+ (name: unknown) => {
+ return multilineInputs.get(name as string) ?? [];
+ }
+ );
+ (util.getBooleanInput as jest.Mock).mockImplementation(
+ (name: unknown, defaultValue: unknown) => {
+ return booleanInputs.get(name as string) ?? defaultValue;
+ }
+ );
+ (util.isJdkCacheEnabled as jest.Mock).mockReturnValue(false);
+ (toolchains.configureToolchains as jest.Mock).mockResolvedValue(undefined);
+ });
+
+ it('does not import cache modules when cache input is not provided', async () => {
+ inputs.set('distribution', 'temurin');
+ multilineInputs.set('java-version', ['21']);
+ (factory.getJavaDistribution as jest.Mock).mockResolvedValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+
+ await run();
+
+ expect(core.setFailed).not.toHaveBeenCalled();
+ });
+});
diff --git a/__tests__/setup-java.test.ts b/__tests__/setup-java.test.ts
new file mode 100644
index 000000000..c75ead639
--- /dev/null
+++ b/__tests__/setup-java.test.ts
@@ -0,0 +1,720 @@
+import {jest, describe, it, expect, beforeEach} from '@jest/globals';
+
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((value: string) => value),
+ toWin32Path: jest.fn((value: string) => value),
+ toPosixPath: jest.fn((value: string) => value)
+}));
+
+jest.unstable_mockModule('fs', () => ({
+ default: {
+ ...jest.requireActual('fs'),
+ readFileSync: jest.fn()
+ }
+}));
+
+jest.unstable_mockModule('../src/util.js', () => ({
+ getBooleanInput: jest.fn(),
+ getVersionFromFileContent: jest.fn(),
+ isJdkCacheEnabled: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/toolchains.js', () => ({
+ validateToolchainIds: jest.fn(),
+ configureToolchains: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/toolchain-ids.js', () => ({
+ validateToolchainIds: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/cache.js', () => ({
+ restore: jest.fn(),
+ validatePackageManager: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/cache-feature.js', () => ({
+ isCacheFeatureAvailable: jest.fn()
+}));
+
+jest.unstable_mockModule(
+ '../src/distributions/distribution-factory.js',
+ () => ({
+ getJavaDistribution: jest.fn()
+ })
+);
+
+jest.unstable_mockModule('../src/auth.js', () => ({
+ configureAuthentication: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/maven-args.js', () => ({
+ configureMavenArgs: jest.fn()
+}));
+
+jest.unstable_mockModule('../src/problem-matcher.js', () => ({
+ configureProblemMatcher: jest.fn()
+}));
+
+const core = await import('@actions/core');
+const fs = (await import('fs')).default;
+const util = await import('../src/util.js');
+const toolchains = await import('../src/toolchains.js');
+const toolchainIds = await import('../src/toolchain-ids.js');
+const cache = await import('../src/cache.js');
+const cacheFeature = await import('../src/cache-feature.js');
+const factory = await import('../src/distributions/distribution-factory.js');
+const auth = await import('../src/auth.js');
+const mavenArgs = await import('../src/maven-args.js');
+const problemMatcher = await import('../src/problem-matcher.js');
+const {run} = await import('../src/setup-java.js');
+
+const inputCallsOnImport = (core.getInput as jest.Mock).mock.calls.length;
+const multilineInputCallsOnImport = (core.getMultilineInput as jest.Mock).mock
+ .calls.length;
+
+describe('setup action orchestration', () => {
+ const inputs = new Map();
+ const multilineInputs = new Map();
+ const booleanInputs = new Map();
+
+ beforeEach(() => {
+ jest.resetAllMocks();
+ inputs.clear();
+ multilineInputs.clear();
+ booleanInputs.clear();
+
+ (core.getInput as jest.Mock).mockImplementation((name: unknown) => {
+ return inputs.get(name as string) ?? '';
+ });
+ (core.getMultilineInput as jest.Mock).mockImplementation(
+ (name: unknown) => {
+ return multilineInputs.get(name as string) ?? [];
+ }
+ );
+ (util.getBooleanInput as jest.Mock).mockImplementation(
+ (name: unknown, defaultValue: unknown) => {
+ return booleanInputs.get(name as string) ?? defaultValue;
+ }
+ );
+ (util.isJdkCacheEnabled as jest.Mock).mockImplementation(
+ (cache: string) => {
+ const explicit = inputs.get('cache-jdk');
+ return explicit
+ ? (booleanInputs.get('cache-jdk') ?? explicit === 'true')
+ : Boolean(cache);
+ }
+ );
+ (cacheFeature.isCacheFeatureAvailable as jest.Mock).mockReturnValue(true);
+ (toolchainIds.validateToolchainIds as jest.Mock).mockImplementation(
+ () => undefined
+ );
+ (toolchains.configureToolchains as jest.Mock).mockResolvedValue(undefined);
+ (auth.configureAuthentication as jest.Mock).mockResolvedValue(undefined);
+ (cache.restore as jest.Mock).mockResolvedValue(undefined);
+ (cache.validatePackageManager as jest.Mock).mockImplementation(
+ () => undefined
+ );
+ });
+
+ it('does not execute the action when imported', () => {
+ expect(inputCallsOnImport).toBe(0);
+ expect(multilineInputCallsOnImport).toBe(0);
+ });
+
+ it('requires java-version or java-version-file', async () => {
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'java-version or java-version-file input expected'
+ );
+ expect(factory.getJavaDistribution).not.toHaveBeenCalled();
+ expect(problemMatcher.configureProblemMatcher).not.toHaveBeenCalled();
+ });
+
+ it('requires distribution when java-version is provided', async () => {
+ multilineInputs.set('java-version', ['21']);
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'distribution input is required'
+ );
+ expect(factory.getJavaDistribution).not.toHaveBeenCalled();
+ });
+
+ it.each([
+ ['temurin', undefined, undefined],
+ ['zulu', undefined, undefined],
+ ['temurin', false, false],
+ ['zulu', true, true]
+ ])(
+ 'passes signature verification input for %s with explicit value %s as %s',
+ async (distribution, explicitValue, expectedValue) => {
+ inputs.set('distribution', distribution);
+ multilineInputs.set('java-version', ['21']);
+ if (explicitValue !== undefined) {
+ inputs.set('verify-signature', String(explicitValue));
+ booleanInputs.set('verify-signature', explicitValue);
+ }
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+
+ await run();
+
+ expect(factory.getJavaDistribution).toHaveBeenCalledWith(
+ distribution,
+ expect.objectContaining({verifySignature: expectedValue}),
+ ''
+ );
+ }
+ );
+
+ it('requires distribution when it cannot be inferred from the version file', async () => {
+ inputs.set('java-version-file', '.java-version');
+ (fs.readFileSync as jest.Mock).mockReturnValue(Buffer.from('21'));
+ (util.getVersionFromFileContent as jest.Mock).mockReturnValue({
+ version: '21'
+ });
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'distribution input is required when not specified in the version file'
+ );
+ expect(factory.getJavaDistribution).not.toHaveBeenCalled();
+ });
+
+ it('fails when the version file has no supported version', async () => {
+ inputs.set('java-version-file', '.java-version');
+ inputs.set('distribution', 'temurin');
+ (fs.readFileSync as jest.Mock).mockReturnValue(Buffer.from('invalid'));
+ (util.getVersionFromFileContent as jest.Mock).mockReturnValue(undefined);
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'No supported version was found in file .java-version'
+ );
+ expect(factory.getJavaDistribution).not.toHaveBeenCalled();
+ });
+
+ it('uses the distribution inferred from a version file', async () => {
+ inputs.set('java-version-file', '.sdkmanrc');
+ inputs.set('architecture', 'x64');
+ inputs.set('java-package', 'jdk');
+ inputs.set('distribution', 'zulu');
+ inputs.set('jdk-file', '/tmp/java.tar.gz');
+ multilineInputs.set('mvn-toolchain-id', ['file-jdk']);
+ booleanInputs.set('check-latest', true);
+ booleanInputs.set('force-download', true);
+ booleanInputs.set('set-default', false);
+ inputs.set('verify-signature-public-key', 'public-key');
+ (fs.readFileSync as jest.Mock).mockReturnValue(
+ Buffer.from('java=21.0.5-tem')
+ );
+ (util.getVersionFromFileContent as jest.Mock).mockReturnValue({
+ version: '21.0.5',
+ distribution: 'temurin'
+ });
+ const setupJava = jest.fn(async () => ({
+ version: '21.0.5+11',
+ path: '/opt/java/21'
+ }));
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
+
+ await run();
+
+ expect(util.getVersionFromFileContent).toHaveBeenCalledWith(
+ 'java=21.0.5-tem',
+ 'zulu',
+ '.sdkmanrc'
+ );
+ expect(factory.getJavaDistribution).toHaveBeenCalledWith(
+ 'temurin',
+ {
+ version: '21.0.5',
+ architecture: 'x64',
+ packageType: 'jdk',
+ checkLatest: true,
+ forceDownload: true,
+ cacheJdk: false,
+ setDefault: false,
+ verifySignature: undefined,
+ verifySignaturePublicKey: 'public-key'
+ },
+ '/tmp/java.tar.gz'
+ );
+ expect(toolchainIds.validateToolchainIds).toHaveBeenCalledWith(
+ [],
+ '.sdkmanrc',
+ ['file-jdk']
+ );
+ expect(toolchains.configureToolchains).toHaveBeenCalledWith(
+ '21.0.5',
+ 'temurin',
+ '/opt/java/21',
+ 'file-jdk'
+ );
+ expect(core.setFailed).not.toHaveBeenCalled();
+ });
+
+ it('installs multiple JDKs in order with matching toolchain IDs', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('architecture', 'x64');
+ inputs.set('java-package', 'jdk');
+ multilineInputs.set('java-version', ['17', '21']);
+ multilineInputs.set('mvn-toolchain-id', ['java-17', 'java-21']);
+
+ const setupJava17 = jest.fn(async () => ({
+ version: '17.0.12+7',
+ path: '/opt/java/17'
+ }));
+ const setupJava21 = jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }));
+ (factory.getJavaDistribution as jest.Mock)
+ .mockReturnValueOnce({setupJava: setupJava17})
+ .mockReturnValueOnce({setupJava: setupJava21});
+
+ await run();
+
+ expect(factory.getJavaDistribution).toHaveBeenNthCalledWith(
+ 1,
+ 'temurin',
+ expect.objectContaining({version: '17'}),
+ ''
+ );
+ expect(factory.getJavaDistribution).toHaveBeenNthCalledWith(
+ 2,
+ 'temurin',
+ expect.objectContaining({version: '21'}),
+ ''
+ );
+ expect(toolchains.configureToolchains).toHaveBeenNthCalledWith(
+ 1,
+ '17',
+ 'temurin',
+ '/opt/java/17',
+ 'java-17'
+ );
+ expect(toolchains.configureToolchains).toHaveBeenNthCalledWith(
+ 2,
+ '21',
+ 'temurin',
+ '/opt/java/21',
+ 'java-21'
+ );
+ expect(setupJava17.mock.invocationCallOrder[0]).toBeLessThan(
+ setupJava21.mock.invocationCallOrder[0]
+ );
+ });
+
+ it('uses the resolved version for the latest Maven toolchain', async () => {
+ inputs.set('distribution', 'temurin');
+ multilineInputs.set('java-version', ['latest']);
+ const setupJava = jest.fn(async () => ({
+ version: '24.0.2+12',
+ path: '/opt/java/24'
+ }));
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
+
+ await run();
+
+ expect(toolchains.configureToolchains).toHaveBeenCalledWith(
+ '24.0.2+12',
+ 'temurin',
+ '/opt/java/24',
+ undefined
+ );
+ });
+
+ it('starts cache restoration before post-install steps and awaits it before finishing', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'maven');
+ inputs.set('cache-dependency-path', '**/pom.xml');
+ multilineInputs.set('java-version', ['21']);
+ multilineInputs.set('cache-path', [
+ '/custom/maven/repository',
+ '!/custom/maven/repository/excluded'
+ ]);
+ const cacheRestore = deferred();
+ let resolveSetupJava: (() => void) | undefined;
+ const setupJava = jest.fn(
+ () =>
+ new Promise<{version: string; path: string}>(resolve => {
+ resolveSetupJava = () =>
+ resolve({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ });
+ })
+ );
+ (cache.restore as jest.Mock).mockReturnValue(cacheRestore.promise);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
+
+ const runPromise = run();
+ try {
+ await tick();
+
+ expect(cacheFeature.isCacheFeatureAvailable).toHaveBeenCalled();
+ expect(cache.restore).toHaveBeenCalledWith('maven', '**/pom.xml', [
+ '/custom/maven/repository',
+ '!/custom/maven/repository/excluded'
+ ]);
+ expect(toolchains.configureToolchains).not.toHaveBeenCalled();
+
+ resolveSetupJava?.();
+ await tick();
+ expect(problemMatcher.configureProblemMatcher).toHaveBeenCalledWith(
+ expect.stringMatching(/\.github[/\\]java\.json$/)
+ );
+
+ expect(
+ (problemMatcher.configureProblemMatcher as jest.Mock).mock
+ .invocationCallOrder[0]
+ ).toBeLessThan(
+ (auth.configureAuthentication as jest.Mock).mock.invocationCallOrder[0]
+ );
+ expect(
+ (problemMatcher.configureProblemMatcher as jest.Mock).mock
+ .invocationCallOrder[0]
+ ).toBeLessThan(
+ (toolchains.configureToolchains as jest.Mock).mock
+ .invocationCallOrder[0]
+ );
+ expect(
+ (auth.configureAuthentication as jest.Mock).mock.invocationCallOrder[0]
+ ).toBeLessThan(
+ (mavenArgs.configureMavenArgs as jest.Mock).mock.invocationCallOrder[0]
+ );
+ expect(
+ (toolchains.configureToolchains as jest.Mock).mock
+ .invocationCallOrder[0]
+ ).toBeLessThan(
+ (mavenArgs.configureMavenArgs as jest.Mock).mock.invocationCallOrder[0]
+ );
+
+ let completed = false;
+ runPromise.then(() => {
+ completed = true;
+ });
+ await tick();
+ expect(completed).toBe(false);
+ } finally {
+ resolveSetupJava?.();
+ cacheRestore.resolve();
+ await runPromise;
+ }
+
+ expect(core.setFailed).not.toHaveBeenCalled();
+ });
+
+ it('overlaps independent Maven settings and toolchains configuration', async () => {
+ inputs.set('distribution', 'temurin');
+ multilineInputs.set('java-version', ['21']);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+ const authentication = deferred();
+ const toolchainConfiguration = deferred();
+ (auth.configureAuthentication as jest.Mock).mockReturnValue(
+ authentication.promise
+ );
+ (toolchains.configureToolchains as jest.Mock).mockReturnValue(
+ toolchainConfiguration.promise
+ );
+
+ const runPromise = run();
+ try {
+ await tick();
+ await tick();
+
+ expect(auth.configureAuthentication).toHaveBeenCalled();
+ expect(toolchains.configureToolchains).toHaveBeenCalledWith(
+ '21',
+ 'temurin',
+ '/opt/java/21',
+ undefined
+ );
+ expect(mavenArgs.configureMavenArgs).not.toHaveBeenCalled();
+
+ authentication.resolve();
+ await tick();
+ expect(mavenArgs.configureMavenArgs).not.toHaveBeenCalled();
+
+ toolchainConfiguration.resolve();
+ await runPromise;
+ } finally {
+ authentication.resolve();
+ toolchainConfiguration.resolve();
+ await runPromise;
+ }
+
+ expect(mavenArgs.configureMavenArgs).toHaveBeenCalled();
+ expect(core.setFailed).not.toHaveBeenCalled();
+ });
+
+ it('skips cache restoration when the cache feature is unavailable', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'maven');
+ multilineInputs.set('java-version', ['21']);
+ (cacheFeature.isCacheFeatureAvailable as jest.Mock).mockReturnValue(false);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+
+ await run();
+
+ expect(cache.restore).not.toHaveBeenCalled();
+ });
+
+ it('does not initialize cache modules when cache input is absent', async () => {
+ inputs.set('distribution', 'temurin');
+ multilineInputs.set('java-version', ['21']);
+ booleanInputs.set('cache-jdk', false);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+
+ await run();
+
+ expect(cacheFeature.isCacheFeatureAvailable).not.toHaveBeenCalled();
+ expect(cache.restore).not.toHaveBeenCalled();
+ expect(factory.getJavaDistribution).toHaveBeenCalledWith(
+ 'temurin',
+ expect.objectContaining({cacheJdk: false}),
+ ''
+ );
+ });
+
+ it('fails invalid cache input before resolving a Java distribution', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'ant');
+ multilineInputs.set('java-version', ['21']);
+ const setupJava = jest.fn();
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
+ (cache.validatePackageManager as jest.Mock).mockImplementation(() => {
+ throw new Error('unknown package manager specified: ant');
+ });
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'unknown package manager specified: ant'
+ );
+ expect(factory.getJavaDistribution).not.toHaveBeenCalled();
+ expect(setupJava).not.toHaveBeenCalled();
+ expect(cache.restore).not.toHaveBeenCalled();
+ });
+
+ it('reports missing java-version before validating the cache input', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'ant');
+ (cache.validatePackageManager as jest.Mock).mockImplementation(() => {
+ throw new Error('unknown package manager specified: ant');
+ });
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'java-version or java-version-file input expected'
+ );
+ expect(cache.validatePackageManager).not.toHaveBeenCalled();
+ });
+
+ it.each([
+ ['', '', false],
+ ['', 'true', true],
+ ['', 'false', false],
+ ['maven', '', true],
+ ['maven', 'true', true],
+ ['maven', 'false', false]
+ ])(
+ 'passes effective JDK caching for cache=%j and cache-jdk=%j',
+ async (cacheInput, cacheJdkInput, expected) => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', cacheInput);
+ inputs.set('cache-jdk', cacheJdkInput);
+ multilineInputs.set('java-version', ['21']);
+ if (cacheJdkInput) {
+ booleanInputs.set('cache-jdk', cacheJdkInput === 'true');
+ }
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+
+ await run();
+
+ expect(factory.getJavaDistribution).toHaveBeenCalledWith(
+ 'temurin',
+ expect.objectContaining({cacheJdk: expected}),
+ ''
+ );
+ }
+ );
+
+ it('reports unsupported distributions through core.setFailed', async () => {
+ inputs.set('distribution', 'unsupported');
+ multilineInputs.set('java-version', ['21']);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue(null);
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith(
+ 'No supported distribution was found for input unsupported'
+ );
+ expect(toolchains.configureToolchains).not.toHaveBeenCalled();
+ expect(problemMatcher.configureProblemMatcher).not.toHaveBeenCalled();
+ });
+
+ it('reports collaborator failures and stops post-install configuration', async () => {
+ inputs.set('distribution', 'temurin');
+ multilineInputs.set('java-version', ['21']);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => {
+ throw new Error('download failed');
+ })
+ });
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith('download failed');
+ expect(toolchains.configureToolchains).not.toHaveBeenCalled();
+ expect(problemMatcher.configureProblemMatcher).not.toHaveBeenCalled();
+ expect(auth.configureAuthentication).not.toHaveBeenCalled();
+ expect(mavenArgs.configureMavenArgs).not.toHaveBeenCalled();
+ expect(cache.restore).not.toHaveBeenCalled();
+ });
+
+ it('reports post-install failures and skips later collaborators', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'maven');
+ multilineInputs.set('java-version', ['21']);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => ({
+ version: '21.0.4+7',
+ path: '/opt/java/21'
+ }))
+ });
+ (auth.configureAuthentication as jest.Mock).mockRejectedValue(
+ new Error('authentication failed')
+ );
+
+ await run();
+
+ expect(problemMatcher.configureProblemMatcher).toHaveBeenCalled();
+ expect(core.setFailed).toHaveBeenCalledWith('authentication failed');
+ expect(mavenArgs.configureMavenArgs).not.toHaveBeenCalled();
+ expect(cache.restore).toHaveBeenCalled();
+ });
+
+ it('keeps Java setup errors deterministic when cache restore also fails', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'maven');
+ multilineInputs.set('java-version', ['21']);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({
+ setupJava: jest.fn(async () => {
+ throw new Error('download failed');
+ })
+ });
+ (cache.restore as jest.Mock).mockRejectedValue(
+ new Error('cache restore failed')
+ );
+
+ await run();
+
+ expect(core.setFailed).toHaveBeenCalledWith('download failed');
+ });
+
+ it('observes cache failures while Java setup is still pending', async () => {
+ inputs.set('distribution', 'temurin');
+ inputs.set('cache', 'maven');
+ multilineInputs.set('java-version', ['21']);
+ const javaSetup = deferred<{version: string; path: string}>();
+ const setupJava = jest.fn(() => javaSetup.promise);
+ (factory.getJavaDistribution as jest.Mock).mockReturnValue({setupJava});
+ const cacheRestore = deferred();
+ const cacheRestoreCalled = deferred();
+ (cache.restore as jest.Mock).mockImplementation(() => {
+ cacheRestoreCalled.resolve();
+ return cacheRestore.promise;
+ });
+ const unhandledRejections: unknown[] = [];
+ const onUnhandledRejection = (reason: unknown) => {
+ unhandledRejections.push(reason);
+ };
+ process.on('unhandledRejection', onUnhandledRejection);
+
+ const runPromise = run();
+ try {
+ // Only reject once the restore has actually started and while the Java
+ // installation is still pending, so the unfixed code would leave the
+ // rejection unhandled.
+ await cacheRestoreCalled.promise;
+ cacheRestore.reject(new Error('cache restore failed'));
+ await tick();
+
+ expect(setupJava).toHaveBeenCalled();
+ expect(unhandledRejections).toEqual([]);
+ expect(core.setFailed).not.toHaveBeenCalled();
+ } finally {
+ javaSetup.resolve({version: '21.0.4+7', path: '/opt/java/21'});
+ await runPromise;
+ process.off('unhandledRejection', onUnhandledRejection);
+ }
+
+ expect(unhandledRejections).toEqual([]);
+ expect(core.setFailed).toHaveBeenCalledWith('cache restore failed');
+ });
+});
+
+function deferred() {
+ let resolve!: (value: T | PromiseLike) => void;
+ let reject!: (reason?: unknown) => void;
+ const promise = new Promise((res, rej) => {
+ resolve = res;
+ reject = rej;
+ });
+ return {promise, resolve, reject};
+}
+
+async function tick() {
+ await new Promise(resolve => setTimeout(resolve, 0));
+}
diff --git a/__tests__/toolchains.test.ts b/__tests__/toolchains.test.ts
index 483077dc1..ea5248629 100644
--- a/__tests__/toolchains.test.ts
+++ b/__tests__/toolchains.test.ts
@@ -1,23 +1,64 @@
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterEach,
+ beforeAll,
+ afterAll
+} from '@jest/globals';
+import {fileURLToPath} from 'url';
import * as fs from 'fs';
import os from 'os';
import * as path from 'path';
-import * as core from '@actions/core';
import * as io from '@actions/io';
-import * as toolchains from '../src/toolchains';
-import {M2_DIR, MVN_TOOLCHAINS_FILE} from '../src/constants';
+import {XMLParser} from 'fast-xml-parser';
+// Mock @actions/core before importing source modules that depend on it
+jest.unstable_mockModule('@actions/core', () => ({
+ info: jest.fn(),
+ warning: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ setFailed: jest.fn(),
+ setOutput: jest.fn(),
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+// Dynamic imports after mocking
+const core = await import('@actions/core');
+const toolchains = await import('../src/toolchains.js');
+const {M2_DIR, MVN_TOOLCHAINS_FILE} = await import('../src/constants.js');
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
const m2Dir = path.join(__dirname, M2_DIR);
const toolchainsFile = path.join(m2Dir, MVN_TOOLCHAINS_FILE);
describe('toolchains tests', () => {
- let spyOSHomedir: jest.SpyInstance;
- let spyInfo: jest.SpyInstance;
+ let spyOSHomedir: any;
+ let spyInfo: any;
beforeEach(async () => {
await io.rmRF(m2Dir);
spyOSHomedir = jest.spyOn(os, 'homedir');
spyOSHomedir.mockReturnValue(__dirname);
- spyInfo = jest.spyOn(core, 'info');
+ spyInfo = core.info as jest.Mock;
spyInfo.mockImplementation(() => null);
}, 300000);
@@ -46,8 +87,7 @@ describe('toolchains tests', () => {
await toolchains.createToolchainsSettings({
jdkInfo,
- settingsDirectory: altHome,
- overwriteSettings: true
+ settingsDirectory: altHome
});
expect(fs.existsSync(m2Dir)).toBe(false);
@@ -56,7 +96,7 @@ describe('toolchains tests', () => {
expect(fs.existsSync(altHome)).toBe(true);
expect(fs.existsSync(altToolchainsFile)).toBe(true);
expect(fs.readFileSync(altToolchainsFile, 'utf-8')).toEqual(
- toolchains.generateToolchainDefinition(
+ await toolchains.generateToolchainDefinition(
'',
jdkInfo.version,
jdkInfo.vendor,
@@ -95,14 +135,13 @@ describe('toolchains tests', () => {
await toolchains.createToolchainsSettings({
jdkInfo,
- settingsDirectory: m2Dir,
- overwriteSettings: true
+ settingsDirectory: m2Dir
});
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(toolchainsFile)).toBe(true);
expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
- toolchains.generateToolchainDefinition(
+ await toolchains.generateToolchainDefinition(
'',
jdkInfo.version,
jdkInfo.vendor,
@@ -111,7 +150,7 @@ describe('toolchains tests', () => {
)
);
expect(
- toolchains.generateToolchainDefinition(
+ await toolchains.generateToolchainDefinition(
'',
jdkInfo.version,
jdkInfo.vendor,
@@ -143,7 +182,20 @@ describe('toolchains tests', () => {
`;
const result = `
-
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
jdk
@@ -155,6 +207,67 @@ describe('toolchains tests', () => {
/opt/jdk/sun/1.6
+`;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
+ }, 100000);
+
+ it('does not discard custom elements in existing toolchain definitions', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
+
+ const originalFile = `
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+ foo
+
+
+ /opt/jdk/sun/1.6
+ /usr/local/bin/bash
+
+
+ `;
+ const result = `
+
jdk
@@ -166,6 +279,19 @@ describe('toolchains tests', () => {
/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+ foo
+
+
+ /opt/jdk/sun/1.6
+ /usr/local/bin/bash
+
+
`;
fs.mkdirSync(m2Dir, {recursive: true});
@@ -175,14 +301,13 @@ describe('toolchains tests', () => {
await toolchains.createToolchainsSettings({
jdkInfo,
- settingsDirectory: m2Dir,
- overwriteSettings: true
+ settingsDirectory: m2Dir
});
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(toolchainsFile)).toBe(true);
expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
- toolchains.generateToolchainDefinition(
+ await toolchains.generateToolchainDefinition(
originalFile,
jdkInfo.version,
jdkInfo.vendor,
@@ -191,7 +316,7 @@ describe('toolchains tests', () => {
)
);
expect(
- toolchains.generateToolchainDefinition(
+ await toolchains.generateToolchainDefinition(
originalFile,
jdkInfo.version,
jdkInfo.vendor,
@@ -201,7 +326,7 @@ describe('toolchains tests', () => {
).toEqual(result);
}, 100000);
- it('does not overwrite existing toolchains.xml files', async () => {
+ it('does not discard existing, custom toolchain definitions', async () => {
const jdkInfo = {
version: '17',
vendor: 'Eclipse Temurin',
@@ -211,17 +336,40 @@ describe('toolchains tests', () => {
const originalFile = `
- jdk
-
- 1.6
- Sun
- sun_1.6
-
-
- /opt/jdk/sun/1.6
-
+ foo
+
+ baz
+
+
+ /usr/local/bin/foo
+
`;
+ const result = `
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+
+ foo
+
+ baz
+
+
+ /usr/local/bin/foo
+
+
+`;
fs.mkdirSync(m2Dir, {recursive: true});
fs.writeFileSync(toolchainsFile, originalFile);
@@ -230,75 +378,809 @@ describe('toolchains tests', () => {
await toolchains.createToolchainsSettings({
jdkInfo,
- settingsDirectory: m2Dir,
- overwriteSettings: false
+ settingsDirectory: m2Dir
});
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(toolchainsFile)).toBe(true);
- expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(originalFile);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
}, 100000);
- it('generates valid toolchains.xml with minimal configuration', () => {
+ it('does not duplicate existing toolchain definitions', async () => {
const jdkInfo = {
- version: 'JAVA_VERSION',
- vendor: 'JAVA_VENDOR',
- id: 'VENDOR_VERSION',
- jdkHome: 'JAVA_HOME'
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
};
- const expectedToolchains = `
+ const originalFile = `
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+ `;
+ const result = `
jdk
- ${jdkInfo.version}
- ${jdkInfo.vendor}
- ${jdkInfo.id}
+ 17
+ Eclipse Temurin
+ temurin_17
- ${jdkInfo.jdkHome}
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
`;
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
expect(
- toolchains.generateToolchainDefinition(
- '',
+ await toolchains.generateToolchainDefinition(
+ originalFile,
jdkInfo.version,
jdkInfo.vendor,
jdkInfo.id,
jdkInfo.jdkHome
)
- ).toEqual(expectedToolchains);
+ ).toEqual(result);
}, 100000);
- it('creates toolchains.xml with correct id when none is supplied', async () => {
- const version = '17';
- const distributionName = 'temurin';
- const id = 'temurin_17';
- const jdkHome =
- '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64';
+ it('does not duplicate existing toolchain definitions if multiple exist', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
- await toolchains.configureToolchains(
- version,
- distributionName,
- jdkHome,
- undefined
- );
+ const originalFile = `
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+
+
+ /opt/jdk/sun/1.6
+
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+ `;
+ const result = `
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+
+
+ /opt/jdk/sun/1.6
+
+
+`;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(toolchainsFile)).toBe(true);
expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
- toolchains.generateToolchainDefinition(
- '',
- version,
- distributionName,
- id,
- jdkHome
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
)
);
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
}, 100000);
-});
+
+ it('handles an empty list of existing toolchains correctly', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
+
+ const originalFile = `
+ `;
+ const result = `
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+`;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
+ }, 100000);
+
+ it('handles an empty existing toolchains.xml correctly', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
+
+ const originalFile = ``;
+ const result = `
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+`;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
+ }, 100000);
+
+ it('preserves custom root attributes on existing toolchains.xml', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
+
+ const originalFile = `
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+
+
+ /opt/jdk/sun/1.6
+
+
+ `;
+ const result = `
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+
+
+ /opt/jdk/sun/1.6
+
+
+`;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
+ }, 100000);
+
+ it('keeps partially-formed jdk toolchains without an id instead of crashing', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
+
+ const originalFile = `
+
+ jdk
+
+ 1.6
+ Sun
+
+
+ /opt/jdk/sun/1.6
+
+
+ `;
+ const result = `
+
+
+ jdk
+
+ 17
+ Eclipse Temurin
+ temurin_17
+
+
+ /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64
+
+
+
+ jdk
+
+ 1.6
+ Sun
+
+
+ /opt/jdk/sun/1.6
+
+
+`;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ );
+ expect(
+ await toolchains.generateToolchainDefinition(
+ originalFile,
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(result);
+ }, 100000);
+
+ it('extends existing toolchains.xml files instead of overwriting them', async () => {
+ const jdkInfo = {
+ version: '17',
+ vendor: 'Eclipse Temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ };
+
+ const originalFile = `
+
+ jdk
+
+ 1.6
+ Sun
+ sun_1.6
+
+
+ /opt/jdk/sun/1.6
+
+
+ `;
+
+ fs.mkdirSync(m2Dir, {recursive: true});
+ fs.writeFileSync(toolchainsFile, originalFile);
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ await toolchains.createToolchainsSettings({
+ jdkInfo,
+ settingsDirectory: m2Dir
+ });
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+
+ const updated = fs.readFileSync(toolchainsFile, 'utf-8');
+ // The pre-existing (Sun 1.6) toolchain must be preserved ...
+ expect(updated).toContain('sun_1.6');
+ expect(updated).toContain('/opt/jdk/sun/1.6');
+ // ... and the newly installed JDK must be appended.
+ expect(updated).toContain('temurin_17');
+ expect(updated).toContain('Eclipse Temurin');
+ expect(updated).toContain(`${jdkInfo.jdkHome}`);
+ }, 100000);
+
+ it('generates valid toolchains.xml with minimal configuration', async () => {
+ const jdkInfo = {
+ version: 'JAVA_VERSION',
+ vendor: 'JAVA_VENDOR',
+ id: 'VENDOR_VERSION',
+ jdkHome: 'JAVA_HOME'
+ };
+
+ const expectedToolchains = `
+
+
+ jdk
+
+ ${jdkInfo.version}
+ ${jdkInfo.vendor}
+ ${jdkInfo.id}
+
+
+ ${jdkInfo.jdkHome}
+
+
+`;
+
+ expect(
+ await toolchains.generateToolchainDefinition(
+ '',
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ )
+ ).toEqual(expectedToolchains);
+ }, 100000);
+
+ it('escapes new toolchains.xml values while preserving parsed semantics', () => {
+ const jdkInfo = {
+ version: `21&<>"'é`,
+ vendor: `Temurin&<>"'é`,
+ id: `temurin&<>"'é`,
+ jdkHome: `/opt/java&<>"'é`
+ };
+
+ const xml = toolchains.generateNewToolchainDefinition(
+ jdkInfo.version,
+ jdkInfo.vendor,
+ jdkInfo.id,
+ jdkInfo.jdkHome
+ );
+ const parsed = parseXmlObject(xml) as any;
+
+ expect(parsed.toolchains.toolchain[0].type).toBe('jdk');
+ expect(xmlElementText(xml, 'version')).toBe(jdkInfo.version);
+ expect(xmlElementText(xml, 'vendor')).toBe(jdkInfo.vendor);
+ expect(xmlElementText(xml, 'id')).toBe(jdkInfo.id);
+ expect(xmlElementText(xml, 'jdkHome')).toBe(jdkInfo.jdkHome);
+ });
+
+ it('creates toolchains.xml with correct id when none is supplied', async () => {
+ const version = '17';
+ const distributionName = 'temurin';
+ const id = 'temurin_17';
+ const jdkHome =
+ '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64';
+
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ if (name === 'settings-path') return m2Dir;
+ return '';
+ });
+
+ await toolchains.configureToolchains(
+ version,
+ distributionName,
+ jdkHome,
+ undefined
+ );
+
+ expect(fs.existsSync(m2Dir)).toBe(true);
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
+ await toolchains.generateToolchainDefinition(
+ '',
+ version,
+ distributionName,
+ id,
+ jdkHome
+ )
+ );
+ }, 100000);
+
+ it('merges a second JDK into a toolchains.xml produced by the new-file fast path', async () => {
+ const firstJdk = {
+ version: '17',
+ vendor: 'temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/java/17'
+ };
+ const secondJdk = {
+ version: '21',
+ vendor: 'temurin',
+ id: 'temurin_21',
+ jdkHome: '/opt/java/21'
+ };
+
+ const firstToolchains = await toolchains.generateToolchainDefinition(
+ '',
+ firstJdk.version,
+ firstJdk.vendor,
+ firstJdk.id,
+ firstJdk.jdkHome
+ );
+ const mergedToolchains = await toolchains.generateToolchainDefinition(
+ firstToolchains,
+ secondJdk.version,
+ secondJdk.vendor,
+ secondJdk.id,
+ secondJdk.jdkHome
+ );
+
+ for (const jdk of [firstJdk, secondJdk]) {
+ expect(mergedToolchains).toContain(`${jdk.id}`);
+ expect(mergedToolchains).toContain(`${jdk.jdkHome}`);
+ }
+ expect((mergedToolchains.match(//g) || []).length).toBe(2);
+ });
+
+ it('preserves custom attributes and elements when merging existing toolchains.xml', async () => {
+ const originalFile = `
+
+ foo
+
+ baz & qux
+
+
+ /usr/local/bin/foo
+
+
+ `;
+
+ const mergedToolchains = await toolchains.generateToolchainDefinition(
+ originalFile,
+ '21&<>"\'',
+ 'Temurin&<>"\'',
+ 'temurin_21&<>"\'',
+ '/opt/java/21&<>"\''
+ );
+ const parsed = parseXmlObject(mergedToolchains) as any;
+ const merged = parsed.toolchains.toolchain;
+
+ expect(parsed.toolchains['@customRoot']).toBe('A & B');
+ expect(merged).toHaveLength(2);
+ expect(merged[0].provides.id).toBe('temurin_21&<>"\'');
+ expect(merged[0].configuration.jdkHome).toBe('/opt/java/21&<>"\'');
+ expect(merged[1]['@customAttr']).toBe('custom & value');
+ expect(merged[1].provides['@customProvides']).toBe('yes');
+ expect(merged[1].provides.custom['#text']).toBe('baz & qux');
+ expect(merged[1].provides.custom['@attr']).toBe('custom " attr');
+ });
+
+ it('preserves toolchains from previous executions across multiple setup-java runs', async () => {
+ // Regression test for https://github.com/actions/setup-java/issues/1099
+ // Running setup-java several times in the same job (e.g. multiple steps / multiple
+ // java-version entries) must accumulate every JDK in toolchains.xml rather
+ // than replacing previously registered entries.
+ (core.getInput as jest.Mock).mockImplementation((name: string) => {
+ if (name === 'settings-path') return m2Dir;
+ return '';
+ });
+
+ const runs = [
+ {
+ version: '8',
+ distributionName: 'temurin',
+ id: 'temurin_8',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/8.0.1-12/x64'
+ },
+ {
+ version: '11',
+ distributionName: 'temurin',
+ id: 'temurin_11',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/11.0.1-12/x64'
+ },
+ {
+ version: '17',
+ distributionName: 'temurin',
+ id: 'temurin_17',
+ jdkHome: '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64'
+ }
+ ];
+
+ for (const run of runs) {
+ await toolchains.configureToolchains(
+ run.version,
+ run.distributionName,
+ run.jdkHome,
+ undefined
+ );
+ }
+
+ expect(fs.existsSync(toolchainsFile)).toBe(true);
+ const contents = fs.readFileSync(toolchainsFile, 'utf-8');
+
+ for (const run of runs) {
+ expect(contents).toContain(`${run.id}`);
+ expect(contents).toContain(`${run.jdkHome}`);
+ }
+ // Exactly one entry per run – no duplicates, none dropped.
+ expect((contents.match(//g) || []).length).toBe(runs.length);
+ }, 100000);
+});
+
+describe('validateToolchainIds', () => {
+ it.each([
+ {
+ name: 'uses generated IDs when no custom IDs are supplied',
+ versions: ['17', '21'],
+ versionFile: '',
+ toolchainIds: []
+ },
+ {
+ name: 'accepts one custom ID for a single Java version',
+ versions: ['21'],
+ versionFile: '',
+ toolchainIds: ['custom-21']
+ },
+ {
+ name: 'accepts one custom ID per Java version',
+ versions: ['17', '21'],
+ versionFile: '',
+ toolchainIds: ['custom-17', 'custom-21']
+ },
+ {
+ name: 'accepts one custom ID with java-version-file',
+ versions: [],
+ versionFile: '.java-version',
+ toolchainIds: ['custom-file-version']
+ }
+ ])('$name', ({versions, versionFile, toolchainIds}) => {
+ expect(() =>
+ toolchains.validateToolchainIds(versions, versionFile, toolchainIds)
+ ).not.toThrow();
+ });
+
+ it.each([
+ {
+ name: 'rejects fewer IDs than Java versions',
+ versions: ['17', '21'],
+ versionFile: '',
+ toolchainIds: ['custom-17'],
+ expectedMessage:
+ 'The number of Maven toolchain IDs (1) must match the number of Java versions (2)'
+ },
+ {
+ name: 'rejects extra IDs for a single Java version',
+ versions: ['21'],
+ versionFile: '',
+ toolchainIds: ['custom-21', 'custom-extra'],
+ expectedMessage:
+ 'The number of Maven toolchain IDs (2) must match the number of Java versions (1)'
+ },
+ {
+ name: 'rejects extra IDs with java-version-file',
+ versions: [],
+ versionFile: '.java-version',
+ toolchainIds: ['custom-file-version', 'custom-extra'],
+ expectedMessage:
+ 'The number of Maven toolchain IDs (2) must match the number of Java versions (1)'
+ }
+ ])('$name', ({versions, versionFile, toolchainIds, expectedMessage}) => {
+ expect(() =>
+ toolchains.validateToolchainIds(versions, versionFile, toolchainIds)
+ ).toThrow(expectedMessage);
+ });
+});
+
+function xmlElementText(xml: string, tagName: string): string {
+ const match = new RegExp(`<${tagName}>([\\s\\S]*?)${tagName}>`).exec(xml);
+ expect(match).not.toBeNull();
+ return (parseXmlObject(`${match?.[1]}`) as {value: string})
+ .value;
+}
+
+function parseXmlObject(xml: string): unknown {
+ const parser = new XMLParser({
+ ignoreAttributes: false,
+ attributeNamePrefix: '@',
+ textNodeName: '#text',
+ parseAttributeValue: false,
+ parseTagValue: false,
+ trimValues: true,
+ isArray: tagName => tagName === 'toolchain'
+ });
+ return parser.parse(xml);
+}
diff --git a/__tests__/util-install.test.ts b/__tests__/util-install.test.ts
new file mode 100644
index 000000000..b32cead72
--- /dev/null
+++ b/__tests__/util-install.test.ts
@@ -0,0 +1,520 @@
+import {jest, describe, it, expect, beforeEach, afterEach} from '@jest/globals';
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
+jest.unstable_mockModule('@actions/core', () => ({
+ debug: jest.fn(),
+ info: jest.fn(),
+ warning: jest.fn(),
+ error: jest.fn(),
+ getInput: jest.fn(() => ''),
+ isDebug: jest.fn(() => false),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ setOutput: jest.fn()
+}));
+
+jest.unstable_mockModule('@actions/tool-cache', () => ({
+ cacheDir: jest.fn(),
+ extractTar: jest.fn(),
+ extractZip: jest.fn(),
+ extract7z: jest.fn()
+}));
+
+jest.unstable_mockModule('@actions/exec', () => ({
+ exec: jest.fn()
+}));
+
+jest.unstable_mockModule('@actions/io', () => ({
+ which: jest.fn(),
+ rmRF: jest.fn(async (target: string) =>
+ fs.rmSync(target, {recursive: true, force: true})
+ ),
+ mkdirP: jest.fn(async (target: string) =>
+ fs.mkdirSync(target, {recursive: true})
+ )
+}));
+
+jest.unstable_mockModule('@actions/http-client', () => ({
+ HttpClient: jest.fn(),
+ HttpClientError: class HttpClientError extends Error {}
+}));
+
+const tc = await import('@actions/tool-cache');
+const exec = await import('@actions/exec');
+const io = await import('@actions/io');
+const {
+ cacheJdkDir,
+ extractJdkFile,
+ getArtifactFingerprint,
+ getJavaVersionFromReleaseFile
+} = await import('../src/util.js');
+
+const originalToolCache = process.env['RUNNER_TOOL_CACHE'];
+const originalTemp = process.env['RUNNER_TEMP'];
+const originalPlatform = process.platform;
+
+let workDir: string;
+
+function setPlatform(platform: NodeJS.Platform) {
+ Object.defineProperty(process, 'platform', {
+ value: platform,
+ configurable: true
+ });
+}
+
+beforeEach(() => {
+ workDir = fs.mkdtempSync(path.join(os.tmpdir(), 'setup-java-util-'));
+ process.env['RUNNER_TOOL_CACHE'] = path.join(workDir, 'toolcache');
+ process.env['RUNNER_TEMP'] = path.join(workDir, 'temp');
+ fs.mkdirSync(process.env['RUNNER_TEMP'], {recursive: true});
+});
+
+afterEach(() => {
+ jest.clearAllMocks();
+ setPlatform(originalPlatform);
+ while (lockedDirs.length) {
+ fs.chmodSync(lockedDirs.pop()!, 0o755);
+ }
+ fs.rmSync(workDir, {recursive: true, force: true});
+ if (originalToolCache === undefined) {
+ delete process.env['RUNNER_TOOL_CACHE'];
+ } else {
+ process.env['RUNNER_TOOL_CACHE'] = originalToolCache;
+ }
+ if (originalTemp === undefined) {
+ delete process.env['RUNNER_TEMP'];
+ } else {
+ process.env['RUNNER_TEMP'] = originalTemp;
+ }
+});
+
+function createJdkDir(name = 'jdk-source'): string {
+ const sourceDir = path.join(workDir, name);
+ fs.mkdirSync(path.join(sourceDir, 'bin'), {recursive: true});
+ fs.writeFileSync(path.join(sourceDir, 'bin', 'java'), 'binary');
+ fs.writeFileSync(path.join(sourceDir, 'release'), 'JAVA_VERSION="17"');
+
+ return sourceDir;
+}
+
+// A rename needs write permission on the source's parent directory, so making
+// that parent read-only is a portable way to force the same failure a
+// cross-device tool-cache (EXDEV) or a Windows anti-virus handle (EPERM) would.
+// Root ignores the permission bits, so those tests are skipped there.
+const canForceRenameFailure =
+ process.platform !== 'win32' &&
+ typeof process.getuid === 'function' &&
+ process.getuid() !== 0;
+const itUnlessRoot = canForceRenameFailure ? it : it.skip;
+const lockedDirs: string[] = [];
+
+function createUnrenameableJdkDir(): string {
+ const parent = path.join(workDir, 'locked');
+ fs.mkdirSync(parent, {recursive: true});
+ const sourceDir = path.join(parent, 'jdk-source');
+ fs.mkdirSync(path.join(sourceDir, 'bin'), {recursive: true});
+ fs.writeFileSync(path.join(sourceDir, 'bin', 'java'), 'binary');
+ fs.chmodSync(parent, 0o555);
+ lockedDirs.push(parent);
+
+ return sourceDir;
+}
+
+describe('cacheJdkDir', () => {
+ it('moves the JDK into the tool-cache instead of copying it', async () => {
+ const sourceDir = createJdkDir();
+
+ const javaPath = await cacheJdkDir(
+ sourceDir,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+
+ expect(javaPath).toBe(
+ path.join(
+ process.env['RUNNER_TOOL_CACHE']!,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ )
+ );
+ expect(fs.existsSync(path.join(javaPath, 'bin', 'java'))).toBe(true);
+ expect(fs.existsSync(path.join(javaPath, 'release'))).toBe(true);
+ // the source is moved, not copied, so it no longer exists
+ expect(fs.existsSync(sourceDir)).toBe(false);
+ expect(tc.cacheDir).not.toHaveBeenCalled();
+ });
+
+ it('writes the .complete marker expected by the tool-cache', async () => {
+ const javaPath = await cacheJdkDir(
+ createJdkDir(),
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+
+ expect(fs.existsSync(`${javaPath}.complete`)).toBe(true);
+ });
+
+ it('replaces an existing tool-cache entry', async () => {
+ const destPath = path.join(
+ process.env['RUNNER_TOOL_CACHE']!,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+ fs.mkdirSync(destPath, {recursive: true});
+ fs.writeFileSync(path.join(destPath, 'stale'), 'stale');
+
+ const javaPath = await cacheJdkDir(
+ createJdkDir(),
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+
+ expect(fs.existsSync(path.join(javaPath, 'stale'))).toBe(false);
+ expect(fs.existsSync(path.join(javaPath, 'bin', 'java'))).toBe(true);
+ });
+
+ it('normalizes the version the same way as tc.cacheDir', async () => {
+ const javaPath = await cacheJdkDir(
+ createJdkDir(),
+ 'Java_temurin_jdk',
+ 'v17.0.1',
+ 'x64'
+ );
+
+ expect(path.basename(path.dirname(javaPath))).toBe('17.0.1');
+ });
+
+ it('keeps unparseable versions as-is', async () => {
+ const javaPath = await cacheJdkDir(
+ createJdkDir(),
+ 'Java_temurin_jdk',
+ '17.0.1-ea.3',
+ 'x64'
+ );
+
+ expect(path.basename(path.dirname(javaPath))).toBe('17.0.1-ea.3');
+ });
+
+ it('falls back to tc.cacheDir when the move fails', async () => {
+ (tc.cacheDir as jest.Mock).mockResolvedValue('/fallback/path' as never);
+ const missingDir = path.join(workDir, 'does-not-exist');
+
+ const javaPath = await cacheJdkDir(
+ missingDir,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+
+ expect(javaPath).toBe('/fallback/path');
+ expect(tc.cacheDir).toHaveBeenCalledWith(
+ missingDir,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+ });
+
+ itUnlessRoot(
+ 'falls back to tc.cacheDir when the rename itself fails',
+ async () => {
+ const sourceDir = createUnrenameableJdkDir();
+ (tc.cacheDir as jest.Mock).mockResolvedValue('/fallback/path' as never);
+
+ await expect(
+ cacheJdkDir(sourceDir, 'Java_temurin_jdk', '17.0.1', 'x64')
+ ).resolves.toBe('/fallback/path');
+ // the source must survive so the copy-based fallback can still read it
+ expect(fs.existsSync(path.join(sourceDir, 'bin', 'java'))).toBe(true);
+ }
+ );
+
+ itUnlessRoot(
+ 'does not leave a .complete marker behind when the rename fails',
+ async () => {
+ const destPath = path.join(
+ process.env['RUNNER_TOOL_CACHE']!,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+ fs.mkdirSync(destPath, {recursive: true});
+ fs.writeFileSync(`${destPath}.complete`, '');
+ (tc.cacheDir as jest.Mock).mockResolvedValue('/fallback/path' as never);
+
+ await cacheJdkDir(
+ createUnrenameableJdkDir(),
+ 'Java_temurin_jdk',
+ '17.0.1',
+ 'x64'
+ );
+
+ // a stale marker without a matching installation would make the
+ // tool-cache resolve a directory that is no longer there
+ expect(fs.existsSync(`${destPath}.complete`)).toBe(false);
+ }
+ );
+
+ it('falls back to tc.cacheDir for symlinked sources', async () => {
+ const realDir = createJdkDir('real-jdk');
+ const linkDir = path.join(workDir, 'linked-jdk');
+ fs.symlinkSync(realDir, linkDir, 'dir');
+ (tc.cacheDir as jest.Mock).mockResolvedValue('/fallback/path' as never);
+
+ await expect(
+ cacheJdkDir(linkDir, 'Java_temurin_jdk', '17.0.1', 'x64')
+ ).resolves.toBe('/fallback/path');
+ // moving the symlink itself would leave a dangling tool-cache entry
+ expect(fs.lstatSync(linkDir).isSymbolicLink()).toBe(true);
+ });
+
+ it('defaults the architecture the same way as tc.cacheDir', async () => {
+ const javaPath = await cacheJdkDir(
+ createJdkDir(),
+ 'Java_temurin_jdk',
+ '17.0.1',
+ ''
+ );
+
+ expect(javaPath).toBe(
+ path.join(
+ process.env['RUNNER_TOOL_CACHE']!,
+ 'Java_temurin_jdk',
+ '17.0.1',
+ os.arch()
+ )
+ );
+ });
+
+ it('falls back to tc.cacheDir when the tool-cache location is unknown', async () => {
+ delete process.env['RUNNER_TOOL_CACHE'];
+ (tc.cacheDir as jest.Mock).mockResolvedValue('/fallback/path' as never);
+
+ await expect(
+ cacheJdkDir(createJdkDir(), 'Java_temurin_jdk', '17.0.1', 'x64')
+ ).resolves.toBe('/fallback/path');
+ });
+});
+
+describe('getJavaVersionFromReleaseFile', () => {
+ it.each([
+ ['JAVA_RUNTIME_VERSION="21.0.9+7-LTS-123"', '21.0.9+7'],
+ ['JAVA_RUNTIME_VERSION="17.0.12+8-jvmci-23.1-b52"', '17.0.12+8'],
+ ['JAVA_RUNTIME_VERSION="25+36-LTS"', '25.0.0+36'],
+ ['JAVA_VERSION="25.0.1"', '25.0.1'],
+ ['JAVA_VERSION="25"', '25.0.0']
+ ])('reads a concrete version from %s', (contents, expected) => {
+ const javaHome = createJdkDir();
+ fs.writeFileSync(path.join(javaHome, 'release'), contents);
+
+ expect(getJavaVersionFromReleaseFile(javaHome)).toBe(expected);
+ });
+
+ it('reads the macOS Contents/Home release file', () => {
+ const javaHome = path.join(workDir, 'macos-jdk');
+ fs.mkdirSync(path.join(javaHome, 'Contents', 'Home'), {recursive: true});
+ fs.writeFileSync(
+ path.join(javaHome, 'Contents', 'Home', 'release'),
+ 'JAVA_RUNTIME_VERSION="21.0.9+7-LTS"'
+ );
+
+ expect(getJavaVersionFromReleaseFile(javaHome)).toBe('21.0.9+7');
+ });
+
+ it('fails when the JDK release metadata has no usable version', () => {
+ const javaHome = createJdkDir();
+ fs.writeFileSync(path.join(javaHome, 'release'), 'IMPLEMENTOR="Oracle"');
+
+ expect(() => getJavaVersionFromReleaseFile(javaHome)).toThrow(
+ /Unable to determine the installed Java version/
+ );
+ });
+});
+
+describe('extractJdkFile', () => {
+ it('uses pigz for tarballs when it is available', async () => {
+ (io.which as jest.Mock).mockResolvedValue('/usr/bin/pigz' as never);
+ (tc.extractTar as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.tar.gz')).resolves.toBe('/extracted');
+ expect(tc.extractTar).toHaveBeenCalledWith(
+ '/tmp/jdk.tar.gz',
+ expect.stringContaining(process.env['RUNNER_TEMP']!),
+ ['--use-compress-program', '/usr/bin/pigz -d', '-x']
+ );
+ });
+
+ it('falls back to gzip when pigz is not installed', async () => {
+ (io.which as jest.Mock).mockResolvedValue('' as never);
+ (tc.extractTar as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.tar.gz')).resolves.toBe('/extracted');
+ expect(tc.extractTar).toHaveBeenCalledWith('/tmp/jdk.tar.gz');
+ });
+
+ it('falls back to gzip when pigz extraction fails', async () => {
+ (io.which as jest.Mock).mockResolvedValue('/usr/bin/pigz' as never);
+ (tc.extractTar as jest.Mock)
+ .mockRejectedValueOnce(new Error('pigz exploded') as never)
+ .mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.tar.gz')).resolves.toBe('/extracted');
+ expect(tc.extractTar).toHaveBeenNthCalledWith(2, '/tmp/jdk.tar.gz');
+ });
+
+ it('cleans up the abandoned folder when pigz extraction fails', async () => {
+ (io.which as jest.Mock).mockResolvedValue('/usr/bin/pigz' as never);
+ let pigzDest: string | undefined;
+ (tc.extractTar as jest.Mock)
+ .mockImplementationOnce((...args: unknown[]) => {
+ pigzDest = args[1] as string;
+ throw new Error('pigz exploded');
+ })
+ .mockResolvedValue('/extracted' as never);
+
+ await extractJdkFile('/tmp/jdk.tar.gz');
+
+ expect(pigzDest).toBeDefined();
+ expect(fs.existsSync(pigzDest!)).toBe(false);
+ });
+
+ it('ignores pigz when its path contains whitespace', async () => {
+ (io.which as jest.Mock).mockResolvedValue(
+ 'C:\\Program Files\\pigz.exe' as never
+ );
+ (tc.extractTar as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await extractJdkFile('/tmp/jdk.tar.gz');
+
+ // tar word-splits --use-compress-program, so a spaced path is unusable
+ expect(tc.extractTar).toHaveBeenCalledWith('/tmp/jdk.tar.gz');
+ });
+
+ it('leaves uncompressed tarballs on the default extraction path', async () => {
+ (tc.extractTar as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.tar')).resolves.toBe('/extracted');
+ expect(tc.extractTar).toHaveBeenCalledWith('/tmp/jdk.tar');
+ expect(io.which).not.toHaveBeenCalled();
+ });
+
+ it('extracts xz-compressed tarballs with xz tar flags', async () => {
+ (tc.extractTar as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.tar.xz')).resolves.toBe('/extracted');
+ expect(tc.extractTar).toHaveBeenCalledWith(
+ '/tmp/jdk.tar.xz',
+ undefined,
+ 'xJ'
+ );
+ expect(io.which).not.toHaveBeenCalled();
+ });
+
+ it('uses the bundled tar.exe for zip archives on Windows', async () => {
+ setPlatform('win32');
+ const systemRoot = path.join(workDir, 'Windows');
+ fs.mkdirSync(path.join(systemRoot, 'System32'), {recursive: true});
+ const systemTar = path.join(systemRoot, 'System32', 'tar.exe');
+ fs.writeFileSync(systemTar, '');
+ process.env['SystemRoot'] = systemRoot;
+
+ const javaPath = await extractJdkFile('/tmp/jdk.zip');
+
+ expect(tc.extractZip).not.toHaveBeenCalled();
+ expect(exec.exec).toHaveBeenCalledWith(
+ `"${systemTar}"`,
+ ['-xf', '/tmp/jdk.zip', '-C', javaPath],
+ {silent: true}
+ );
+ expect(fs.existsSync(javaPath)).toBe(true);
+ });
+
+ it('falls back to tc.extractZip when tar.exe fails', async () => {
+ setPlatform('win32');
+ const systemRoot = path.join(workDir, 'Windows');
+ fs.mkdirSync(path.join(systemRoot, 'System32'), {recursive: true});
+ fs.writeFileSync(path.join(systemRoot, 'System32', 'tar.exe'), '');
+ process.env['SystemRoot'] = systemRoot;
+ let tarDest: string | undefined;
+ (exec.exec as jest.Mock).mockImplementation((...args: unknown[]) => {
+ tarDest = (args[1] as string[])[3];
+ throw new Error('boom');
+ });
+ (tc.extractZip as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.zip')).resolves.toBe('/extracted');
+ expect(tarDest).toBeDefined();
+ expect(fs.existsSync(tarDest!)).toBe(false);
+ });
+
+ it('uses tc.extractZip on non-Windows platforms', async () => {
+ setPlatform('linux');
+ (tc.extractZip as jest.Mock).mockResolvedValue('/extracted' as never);
+
+ await expect(extractJdkFile('/tmp/jdk.zip')).resolves.toBe('/extracted');
+ expect(exec.exec).not.toHaveBeenCalled();
+ });
+});
+
+describe('getArtifactFingerprint', () => {
+ it('prefers the ETag over the other validators', () => {
+ expect(
+ getArtifactFingerprint({
+ etag: '"abc123"',
+ 'last-modified': 'Wed, 21 Oct 2026 07:28:00 GMT',
+ 'content-length': '195000000'
+ })
+ ).toBe('etag:"abc123"');
+ });
+
+ it('combines the last-modified date and the content length without an ETag', () => {
+ expect(
+ getArtifactFingerprint({
+ 'last-modified': 'Wed, 21 Oct 2026 07:28:00 GMT',
+ 'content-length': '195000000'
+ })
+ ).toBe('mtime:Wed, 21 Oct 2026 07:28:00 GMT;length:195000000');
+ });
+
+ it.each([
+ ['no validators', {}],
+ [
+ 'only a last-modified date',
+ {'last-modified': 'Wed, 21 Oct 2026 07:28:00 GMT'}
+ ],
+ ['only a content length', {'content-length': '195000000'}],
+ [
+ 'blank validators',
+ {etag: ' ', 'last-modified': '', 'content-length': ''}
+ ],
+ ['missing headers', undefined]
+ ])('returns undefined for %s', (_label, headers) => {
+ expect(getArtifactFingerprint(headers)).toBeUndefined();
+ });
+
+ it('uses the first value of a repeated header', () => {
+ expect(getArtifactFingerprint({etag: ['"first"', '"second"'] as any})).toBe(
+ 'etag:"first"'
+ );
+ });
+
+ it('distinguishes a republished artifact from the previous one', () => {
+ const before = getArtifactFingerprint({
+ 'last-modified': 'Wed, 21 Oct 2026 07:28:00 GMT',
+ 'content-length': '195000000'
+ });
+ const after = getArtifactFingerprint({
+ 'last-modified': 'Thu, 22 Oct 2026 09:03:00 GMT',
+ 'content-length': '195400000'
+ });
+
+ expect(before).not.toBe(after);
+ });
+});
diff --git a/__tests__/util.test.ts b/__tests__/util.test.ts
index 85b76069e..be3f10bc1 100644
--- a/__tests__/util.test.ts
+++ b/__tests__/util.test.ts
@@ -1,17 +1,152 @@
-import * as cache from '@actions/cache';
-import * as core from '@actions/core';
+import {
+ jest,
+ describe,
+ it,
+ expect,
+ beforeEach,
+ afterAll,
+ afterEach
+} from '@jest/globals';
+import {fileURLToPath} from 'url';
import * as fs from 'fs';
import * as path from 'path';
-import {
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+// Mock @actions/core
+jest.unstable_mockModule('@actions/core', () => ({
+ getInput: jest.fn(),
+ getBooleanInput: jest.fn(),
+ getMultilineInput: jest.fn(),
+ setOutput: jest.fn(),
+ setFailed: jest.fn(),
+ warning: jest.fn(),
+ info: jest.fn(),
+ debug: jest.fn(),
+ error: jest.fn(),
+ notice: jest.fn(),
+ startGroup: jest.fn(),
+ endGroup: jest.fn(),
+ addPath: jest.fn(),
+ exportVariable: jest.fn(),
+ saveState: jest.fn(),
+ getState: jest.fn(),
+ setSecret: jest.fn(),
+ isDebug: jest.fn(() => false),
+ group: jest.fn((_name: string, fn: () => Promise) => fn()),
+ toPlatformPath: jest.fn((p: string) => p),
+ toWin32Path: jest.fn((p: string) => p),
+ toPosixPath: jest.fn((p: string) => p)
+}));
+
+const core = await import('@actions/core');
+
+const {
convertVersionToSemver,
+ normalizeJavaVersionToSemver,
+ getNextPageUrlFromLinkHeader,
getVersionFromFileContent,
isVersionSatisfies,
- isCacheFeatureAvailable,
- isGhes
-} from '../src/util';
+ isGhes,
+ validatePaginationUrl,
+ getLatestMajorVersion,
+ getBooleanInput,
+ isJdkCacheEnabled
+} = await import('../src/util.js');
+
+describe('getBooleanInput', () => {
+ let inputs: Record;
+
+ beforeEach(() => {
+ inputs = {};
+ (core.getInput as jest.Mock).mockImplementation(
+ (name: string) => inputs[name] ?? ''
+ );
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ });
+
+ it.each([
+ ['true', true],
+ ['TRUE', true],
+ ['TrUe', true],
+ [' true ', true],
+ ['false', false],
+ ['FALSE', false],
+ ['FaLsE', false],
+ [' false ', false]
+ ])('parses %j as %s', (value: string, expected: boolean) => {
+ inputs['boolean-input'] = value;
+
+ expect(getBooleanInput('boolean-input')).toBe(expected);
+ });
+
+ it.each([
+ [undefined, false],
+ [false, false],
+ [true, true]
+ ])(
+ 'uses the configured default %s when the input is omitted',
+ (defaultValue: boolean | undefined, expected: boolean) => {
+ expect(getBooleanInput('boolean-input', defaultValue)).toBe(expected);
+ }
+ );
+
+ it('uses the configured default for a whitespace-only input', () => {
+ inputs['boolean-input'] = ' ';
+
+ expect(getBooleanInput('boolean-input', true)).toBe(true);
+ });
+
+ it.each([
+ 'check-latest',
+ 'force-download',
+ 'set-default',
+ 'verify-signature',
+ 'overwrite-settings',
+ 'show-download-progress',
+ 'problem-matcher'
+ ])('rejects an invalid value for %s', inputName => {
+ inputs[inputName] = 'ture';
+
+ expect(() => getBooleanInput(inputName)).toThrow(
+ `Invalid value 'ture' for boolean input '${inputName}'. Expected 'true' or 'false'.`
+ );
+ });
+});
-jest.mock('@actions/cache');
-jest.mock('@actions/core');
+describe('isJdkCacheEnabled', () => {
+ let inputs: Record;
+
+ beforeEach(() => {
+ inputs = {};
+ (core.getInput as jest.Mock).mockImplementation(
+ (name: string) => inputs[name] ?? ''
+ );
+ });
+
+ afterEach(() => {
+ jest.resetAllMocks();
+ });
+
+ it.each([
+ ['', '', false],
+ ['', 'true', true],
+ ['', 'false', false],
+ ['maven', '', true],
+ ['maven', 'true', true],
+ ['maven', 'false', false]
+ ])(
+ 'resolves cache=%j and cache-jdk=%j to %s',
+ (cache, cacheJdk, expected) => {
+ inputs['cache-jdk'] = cacheJdk;
+
+ expect(isJdkCacheEnabled(cache)).toBe(expected);
+ }
+ );
+});
describe('isVersionSatisfies', () => {
it.each([
@@ -27,7 +162,11 @@ describe('isVersionSatisfies', () => {
['2.5.1+3', '2.5.1+3', true],
['2.5.1+3', '2.5.1+2', false],
['15.0.0+14', '15.0.0+14.1.202003190635', false],
- ['15.0.0+14.1.202003190635', '15.0.0+14.1.202003190635', true]
+ ['15.0.0+14.1.202003190635', '15.0.0+14.1.202003190635', true],
+ // 4-segment versions (e.g. JetBrains Runtime '17.0.8.1+1080.1') are not
+ // valid semver — they should be rejected, not throw.
+ ['25.0.3+480.61', '17.0.8.1+1080.1', false],
+ ['17', '17.0.8.1+1080.1', false]
])(
'%s, %s -> %s',
(inputRange: string, inputVersion: string, expected: boolean) => {
@@ -37,41 +176,6 @@ describe('isVersionSatisfies', () => {
);
});
-describe('isCacheFeatureAvailable', () => {
- it('isCacheFeatureAvailable disabled on GHES', () => {
- jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
- const infoMock = jest.spyOn(core, 'warning');
- const message =
- 'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.';
- try {
- process.env['GITHUB_SERVER_URL'] = 'http://example.com';
- expect(isCacheFeatureAvailable()).toBeFalsy();
- expect(infoMock).toHaveBeenCalledWith(message);
- } finally {
- delete process.env['GITHUB_SERVER_URL'];
- }
- });
-
- it('isCacheFeatureAvailable disabled on dotcom', () => {
- jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
- const infoMock = jest.spyOn(core, 'warning');
- const message =
- 'The runner was not able to contact the cache service. Caching will be skipped';
- try {
- process.env['GITHUB_SERVER_URL'] = 'http://github.com';
- expect(isCacheFeatureAvailable()).toBe(false);
- expect(infoMock).toHaveBeenCalledWith(message);
- } finally {
- delete process.env['GITHUB_SERVER_URL'];
- }
- });
-
- it('isCacheFeatureAvailable is enabled', () => {
- jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => true);
- expect(isCacheFeatureAvailable()).toBe(true);
- });
-});
-
describe('convertVersionToSemver', () => {
it.each([
['12', '12'],
@@ -85,18 +189,178 @@ describe('convertVersionToSemver', () => {
});
});
+describe('normalizeJavaVersionToSemver', () => {
+ it.each([
+ ['17', '17'],
+ ['17.0.8', '17.0.8'],
+ ['17.0.8+7', '17.0.8+7'],
+ ['11.0.9.1', '11.0.9+1'],
+ ['12.0.2.1.0', '12.0.2+1.0'],
+ ['26.0.2.1+1', '26.0.2+1.1'],
+ ['17.0.8.1+1080.1', '17.0.8+1.1080.1'],
+ ['>=11.0.9.1', '>=11.0.9.1'],
+ ['17.x', '17.x']
+ ])('%s -> %s', (input: string, expected: string) => {
+ expect(normalizeJavaVersionToSemver(input)).toBe(expected);
+ });
+});
+
+describe('getNextPageUrlFromLinkHeader', () => {
+ it.each([
+ [
+ {
+ link: '; rel="next"'
+ },
+ 'https://api.adoptium.net/v3/info/release_versions?page=1&page_size=10'
+ ],
+ [
+ {
+ Link: '; rel="last", ; rel="next"'
+ },
+ 'https://example.com/next?page=2'
+ ],
+ [
+ {
+ link: '; type="application/json"; rel="next"'
+ },
+ 'https://api.adoptium.net/v3/versions?page=3'
+ ],
+ [{link: '; rel="last"'}, null],
+ [{link: '; rel="nextsomething"'}, null],
+ [undefined, null]
+ ])('returns %s -> %s', (headers, expected) => {
+ expect(getNextPageUrlFromLinkHeader(headers)).toBe(expected);
+ });
+});
+
+describe('validatePaginationUrl', () => {
+ it('accepts URL with matching origin', () => {
+ expect(
+ validatePaginationUrl(
+ 'https://api.adoptium.net/v3/assets?page=2',
+ 'https://api.adoptium.net'
+ )
+ ).toBe(true);
+ });
+
+ it('rejects URL with different host', () => {
+ expect(
+ validatePaginationUrl(
+ 'https://evil.example.com/steal?data=1',
+ 'https://api.adoptium.net'
+ )
+ ).toBe(false);
+ });
+
+ it('rejects URL with different protocol', () => {
+ expect(
+ validatePaginationUrl(
+ 'http://api.adoptium.net/v3/assets?page=2',
+ 'https://api.adoptium.net'
+ )
+ ).toBe(false);
+ });
+
+ it('returns false for invalid URL', () => {
+ expect(validatePaginationUrl('not-a-url', 'https://api.adoptium.net')).toBe(
+ false
+ );
+ });
+
+ it('accepts URL with explicit default port', () => {
+ expect(
+ validatePaginationUrl(
+ 'https://api.adoptium.net:443/v3/assets?page=2',
+ 'https://api.adoptium.net'
+ )
+ ).toBe(true);
+ });
+});
+
describe('getVersionFromFileContent', () => {
+ it.each(['25.0.5.0.10', '8.472.08.1', '25.0.5+0.10'])(
+ 'preserves full Corretto release %s in .java-version',
+ version => {
+ expect(
+ getVersionFromFileContent(version, 'corretto', '.java-version')
+ ).toEqual({version, distribution: undefined});
+ }
+ );
+
+ it.each([
+ ['17.0.3.1', '.java-version', '17'],
+ ['1.8.0.472.1', '.java-version', '8'],
+ ['8.0.472.08.1', '.java-version', '8'],
+ ['8.0.282+8', '.java-version', '8'],
+ ['java corretto-17.0.13.11.1-jre', '.tool-versions', '17'],
+ ['java corretto-17.0.13.11.1+1', '.tool-versions', '17']
+ ])('keeps the existing major selection for %s', (content, file, version) => {
+ expect(getVersionFromFileContent(content, 'corretto', file)?.version).toBe(
+ version
+ );
+ });
+
describe('.sdkmanrc', () => {
it.each([
- ['java=11.0.20.1-tem', '11.0.20'],
- ['java = 11.0.20.1-tem', '11.0.20'],
- ['java=11.0.20.1-tem # a comment in sdkmanrc', '11.0.20'],
- ['java=11.0.20.1-tem\n#java=21.0.20.1-tem\n', '11.0.20'], // choose first match
- ['java=11.0.20.1-tem\njava=21.0.20.1-tem\n', '11.0.20'], // choose first match
- ['#java=11.0.20.1-tem\njava=21.0.20.1-tem\n', '21.0.20'] // first one is 'commented' in .sdkmanrc
- ])('parsing %s should return %s', (content: string, expected: string) => {
- const actual = getVersionFromFileContent(content, 'openjdk', '.sdkmanrc');
- expect(actual).toBe(expected);
+ ['java=26-tem', '26', 'temurin'],
+ ['java=11.0.20.1-tem', '11.0.20', 'temurin'],
+ ['java = 11.0.20.1-tem', '11.0.20', 'temurin'],
+ ['java=11.0.20.1-tem # a comment in sdkmanrc', '11.0.20', 'temurin'],
+ ['java=11.0.20.1-tem\n#java=21.0.20.1-tem\n', '11.0.20', 'temurin'], // choose first match
+ ['java=11.0.20.1-tem\njava=21.0.20.1-tem\n', '11.0.20', 'temurin'], // choose first match
+ ['#java=11.0.20.1-tem\njava=21.0.20.1-tem\n', '21.0.20', 'temurin'], // first one is 'commented' in .sdkmanrc
+ ['java=21.0.5-zulu', '21.0.5', 'zulu'],
+ ['java=17.0.13-albba', '17.0.13', 'dragonwell'],
+ ['java=17.0.13-amzn', '17', 'corretto'],
+ ['java=25.0.5.0.10-amzn', '25.0.5.0.10', 'corretto'],
+ ['java=8.472.08.1-amzn', '8.472.08.1', 'corretto'],
+ ['java=21.0.5-graal', '21.0.5', 'graalvm'],
+ ['java=17.0.9-graalce', '17.0.9', 'graalvm'],
+ ['java=11.0.25-librca', '11.0.25', 'liberica'],
+ ['java=25.0.4+1.1-librca', '25.0.4+1.1', 'liberica'],
+ ['java=25.0.4+1.1-zulu', '25.0.4+1.1', 'zulu'],
+ ['java=11.0.25-ms', '11.0.25', 'microsoft'],
+ ['java=21.0.5-oracle', '21.0.5', 'oracle'],
+ ['java=11.0.25-sapmchn', '11.0.25', 'sapmachine'],
+ ['java=21.0.5-jbr', '21.0.5', 'jetbrains'],
+ ['java=11.0.25-sem', '11.0.25', 'semeru'],
+ ['java=17.0.13-dragonwell', '17.0.13', 'dragonwell'],
+ ['java=21.0.5-kona', '21.0.5', 'kona']
+ ])(
+ 'parsing %s should return version %s and distribution %s',
+ (content: string, expectedVersion: string, expectedDist: string) => {
+ const actual = getVersionFromFileContent(
+ content,
+ 'openjdk',
+ '.sdkmanrc'
+ );
+ expect(actual?.version).toBe(expectedVersion);
+ expect(actual?.distribution).toBe(expectedDist);
+ }
+ );
+
+ it('should warn and return undefined distribution for unknown identifier', () => {
+ const warnSpy = jest.spyOn(core, 'warning');
+ const actual = getVersionFromFileContent(
+ 'java=21.0.5-unknown',
+ 'temurin',
+ '.sdkmanrc'
+ );
+ expect(actual?.version).toBe('21.0.5');
+ expect(actual?.distribution).toBeUndefined();
+ expect(warnSpy).toHaveBeenCalledWith(
+ expect.stringContaining('Unknown SDKMAN distribution identifier')
+ );
+ });
+
+ it('should return version without distribution when no suffix provided', () => {
+ const actual = getVersionFromFileContent(
+ 'java=11.0.20',
+ 'temurin',
+ '.sdkmanrc'
+ );
+ expect(actual?.version).toBe('11.0.20');
+ expect(actual?.distribution).toBeUndefined();
});
describe('known versions', () => {
@@ -115,18 +379,84 @@ describe('getVersionFromFileContent', () => {
'openjdk',
'.sdkmanrc'
);
- expect(actual).toBe(expected);
+ expect(actual?.version).toBe(expected);
}
);
});
});
+
+ describe('.tool-versions', () => {
+ it.each([
+ ['java temurin-17.0.3+7', '17.0.3+7', 'temurin'],
+ ['java temurin-jre-17.0.3+7', '17.0.3+7', 'temurin'],
+ ['java adoptopenjdk-11.0.16+8', '11.0.16+8', 'temurin'],
+ ['java adoptopenjdk-openj9-11.0.16+8', '11.0.16+8', 'temurin'],
+ ['java zulu-11.56.19', '11.56.19', 'zulu'],
+ ['java corretto-17.0.13.11.1', '17.0.13.11.1', 'corretto'],
+ ['java corretto-8.472.08.1', '8.472.08.1', 'corretto'],
+ ['java liberica-11.0.15+10', '11.0.15+10', 'liberica'],
+ ['java microsoft-11.0.13.8.1', '11.0.13', 'microsoft'],
+ ['java semeru-openj9-11.0.25+9', '11.0.25+9', 'semeru'],
+ ['java ibm-openj9-11.0.25+9', '11.0.25+9', 'semeru'],
+ ['java dragonwell-17.0.13.0.13+11', '17.0.13', 'dragonwell'],
+ ['java graalvm-22.3.0+java17', '22.3.0+java17', 'graalvm'],
+ ['java graalvm-community-22.3.0', '22.3.0', 'graalvm-community'],
+ ['java oracle-graalvm-21.0.5', '21.0.5', 'graalvm'],
+ ['java oracle-21.0.5', '21.0.5', 'oracle'],
+ ['java sapmachine-21.0.5', '21.0.5', 'sapmachine'],
+ ['java kona-17.0.13', '17.0.13', 'kona'],
+ ['java jetbrains-21.0.5', '21.0.5', 'jetbrains']
+ ])(
+ 'parsing %s should return version %s and distribution %s',
+ (content: string, expectedVersion: string, expectedDist: string) => {
+ const actual = getVersionFromFileContent(
+ content,
+ 'openjdk',
+ '.tool-versions'
+ );
+ expect(actual?.version).toBe(expectedVersion);
+ expect(actual?.distribution).toBe(expectedDist);
+ }
+ );
+
+ it.each([
+ ['java 17.0.7', '17.0.7'],
+ ['java 17', '17'],
+ ['java 1.8', '8'],
+ ['java 21-ea', '21-ea']
+ ])(
+ 'parsing prefix-less %s should return version %s and no distribution',
+ (content: string, expectedVersion: string) => {
+ const actual = getVersionFromFileContent(
+ content,
+ 'temurin',
+ '.tool-versions'
+ );
+ expect(actual?.version).toBe(expectedVersion);
+ expect(actual?.distribution).toBeUndefined();
+ }
+ );
+
+ it('should warn and return undefined distribution for unsupported vendor', () => {
+ const warnSpy = jest.spyOn(core, 'warning');
+ const actual = getVersionFromFileContent(
+ 'java openjdk-17.0.7',
+ 'temurin',
+ '.tool-versions'
+ );
+ expect(actual?.version).toBe('17.0.7');
+ expect(actual?.distribution).toBeUndefined();
+ expect(warnSpy).toHaveBeenCalledWith(
+ expect.stringContaining('Unknown asdf distribution identifier')
+ );
+ });
+ });
});
describe('isGhes', () => {
const pristineEnv = process.env;
beforeEach(() => {
- jest.resetModules();
process.env = {...pristineEnv};
});
@@ -159,3 +489,33 @@ describe('isGhes', () => {
expect(isGhes()).toBeTruthy();
});
});
+
+describe('getLatestMajorVersion', () => {
+ const makeHttp = (getJson: jest.Mock) =>
+ ({getJson}) as unknown as import('@actions/http-client').HttpClient;
+
+ it('returns most_recent_feature_release from the Adoptium API', async () => {
+ const getJson = jest.fn(async () => ({
+ statusCode: 200,
+ result: {most_recent_feature_release: 25},
+ headers: {}
+ }));
+
+ await expect(getLatestMajorVersion(makeHttp(getJson))).resolves.toBe(25);
+ expect(getJson).toHaveBeenCalledWith(
+ 'https://api.adoptium.net/v3/info/available_releases'
+ );
+ });
+
+ it('throws when the response does not contain a usable value', async () => {
+ const getJson = jest.fn(async () => ({
+ statusCode: 200,
+ result: {},
+ headers: {}
+ }));
+
+ await expect(getLatestMajorVersion(makeHttp(getJson))).rejects.toThrow(
+ 'Could not determine the latest available Java major version'
+ );
+ });
+});
diff --git a/__tests__/verify-java.sh b/__tests__/verify-java.sh
index 069d9008a..1a81283d7 100755
--- a/__tests__/verify-java.sh
+++ b/__tests__/verify-java.sh
@@ -12,6 +12,15 @@ fi
EXPECTED_JAVA_VERSION=$1
EXPECTED_PATH=$2
+SETUP_JAVA_VERSION=$3
+REQUIRE_CONCRETE_VERSION=$4
+
+if [[ $EXPECTED_JAVA_VERSION == *"+"* ]] && [ "$SETUP_JAVA_VERSION" != "$EXPECTED_JAVA_VERSION" ]; then
+ echo "::error::The version output does not match the requested build"
+ echo "Requested version: $EXPECTED_JAVA_VERSION"
+ echo "Version output: $SETUP_JAVA_VERSION"
+ exit 1
+fi
EXPECTED_JAVA_VERSION=$(echo $EXPECTED_JAVA_VERSION | cut -d'+' -f1)
if [[ $EXPECTED_JAVA_VERSION == 8 ]] || [[ $EXPECTED_JAVA_VERSION == 8.* ]]; then
@@ -31,6 +40,24 @@ if [ -z "$GREP_RESULT" ]; then
exit 1
fi
+if [ -n "$SETUP_JAVA_VERSION" ]; then
+ OUTPUT_JAVA_VERSION=$(echo "$SETUP_JAVA_VERSION" | cut -d'+' -f1)
+ if [[ $OUTPUT_JAVA_VERSION == *-ea* ]]; then
+ OUTPUT_JAVA_VERSION=$(echo "$OUTPUT_JAVA_VERSION" | cut -d'-' -f1 | cut -d'.' -f1)
+ fi
+ OUTPUT_GREP_RESULT=$(echo "$ACTUAL_JAVA_VERSION" | grep -E "^(openjdk|java) version \"$OUTPUT_JAVA_VERSION")
+ if [ -z "$OUTPUT_GREP_RESULT" ]; then
+ echo "::error::The version output does not match the installed Java version"
+ echo "Version output: $SETUP_JAVA_VERSION"
+ exit 1
+ fi
+ if [ "$REQUIRE_CONCRETE_VERSION" = "true" ] && [ "$OUTPUT_JAVA_VERSION" = "$EXPECTED_JAVA_VERSION" ]; then
+ echo "::error::Expected a concrete version output for a floating JDK"
+ echo "Version output: $SETUP_JAVA_VERSION"
+ exit 1
+ fi
+fi
+
if [ "$EXPECTED_PATH" != "$JAVA_HOME" ]; then
echo "::error::Unexpected path"
echo "Actual path: $JAVA_HOME"
diff --git a/action.yml b/action.yml
index 21a4269d7..c52732b46 100644
--- a/action.yml
+++ b/action.yml
@@ -4,41 +4,88 @@ description: 'Set up a specific version of the Java JDK and add the
author: 'GitHub'
inputs:
java-version:
- description: 'The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file'
+ description: 'The Java version to set up. Takes a whole or semver Java version, or the "latest" alias to use the newest available stable release. See examples of supported syntax in README file'
+ required: false
java-version-file:
- description: 'The path to the `.java-version` file. See examples of supported syntax in README file'
+ description: 'The path to a file containing the Java version to set up (.java-version, .tool-versions, .sdkmanrc). Used when java-version is not set. See examples of supported syntax in README file'
+ required: false
distribution:
- description: 'Java distribution. See the list of supported distributions in README file'
- required: true
+ description: 'Java distribution. See the list of supported distributions in README file. This input is required except when java-version-file points to .sdkmanrc with a recognized distribution suffix (e.g., java=21.0.5-tem).'
+ required: false
java-package:
- description: 'The package type (jdk, jre, jdk+fx, jre+fx)'
+ description: 'The package type (`jdk`, `jre`, `jdk+fx`, `jre+fx`, `jdk+crac`, `jre+crac`, `jdk+jmods`, `jdk+jcef`, `jre+jcef`, `jdk+ft`, or `jre+ft`). Supported values vary by distribution.'
required: false
default: 'jdk'
architecture:
- description: "The architecture of the package (defaults to the action runner's architecture)"
+ description: "The architecture of the package (`x86`, `x64`, `armv7`, `aarch64`, `ppc64le`, `ppc64`, `riscv64`, or `s390x`). Aliases `ia32`, `amd64`, `arm`, and `arm64` are normalized to `x86`, `x64`, `armv7`, and `aarch64`. Supported values vary by distribution and operating system. Defaults to the action runner's architecture."
required: false
- jdkFile:
+ jdk-file:
description: 'Path to where the compressed JDK is located'
required: false
+ jdkFile:
+ description: 'Deprecated alias for `jdk-file`. Path to where the compressed JDK is located. Use `jdk-file` instead; this alias may be removed in a future release.'
+ required: false
+ deprecationMessage: 'The `jdkFile` input is deprecated. Use `jdk-file` instead.'
check-latest:
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec'
required: false
default: false
+ force-download:
+ description: 'Set this option to always download Java and replace any matching version in the tool cache'
+ required: false
+ default: false
+ set-default:
+ description: 'Set this option to false if you want to install a JDK but not make it the default. When false, JAVA_HOME and PATH are not updated, but JAVA_HOME__ is still set.'
+ required: false
+ default: true
+ verify-signature:
+ description: 'Check downloaded Java package signatures when supported by the selected distribution. When omitted, failures produce warnings. Explicitly setting this to true enforces verification and makes failures fatal, including failures caused by an unexpected vendor signing-key rotation.'
+ required: false
+ verify-signature-public-key:
+ description: 'One or more ASCII-armored GPG public keys used to verify downloaded package signatures. Concatenate multiple armored key blocks. Custom keys replace the bundled keys for the selected distribution.'
+ required: false
server-id:
description: 'ID of the distributionManagement repository in the pom.xml
file. Default is `github`'
required: false
default: 'github'
- server-username:
+ server-username-env-var:
description: 'Environment variable name for the username for authentication
to the Apache Maven repository. Default is $GITHUB_ACTOR'
required: false
- default: 'GITHUB_ACTOR'
- server-password:
+ server-username:
+ description: 'Deprecated alias for server-username-env-var'
+ required: false
+ server-password-env-var:
description: 'Environment variable name for password or token for
authentication to the Apache Maven repository. Default is $GITHUB_TOKEN'
required: false
- default: 'GITHUB_TOKEN'
+ server-password:
+ description: 'Deprecated alias for server-password-env-var'
+ required: false
+ mvn-server-credentials:
+ description: 'Multiline list of Maven server credentials in the format `server-id:USERNAME_ENV:PASSWORD_ENV`. When set, replaces the single server configured by server-id, server-username-env-var, and server-password-env-var.'
+ required: false
+ mvn-server-repository-origins:
+ description: 'Multiline list of Maven credential origins in the format `server-id:repository-origin`. Each origin must belong to a configured server ID. Requires Maven 3.10+.'
+ required: false
+ mvn-repositories:
+ description: 'Multiline list of Maven dependency repositories in the format `repository-id:repository-url:snapshots-enabled`.'
+ required: false
+ mvn-plugin-repositories:
+ description: 'Multiline list of Maven plugin repositories in the format `repository-id:repository-url:snapshots-enabled`.'
+ required: false
+ mvn-mirrors:
+ description: 'Multiline list of Maven mirrors in the format `mirror-id:mirror-url:mirror-of`. The URL must include a scheme; percent-encode colons in its path, query, or fragment. Use a matching server ID for authentication. Can be used independently of repository inputs.'
+ required: false
+ mvn-repositories-include-central:
+ description: 'Include Maven Central for dependency and plugin repositories in the generated profile. When false, Central is disabled for both types unless that type explicitly declares ID `central`. Has no effect when neither repository list is configured.'
+ required: false
+ default: true
+ mvn-repositories-prioritize-central:
+ description: 'Place Maven Central before custom dependency and plugin repositories. Has no effect when Maven Central is excluded or neither repository list is configured.'
+ required: false
+ default: true
settings-path:
description: 'Path to where the settings.xml file will be written. Default is ~/.m2.'
required: false
@@ -47,30 +94,53 @@ inputs:
required: false
default: true
gpg-private-key:
- description: 'GPG private key to import. Default is empty string.'
+ description: 'GPG private key to import into an isolated temporary keyring. Default is empty string.'
+ required: false
+ default: ''
+ gpg-passphrase-env-var:
+ description: 'Environment variable name for the GPG private key passphrase. Defaults to GPG_PASSPHRASE when gpg-private-key is set.'
required: false
gpg-passphrase:
- description: 'Environment variable name for the GPG private key passphrase. Default is
- $GPG_PASSPHRASE.'
+ description: 'Deprecated alias for gpg-passphrase-env-var'
required: false
cache:
description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".'
required: false
+ cache-jdk:
+ description: 'Cache downloaded JDK installations between jobs. Defaults to enabled when dependency caching is configured with `cache`; set explicitly to "true" or "false" to override.'
+ required: false
cache-dependency-path:
description: 'The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.'
required: false
+ cache-path:
+ description: 'The path to cache instead of the default dependency cache path for the selected package manager. This option can be used with the `cache` option and supports a list of paths and exclusion patterns.'
+ required: false
+ cache-read-only:
+ description: 'Restore caches without saving cache changes in the post action.'
+ required: false
+ default: false
job-status:
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
+ required: false
default: ${{ job.status }}
token:
description: The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
+ required: false
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
mvn-toolchain-id:
- description: 'Name of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. See examples of supported syntax in Advanced Usage file'
+ description: 'Name of Maven Toolchain ID if the default name of "${mvn-toolchain-vendor}_${java-version}" is not wanted. The toolchain vendor defaults to the "distribution" input. When supplied, the number of IDs must match the number of Java versions. See examples of supported syntax in Advanced Usage file'
required: false
mvn-toolchain-vendor:
description: 'Name of Maven Toolchain Vendor if the default name of "${distribution}" is not wanted. See examples of supported syntax in Advanced Usage file'
required: false
+ show-download-progress:
+ description: 'Whether Maven should print artifact download/transfer progress to the build log. When "false" (default) the action sets "-ntp" (--no-transfer-progress) in MAVEN_ARGS to produce cleaner logs. Set to "true" to keep the progress output. Has no effect on non-Maven builds.'
+ required: false
+ default: false
+ problem-matcher:
+ description: 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Disabled by default; set to "true" to enable annotations.'
+ required: false
+ default: false
outputs:
distribution:
description: 'Distribution of Java that has been installed'
@@ -80,6 +150,8 @@ outputs:
description: 'Path to where the java environment has been installed (same as $JAVA_HOME)'
cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key'
+ cache-primary-key:
+ description: 'The primary cache key computed by the action for the configured build tool. Empty when caching is not enabled or when caching is skipped (e.g. cache service unavailable). Useful for composing with actions/cache or actions/cache/restore across jobs.'
runs:
using: 'node24'
main: 'dist/setup/index.js'
diff --git a/dist/cleanup/230.index.js b/dist/cleanup/230.index.js
new file mode 100644
index 000000000..746f194c1
--- /dev/null
+++ b/dist/cleanup/230.index.js
@@ -0,0 +1,63446 @@
+export const id = 230;
+export const ids = [230];
+export const modules = {
+
+/***/ 7889:
+/***/ (function(__unused_webpack_module, exports) {
+
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ClientStreamingCall = void 0;
+/**
+ * A client streaming RPC call. This means that the clients sends 0, 1, or
+ * more messages to the server, and the server replies with exactly one
+ * message.
+ */
+class ClientStreamingCall {
+ constructor(method, requestHeaders, request, headers, response, status, trailers) {
+ this.method = method;
+ this.requestHeaders = requestHeaders;
+ this.requests = request;
+ this.headers = headers;
+ this.response = response;
+ this.status = status;
+ this.trailers = trailers;
+ }
+ /**
+ * Instead of awaiting the response status and trailers, you can
+ * just as well await this call itself to receive the server outcome.
+ * Note that it may still be valid to send more request messages.
+ */
+ then(onfulfilled, onrejected) {
+ return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
+ }
+ promiseFinished() {
+ return __awaiter(this, void 0, void 0, function* () {
+ let [headers, response, status, trailers] = yield Promise.all([this.headers, this.response, this.status, this.trailers]);
+ return {
+ method: this.method,
+ requestHeaders: this.requestHeaders,
+ headers,
+ response,
+ status,
+ trailers
+ };
+ });
+ }
+}
+exports.ClientStreamingCall = ClientStreamingCall;
+
+
+/***/ }),
+
+/***/ 1409:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.Deferred = exports.DeferredState = void 0;
+var DeferredState;
+(function (DeferredState) {
+ DeferredState[DeferredState["PENDING"] = 0] = "PENDING";
+ DeferredState[DeferredState["REJECTED"] = 1] = "REJECTED";
+ DeferredState[DeferredState["RESOLVED"] = 2] = "RESOLVED";
+})(DeferredState = exports.DeferredState || (exports.DeferredState = {}));
+/**
+ * A deferred promise. This is a "controller" for a promise, which lets you
+ * pass a promise around and reject or resolve it from the outside.
+ *
+ * Warning: This class is to be used with care. Using it can make code very
+ * difficult to read. It is intended for use in library code that exposes
+ * promises, not for regular business logic.
+ */
+class Deferred {
+ /**
+ * @param preventUnhandledRejectionWarning - prevents the warning
+ * "Unhandled Promise rejection" by adding a noop rejection handler.
+ * Working with calls returned from the runtime-rpc package in an
+ * async function usually means awaiting one call property after
+ * the other. This means that the "status" is not being awaited when
+ * an earlier await for the "headers" is rejected. This causes the
+ * "unhandled promise reject" warning. A more correct behaviour for
+ * calls might be to become aware whether at least one of the
+ * promises is handled and swallow the rejection warning for the
+ * others.
+ */
+ constructor(preventUnhandledRejectionWarning = true) {
+ this._state = DeferredState.PENDING;
+ this._promise = new Promise((resolve, reject) => {
+ this._resolve = resolve;
+ this._reject = reject;
+ });
+ if (preventUnhandledRejectionWarning) {
+ this._promise.catch(_ => { });
+ }
+ }
+ /**
+ * Get the current state of the promise.
+ */
+ get state() {
+ return this._state;
+ }
+ /**
+ * Get the deferred promise.
+ */
+ get promise() {
+ return this._promise;
+ }
+ /**
+ * Resolve the promise. Throws if the promise is already resolved or rejected.
+ */
+ resolve(value) {
+ if (this.state !== DeferredState.PENDING)
+ throw new Error(`cannot resolve ${DeferredState[this.state].toLowerCase()}`);
+ this._resolve(value);
+ this._state = DeferredState.RESOLVED;
+ }
+ /**
+ * Reject the promise. Throws if the promise is already resolved or rejected.
+ */
+ reject(reason) {
+ if (this.state !== DeferredState.PENDING)
+ throw new Error(`cannot reject ${DeferredState[this.state].toLowerCase()}`);
+ this._reject(reason);
+ this._state = DeferredState.REJECTED;
+ }
+ /**
+ * Resolve the promise. Ignore if not pending.
+ */
+ resolvePending(val) {
+ if (this._state === DeferredState.PENDING)
+ this.resolve(val);
+ }
+ /**
+ * Reject the promise. Ignore if not pending.
+ */
+ rejectPending(reason) {
+ if (this._state === DeferredState.PENDING)
+ this.reject(reason);
+ }
+}
+exports.Deferred = Deferred;
+
+
+/***/ }),
+
+/***/ 6826:
+/***/ (function(__unused_webpack_module, exports) {
+
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.DuplexStreamingCall = void 0;
+/**
+ * A duplex streaming RPC call. This means that the clients sends an
+ * arbitrary amount of messages to the server, while at the same time,
+ * the server sends an arbitrary amount of messages to the client.
+ */
+class DuplexStreamingCall {
+ constructor(method, requestHeaders, request, headers, response, status, trailers) {
+ this.method = method;
+ this.requestHeaders = requestHeaders;
+ this.requests = request;
+ this.headers = headers;
+ this.responses = response;
+ this.status = status;
+ this.trailers = trailers;
+ }
+ /**
+ * Instead of awaiting the response status and trailers, you can
+ * just as well await this call itself to receive the server outcome.
+ * Note that it may still be valid to send more request messages.
+ */
+ then(onfulfilled, onrejected) {
+ return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
+ }
+ promiseFinished() {
+ return __awaiter(this, void 0, void 0, function* () {
+ let [headers, status, trailers] = yield Promise.all([this.headers, this.status, this.trailers]);
+ return {
+ method: this.method,
+ requestHeaders: this.requestHeaders,
+ headers,
+ status,
+ trailers,
+ };
+ });
+ }
+}
+exports.DuplexStreamingCall = DuplexStreamingCall;
+
+
+/***/ }),
+
+/***/ 4420:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+var __webpack_unused_export__;
+
+// Public API of the rpc runtime.
+// Note: we do not use `export * from ...` to help tree shakers,
+// webpack verbose output hints that this should be useful
+__webpack_unused_export__ = ({ value: true });
+var service_type_1 = __webpack_require__(6892);
+Object.defineProperty(exports, "C0", ({ enumerable: true, get: function () { return service_type_1.ServiceType; } }));
+var reflection_info_1 = __webpack_require__(2496);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return reflection_info_1.readMethodOptions; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return reflection_info_1.readMethodOption; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return reflection_info_1.readServiceOption; } });
+var rpc_error_1 = __webpack_require__(8636);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_error_1.RpcError; } });
+var rpc_options_1 = __webpack_require__(8576);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_options_1.mergeRpcOptions; } });
+var rpc_output_stream_1 = __webpack_require__(2726);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_output_stream_1.RpcOutputStreamController; } });
+var test_transport_1 = __webpack_require__(9122);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return test_transport_1.TestTransport; } });
+var deferred_1 = __webpack_require__(1409);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return deferred_1.Deferred; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return deferred_1.DeferredState; } });
+var duplex_streaming_call_1 = __webpack_require__(6826);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return duplex_streaming_call_1.DuplexStreamingCall; } });
+var client_streaming_call_1 = __webpack_require__(7889);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return client_streaming_call_1.ClientStreamingCall; } });
+var server_streaming_call_1 = __webpack_require__(6173);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return server_streaming_call_1.ServerStreamingCall; } });
+var unary_call_1 = __webpack_require__(9288);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return unary_call_1.UnaryCall; } });
+var rpc_interceptor_1 = __webpack_require__(2849);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_interceptor_1.stackIntercept; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_interceptor_1.stackDuplexStreamingInterceptors; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_interceptor_1.stackClientStreamingInterceptors; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_interceptor_1.stackServerStreamingInterceptors; } });
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return rpc_interceptor_1.stackUnaryInterceptors; } });
+var server_call_context_1 = __webpack_require__(3352);
+__webpack_unused_export__ = ({ enumerable: true, get: function () { return server_call_context_1.ServerCallContextController; } });
+
+
+/***/ }),
+
+/***/ 2496:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.readServiceOption = exports.readMethodOption = exports.readMethodOptions = exports.normalizeMethodInfo = void 0;
+const runtime_1 = __webpack_require__(8886);
+/**
+ * Turns PartialMethodInfo into MethodInfo.
+ */
+function normalizeMethodInfo(method, service) {
+ var _a, _b, _c;
+ let m = method;
+ m.service = service;
+ m.localName = (_a = m.localName) !== null && _a !== void 0 ? _a : runtime_1.lowerCamelCase(m.name);
+ // noinspection PointlessBooleanExpressionJS
+ m.serverStreaming = !!m.serverStreaming;
+ // noinspection PointlessBooleanExpressionJS
+ m.clientStreaming = !!m.clientStreaming;
+ m.options = (_b = m.options) !== null && _b !== void 0 ? _b : {};
+ m.idempotency = (_c = m.idempotency) !== null && _c !== void 0 ? _c : undefined;
+ return m;
+}
+exports.normalizeMethodInfo = normalizeMethodInfo;
+/**
+ * Read custom method options from a generated service client.
+ *
+ * @deprecated use readMethodOption()
+ */
+function readMethodOptions(service, methodName, extensionName, extensionType) {
+ var _a;
+ const options = (_a = service.methods.find((m, i) => m.localName === methodName || i === methodName)) === null || _a === void 0 ? void 0 : _a.options;
+ return options && options[extensionName] ? extensionType.fromJson(options[extensionName]) : undefined;
+}
+exports.readMethodOptions = readMethodOptions;
+function readMethodOption(service, methodName, extensionName, extensionType) {
+ var _a;
+ const options = (_a = service.methods.find((m, i) => m.localName === methodName || i === methodName)) === null || _a === void 0 ? void 0 : _a.options;
+ if (!options) {
+ return undefined;
+ }
+ const optionVal = options[extensionName];
+ if (optionVal === undefined) {
+ return optionVal;
+ }
+ return extensionType ? extensionType.fromJson(optionVal) : optionVal;
+}
+exports.readMethodOption = readMethodOption;
+function readServiceOption(service, extensionName, extensionType) {
+ const options = service.options;
+ if (!options) {
+ return undefined;
+ }
+ const optionVal = options[extensionName];
+ if (optionVal === undefined) {
+ return optionVal;
+ }
+ return extensionType ? extensionType.fromJson(optionVal) : optionVal;
+}
+exports.readServiceOption = readServiceOption;
+
+
+/***/ }),
+
+/***/ 8636:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RpcError = void 0;
+/**
+ * An error that occurred while calling a RPC method.
+ */
+class RpcError extends Error {
+ constructor(message, code = 'UNKNOWN', meta) {
+ super(message);
+ this.name = 'RpcError';
+ // see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#example
+ Object.setPrototypeOf(this, new.target.prototype);
+ this.code = code;
+ this.meta = meta !== null && meta !== void 0 ? meta : {};
+ }
+ toString() {
+ const l = [this.name + ': ' + this.message];
+ if (this.code) {
+ l.push('');
+ l.push('Code: ' + this.code);
+ }
+ if (this.serviceName && this.methodName) {
+ l.push('Method: ' + this.serviceName + '/' + this.methodName);
+ }
+ let m = Object.entries(this.meta);
+ if (m.length) {
+ l.push('');
+ l.push('Meta:');
+ for (let [k, v] of m) {
+ l.push(` ${k}: ${v}`);
+ }
+ }
+ return l.join('\n');
+ }
+}
+exports.RpcError = RpcError;
+
+
+/***/ }),
+
+/***/ 2849:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.stackDuplexStreamingInterceptors = exports.stackClientStreamingInterceptors = exports.stackServerStreamingInterceptors = exports.stackUnaryInterceptors = exports.stackIntercept = void 0;
+const runtime_1 = __webpack_require__(8886);
+/**
+ * Creates a "stack" of of all interceptors specified in the given `RpcOptions`.
+ * Used by generated client implementations.
+ * @internal
+ */
+function stackIntercept(kind, transport, method, options, input) {
+ var _a, _b, _c, _d;
+ if (kind == "unary") {
+ let tail = (mtd, inp, opt) => transport.unary(mtd, inp, opt);
+ for (const curr of ((_a = options.interceptors) !== null && _a !== void 0 ? _a : []).filter(i => i.interceptUnary).reverse()) {
+ const next = tail;
+ tail = (mtd, inp, opt) => curr.interceptUnary(next, mtd, inp, opt);
+ }
+ return tail(method, input, options);
+ }
+ if (kind == "serverStreaming") {
+ let tail = (mtd, inp, opt) => transport.serverStreaming(mtd, inp, opt);
+ for (const curr of ((_b = options.interceptors) !== null && _b !== void 0 ? _b : []).filter(i => i.interceptServerStreaming).reverse()) {
+ const next = tail;
+ tail = (mtd, inp, opt) => curr.interceptServerStreaming(next, mtd, inp, opt);
+ }
+ return tail(method, input, options);
+ }
+ if (kind == "clientStreaming") {
+ let tail = (mtd, opt) => transport.clientStreaming(mtd, opt);
+ for (const curr of ((_c = options.interceptors) !== null && _c !== void 0 ? _c : []).filter(i => i.interceptClientStreaming).reverse()) {
+ const next = tail;
+ tail = (mtd, opt) => curr.interceptClientStreaming(next, mtd, opt);
+ }
+ return tail(method, options);
+ }
+ if (kind == "duplex") {
+ let tail = (mtd, opt) => transport.duplex(mtd, opt);
+ for (const curr of ((_d = options.interceptors) !== null && _d !== void 0 ? _d : []).filter(i => i.interceptDuplex).reverse()) {
+ const next = tail;
+ tail = (mtd, opt) => curr.interceptDuplex(next, mtd, opt);
+ }
+ return tail(method, options);
+ }
+ runtime_1.assertNever(kind);
+}
+exports.stackIntercept = stackIntercept;
+/**
+ * @deprecated replaced by `stackIntercept()`, still here to support older generated code
+ */
+function stackUnaryInterceptors(transport, method, input, options) {
+ return stackIntercept("unary", transport, method, options, input);
+}
+exports.stackUnaryInterceptors = stackUnaryInterceptors;
+/**
+ * @deprecated replaced by `stackIntercept()`, still here to support older generated code
+ */
+function stackServerStreamingInterceptors(transport, method, input, options) {
+ return stackIntercept("serverStreaming", transport, method, options, input);
+}
+exports.stackServerStreamingInterceptors = stackServerStreamingInterceptors;
+/**
+ * @deprecated replaced by `stackIntercept()`, still here to support older generated code
+ */
+function stackClientStreamingInterceptors(transport, method, options) {
+ return stackIntercept("clientStreaming", transport, method, options);
+}
+exports.stackClientStreamingInterceptors = stackClientStreamingInterceptors;
+/**
+ * @deprecated replaced by `stackIntercept()`, still here to support older generated code
+ */
+function stackDuplexStreamingInterceptors(transport, method, options) {
+ return stackIntercept("duplex", transport, method, options);
+}
+exports.stackDuplexStreamingInterceptors = stackDuplexStreamingInterceptors;
+
+
+/***/ }),
+
+/***/ 8576:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.mergeRpcOptions = void 0;
+const runtime_1 = __webpack_require__(8886);
+/**
+ * Merges custom RPC options with defaults. Returns a new instance and keeps
+ * the "defaults" and the "options" unmodified.
+ *
+ * Merges `RpcMetadata` "meta", overwriting values from "defaults" with
+ * values from "options". Does not append values to existing entries.
+ *
+ * Merges "jsonOptions", including "jsonOptions.typeRegistry", by creating
+ * a new array that contains types from "options.jsonOptions.typeRegistry"
+ * first, then types from "defaults.jsonOptions.typeRegistry".
+ *
+ * Merges "binaryOptions".
+ *
+ * Merges "interceptors" by creating a new array that contains interceptors
+ * from "defaults" first, then interceptors from "options".
+ *
+ * Works with objects that extend `RpcOptions`, but only if the added
+ * properties are of type Date, primitive like string, boolean, or Array
+ * of primitives. If you have other property types, you have to merge them
+ * yourself.
+ */
+function mergeRpcOptions(defaults, options) {
+ if (!options)
+ return defaults;
+ let o = {};
+ copy(defaults, o);
+ copy(options, o);
+ for (let key of Object.keys(options)) {
+ let val = options[key];
+ switch (key) {
+ case "jsonOptions":
+ o.jsonOptions = runtime_1.mergeJsonOptions(defaults.jsonOptions, o.jsonOptions);
+ break;
+ case "binaryOptions":
+ o.binaryOptions = runtime_1.mergeBinaryOptions(defaults.binaryOptions, o.binaryOptions);
+ break;
+ case "meta":
+ o.meta = {};
+ copy(defaults.meta, o.meta);
+ copy(options.meta, o.meta);
+ break;
+ case "interceptors":
+ o.interceptors = defaults.interceptors ? defaults.interceptors.concat(val) : val.concat();
+ break;
+ }
+ }
+ return o;
+}
+exports.mergeRpcOptions = mergeRpcOptions;
+function copy(a, into) {
+ if (!a)
+ return;
+ let c = into;
+ for (let [k, v] of Object.entries(a)) {
+ if (v instanceof Date)
+ c[k] = new Date(v.getTime());
+ else if (Array.isArray(v))
+ c[k] = v.concat();
+ else
+ c[k] = v;
+ }
+}
+
+
+/***/ }),
+
+/***/ 2726:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.RpcOutputStreamController = void 0;
+const deferred_1 = __webpack_require__(1409);
+const runtime_1 = __webpack_require__(8886);
+/**
+ * A `RpcOutputStream` that you control.
+ */
+class RpcOutputStreamController {
+ constructor() {
+ this._lis = {
+ nxt: [],
+ msg: [],
+ err: [],
+ cmp: [],
+ };
+ this._closed = false;
+ // --- RpcOutputStream async iterator API
+ // iterator state.
+ // is undefined when no iterator has been acquired yet.
+ this._itState = { q: [] };
+ }
+ // --- RpcOutputStream callback API
+ onNext(callback) {
+ return this.addLis(callback, this._lis.nxt);
+ }
+ onMessage(callback) {
+ return this.addLis(callback, this._lis.msg);
+ }
+ onError(callback) {
+ return this.addLis(callback, this._lis.err);
+ }
+ onComplete(callback) {
+ return this.addLis(callback, this._lis.cmp);
+ }
+ addLis(callback, list) {
+ list.push(callback);
+ return () => {
+ let i = list.indexOf(callback);
+ if (i >= 0)
+ list.splice(i, 1);
+ };
+ }
+ // remove all listeners
+ clearLis() {
+ for (let l of Object.values(this._lis))
+ l.splice(0, l.length);
+ }
+ // --- Controller API
+ /**
+ * Is this stream already closed by a completion or error?
+ */
+ get closed() {
+ return this._closed !== false;
+ }
+ /**
+ * Emit message, close with error, or close successfully, but only one
+ * at a time.
+ * Can be used to wrap a stream by using the other stream's `onNext`.
+ */
+ notifyNext(message, error, complete) {
+ runtime_1.assert((message ? 1 : 0) + (error ? 1 : 0) + (complete ? 1 : 0) <= 1, 'only one emission at a time');
+ if (message)
+ this.notifyMessage(message);
+ if (error)
+ this.notifyError(error);
+ if (complete)
+ this.notifyComplete();
+ }
+ /**
+ * Emits a new message. Throws if stream is closed.
+ *
+ * Triggers onNext and onMessage callbacks.
+ */
+ notifyMessage(message) {
+ runtime_1.assert(!this.closed, 'stream is closed');
+ this.pushIt({ value: message, done: false });
+ this._lis.msg.forEach(l => l(message));
+ this._lis.nxt.forEach(l => l(message, undefined, false));
+ }
+ /**
+ * Closes the stream with an error. Throws if stream is closed.
+ *
+ * Triggers onNext and onError callbacks.
+ */
+ notifyError(error) {
+ runtime_1.assert(!this.closed, 'stream is closed');
+ this._closed = error;
+ this.pushIt(error);
+ this._lis.err.forEach(l => l(error));
+ this._lis.nxt.forEach(l => l(undefined, error, false));
+ this.clearLis();
+ }
+ /**
+ * Closes the stream successfully. Throws if stream is closed.
+ *
+ * Triggers onNext and onComplete callbacks.
+ */
+ notifyComplete() {
+ runtime_1.assert(!this.closed, 'stream is closed');
+ this._closed = true;
+ this.pushIt({ value: null, done: true });
+ this._lis.cmp.forEach(l => l());
+ this._lis.nxt.forEach(l => l(undefined, undefined, true));
+ this.clearLis();
+ }
+ /**
+ * Creates an async iterator (that can be used with `for await {...}`)
+ * to consume the stream.
+ *
+ * Some things to note:
+ * - If an error occurs, the `for await` will throw it.
+ * - If an error occurred before the `for await` was started, `for await`
+ * will re-throw it.
+ * - If the stream is already complete, the `for await` will be empty.
+ * - If your `for await` consumes slower than the stream produces,
+ * for example because you are relaying messages in a slow operation,
+ * messages are queued.
+ */
+ [Symbol.asyncIterator]() {
+ // if we are closed, we are definitely not receiving any more messages.
+ // but we can't let the iterator get stuck. we want to either:
+ // a) finish the new iterator immediately, because we are completed
+ // b) reject the new iterator, because we errored
+ if (this._closed === true)
+ this.pushIt({ value: null, done: true });
+ else if (this._closed !== false)
+ this.pushIt(this._closed);
+ // the async iterator
+ return {
+ next: () => {
+ let state = this._itState;
+ runtime_1.assert(state, "bad state"); // if we don't have a state here, code is broken
+ // there should be no pending result.
+ // did the consumer call next() before we resolved our previous result promise?
+ runtime_1.assert(!state.p, "iterator contract broken");
+ // did we produce faster than the iterator consumed?
+ // return the oldest result from the queue.
+ let first = state.q.shift();
+ if (first)
+ return ("value" in first) ? Promise.resolve(first) : Promise.reject(first);
+ // we have no result ATM, but we promise one.
+ // as soon as we have a result, we must resolve promise.
+ state.p = new deferred_1.Deferred();
+ return state.p.promise;
+ },
+ };
+ }
+ // "push" a new iterator result.
+ // this either resolves a pending promise, or enqueues the result.
+ pushIt(result) {
+ let state = this._itState;
+ // is the consumer waiting for us?
+ if (state.p) {
+ // yes, consumer is waiting for this promise.
+ const p = state.p;
+ runtime_1.assert(p.state == deferred_1.DeferredState.PENDING, "iterator contract broken");
+ // resolve the promise
+ ("value" in result) ? p.resolve(result) : p.reject(result);
+ // must cleanup, otherwise iterator.next() would pick it up again.
+ delete state.p;
+ }
+ else {
+ // we are producing faster than the iterator consumes.
+ // push result onto queue.
+ state.q.push(result);
+ }
+ }
+}
+exports.RpcOutputStreamController = RpcOutputStreamController;
+
+
+/***/ }),
+
+/***/ 3352:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ServerCallContextController = void 0;
+class ServerCallContextController {
+ constructor(method, headers, deadline, sendResponseHeadersFn, defaultStatus = { code: 'OK', detail: '' }) {
+ this._cancelled = false;
+ this._listeners = [];
+ this.method = method;
+ this.headers = headers;
+ this.deadline = deadline;
+ this.trailers = {};
+ this._sendRH = sendResponseHeadersFn;
+ this.status = defaultStatus;
+ }
+ /**
+ * Set the call cancelled.
+ *
+ * Invokes all callbacks registered with onCancel() and
+ * sets `cancelled = true`.
+ */
+ notifyCancelled() {
+ if (!this._cancelled) {
+ this._cancelled = true;
+ for (let l of this._listeners) {
+ l();
+ }
+ }
+ }
+ /**
+ * Send response headers.
+ */
+ sendResponseHeaders(data) {
+ this._sendRH(data);
+ }
+ /**
+ * Is the call cancelled?
+ *
+ * When the client closes the connection before the server
+ * is done, the call is cancelled.
+ *
+ * If you want to cancel a request on the server, throw a
+ * RpcError with the CANCELLED status code.
+ */
+ get cancelled() {
+ return this._cancelled;
+ }
+ /**
+ * Add a callback for cancellation.
+ */
+ onCancel(callback) {
+ const l = this._listeners;
+ l.push(callback);
+ return () => {
+ let i = l.indexOf(callback);
+ if (i >= 0)
+ l.splice(i, 1);
+ };
+ }
+}
+exports.ServerCallContextController = ServerCallContextController;
+
+
+/***/ }),
+
+/***/ 6173:
+/***/ (function(__unused_webpack_module, exports) {
+
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ServerStreamingCall = void 0;
+/**
+ * A server streaming RPC call. The client provides exactly one input message
+ * but the server may respond with 0, 1, or more messages.
+ */
+class ServerStreamingCall {
+ constructor(method, requestHeaders, request, headers, response, status, trailers) {
+ this.method = method;
+ this.requestHeaders = requestHeaders;
+ this.request = request;
+ this.headers = headers;
+ this.responses = response;
+ this.status = status;
+ this.trailers = trailers;
+ }
+ /**
+ * Instead of awaiting the response status and trailers, you can
+ * just as well await this call itself to receive the server outcome.
+ * You should first setup some listeners to the `request` to
+ * see the actual messages the server replied with.
+ */
+ then(onfulfilled, onrejected) {
+ return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
+ }
+ promiseFinished() {
+ return __awaiter(this, void 0, void 0, function* () {
+ let [headers, status, trailers] = yield Promise.all([this.headers, this.status, this.trailers]);
+ return {
+ method: this.method,
+ requestHeaders: this.requestHeaders,
+ request: this.request,
+ headers,
+ status,
+ trailers,
+ };
+ });
+ }
+}
+exports.ServerStreamingCall = ServerStreamingCall;
+
+
+/***/ }),
+
+/***/ 6892:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ServiceType = void 0;
+const reflection_info_1 = __webpack_require__(2496);
+class ServiceType {
+ constructor(typeName, methods, options) {
+ this.typeName = typeName;
+ this.methods = methods.map(i => reflection_info_1.normalizeMethodInfo(i, this));
+ this.options = options !== null && options !== void 0 ? options : {};
+ }
+}
+exports.ServiceType = ServiceType;
+
+
+/***/ }),
+
+/***/ 9122:
+/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
+
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.TestTransport = void 0;
+const rpc_error_1 = __webpack_require__(8636);
+const runtime_1 = __webpack_require__(8886);
+const rpc_output_stream_1 = __webpack_require__(2726);
+const rpc_options_1 = __webpack_require__(8576);
+const unary_call_1 = __webpack_require__(9288);
+const server_streaming_call_1 = __webpack_require__(6173);
+const client_streaming_call_1 = __webpack_require__(7889);
+const duplex_streaming_call_1 = __webpack_require__(6826);
+/**
+ * Transport for testing.
+ */
+class TestTransport {
+ /**
+ * Initialize with mock data. Omitted fields have default value.
+ */
+ constructor(data) {
+ /**
+ * Suppress warning / error about uncaught rejections of
+ * "status" and "trailers".
+ */
+ this.suppressUncaughtRejections = true;
+ this.headerDelay = 10;
+ this.responseDelay = 50;
+ this.betweenResponseDelay = 10;
+ this.afterResponseDelay = 10;
+ this.data = data !== null && data !== void 0 ? data : {};
+ }
+ /**
+ * Sent message(s) during the last operation.
+ */
+ get sentMessages() {
+ if (this.lastInput instanceof TestInputStream) {
+ return this.lastInput.sent;
+ }
+ else if (typeof this.lastInput == "object") {
+ return [this.lastInput.single];
+ }
+ return [];
+ }
+ /**
+ * Sending message(s) completed?
+ */
+ get sendComplete() {
+ if (this.lastInput instanceof TestInputStream) {
+ return this.lastInput.completed;
+ }
+ else if (typeof this.lastInput == "object") {
+ return true;
+ }
+ return false;
+ }
+ // Creates a promise for response headers from the mock data.
+ promiseHeaders() {
+ var _a;
+ const headers = (_a = this.data.headers) !== null && _a !== void 0 ? _a : TestTransport.defaultHeaders;
+ return headers instanceof rpc_error_1.RpcError
+ ? Promise.reject(headers)
+ : Promise.resolve(headers);
+ }
+ // Creates a promise for a single, valid, message from the mock data.
+ promiseSingleResponse(method) {
+ if (this.data.response instanceof rpc_error_1.RpcError) {
+ return Promise.reject(this.data.response);
+ }
+ let r;
+ if (Array.isArray(this.data.response)) {
+ runtime_1.assert(this.data.response.length > 0);
+ r = this.data.response[0];
+ }
+ else if (this.data.response !== undefined) {
+ r = this.data.response;
+ }
+ else {
+ r = method.O.create();
+ }
+ runtime_1.assert(method.O.is(r));
+ return Promise.resolve(r);
+ }
+ /**
+ * Pushes response messages from the mock data to the output stream.
+ * If an error response, status or trailers are mocked, the stream is
+ * closed with the respective error.
+ * Otherwise, stream is completed successfully.
+ *
+ * The returned promise resolves when the stream is closed. It should
+ * not reject. If it does, code is broken.
+ */
+ streamResponses(method, stream, abort) {
+ return __awaiter(this, void 0, void 0, function* () {
+ // normalize "data.response" into an array of valid output messages
+ const messages = [];
+ if (this.data.response === undefined) {
+ messages.push(method.O.create());
+ }
+ else if (Array.isArray(this.data.response)) {
+ for (let msg of this.data.response) {
+ runtime_1.assert(method.O.is(msg));
+ messages.push(msg);
+ }
+ }
+ else if (!(this.data.response instanceof rpc_error_1.RpcError)) {
+ runtime_1.assert(method.O.is(this.data.response));
+ messages.push(this.data.response);
+ }
+ // start the stream with an initial delay.
+ // if the request is cancelled, notify() error and exit.
+ try {
+ yield delay(this.responseDelay, abort)(undefined);
+ }
+ catch (error) {
+ stream.notifyError(error);
+ return;
+ }
+ // if error response was mocked, notify() error (stream is now closed with error) and exit.
+ if (this.data.response instanceof rpc_error_1.RpcError) {
+ stream.notifyError(this.data.response);
+ return;
+ }
+ // regular response messages were mocked. notify() them.
+ for (let msg of messages) {
+ stream.notifyMessage(msg);
+ // add a short delay between responses
+ // if the request is cancelled, notify() error and exit.
+ try {
+ yield delay(this.betweenResponseDelay, abort)(undefined);
+ }
+ catch (error) {
+ stream.notifyError(error);
+ return;
+ }
+ }
+ // error status was mocked, notify() error (stream is now closed with error) and exit.
+ if (this.data.status instanceof rpc_error_1.RpcError) {
+ stream.notifyError(this.data.status);
+ return;
+ }
+ // error trailers were mocked, notify() error (stream is now closed with error) and exit.
+ if (this.data.trailers instanceof rpc_error_1.RpcError) {
+ stream.notifyError(this.data.trailers);
+ return;
+ }
+ // stream completed successfully
+ stream.notifyComplete();
+ });
+ }
+ // Creates a promise for response status from the mock data.
+ promiseStatus() {
+ var _a;
+ const status = (_a = this.data.status) !== null && _a !== void 0 ? _a : TestTransport.defaultStatus;
+ return status instanceof rpc_error_1.RpcError
+ ? Promise.reject(status)
+ : Promise.resolve(status);
+ }
+ // Creates a promise for response trailers from the mock data.
+ promiseTrailers() {
+ var _a;
+ const trailers = (_a = this.data.trailers) !== null && _a !== void 0 ? _a : TestTransport.defaultTrailers;
+ return trailers instanceof rpc_error_1.RpcError
+ ? Promise.reject(trailers)
+ : Promise.resolve(trailers);
+ }
+ maybeSuppressUncaught(...promise) {
+ if (this.suppressUncaughtRejections) {
+ for (let p of promise) {
+ p.catch(() => {
+ });
+ }
+ }
+ }
+ mergeOptions(options) {
+ return rpc_options_1.mergeRpcOptions({}, options);
+ }
+ unary(method, input, options) {
+ var _a;
+ const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
+ .then(delay(this.headerDelay, options.abort)), responsePromise = headersPromise
+ .catch(_ => {
+ })
+ .then(delay(this.responseDelay, options.abort))
+ .then(_ => this.promiseSingleResponse(method)), statusPromise = responsePromise
+ .catch(_ => {
+ })
+ .then(delay(this.afterResponseDelay, options.abort))
+ .then(_ => this.promiseStatus()), trailersPromise = responsePromise
+ .catch(_ => {
+ })
+ .then(delay(this.afterResponseDelay, options.abort))
+ .then(_ => this.promiseTrailers());
+ this.maybeSuppressUncaught(statusPromise, trailersPromise);
+ this.lastInput = { single: input };
+ return new unary_call_1.UnaryCall(method, requestHeaders, input, headersPromise, responsePromise, statusPromise, trailersPromise);
+ }
+ serverStreaming(method, input, options) {
+ var _a;
+ const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
+ .then(delay(this.headerDelay, options.abort)), outputStream = new rpc_output_stream_1.RpcOutputStreamController(), responseStreamClosedPromise = headersPromise
+ .then(delay(this.responseDelay, options.abort))
+ .catch(() => {
+ })
+ .then(() => this.streamResponses(method, outputStream, options.abort))
+ .then(delay(this.afterResponseDelay, options.abort)), statusPromise = responseStreamClosedPromise
+ .then(() => this.promiseStatus()), trailersPromise = responseStreamClosedPromise
+ .then(() => this.promiseTrailers());
+ this.maybeSuppressUncaught(statusPromise, trailersPromise);
+ this.lastInput = { single: input };
+ return new server_streaming_call_1.ServerStreamingCall(method, requestHeaders, input, headersPromise, outputStream, statusPromise, trailersPromise);
+ }
+ clientStreaming(method, options) {
+ var _a;
+ const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
+ .then(delay(this.headerDelay, options.abort)), responsePromise = headersPromise
+ .catch(_ => {
+ })
+ .then(delay(this.responseDelay, options.abort))
+ .then(_ => this.promiseSingleResponse(method)), statusPromise = responsePromise
+ .catch(_ => {
+ })
+ .then(delay(this.afterResponseDelay, options.abort))
+ .then(_ => this.promiseStatus()), trailersPromise = responsePromise
+ .catch(_ => {
+ })
+ .then(delay(this.afterResponseDelay, options.abort))
+ .then(_ => this.promiseTrailers());
+ this.maybeSuppressUncaught(statusPromise, trailersPromise);
+ this.lastInput = new TestInputStream(this.data, options.abort);
+ return new client_streaming_call_1.ClientStreamingCall(method, requestHeaders, this.lastInput, headersPromise, responsePromise, statusPromise, trailersPromise);
+ }
+ duplex(method, options) {
+ var _a;
+ const requestHeaders = (_a = options.meta) !== null && _a !== void 0 ? _a : {}, headersPromise = this.promiseHeaders()
+ .then(delay(this.headerDelay, options.abort)), outputStream = new rpc_output_stream_1.RpcOutputStreamController(), responseStreamClosedPromise = headersPromise
+ .then(delay(this.responseDelay, options.abort))
+ .catch(() => {
+ })
+ .then(() => this.streamResponses(method, outputStream, options.abort))
+ .then(delay(this.afterResponseDelay, options.abort)), statusPromise = responseStreamClosedPromise
+ .then(() => this.promiseStatus()), trailersPromise = responseStreamClosedPromise
+ .then(() => this.promiseTrailers());
+ this.maybeSuppressUncaught(statusPromise, trailersPromise);
+ this.lastInput = new TestInputStream(this.data, options.abort);
+ return new duplex_streaming_call_1.DuplexStreamingCall(method, requestHeaders, this.lastInput, headersPromise, outputStream, statusPromise, trailersPromise);
+ }
+}
+exports.TestTransport = TestTransport;
+TestTransport.defaultHeaders = {
+ responseHeader: "test"
+};
+TestTransport.defaultStatus = {
+ code: "OK", detail: "all good"
+};
+TestTransport.defaultTrailers = {
+ responseTrailer: "test"
+};
+function delay(ms, abort) {
+ return (v) => new Promise((resolve, reject) => {
+ if (abort === null || abort === void 0 ? void 0 : abort.aborted) {
+ reject(new rpc_error_1.RpcError("user cancel", "CANCELLED"));
+ }
+ else {
+ const id = setTimeout(() => resolve(v), ms);
+ if (abort) {
+ abort.addEventListener("abort", ev => {
+ clearTimeout(id);
+ reject(new rpc_error_1.RpcError("user cancel", "CANCELLED"));
+ });
+ }
+ }
+ });
+}
+class TestInputStream {
+ constructor(data, abort) {
+ this._completed = false;
+ this._sent = [];
+ this.data = data;
+ this.abort = abort;
+ }
+ get sent() {
+ return this._sent;
+ }
+ get completed() {
+ return this._completed;
+ }
+ send(message) {
+ if (this.data.inputMessage instanceof rpc_error_1.RpcError) {
+ return Promise.reject(this.data.inputMessage);
+ }
+ const delayMs = this.data.inputMessage === undefined
+ ? 10
+ : this.data.inputMessage;
+ return Promise.resolve(undefined)
+ .then(() => {
+ this._sent.push(message);
+ })
+ .then(delay(delayMs, this.abort));
+ }
+ complete() {
+ if (this.data.inputComplete instanceof rpc_error_1.RpcError) {
+ return Promise.reject(this.data.inputComplete);
+ }
+ const delayMs = this.data.inputComplete === undefined
+ ? 10
+ : this.data.inputComplete;
+ return Promise.resolve(undefined)
+ .then(() => {
+ this._completed = true;
+ })
+ .then(delay(delayMs, this.abort));
+ }
+}
+
+
+/***/ }),
+
+/***/ 9288:
+/***/ (function(__unused_webpack_module, exports) {
+
+
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.UnaryCall = void 0;
+/**
+ * A unary RPC call. Unary means there is exactly one input message and
+ * exactly one output message unless an error occurred.
+ */
+class UnaryCall {
+ constructor(method, requestHeaders, request, headers, response, status, trailers) {
+ this.method = method;
+ this.requestHeaders = requestHeaders;
+ this.request = request;
+ this.headers = headers;
+ this.response = response;
+ this.status = status;
+ this.trailers = trailers;
+ }
+ /**
+ * If you are only interested in the final outcome of this call,
+ * you can await it to receive a `FinishedUnaryCall`.
+ */
+ then(onfulfilled, onrejected) {
+ return this.promiseFinished().then(value => onfulfilled ? Promise.resolve(onfulfilled(value)) : value, reason => onrejected ? Promise.resolve(onrejected(reason)) : Promise.reject(reason));
+ }
+ promiseFinished() {
+ return __awaiter(this, void 0, void 0, function* () {
+ let [headers, response, status, trailers] = yield Promise.all([this.headers, this.response, this.status, this.trailers]);
+ return {
+ method: this.method,
+ requestHeaders: this.requestHeaders,
+ request: this.request,
+ headers,
+ response,
+ status,
+ trailers
+ };
+ });
+ }
+}
+exports.UnaryCall = UnaryCall;
+
+
+/***/ }),
+
+/***/ 8602:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.assertFloat32 = exports.assertUInt32 = exports.assertInt32 = exports.assertNever = exports.assert = void 0;
+/**
+ * assert that condition is true or throw error (with message)
+ */
+function assert(condition, msg) {
+ if (!condition) {
+ throw new Error(msg);
+ }
+}
+exports.assert = assert;
+/**
+ * assert that value cannot exist = type `never`. throw runtime error if it does.
+ */
+function assertNever(value, msg) {
+ throw new Error(msg !== null && msg !== void 0 ? msg : 'Unexpected object: ' + value);
+}
+exports.assertNever = assertNever;
+const FLOAT32_MAX = 3.4028234663852886e+38, FLOAT32_MIN = -3.4028234663852886e+38, UINT32_MAX = 0xFFFFFFFF, INT32_MAX = 0X7FFFFFFF, INT32_MIN = -0X80000000;
+function assertInt32(arg) {
+ if (typeof arg !== "number")
+ throw new Error('invalid int 32: ' + typeof arg);
+ if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)
+ throw new Error('invalid int 32: ' + arg);
+}
+exports.assertInt32 = assertInt32;
+function assertUInt32(arg) {
+ if (typeof arg !== "number")
+ throw new Error('invalid uint 32: ' + typeof arg);
+ if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)
+ throw new Error('invalid uint 32: ' + arg);
+}
+exports.assertUInt32 = assertUInt32;
+function assertFloat32(arg) {
+ if (typeof arg !== "number")
+ throw new Error('invalid float 32: ' + typeof arg);
+ if (!Number.isFinite(arg))
+ return;
+ if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)
+ throw new Error('invalid float 32: ' + arg);
+}
+exports.assertFloat32 = assertFloat32;
+
+
+/***/ }),
+
+/***/ 6335:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.base64encode = exports.base64decode = void 0;
+// lookup table from base64 character to byte
+let encTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
+// lookup table from base64 character *code* to byte because lookup by number is fast
+let decTable = [];
+for (let i = 0; i < encTable.length; i++)
+ decTable[encTable[i].charCodeAt(0)] = i;
+// support base64url variants
+decTable["-".charCodeAt(0)] = encTable.indexOf("+");
+decTable["_".charCodeAt(0)] = encTable.indexOf("/");
+/**
+ * Decodes a base64 string to a byte array.
+ *
+ * - ignores white-space, including line breaks and tabs
+ * - allows inner padding (can decode concatenated base64 strings)
+ * - does not require padding
+ * - understands base64url encoding:
+ * "-" instead of "+",
+ * "_" instead of "/",
+ * no padding
+ */
+function base64decode(base64Str) {
+ // estimate byte size, not accounting for inner padding and whitespace
+ let es = base64Str.length * 3 / 4;
+ // if (es % 3 !== 0)
+ // throw new Error('invalid base64 string');
+ if (base64Str[base64Str.length - 2] == '=')
+ es -= 2;
+ else if (base64Str[base64Str.length - 1] == '=')
+ es -= 1;
+ let bytes = new Uint8Array(es), bytePos = 0, // position in byte array
+ groupPos = 0, // position in base64 group
+ b, // current byte
+ p = 0 // previous byte
+ ;
+ for (let i = 0; i < base64Str.length; i++) {
+ b = decTable[base64Str.charCodeAt(i)];
+ if (b === undefined) {
+ // noinspection FallThroughInSwitchStatementJS
+ switch (base64Str[i]) {
+ case '=':
+ groupPos = 0; // reset state when padding found
+ case '\n':
+ case '\r':
+ case '\t':
+ case ' ':
+ continue; // skip white-space, and padding
+ default:
+ throw Error(`invalid base64 string.`);
+ }
+ }
+ switch (groupPos) {
+ case 0:
+ p = b;
+ groupPos = 1;
+ break;
+ case 1:
+ bytes[bytePos++] = p << 2 | (b & 48) >> 4;
+ p = b;
+ groupPos = 2;
+ break;
+ case 2:
+ bytes[bytePos++] = (p & 15) << 4 | (b & 60) >> 2;
+ p = b;
+ groupPos = 3;
+ break;
+ case 3:
+ bytes[bytePos++] = (p & 3) << 6 | b;
+ groupPos = 0;
+ break;
+ }
+ }
+ if (groupPos == 1)
+ throw Error(`invalid base64 string.`);
+ return bytes.subarray(0, bytePos);
+}
+exports.base64decode = base64decode;
+/**
+ * Encodes a byte array to a base64 string.
+ * Adds padding at the end.
+ * Does not insert newlines.
+ */
+function base64encode(bytes) {
+ let base64 = '', groupPos = 0, // position in base64 group
+ b, // current byte
+ p = 0; // carry over from previous byte
+ for (let i = 0; i < bytes.length; i++) {
+ b = bytes[i];
+ switch (groupPos) {
+ case 0:
+ base64 += encTable[b >> 2];
+ p = (b & 3) << 4;
+ groupPos = 1;
+ break;
+ case 1:
+ base64 += encTable[p | b >> 4];
+ p = (b & 15) << 2;
+ groupPos = 2;
+ break;
+ case 2:
+ base64 += encTable[p | b >> 6];
+ base64 += encTable[b & 63];
+ groupPos = 0;
+ break;
+ }
+ }
+ // padding required?
+ if (groupPos) {
+ base64 += encTable[p];
+ base64 += '=';
+ if (groupPos == 1)
+ base64 += '=';
+ }
+ return base64;
+}
+exports.base64encode = base64encode;
+
+
+/***/ }),
+
+/***/ 4816:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.WireType = exports.mergeBinaryOptions = exports.UnknownFieldHandler = void 0;
+/**
+ * This handler implements the default behaviour for unknown fields.
+ * When reading data, unknown fields are stored on the message, in a
+ * symbol property.
+ * When writing data, the symbol property is queried and unknown fields
+ * are serialized into the output again.
+ */
+var UnknownFieldHandler;
+(function (UnknownFieldHandler) {
+ /**
+ * The symbol used to store unknown fields for a message.
+ * The property must conform to `UnknownFieldContainer`.
+ */
+ UnknownFieldHandler.symbol = Symbol.for("protobuf-ts/unknown");
+ /**
+ * Store an unknown field during binary read directly on the message.
+ * This method is compatible with `BinaryReadOptions.readUnknownField`.
+ */
+ UnknownFieldHandler.onRead = (typeName, message, fieldNo, wireType, data) => {
+ let container = is(message) ? message[UnknownFieldHandler.symbol] : message[UnknownFieldHandler.symbol] = [];
+ container.push({ no: fieldNo, wireType, data });
+ };
+ /**
+ * Write unknown fields stored for the message to the writer.
+ * This method is compatible with `BinaryWriteOptions.writeUnknownFields`.
+ */
+ UnknownFieldHandler.onWrite = (typeName, message, writer) => {
+ for (let { no, wireType, data } of UnknownFieldHandler.list(message))
+ writer.tag(no, wireType).raw(data);
+ };
+ /**
+ * List unknown fields stored for the message.
+ * Note that there may be multiples fields with the same number.
+ */
+ UnknownFieldHandler.list = (message, fieldNo) => {
+ if (is(message)) {
+ let all = message[UnknownFieldHandler.symbol];
+ return fieldNo ? all.filter(uf => uf.no == fieldNo) : all;
+ }
+ return [];
+ };
+ /**
+ * Returns the last unknown field by field number.
+ */
+ UnknownFieldHandler.last = (message, fieldNo) => UnknownFieldHandler.list(message, fieldNo).slice(-1)[0];
+ const is = (message) => message && Array.isArray(message[UnknownFieldHandler.symbol]);
+})(UnknownFieldHandler = exports.UnknownFieldHandler || (exports.UnknownFieldHandler = {}));
+/**
+ * Merges binary write or read options. Later values override earlier values.
+ */
+function mergeBinaryOptions(a, b) {
+ return Object.assign(Object.assign({}, a), b);
+}
+exports.mergeBinaryOptions = mergeBinaryOptions;
+/**
+ * Protobuf binary format wire types.
+ *
+ * A wire type provides just enough information to find the length of the
+ * following value.
+ *
+ * See https://developers.google.com/protocol-buffers/docs/encoding#structure
+ */
+var WireType;
+(function (WireType) {
+ /**
+ * Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum
+ */
+ WireType[WireType["Varint"] = 0] = "Varint";
+ /**
+ * Used for fixed64, sfixed64, double.
+ * Always 8 bytes with little-endian byte order.
+ */
+ WireType[WireType["Bit64"] = 1] = "Bit64";
+ /**
+ * Used for string, bytes, embedded messages, packed repeated fields
+ *
+ * Only repeated numeric types (types which use the varint, 32-bit,
+ * or 64-bit wire types) can be packed. In proto3, such fields are
+ * packed by default.
+ */
+ WireType[WireType["LengthDelimited"] = 2] = "LengthDelimited";
+ /**
+ * Used for groups
+ * @deprecated
+ */
+ WireType[WireType["StartGroup"] = 3] = "StartGroup";
+ /**
+ * Used for groups
+ * @deprecated
+ */
+ WireType[WireType["EndGroup"] = 4] = "EndGroup";
+ /**
+ * Used for fixed32, sfixed32, float.
+ * Always 4 bytes with little-endian byte order.
+ */
+ WireType[WireType["Bit32"] = 5] = "Bit32";
+})(WireType = exports.WireType || (exports.WireType = {}));
+
+
+/***/ }),
+
+/***/ 2889:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.BinaryReader = exports.binaryReadOptions = void 0;
+const binary_format_contract_1 = __webpack_require__(4816);
+const pb_long_1 = __webpack_require__(1753);
+const goog_varint_1 = __webpack_require__(3223);
+const defaultsRead = {
+ readUnknownField: true,
+ readerFactory: bytes => new BinaryReader(bytes),
+};
+/**
+ * Make options for reading binary data form partial options.
+ */
+function binaryReadOptions(options) {
+ return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
+}
+exports.binaryReadOptions = binaryReadOptions;
+class BinaryReader {
+ constructor(buf, textDecoder) {
+ this.varint64 = goog_varint_1.varint64read; // dirty cast for `this`
+ /**
+ * Read a `uint32` field, an unsigned 32 bit varint.
+ */
+ this.uint32 = goog_varint_1.varint32read; // dirty cast for `this` and access to protected `buf`
+ this.buf = buf;
+ this.len = buf.length;
+ this.pos = 0;
+ this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
+ this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder("utf-8", {
+ fatal: true,
+ ignoreBOM: true,
+ });
+ }
+ /**
+ * Reads a tag - field number and wire type.
+ */
+ tag() {
+ let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;
+ if (fieldNo <= 0 || wireType < 0 || wireType > 5)
+ throw new Error("illegal tag: field no " + fieldNo + " wire type " + wireType);
+ return [fieldNo, wireType];
+ }
+ /**
+ * Skip one element on the wire and return the skipped data.
+ * Supports WireType.StartGroup since v2.0.0-alpha.23.
+ */
+ skip(wireType) {
+ let start = this.pos;
+ // noinspection FallThroughInSwitchStatementJS
+ switch (wireType) {
+ case binary_format_contract_1.WireType.Varint:
+ while (this.buf[this.pos++] & 0x80) {
+ // ignore
+ }
+ break;
+ case binary_format_contract_1.WireType.Bit64:
+ this.pos += 4;
+ case binary_format_contract_1.WireType.Bit32:
+ this.pos += 4;
+ break;
+ case binary_format_contract_1.WireType.LengthDelimited:
+ let len = this.uint32();
+ this.pos += len;
+ break;
+ case binary_format_contract_1.WireType.StartGroup:
+ // From descriptor.proto: Group type is deprecated, not supported in proto3.
+ // But we must still be able to parse and treat as unknown.
+ let t;
+ while ((t = this.tag()[1]) !== binary_format_contract_1.WireType.EndGroup) {
+ this.skip(t);
+ }
+ break;
+ default:
+ throw new Error("cant skip wire type " + wireType);
+ }
+ this.assertBounds();
+ return this.buf.subarray(start, this.pos);
+ }
+ /**
+ * Throws error if position in byte array is out of range.
+ */
+ assertBounds() {
+ if (this.pos > this.len)
+ throw new RangeError("premature EOF");
+ }
+ /**
+ * Read a `int32` field, a signed 32 bit varint.
+ */
+ int32() {
+ return this.uint32() | 0;
+ }
+ /**
+ * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
+ */
+ sint32() {
+ let zze = this.uint32();
+ // decode zigzag
+ return (zze >>> 1) ^ -(zze & 1);
+ }
+ /**
+ * Read a `int64` field, a signed 64-bit varint.
+ */
+ int64() {
+ return new pb_long_1.PbLong(...this.varint64());
+ }
+ /**
+ * Read a `uint64` field, an unsigned 64-bit varint.
+ */
+ uint64() {
+ return new pb_long_1.PbULong(...this.varint64());
+ }
+ /**
+ * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
+ */
+ sint64() {
+ let [lo, hi] = this.varint64();
+ // decode zig zag
+ let s = -(lo & 1);
+ lo = ((lo >>> 1 | (hi & 1) << 31) ^ s);
+ hi = (hi >>> 1 ^ s);
+ return new pb_long_1.PbLong(lo, hi);
+ }
+ /**
+ * Read a `bool` field, a variant.
+ */
+ bool() {
+ let [lo, hi] = this.varint64();
+ return lo !== 0 || hi !== 0;
+ }
+ /**
+ * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
+ */
+ fixed32() {
+ return this.view.getUint32((this.pos += 4) - 4, true);
+ }
+ /**
+ * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
+ */
+ sfixed32() {
+ return this.view.getInt32((this.pos += 4) - 4, true);
+ }
+ /**
+ * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
+ */
+ fixed64() {
+ return new pb_long_1.PbULong(this.sfixed32(), this.sfixed32());
+ }
+ /**
+ * Read a `fixed64` field, a signed, fixed-length 64-bit integer.
+ */
+ sfixed64() {
+ return new pb_long_1.PbLong(this.sfixed32(), this.sfixed32());
+ }
+ /**
+ * Read a `float` field, 32-bit floating point number.
+ */
+ float() {
+ return this.view.getFloat32((this.pos += 4) - 4, true);
+ }
+ /**
+ * Read a `double` field, a 64-bit floating point number.
+ */
+ double() {
+ return this.view.getFloat64((this.pos += 8) - 8, true);
+ }
+ /**
+ * Read a `bytes` field, length-delimited arbitrary data.
+ */
+ bytes() {
+ let len = this.uint32();
+ let start = this.pos;
+ this.pos += len;
+ this.assertBounds();
+ return this.buf.subarray(start, start + len);
+ }
+ /**
+ * Read a `string` field, length-delimited data converted to UTF-8 text.
+ */
+ string() {
+ return this.textDecoder.decode(this.bytes());
+ }
+}
+exports.BinaryReader = BinaryReader;
+
+
+/***/ }),
+
+/***/ 3957:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.BinaryWriter = exports.binaryWriteOptions = void 0;
+const pb_long_1 = __webpack_require__(1753);
+const goog_varint_1 = __webpack_require__(3223);
+const assert_1 = __webpack_require__(8602);
+const defaultsWrite = {
+ writeUnknownFields: true,
+ writerFactory: () => new BinaryWriter(),
+};
+/**
+ * Make options for writing binary data form partial options.
+ */
+function binaryWriteOptions(options) {
+ return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
+}
+exports.binaryWriteOptions = binaryWriteOptions;
+class BinaryWriter {
+ constructor(textEncoder) {
+ /**
+ * Previous fork states.
+ */
+ this.stack = [];
+ this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();
+ this.chunks = [];
+ this.buf = [];
+ }
+ /**
+ * Return all bytes written and reset this writer.
+ */
+ finish() {
+ this.chunks.push(new Uint8Array(this.buf)); // flush the buffer
+ let len = 0;
+ for (let i = 0; i < this.chunks.length; i++)
+ len += this.chunks[i].length;
+ let bytes = new Uint8Array(len);
+ let offset = 0;
+ for (let i = 0; i < this.chunks.length; i++) {
+ bytes.set(this.chunks[i], offset);
+ offset += this.chunks[i].length;
+ }
+ this.chunks = [];
+ return bytes;
+ }
+ /**
+ * Start a new fork for length-delimited data like a message
+ * or a packed repeated field.
+ *
+ * Must be joined later with `join()`.
+ */
+ fork() {
+ this.stack.push({ chunks: this.chunks, buf: this.buf });
+ this.chunks = [];
+ this.buf = [];
+ return this;
+ }
+ /**
+ * Join the last fork. Write its length and bytes, then
+ * return to the previous state.
+ */
+ join() {
+ // get chunk of fork
+ let chunk = this.finish();
+ // restore previous state
+ let prev = this.stack.pop();
+ if (!prev)
+ throw new Error('invalid state, fork stack empty');
+ this.chunks = prev.chunks;
+ this.buf = prev.buf;
+ // write length of chunk as varint
+ this.uint32(chunk.byteLength);
+ return this.raw(chunk);
+ }
+ /**
+ * Writes a tag (field number and wire type).
+ *
+ * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
+ *
+ * Generated code should compute the tag ahead of time and call `uint32()`.
+ */
+ tag(fieldNo, type) {
+ return this.uint32((fieldNo << 3 | type) >>> 0);
+ }
+ /**
+ * Write a chunk of raw bytes.
+ */
+ raw(chunk) {
+ if (this.buf.length) {
+ this.chunks.push(new Uint8Array(this.buf));
+ this.buf = [];
+ }
+ this.chunks.push(chunk);
+ return this;
+ }
+ /**
+ * Write a `uint32` value, an unsigned 32 bit varint.
+ */
+ uint32(value) {
+ assert_1.assertUInt32(value);
+ // write value as varint 32, inlined for speed
+ while (value > 0x7f) {
+ this.buf.push((value & 0x7f) | 0x80);
+ value = value >>> 7;
+ }
+ this.buf.push(value);
+ return this;
+ }
+ /**
+ * Write a `int32` value, a signed 32 bit varint.
+ */
+ int32(value) {
+ assert_1.assertInt32(value);
+ goog_varint_1.varint32write(value, this.buf);
+ return this;
+ }
+ /**
+ * Write a `bool` value, a variant.
+ */
+ bool(value) {
+ this.buf.push(value ? 1 : 0);
+ return this;
+ }
+ /**
+ * Write a `bytes` value, length-delimited arbitrary data.
+ */
+ bytes(value) {
+ this.uint32(value.byteLength); // write length of chunk as varint
+ return this.raw(value);
+ }
+ /**
+ * Write a `string` value, length-delimited data converted to UTF-8 text.
+ */
+ string(value) {
+ let chunk = this.textEncoder.encode(value);
+ this.uint32(chunk.byteLength); // write length of chunk as varint
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `float` value, 32-bit floating point number.
+ */
+ float(value) {
+ assert_1.assertFloat32(value);
+ let chunk = new Uint8Array(4);
+ new DataView(chunk.buffer).setFloat32(0, value, true);
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `double` value, a 64-bit floating point number.
+ */
+ double(value) {
+ let chunk = new Uint8Array(8);
+ new DataView(chunk.buffer).setFloat64(0, value, true);
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
+ */
+ fixed32(value) {
+ assert_1.assertUInt32(value);
+ let chunk = new Uint8Array(4);
+ new DataView(chunk.buffer).setUint32(0, value, true);
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
+ */
+ sfixed32(value) {
+ assert_1.assertInt32(value);
+ let chunk = new Uint8Array(4);
+ new DataView(chunk.buffer).setInt32(0, value, true);
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
+ */
+ sint32(value) {
+ assert_1.assertInt32(value);
+ // zigzag encode
+ value = ((value << 1) ^ (value >> 31)) >>> 0;
+ goog_varint_1.varint32write(value, this.buf);
+ return this;
+ }
+ /**
+ * Write a `fixed64` value, a signed, fixed-length 64-bit integer.
+ */
+ sfixed64(value) {
+ let chunk = new Uint8Array(8);
+ let view = new DataView(chunk.buffer);
+ let long = pb_long_1.PbLong.from(value);
+ view.setInt32(0, long.lo, true);
+ view.setInt32(4, long.hi, true);
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
+ */
+ fixed64(value) {
+ let chunk = new Uint8Array(8);
+ let view = new DataView(chunk.buffer);
+ let long = pb_long_1.PbULong.from(value);
+ view.setInt32(0, long.lo, true);
+ view.setInt32(4, long.hi, true);
+ return this.raw(chunk);
+ }
+ /**
+ * Write a `int64` value, a signed 64-bit varint.
+ */
+ int64(value) {
+ let long = pb_long_1.PbLong.from(value);
+ goog_varint_1.varint64write(long.lo, long.hi, this.buf);
+ return this;
+ }
+ /**
+ * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
+ */
+ sint64(value) {
+ let long = pb_long_1.PbLong.from(value),
+ // zigzag encode
+ sign = long.hi >> 31, lo = (long.lo << 1) ^ sign, hi = ((long.hi << 1) | (long.lo >>> 31)) ^ sign;
+ goog_varint_1.varint64write(lo, hi, this.buf);
+ return this;
+ }
+ /**
+ * Write a `uint64` value, an unsigned 64-bit varint.
+ */
+ uint64(value) {
+ let long = pb_long_1.PbULong.from(value);
+ goog_varint_1.varint64write(long.lo, long.hi, this.buf);
+ return this;
+ }
+}
+exports.BinaryWriter = BinaryWriter;
+
+
+/***/ }),
+
+/***/ 257:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.listEnumNumbers = exports.listEnumNames = exports.listEnumValues = exports.isEnumObject = void 0;
+/**
+ * Is this a lookup object generated by Typescript, for a Typescript enum
+ * generated by protobuf-ts?
+ *
+ * - No `const enum` (enum must not be inlined, we need reverse mapping).
+ * - No string enum (we need int32 for protobuf).
+ * - Must have a value for 0 (otherwise, we would need to support custom default values).
+ */
+function isEnumObject(arg) {
+ if (typeof arg != 'object' || arg === null) {
+ return false;
+ }
+ if (!arg.hasOwnProperty(0)) {
+ return false;
+ }
+ for (let k of Object.keys(arg)) {
+ let num = parseInt(k);
+ if (!Number.isNaN(num)) {
+ // is there a name for the number?
+ let nam = arg[num];
+ if (nam === undefined)
+ return false;
+ // does the name resolve back to the number?
+ if (arg[nam] !== num)
+ return false;
+ }
+ else {
+ // is there a number for the name?
+ let num = arg[k];
+ if (num === undefined)
+ return false;
+ // is it a string enum?
+ if (typeof num !== 'number')
+ return false;
+ // do we know the number?
+ if (arg[num] === undefined)
+ return false;
+ }
+ }
+ return true;
+}
+exports.isEnumObject = isEnumObject;
+/**
+ * Lists all values of a Typescript enum, as an array of objects with a "name"
+ * property and a "number" property.
+ *
+ * Note that it is possible that a number appears more than once, because it is
+ * possible to have aliases in an enum.
+ *
+ * Throws if the enum does not adhere to the rules of enums generated by
+ * protobuf-ts. See `isEnumObject()`.
+ */
+function listEnumValues(enumObject) {
+ if (!isEnumObject(enumObject))
+ throw new Error("not a typescript enum object");
+ let values = [];
+ for (let [name, number] of Object.entries(enumObject))
+ if (typeof number == "number")
+ values.push({ name, number });
+ return values;
+}
+exports.listEnumValues = listEnumValues;
+/**
+ * Lists the names of a Typescript enum.
+ *
+ * Throws if the enum does not adhere to the rules of enums generated by
+ * protobuf-ts. See `isEnumObject()`.
+ */
+function listEnumNames(enumObject) {
+ return listEnumValues(enumObject).map(val => val.name);
+}
+exports.listEnumNames = listEnumNames;
+/**
+ * Lists the numbers of a Typescript enum.
+ *
+ * Throws if the enum does not adhere to the rules of enums generated by
+ * protobuf-ts. See `isEnumObject()`.
+ */
+function listEnumNumbers(enumObject) {
+ return listEnumValues(enumObject)
+ .map(val => val.number)
+ .filter((num, index, arr) => arr.indexOf(num) == index);
+}
+exports.listEnumNumbers = listEnumNumbers;
+
+
+/***/ }),
+
+/***/ 3223:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+// Copyright 2008 Google Inc. All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Code generated by the Protocol Buffer compiler is owned by the owner
+// of the input file used when generating it. This code is not
+// standalone and requires a support library to be linked with it. This
+// support library is itself covered by the above license.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.varint32read = exports.varint32write = exports.int64toString = exports.int64fromString = exports.varint64write = exports.varint64read = void 0;
+/**
+ * Read a 64 bit varint as two JS numbers.
+ *
+ * Returns tuple:
+ * [0]: low bits
+ * [0]: high bits
+ *
+ * Copyright 2008 Google Inc. All rights reserved.
+ *
+ * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175
+ */
+function varint64read() {
+ let lowBits = 0;
+ let highBits = 0;
+ for (let shift = 0; shift < 28; shift += 7) {
+ let b = this.buf[this.pos++];
+ lowBits |= (b & 0x7F) << shift;
+ if ((b & 0x80) == 0) {
+ this.assertBounds();
+ return [lowBits, highBits];
+ }
+ }
+ let middleByte = this.buf[this.pos++];
+ // last four bits of the first 32 bit number
+ lowBits |= (middleByte & 0x0F) << 28;
+ // 3 upper bits are part of the next 32 bit number
+ highBits = (middleByte & 0x70) >> 4;
+ if ((middleByte & 0x80) == 0) {
+ this.assertBounds();
+ return [lowBits, highBits];
+ }
+ for (let shift = 3; shift <= 31; shift += 7) {
+ let b = this.buf[this.pos++];
+ highBits |= (b & 0x7F) << shift;
+ if ((b & 0x80) == 0) {
+ this.assertBounds();
+ return [lowBits, highBits];
+ }
+ }
+ throw new Error('invalid varint');
+}
+exports.varint64read = varint64read;
+/**
+ * Write a 64 bit varint, given as two JS numbers, to the given bytes array.
+ *
+ * Copyright 2008 Google Inc. All rights reserved.
+ *
+ * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344
+ */
+function varint64write(lo, hi, bytes) {
+ for (let i = 0; i < 28; i = i + 7) {
+ const shift = lo >>> i;
+ const hasNext = !((shift >>> 7) == 0 && hi == 0);
+ const byte = (hasNext ? shift | 0x80 : shift) & 0xFF;
+ bytes.push(byte);
+ if (!hasNext) {
+ return;
+ }
+ }
+ const splitBits = ((lo >>> 28) & 0x0F) | ((hi & 0x07) << 4);
+ const hasMoreBits = !((hi >> 3) == 0);
+ bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xFF);
+ if (!hasMoreBits) {
+ return;
+ }
+ for (let i = 3; i < 31; i = i + 7) {
+ const shift = hi >>> i;
+ const hasNext = !((shift >>> 7) == 0);
+ const byte = (hasNext ? shift | 0x80 : shift) & 0xFF;
+ bytes.push(byte);
+ if (!hasNext) {
+ return;
+ }
+ }
+ bytes.push((hi >>> 31) & 0x01);
+}
+exports.varint64write = varint64write;
+// constants for binary math
+const TWO_PWR_32_DBL = (1 << 16) * (1 << 16);
+/**
+ * Parse decimal string of 64 bit integer value as two JS numbers.
+ *
+ * Returns tuple:
+ * [0]: minus sign?
+ * [1]: low bits
+ * [2]: high bits
+ *
+ * Copyright 2008 Google Inc.
+ */
+function int64fromString(dec) {
+ // Check for minus sign.
+ let minus = dec[0] == '-';
+ if (minus)
+ dec = dec.slice(1);
+ // Work 6 decimal digits at a time, acting like we're converting base 1e6
+ // digits to binary. This is safe to do with floating point math because
+ // Number.isSafeInteger(ALL_32_BITS * 1e6) == true.
+ const base = 1e6;
+ let lowBits = 0;
+ let highBits = 0;
+ function add1e6digit(begin, end) {
+ // Note: Number('') is 0.
+ const digit1e6 = Number(dec.slice(begin, end));
+ highBits *= base;
+ lowBits = lowBits * base + digit1e6;
+ // Carry bits from lowBits to highBits
+ if (lowBits >= TWO_PWR_32_DBL) {
+ highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);
+ lowBits = lowBits % TWO_PWR_32_DBL;
+ }
+ }
+ add1e6digit(-24, -18);
+ add1e6digit(-18, -12);
+ add1e6digit(-12, -6);
+ add1e6digit(-6);
+ return [minus, lowBits, highBits];
+}
+exports.int64fromString = int64fromString;
+/**
+ * Format 64 bit integer value (as two JS numbers) to decimal string.
+ *
+ * Copyright 2008 Google Inc.
+ */
+function int64toString(bitsLow, bitsHigh) {
+ // Skip the expensive conversion if the number is small enough to use the
+ // built-in conversions.
+ if ((bitsHigh >>> 0) <= 0x1FFFFF) {
+ return '' + (TWO_PWR_32_DBL * bitsHigh + (bitsLow >>> 0));
+ }
+ // What this code is doing is essentially converting the input number from
+ // base-2 to base-1e7, which allows us to represent the 64-bit range with
+ // only 3 (very large) digits. Those digits are then trivial to convert to
+ // a base-10 string.
+ // The magic numbers used here are -
+ // 2^24 = 16777216 = (1,6777216) in base-1e7.
+ // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.
+ // Split 32:32 representation into 16:24:24 representation so our
+ // intermediate digits don't overflow.
+ let low = bitsLow & 0xFFFFFF;
+ let mid = (((bitsLow >>> 24) | (bitsHigh << 8)) >>> 0) & 0xFFFFFF;
+ let high = (bitsHigh >> 16) & 0xFFFF;
+ // Assemble our three base-1e7 digits, ignoring carries. The maximum
+ // value in a digit at this step is representable as a 48-bit integer, which
+ // can be stored in a 64-bit floating point number.
+ let digitA = low + (mid * 6777216) + (high * 6710656);
+ let digitB = mid + (high * 8147497);
+ let digitC = (high * 2);
+ // Apply carries from A to B and from B to C.
+ let base = 10000000;
+ if (digitA >= base) {
+ digitB += Math.floor(digitA / base);
+ digitA %= base;
+ }
+ if (digitB >= base) {
+ digitC += Math.floor(digitB / base);
+ digitB %= base;
+ }
+ // Convert base-1e7 digits to base-10, with optional leading zeroes.
+ function decimalFrom1e7(digit1e7, needLeadingZeros) {
+ let partial = digit1e7 ? String(digit1e7) : '';
+ if (needLeadingZeros) {
+ return '0000000'.slice(partial.length) + partial;
+ }
+ return partial;
+ }
+ return decimalFrom1e7(digitC, /*needLeadingZeros=*/ 0) +
+ decimalFrom1e7(digitB, /*needLeadingZeros=*/ digitC) +
+ // If the final 1e7 digit didn't need leading zeros, we would have
+ // returned via the trivial code path at the top.
+ decimalFrom1e7(digitA, /*needLeadingZeros=*/ 1);
+}
+exports.int64toString = int64toString;
+/**
+ * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`
+ *
+ * Copyright 2008 Google Inc. All rights reserved.
+ *
+ * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144
+ */
+function varint32write(value, bytes) {
+ if (value >= 0) {
+ // write value as varint 32
+ while (value > 0x7f) {
+ bytes.push((value & 0x7f) | 0x80);
+ value = value >>> 7;
+ }
+ bytes.push(value);
+ }
+ else {
+ for (let i = 0; i < 9; i++) {
+ bytes.push(value & 127 | 128);
+ value = value >> 7;
+ }
+ bytes.push(1);
+ }
+}
+exports.varint32write = varint32write;
+/**
+ * Read an unsigned 32 bit varint.
+ *
+ * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220
+ */
+function varint32read() {
+ let b = this.buf[this.pos++];
+ let result = b & 0x7F;
+ if ((b & 0x80) == 0) {
+ this.assertBounds();
+ return result;
+ }
+ b = this.buf[this.pos++];
+ result |= (b & 0x7F) << 7;
+ if ((b & 0x80) == 0) {
+ this.assertBounds();
+ return result;
+ }
+ b = this.buf[this.pos++];
+ result |= (b & 0x7F) << 14;
+ if ((b & 0x80) == 0) {
+ this.assertBounds();
+ return result;
+ }
+ b = this.buf[this.pos++];
+ result |= (b & 0x7F) << 21;
+ if ((b & 0x80) == 0) {
+ this.assertBounds();
+ return result;
+ }
+ // Extract only last 4 bits
+ b = this.buf[this.pos++];
+ result |= (b & 0x0F) << 28;
+ for (let readBytes = 5; ((b & 0x80) !== 0) && readBytes < 10; readBytes++)
+ b = this.buf[this.pos++];
+ if ((b & 0x80) != 0)
+ throw new Error('invalid varint');
+ this.assertBounds();
+ // Result can have 32 bits, convert it to unsigned
+ return result >>> 0;
+}
+exports.varint32read = varint32read;
+
+
+/***/ }),
+
+/***/ 8886:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+// Public API of the protobuf-ts runtime.
+// Note: we do not use `export * from ...` to help tree shakers,
+// webpack verbose output hints that this should be useful
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+// Convenience JSON typings and corresponding type guards
+var json_typings_1 = __webpack_require__(9999);
+Object.defineProperty(exports, "typeofJsonValue", ({ enumerable: true, get: function () { return json_typings_1.typeofJsonValue; } }));
+Object.defineProperty(exports, "isJsonObject", ({ enumerable: true, get: function () { return json_typings_1.isJsonObject; } }));
+// Base 64 encoding
+var base64_1 = __webpack_require__(6335);
+Object.defineProperty(exports, "base64decode", ({ enumerable: true, get: function () { return base64_1.base64decode; } }));
+Object.defineProperty(exports, "base64encode", ({ enumerable: true, get: function () { return base64_1.base64encode; } }));
+// UTF8 encoding
+var protobufjs_utf8_1 = __webpack_require__(8950);
+Object.defineProperty(exports, "utf8read", ({ enumerable: true, get: function () { return protobufjs_utf8_1.utf8read; } }));
+// Binary format contracts, options for reading and writing, for example
+var binary_format_contract_1 = __webpack_require__(4816);
+Object.defineProperty(exports, "WireType", ({ enumerable: true, get: function () { return binary_format_contract_1.WireType; } }));
+Object.defineProperty(exports, "mergeBinaryOptions", ({ enumerable: true, get: function () { return binary_format_contract_1.mergeBinaryOptions; } }));
+Object.defineProperty(exports, "UnknownFieldHandler", ({ enumerable: true, get: function () { return binary_format_contract_1.UnknownFieldHandler; } }));
+// Standard IBinaryReader implementation
+var binary_reader_1 = __webpack_require__(2889);
+Object.defineProperty(exports, "BinaryReader", ({ enumerable: true, get: function () { return binary_reader_1.BinaryReader; } }));
+Object.defineProperty(exports, "binaryReadOptions", ({ enumerable: true, get: function () { return binary_reader_1.binaryReadOptions; } }));
+// Standard IBinaryWriter implementation
+var binary_writer_1 = __webpack_require__(3957);
+Object.defineProperty(exports, "BinaryWriter", ({ enumerable: true, get: function () { return binary_writer_1.BinaryWriter; } }));
+Object.defineProperty(exports, "binaryWriteOptions", ({ enumerable: true, get: function () { return binary_writer_1.binaryWriteOptions; } }));
+// Int64 and UInt64 implementations required for the binary format
+var pb_long_1 = __webpack_require__(1753);
+Object.defineProperty(exports, "PbLong", ({ enumerable: true, get: function () { return pb_long_1.PbLong; } }));
+Object.defineProperty(exports, "PbULong", ({ enumerable: true, get: function () { return pb_long_1.PbULong; } }));
+// JSON format contracts, options for reading and writing, for example
+var json_format_contract_1 = __webpack_require__(9367);
+Object.defineProperty(exports, "jsonReadOptions", ({ enumerable: true, get: function () { return json_format_contract_1.jsonReadOptions; } }));
+Object.defineProperty(exports, "jsonWriteOptions", ({ enumerable: true, get: function () { return json_format_contract_1.jsonWriteOptions; } }));
+Object.defineProperty(exports, "mergeJsonOptions", ({ enumerable: true, get: function () { return json_format_contract_1.mergeJsonOptions; } }));
+// Message type contract
+var message_type_contract_1 = __webpack_require__(3785);
+Object.defineProperty(exports, "MESSAGE_TYPE", ({ enumerable: true, get: function () { return message_type_contract_1.MESSAGE_TYPE; } }));
+// Message type implementation via reflection
+var message_type_1 = __webpack_require__(5106);
+Object.defineProperty(exports, "MessageType", ({ enumerable: true, get: function () { return message_type_1.MessageType; } }));
+// Reflection info, generated by the plugin, exposed to the user, used by reflection ops
+var reflection_info_1 = __webpack_require__(7910);
+Object.defineProperty(exports, "ScalarType", ({ enumerable: true, get: function () { return reflection_info_1.ScalarType; } }));
+Object.defineProperty(exports, "LongType", ({ enumerable: true, get: function () { return reflection_info_1.LongType; } }));
+Object.defineProperty(exports, "RepeatType", ({ enumerable: true, get: function () { return reflection_info_1.RepeatType; } }));
+Object.defineProperty(exports, "normalizeFieldInfo", ({ enumerable: true, get: function () { return reflection_info_1.normalizeFieldInfo; } }));
+Object.defineProperty(exports, "readFieldOptions", ({ enumerable: true, get: function () { return reflection_info_1.readFieldOptions; } }));
+Object.defineProperty(exports, "readFieldOption", ({ enumerable: true, get: function () { return reflection_info_1.readFieldOption; } }));
+Object.defineProperty(exports, "readMessageOption", ({ enumerable: true, get: function () { return reflection_info_1.readMessageOption; } }));
+// Message operations via reflection
+var reflection_type_check_1 = __webpack_require__(5167);
+Object.defineProperty(exports, "ReflectionTypeCheck", ({ enumerable: true, get: function () { return reflection_type_check_1.ReflectionTypeCheck; } }));
+var reflection_create_1 = __webpack_require__(5726);
+Object.defineProperty(exports, "reflectionCreate", ({ enumerable: true, get: function () { return reflection_create_1.reflectionCreate; } }));
+var reflection_scalar_default_1 = __webpack_require__(9526);
+Object.defineProperty(exports, "reflectionScalarDefault", ({ enumerable: true, get: function () { return reflection_scalar_default_1.reflectionScalarDefault; } }));
+var reflection_merge_partial_1 = __webpack_require__(8044);
+Object.defineProperty(exports, "reflectionMergePartial", ({ enumerable: true, get: function () { return reflection_merge_partial_1.reflectionMergePartial; } }));
+var reflection_equals_1 = __webpack_require__(4827);
+Object.defineProperty(exports, "reflectionEquals", ({ enumerable: true, get: function () { return reflection_equals_1.reflectionEquals; } }));
+var reflection_binary_reader_1 = __webpack_require__(9611);
+Object.defineProperty(exports, "ReflectionBinaryReader", ({ enumerable: true, get: function () { return reflection_binary_reader_1.ReflectionBinaryReader; } }));
+var reflection_binary_writer_1 = __webpack_require__(6907);
+Object.defineProperty(exports, "ReflectionBinaryWriter", ({ enumerable: true, get: function () { return reflection_binary_writer_1.ReflectionBinaryWriter; } }));
+var reflection_json_reader_1 = __webpack_require__(6790);
+Object.defineProperty(exports, "ReflectionJsonReader", ({ enumerable: true, get: function () { return reflection_json_reader_1.ReflectionJsonReader; } }));
+var reflection_json_writer_1 = __webpack_require__(1094);
+Object.defineProperty(exports, "ReflectionJsonWriter", ({ enumerable: true, get: function () { return reflection_json_writer_1.ReflectionJsonWriter; } }));
+var reflection_contains_message_type_1 = __webpack_require__(9946);
+Object.defineProperty(exports, "containsMessageType", ({ enumerable: true, get: function () { return reflection_contains_message_type_1.containsMessageType; } }));
+// Oneof helpers
+var oneof_1 = __webpack_require__(8063);
+Object.defineProperty(exports, "isOneofGroup", ({ enumerable: true, get: function () { return oneof_1.isOneofGroup; } }));
+Object.defineProperty(exports, "setOneofValue", ({ enumerable: true, get: function () { return oneof_1.setOneofValue; } }));
+Object.defineProperty(exports, "getOneofValue", ({ enumerable: true, get: function () { return oneof_1.getOneofValue; } }));
+Object.defineProperty(exports, "clearOneofValue", ({ enumerable: true, get: function () { return oneof_1.clearOneofValue; } }));
+Object.defineProperty(exports, "getSelectedOneofValue", ({ enumerable: true, get: function () { return oneof_1.getSelectedOneofValue; } }));
+// Enum object type guard and reflection util, may be interesting to the user.
+var enum_object_1 = __webpack_require__(257);
+Object.defineProperty(exports, "listEnumValues", ({ enumerable: true, get: function () { return enum_object_1.listEnumValues; } }));
+Object.defineProperty(exports, "listEnumNames", ({ enumerable: true, get: function () { return enum_object_1.listEnumNames; } }));
+Object.defineProperty(exports, "listEnumNumbers", ({ enumerable: true, get: function () { return enum_object_1.listEnumNumbers; } }));
+Object.defineProperty(exports, "isEnumObject", ({ enumerable: true, get: function () { return enum_object_1.isEnumObject; } }));
+// lowerCamelCase() is exported for plugin, rpc-runtime and other rpc packages
+var lower_camel_case_1 = __webpack_require__(4073);
+Object.defineProperty(exports, "lowerCamelCase", ({ enumerable: true, get: function () { return lower_camel_case_1.lowerCamelCase; } }));
+// assertion functions are exported for plugin, may also be useful to user
+var assert_1 = __webpack_require__(8602);
+Object.defineProperty(exports, "assert", ({ enumerable: true, get: function () { return assert_1.assert; } }));
+Object.defineProperty(exports, "assertNever", ({ enumerable: true, get: function () { return assert_1.assertNever; } }));
+Object.defineProperty(exports, "assertInt32", ({ enumerable: true, get: function () { return assert_1.assertInt32; } }));
+Object.defineProperty(exports, "assertUInt32", ({ enumerable: true, get: function () { return assert_1.assertUInt32; } }));
+Object.defineProperty(exports, "assertFloat32", ({ enumerable: true, get: function () { return assert_1.assertFloat32; } }));
+
+
+/***/ }),
+
+/***/ 9367:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.mergeJsonOptions = exports.jsonWriteOptions = exports.jsonReadOptions = void 0;
+const defaultsWrite = {
+ emitDefaultValues: false,
+ enumAsInteger: false,
+ useProtoFieldName: false,
+ prettySpaces: 0,
+}, defaultsRead = {
+ ignoreUnknownFields: false,
+};
+/**
+ * Make options for reading JSON data from partial options.
+ */
+function jsonReadOptions(options) {
+ return options ? Object.assign(Object.assign({}, defaultsRead), options) : defaultsRead;
+}
+exports.jsonReadOptions = jsonReadOptions;
+/**
+ * Make options for writing JSON data from partial options.
+ */
+function jsonWriteOptions(options) {
+ return options ? Object.assign(Object.assign({}, defaultsWrite), options) : defaultsWrite;
+}
+exports.jsonWriteOptions = jsonWriteOptions;
+/**
+ * Merges JSON write or read options. Later values override earlier values. Type registries are merged.
+ */
+function mergeJsonOptions(a, b) {
+ var _a, _b;
+ let c = Object.assign(Object.assign({}, a), b);
+ c.typeRegistry = [...((_a = a === null || a === void 0 ? void 0 : a.typeRegistry) !== null && _a !== void 0 ? _a : []), ...((_b = b === null || b === void 0 ? void 0 : b.typeRegistry) !== null && _b !== void 0 ? _b : [])];
+ return c;
+}
+exports.mergeJsonOptions = mergeJsonOptions;
+
+
+/***/ }),
+
+/***/ 9999:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.isJsonObject = exports.typeofJsonValue = void 0;
+/**
+ * Get the type of a JSON value.
+ * Distinguishes between array, null and object.
+ */
+function typeofJsonValue(value) {
+ let t = typeof value;
+ if (t == "object") {
+ if (Array.isArray(value))
+ return "array";
+ if (value === null)
+ return "null";
+ }
+ return t;
+}
+exports.typeofJsonValue = typeofJsonValue;
+/**
+ * Is this a JSON object (instead of an array or null)?
+ */
+function isJsonObject(value) {
+ return value !== null && typeof value == "object" && !Array.isArray(value);
+}
+exports.isJsonObject = isJsonObject;
+
+
+/***/ }),
+
+/***/ 4073:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.lowerCamelCase = void 0;
+/**
+ * Converts snake_case to lowerCamelCase.
+ *
+ * Should behave like protoc:
+ * https://github.com/protocolbuffers/protobuf/blob/e8ae137c96444ea313485ed1118c5e43b2099cf1/src/google/protobuf/compiler/java/java_helpers.cc#L118
+ */
+function lowerCamelCase(snakeCase) {
+ let capNext = false;
+ const sb = [];
+ for (let i = 0; i < snakeCase.length; i++) {
+ let next = snakeCase.charAt(i);
+ if (next == '_') {
+ capNext = true;
+ }
+ else if (/\d/.test(next)) {
+ sb.push(next);
+ capNext = true;
+ }
+ else if (capNext) {
+ sb.push(next.toUpperCase());
+ capNext = false;
+ }
+ else if (i == 0) {
+ sb.push(next.toLowerCase());
+ }
+ else {
+ sb.push(next);
+ }
+ }
+ return sb.join('');
+}
+exports.lowerCamelCase = lowerCamelCase;
+
+
+/***/ }),
+
+/***/ 3785:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.MESSAGE_TYPE = void 0;
+/**
+ * The symbol used as a key on message objects to store the message type.
+ *
+ * Note that this is an experimental feature - it is here to stay, but
+ * implementation details may change without notice.
+ */
+exports.MESSAGE_TYPE = Symbol.for("protobuf-ts/message-type");
+
+
+/***/ }),
+
+/***/ 5106:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.MessageType = void 0;
+const message_type_contract_1 = __webpack_require__(3785);
+const reflection_info_1 = __webpack_require__(7910);
+const reflection_type_check_1 = __webpack_require__(5167);
+const reflection_json_reader_1 = __webpack_require__(6790);
+const reflection_json_writer_1 = __webpack_require__(1094);
+const reflection_binary_reader_1 = __webpack_require__(9611);
+const reflection_binary_writer_1 = __webpack_require__(6907);
+const reflection_create_1 = __webpack_require__(5726);
+const reflection_merge_partial_1 = __webpack_require__(8044);
+const json_typings_1 = __webpack_require__(9999);
+const json_format_contract_1 = __webpack_require__(9367);
+const reflection_equals_1 = __webpack_require__(4827);
+const binary_writer_1 = __webpack_require__(3957);
+const binary_reader_1 = __webpack_require__(2889);
+const baseDescriptors = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({}));
+const messageTypeDescriptor = baseDescriptors[message_type_contract_1.MESSAGE_TYPE] = {};
+/**
+ * This standard message type provides reflection-based
+ * operations to work with a message.
+ */
+class MessageType {
+ constructor(name, fields, options) {
+ this.defaultCheckDepth = 16;
+ this.typeName = name;
+ this.fields = fields.map(reflection_info_1.normalizeFieldInfo);
+ this.options = options !== null && options !== void 0 ? options : {};
+ messageTypeDescriptor.value = this;
+ this.messagePrototype = Object.create(null, baseDescriptors);
+ this.refTypeCheck = new reflection_type_check_1.ReflectionTypeCheck(this);
+ this.refJsonReader = new reflection_json_reader_1.ReflectionJsonReader(this);
+ this.refJsonWriter = new reflection_json_writer_1.ReflectionJsonWriter(this);
+ this.refBinReader = new reflection_binary_reader_1.ReflectionBinaryReader(this);
+ this.refBinWriter = new reflection_binary_writer_1.ReflectionBinaryWriter(this);
+ }
+ create(value) {
+ let message = reflection_create_1.reflectionCreate(this);
+ if (value !== undefined) {
+ reflection_merge_partial_1.reflectionMergePartial(this, message, value);
+ }
+ return message;
+ }
+ /**
+ * Clone the message.
+ *
+ * Unknown fields are discarded.
+ */
+ clone(message) {
+ let copy = this.create();
+ reflection_merge_partial_1.reflectionMergePartial(this, copy, message);
+ return copy;
+ }
+ /**
+ * Determines whether two message of the same type have the same field values.
+ * Checks for deep equality, traversing repeated fields, oneof groups, maps
+ * and messages recursively.
+ * Will also return true if both messages are `undefined`.
+ */
+ equals(a, b) {
+ return reflection_equals_1.reflectionEquals(this, a, b);
+ }
+ /**
+ * Is the given value assignable to our message type
+ * and contains no [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
+ */
+ is(arg, depth = this.defaultCheckDepth) {
+ return this.refTypeCheck.is(arg, depth, false);
+ }
+ /**
+ * Is the given value assignable to our message type,
+ * regardless of [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
+ */
+ isAssignable(arg, depth = this.defaultCheckDepth) {
+ return this.refTypeCheck.is(arg, depth, true);
+ }
+ /**
+ * Copy partial data into the target message.
+ */
+ mergePartial(target, source) {
+ reflection_merge_partial_1.reflectionMergePartial(this, target, source);
+ }
+ /**
+ * Create a new message from binary format.
+ */
+ fromBinary(data, options) {
+ let opt = binary_reader_1.binaryReadOptions(options);
+ return this.internalBinaryRead(opt.readerFactory(data), data.byteLength, opt);
+ }
+ /**
+ * Read a new message from a JSON value.
+ */
+ fromJson(json, options) {
+ return this.internalJsonRead(json, json_format_contract_1.jsonReadOptions(options));
+ }
+ /**
+ * Read a new message from a JSON string.
+ * This is equivalent to `T.fromJson(JSON.parse(json))`.
+ */
+ fromJsonString(json, options) {
+ let value = JSON.parse(json);
+ return this.fromJson(value, options);
+ }
+ /**
+ * Write the message to canonical JSON value.
+ */
+ toJson(message, options) {
+ return this.internalJsonWrite(message, json_format_contract_1.jsonWriteOptions(options));
+ }
+ /**
+ * Convert the message to canonical JSON string.
+ * This is equivalent to `JSON.stringify(T.toJson(t))`
+ */
+ toJsonString(message, options) {
+ var _a;
+ let value = this.toJson(message, options);
+ return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);
+ }
+ /**
+ * Write the message to binary format.
+ */
+ toBinary(message, options) {
+ let opt = binary_writer_1.binaryWriteOptions(options);
+ return this.internalBinaryWrite(message, opt.writerFactory(), opt).finish();
+ }
+ /**
+ * This is an internal method. If you just want to read a message from
+ * JSON, use `fromJson()` or `fromJsonString()`.
+ *
+ * Reads JSON value and merges the fields into the target
+ * according to protobuf rules. If the target is omitted,
+ * a new instance is created first.
+ */
+ internalJsonRead(json, options, target) {
+ if (json !== null && typeof json == "object" && !Array.isArray(json)) {
+ let message = target !== null && target !== void 0 ? target : this.create();
+ this.refJsonReader.read(json, message, options);
+ return message;
+ }
+ throw new Error(`Unable to parse message ${this.typeName} from JSON ${json_typings_1.typeofJsonValue(json)}.`);
+ }
+ /**
+ * This is an internal method. If you just want to write a message
+ * to JSON, use `toJson()` or `toJsonString().
+ *
+ * Writes JSON value and returns it.
+ */
+ internalJsonWrite(message, options) {
+ return this.refJsonWriter.write(message, options);
+ }
+ /**
+ * This is an internal method. If you just want to write a message
+ * in binary format, use `toBinary()`.
+ *
+ * Serializes the message in binary format and appends it to the given
+ * writer. Returns passed writer.
+ */
+ internalBinaryWrite(message, writer, options) {
+ this.refBinWriter.write(message, writer, options);
+ return writer;
+ }
+ /**
+ * This is an internal method. If you just want to read a message from
+ * binary data, use `fromBinary()`.
+ *
+ * Reads data from binary format and merges the fields into
+ * the target according to protobuf rules. If the target is
+ * omitted, a new instance is created first.
+ */
+ internalBinaryRead(reader, length, options, target) {
+ let message = target !== null && target !== void 0 ? target : this.create();
+ this.refBinReader.read(reader, message, options, length);
+ return message;
+ }
+}
+exports.MessageType = MessageType;
+
+
+/***/ }),
+
+/***/ 8063:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.getSelectedOneofValue = exports.clearOneofValue = exports.setUnknownOneofValue = exports.setOneofValue = exports.getOneofValue = exports.isOneofGroup = void 0;
+/**
+ * Is the given value a valid oneof group?
+ *
+ * We represent protobuf `oneof` as algebraic data types (ADT) in generated
+ * code. But when working with messages of unknown type, the ADT does not
+ * help us.
+ *
+ * This type guard checks if the given object adheres to the ADT rules, which
+ * are as follows:
+ *
+ * 1) Must be an object.
+ *
+ * 2) Must have a "oneofKind" discriminator property.
+ *
+ * 3) If "oneofKind" is `undefined`, no member field is selected. The object
+ * must not have any other properties.
+ *
+ * 4) If "oneofKind" is a `string`, the member field with this name is
+ * selected.
+ *
+ * 5) If a member field is selected, the object must have a second property
+ * with this name. The property must not be `undefined`.
+ *
+ * 6) No extra properties are allowed. The object has either one property
+ * (no selection) or two properties (selection).
+ *
+ */
+function isOneofGroup(any) {
+ if (typeof any != 'object' || any === null || !any.hasOwnProperty('oneofKind')) {
+ return false;
+ }
+ switch (typeof any.oneofKind) {
+ case "string":
+ if (any[any.oneofKind] === undefined)
+ return false;
+ return Object.keys(any).length == 2;
+ case "undefined":
+ return Object.keys(any).length == 1;
+ default:
+ return false;
+ }
+}
+exports.isOneofGroup = isOneofGroup;
+/**
+ * Returns the value of the given field in a oneof group.
+ */
+function getOneofValue(oneof, kind) {
+ return oneof[kind];
+}
+exports.getOneofValue = getOneofValue;
+function setOneofValue(oneof, kind, value) {
+ if (oneof.oneofKind !== undefined) {
+ delete oneof[oneof.oneofKind];
+ }
+ oneof.oneofKind = kind;
+ if (value !== undefined) {
+ oneof[kind] = value;
+ }
+}
+exports.setOneofValue = setOneofValue;
+function setUnknownOneofValue(oneof, kind, value) {
+ if (oneof.oneofKind !== undefined) {
+ delete oneof[oneof.oneofKind];
+ }
+ oneof.oneofKind = kind;
+ if (value !== undefined && kind !== undefined) {
+ oneof[kind] = value;
+ }
+}
+exports.setUnknownOneofValue = setUnknownOneofValue;
+/**
+ * Removes the selected field in a oneof group.
+ *
+ * Note that the recommended way to modify a oneof group is to set
+ * a new object:
+ *
+ * ```ts
+ * message.result = { oneofKind: undefined };
+ * ```
+ */
+function clearOneofValue(oneof) {
+ if (oneof.oneofKind !== undefined) {
+ delete oneof[oneof.oneofKind];
+ }
+ oneof.oneofKind = undefined;
+}
+exports.clearOneofValue = clearOneofValue;
+/**
+ * Returns the selected value of the given oneof group.
+ *
+ * Not that the recommended way to access a oneof group is to check
+ * the "oneofKind" property and let TypeScript narrow down the union
+ * type for you:
+ *
+ * ```ts
+ * if (message.result.oneofKind === "error") {
+ * message.result.error; // string
+ * }
+ * ```
+ *
+ * In the rare case you just need the value, and do not care about
+ * which protobuf field is selected, you can use this function
+ * for convenience.
+ */
+function getSelectedOneofValue(oneof) {
+ if (oneof.oneofKind === undefined) {
+ return undefined;
+ }
+ return oneof[oneof.oneofKind];
+}
+exports.getSelectedOneofValue = getSelectedOneofValue;
+
+
+/***/ }),
+
+/***/ 1753:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.PbLong = exports.PbULong = exports.detectBi = void 0;
+const goog_varint_1 = __webpack_require__(3223);
+let BI;
+function detectBi() {
+ const dv = new DataView(new ArrayBuffer(8));
+ const ok = globalThis.BigInt !== undefined
+ && typeof dv.getBigInt64 === "function"
+ && typeof dv.getBigUint64 === "function"
+ && typeof dv.setBigInt64 === "function"
+ && typeof dv.setBigUint64 === "function";
+ BI = ok ? {
+ MIN: BigInt("-9223372036854775808"),
+ MAX: BigInt("9223372036854775807"),
+ UMIN: BigInt("0"),
+ UMAX: BigInt("18446744073709551615"),
+ C: BigInt,
+ V: dv,
+ } : undefined;
+}
+exports.detectBi = detectBi;
+detectBi();
+function assertBi(bi) {
+ if (!bi)
+ throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
+}
+// used to validate from(string) input (when bigint is unavailable)
+const RE_DECIMAL_STR = /^-?[0-9]+$/;
+// constants for binary math
+const TWO_PWR_32_DBL = 0x100000000;
+const HALF_2_PWR_32 = 0x080000000;
+// base class for PbLong and PbULong provides shared code
+class SharedPbLong {
+ /**
+ * Create a new instance with the given bits.
+ */
+ constructor(lo, hi) {
+ this.lo = lo | 0;
+ this.hi = hi | 0;
+ }
+ /**
+ * Is this instance equal to 0?
+ */
+ isZero() {
+ return this.lo == 0 && this.hi == 0;
+ }
+ /**
+ * Convert to a native number.
+ */
+ toNumber() {
+ let result = this.hi * TWO_PWR_32_DBL + (this.lo >>> 0);
+ if (!Number.isSafeInteger(result))
+ throw new Error("cannot convert to safe number");
+ return result;
+ }
+}
+/**
+ * 64-bit unsigned integer as two 32-bit values.
+ * Converts between `string`, `number` and `bigint` representations.
+ */
+class PbULong extends SharedPbLong {
+ /**
+ * Create instance from a `string`, `number` or `bigint`.
+ */
+ static from(value) {
+ if (BI)
+ // noinspection FallThroughInSwitchStatementJS
+ switch (typeof value) {
+ case "string":
+ if (value == "0")
+ return this.ZERO;
+ if (value == "")
+ throw new Error('string is no integer');
+ value = BI.C(value);
+ case "number":
+ if (value === 0)
+ return this.ZERO;
+ value = BI.C(value);
+ case "bigint":
+ if (!value)
+ return this.ZERO;
+ if (value < BI.UMIN)
+ throw new Error('signed value for ulong');
+ if (value > BI.UMAX)
+ throw new Error('ulong too large');
+ BI.V.setBigUint64(0, value, true);
+ return new PbULong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
+ }
+ else
+ switch (typeof value) {
+ case "string":
+ if (value == "0")
+ return this.ZERO;
+ value = value.trim();
+ if (!RE_DECIMAL_STR.test(value))
+ throw new Error('string is no integer');
+ let [minus, lo, hi] = goog_varint_1.int64fromString(value);
+ if (minus)
+ throw new Error('signed value for ulong');
+ return new PbULong(lo, hi);
+ case "number":
+ if (value == 0)
+ return this.ZERO;
+ if (!Number.isSafeInteger(value))
+ throw new Error('number is no integer');
+ if (value < 0)
+ throw new Error('signed value for ulong');
+ return new PbULong(value, value / TWO_PWR_32_DBL);
+ }
+ throw new Error('unknown value ' + typeof value);
+ }
+ /**
+ * Convert to decimal string.
+ */
+ toString() {
+ return BI ? this.toBigInt().toString() : goog_varint_1.int64toString(this.lo, this.hi);
+ }
+ /**
+ * Convert to native bigint.
+ */
+ toBigInt() {
+ assertBi(BI);
+ BI.V.setInt32(0, this.lo, true);
+ BI.V.setInt32(4, this.hi, true);
+ return BI.V.getBigUint64(0, true);
+ }
+}
+exports.PbULong = PbULong;
+/**
+ * ulong 0 singleton.
+ */
+PbULong.ZERO = new PbULong(0, 0);
+/**
+ * 64-bit signed integer as two 32-bit values.
+ * Converts between `string`, `number` and `bigint` representations.
+ */
+class PbLong extends SharedPbLong {
+ /**
+ * Create instance from a `string`, `number` or `bigint`.
+ */
+ static from(value) {
+ if (BI)
+ // noinspection FallThroughInSwitchStatementJS
+ switch (typeof value) {
+ case "string":
+ if (value == "0")
+ return this.ZERO;
+ if (value == "")
+ throw new Error('string is no integer');
+ value = BI.C(value);
+ case "number":
+ if (value === 0)
+ return this.ZERO;
+ value = BI.C(value);
+ case "bigint":
+ if (!value)
+ return this.ZERO;
+ if (value < BI.MIN)
+ throw new Error('signed long too small');
+ if (value > BI.MAX)
+ throw new Error('signed long too large');
+ BI.V.setBigInt64(0, value, true);
+ return new PbLong(BI.V.getInt32(0, true), BI.V.getInt32(4, true));
+ }
+ else
+ switch (typeof value) {
+ case "string":
+ if (value == "0")
+ return this.ZERO;
+ value = value.trim();
+ if (!RE_DECIMAL_STR.test(value))
+ throw new Error('string is no integer');
+ let [minus, lo, hi] = goog_varint_1.int64fromString(value);
+ if (minus) {
+ if (hi > HALF_2_PWR_32 || (hi == HALF_2_PWR_32 && lo != 0))
+ throw new Error('signed long too small');
+ }
+ else if (hi >= HALF_2_PWR_32)
+ throw new Error('signed long too large');
+ let pbl = new PbLong(lo, hi);
+ return minus ? pbl.negate() : pbl;
+ case "number":
+ if (value == 0)
+ return this.ZERO;
+ if (!Number.isSafeInteger(value))
+ throw new Error('number is no integer');
+ return value > 0
+ ? new PbLong(value, value / TWO_PWR_32_DBL)
+ : new PbLong(-value, -value / TWO_PWR_32_DBL).negate();
+ }
+ throw new Error('unknown value ' + typeof value);
+ }
+ /**
+ * Do we have a minus sign?
+ */
+ isNegative() {
+ return (this.hi & HALF_2_PWR_32) !== 0;
+ }
+ /**
+ * Negate two's complement.
+ * Invert all the bits and add one to the result.
+ */
+ negate() {
+ let hi = ~this.hi, lo = this.lo;
+ if (lo)
+ lo = ~lo + 1;
+ else
+ hi += 1;
+ return new PbLong(lo, hi);
+ }
+ /**
+ * Convert to decimal string.
+ */
+ toString() {
+ if (BI)
+ return this.toBigInt().toString();
+ if (this.isNegative()) {
+ let n = this.negate();
+ return '-' + goog_varint_1.int64toString(n.lo, n.hi);
+ }
+ return goog_varint_1.int64toString(this.lo, this.hi);
+ }
+ /**
+ * Convert to native bigint.
+ */
+ toBigInt() {
+ assertBi(BI);
+ BI.V.setInt32(0, this.lo, true);
+ BI.V.setInt32(4, this.hi, true);
+ return BI.V.getBigInt64(0, true);
+ }
+}
+exports.PbLong = PbLong;
+/**
+ * long 0 singleton.
+ */
+PbLong.ZERO = new PbLong(0, 0);
+
+
+/***/ }),
+
+/***/ 8950:
+/***/ ((__unused_webpack_module, exports) => {
+
+
+// Copyright (c) 2016, Daniel Wirtz All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the distribution.
+// * Neither the name of its author, nor the names of its contributors
+// may be used to endorse or promote products derived from this software
+// without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.utf8read = void 0;
+const fromCharCodes = (chunk) => String.fromCharCode.apply(String, chunk);
+/**
+ * @deprecated This function will no longer be exported with the next major
+ * release, since protobuf-ts has switch to TextDecoder API. If you need this
+ * function, please migrate to @protobufjs/utf8. For context, see
+ * https://github.com/timostamm/protobuf-ts/issues/184
+ *
+ * Reads UTF8 bytes as a string.
+ *
+ * See [protobufjs / utf8](https://github.com/protobufjs/protobuf.js/blob/9893e35b854621cce64af4bf6be2cff4fb892796/lib/utf8/index.js#L40)
+ *
+ * Copyright (c) 2016, Daniel Wirtz
+ */
+function utf8read(bytes) {
+ if (bytes.length < 1)
+ return "";
+ let pos = 0, // position in bytes
+ parts = [], chunk = [], i = 0, // char offset
+ t; // temporary
+ let len = bytes.length;
+ while (pos < len) {
+ t = bytes[pos++];
+ if (t < 128)
+ chunk[i++] = t;
+ else if (t > 191 && t < 224)
+ chunk[i++] = (t & 31) << 6 | bytes[pos++] & 63;
+ else if (t > 239 && t < 365) {
+ t = ((t & 7) << 18 | (bytes[pos++] & 63) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63) - 0x10000;
+ chunk[i++] = 0xD800 + (t >> 10);
+ chunk[i++] = 0xDC00 + (t & 1023);
+ }
+ else
+ chunk[i++] = (t & 15) << 12 | (bytes[pos++] & 63) << 6 | bytes[pos++] & 63;
+ if (i > 8191) {
+ parts.push(fromCharCodes(chunk));
+ i = 0;
+ }
+ }
+ if (parts.length) {
+ if (i)
+ parts.push(fromCharCodes(chunk.slice(0, i)));
+ return parts.join("");
+ }
+ return fromCharCodes(chunk.slice(0, i));
+}
+exports.utf8read = utf8read;
+
+
+/***/ }),
+
+/***/ 9611:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ReflectionBinaryReader = void 0;
+const binary_format_contract_1 = __webpack_require__(4816);
+const reflection_info_1 = __webpack_require__(7910);
+const reflection_long_convert_1 = __webpack_require__(3402);
+const reflection_scalar_default_1 = __webpack_require__(9526);
+/**
+ * Reads proto3 messages in binary format using reflection information.
+ *
+ * https://developers.google.com/protocol-buffers/docs/encoding
+ */
+class ReflectionBinaryReader {
+ constructor(info) {
+ this.info = info;
+ }
+ prepare() {
+ var _a;
+ if (!this.fieldNoToField) {
+ const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
+ this.fieldNoToField = new Map(fieldsInput.map(field => [field.no, field]));
+ }
+ }
+ /**
+ * Reads a message from binary format into the target message.
+ *
+ * Repeated fields are appended. Map entries are added, overwriting
+ * existing keys.
+ *
+ * If a message field is already present, it will be merged with the
+ * new data.
+ */
+ read(reader, message, options, length) {
+ this.prepare();
+ const end = length === undefined ? reader.len : reader.pos + length;
+ while (reader.pos < end) {
+ // read the tag and find the field
+ const [fieldNo, wireType] = reader.tag(), field = this.fieldNoToField.get(fieldNo);
+ if (!field) {
+ let u = options.readUnknownField;
+ if (u == "throw")
+ throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.info.typeName}`);
+ let d = reader.skip(wireType);
+ if (u !== false)
+ (u === true ? binary_format_contract_1.UnknownFieldHandler.onRead : u)(this.info.typeName, message, fieldNo, wireType, d);
+ continue;
+ }
+ // target object for the field we are reading
+ let target = message, repeated = field.repeat, localName = field.localName;
+ // if field is member of oneof ADT, use ADT as target
+ if (field.oneof) {
+ target = target[field.oneof];
+ // if other oneof member selected, set new ADT
+ if (target.oneofKind !== localName)
+ target = message[field.oneof] = {
+ oneofKind: localName
+ };
+ }
+ // we have handled oneof above, we just have read the value into `target[localName]`
+ switch (field.kind) {
+ case "scalar":
+ case "enum":
+ let T = field.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.T;
+ let L = field.kind == "scalar" ? field.L : undefined;
+ if (repeated) {
+ let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values
+ if (wireType == binary_format_contract_1.WireType.LengthDelimited && T != reflection_info_1.ScalarType.STRING && T != reflection_info_1.ScalarType.BYTES) {
+ let e = reader.uint32() + reader.pos;
+ while (reader.pos < e)
+ arr.push(this.scalar(reader, T, L));
+ }
+ else
+ arr.push(this.scalar(reader, T, L));
+ }
+ else
+ target[localName] = this.scalar(reader, T, L);
+ break;
+ case "message":
+ if (repeated) {
+ let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values
+ let msg = field.T().internalBinaryRead(reader, reader.uint32(), options);
+ arr.push(msg);
+ }
+ else
+ target[localName] = field.T().internalBinaryRead(reader, reader.uint32(), options, target[localName]);
+ break;
+ case "map":
+ let [mapKey, mapVal] = this.mapEntry(field, reader, options);
+ // safe to assume presence of map object, oneof cannot contain repeated values
+ target[localName][mapKey] = mapVal;
+ break;
+ }
+ }
+ }
+ /**
+ * Read a map field, expecting key field = 1, value field = 2
+ */
+ mapEntry(field, reader, options) {
+ let length = reader.uint32();
+ let end = reader.pos + length;
+ let key = undefined; // javascript only allows number or string for object properties
+ let val = undefined;
+ while (reader.pos < end) {
+ let [fieldNo, wireType] = reader.tag();
+ switch (fieldNo) {
+ case 1:
+ if (field.K == reflection_info_1.ScalarType.BOOL)
+ key = reader.bool().toString();
+ else
+ // long types are read as string, number types are okay as number
+ key = this.scalar(reader, field.K, reflection_info_1.LongType.STRING);
+ break;
+ case 2:
+ switch (field.V.kind) {
+ case "scalar":
+ val = this.scalar(reader, field.V.T, field.V.L);
+ break;
+ case "enum":
+ val = reader.int32();
+ break;
+ case "message":
+ val = field.V.T().internalBinaryRead(reader, reader.uint32(), options);
+ break;
+ }
+ break;
+ default:
+ throw new Error(`Unknown field ${fieldNo} (wire type ${wireType}) in map entry for ${this.info.typeName}#${field.name}`);
+ }
+ }
+ if (key === undefined) {
+ let keyRaw = reflection_scalar_default_1.reflectionScalarDefault(field.K);
+ key = field.K == reflection_info_1.ScalarType.BOOL ? keyRaw.toString() : keyRaw;
+ }
+ if (val === undefined)
+ switch (field.V.kind) {
+ case "scalar":
+ val = reflection_scalar_default_1.reflectionScalarDefault(field.V.T, field.V.L);
+ break;
+ case "enum":
+ val = 0;
+ break;
+ case "message":
+ val = field.V.T().create();
+ break;
+ }
+ return [key, val];
+ }
+ scalar(reader, type, longType) {
+ switch (type) {
+ case reflection_info_1.ScalarType.INT32:
+ return reader.int32();
+ case reflection_info_1.ScalarType.STRING:
+ return reader.string();
+ case reflection_info_1.ScalarType.BOOL:
+ return reader.bool();
+ case reflection_info_1.ScalarType.DOUBLE:
+ return reader.double();
+ case reflection_info_1.ScalarType.FLOAT:
+ return reader.float();
+ case reflection_info_1.ScalarType.INT64:
+ return reflection_long_convert_1.reflectionLongConvert(reader.int64(), longType);
+ case reflection_info_1.ScalarType.UINT64:
+ return reflection_long_convert_1.reflectionLongConvert(reader.uint64(), longType);
+ case reflection_info_1.ScalarType.FIXED64:
+ return reflection_long_convert_1.reflectionLongConvert(reader.fixed64(), longType);
+ case reflection_info_1.ScalarType.FIXED32:
+ return reader.fixed32();
+ case reflection_info_1.ScalarType.BYTES:
+ return reader.bytes();
+ case reflection_info_1.ScalarType.UINT32:
+ return reader.uint32();
+ case reflection_info_1.ScalarType.SFIXED32:
+ return reader.sfixed32();
+ case reflection_info_1.ScalarType.SFIXED64:
+ return reflection_long_convert_1.reflectionLongConvert(reader.sfixed64(), longType);
+ case reflection_info_1.ScalarType.SINT32:
+ return reader.sint32();
+ case reflection_info_1.ScalarType.SINT64:
+ return reflection_long_convert_1.reflectionLongConvert(reader.sint64(), longType);
+ }
+ }
+}
+exports.ReflectionBinaryReader = ReflectionBinaryReader;
+
+
+/***/ }),
+
+/***/ 6907:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ReflectionBinaryWriter = void 0;
+const binary_format_contract_1 = __webpack_require__(4816);
+const reflection_info_1 = __webpack_require__(7910);
+const assert_1 = __webpack_require__(8602);
+const pb_long_1 = __webpack_require__(1753);
+/**
+ * Writes proto3 messages in binary format using reflection information.
+ *
+ * https://developers.google.com/protocol-buffers/docs/encoding
+ */
+class ReflectionBinaryWriter {
+ constructor(info) {
+ this.info = info;
+ }
+ prepare() {
+ if (!this.fields) {
+ const fieldsInput = this.info.fields ? this.info.fields.concat() : [];
+ this.fields = fieldsInput.sort((a, b) => a.no - b.no);
+ }
+ }
+ /**
+ * Writes the message to binary format.
+ */
+ write(message, writer, options) {
+ this.prepare();
+ for (const field of this.fields) {
+ let value, // this will be our field value, whether it is member of a oneof or not
+ emitDefault, // whether we emit the default value (only true for oneof members)
+ repeated = field.repeat, localName = field.localName;
+ // handle oneof ADT
+ if (field.oneof) {
+ const group = message[field.oneof];
+ if (group.oneofKind !== localName)
+ continue; // if field is not selected, skip
+ value = group[localName];
+ emitDefault = true;
+ }
+ else {
+ value = message[localName];
+ emitDefault = false;
+ }
+ // we have handled oneof above. we just have to honor `emitDefault`.
+ switch (field.kind) {
+ case "scalar":
+ case "enum":
+ let T = field.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.T;
+ if (repeated) {
+ assert_1.assert(Array.isArray(value));
+ if (repeated == reflection_info_1.RepeatType.PACKED)
+ this.packed(writer, T, field.no, value);
+ else
+ for (const item of value)
+ this.scalar(writer, T, field.no, item, true);
+ }
+ else if (value === undefined)
+ assert_1.assert(field.opt);
+ else
+ this.scalar(writer, T, field.no, value, emitDefault || field.opt);
+ break;
+ case "message":
+ if (repeated) {
+ assert_1.assert(Array.isArray(value));
+ for (const item of value)
+ this.message(writer, options, field.T(), field.no, item);
+ }
+ else {
+ this.message(writer, options, field.T(), field.no, value);
+ }
+ break;
+ case "map":
+ assert_1.assert(typeof value == 'object' && value !== null);
+ for (const [key, val] of Object.entries(value))
+ this.mapEntry(writer, options, field, key, val);
+ break;
+ }
+ }
+ let u = options.writeUnknownFields;
+ if (u !== false)
+ (u === true ? binary_format_contract_1.UnknownFieldHandler.onWrite : u)(this.info.typeName, message, writer);
+ }
+ mapEntry(writer, options, field, key, value) {
+ writer.tag(field.no, binary_format_contract_1.WireType.LengthDelimited);
+ writer.fork();
+ // javascript only allows number or string for object properties
+ // we convert from our representation to the protobuf type
+ let keyValue = key;
+ switch (field.K) {
+ case reflection_info_1.ScalarType.INT32:
+ case reflection_info_1.ScalarType.FIXED32:
+ case reflection_info_1.ScalarType.UINT32:
+ case reflection_info_1.ScalarType.SFIXED32:
+ case reflection_info_1.ScalarType.SINT32:
+ keyValue = Number.parseInt(key);
+ break;
+ case reflection_info_1.ScalarType.BOOL:
+ assert_1.assert(key == 'true' || key == 'false');
+ keyValue = key == 'true';
+ break;
+ }
+ // write key, expecting key field number = 1
+ this.scalar(writer, field.K, 1, keyValue, true);
+ // write value, expecting value field number = 2
+ switch (field.V.kind) {
+ case 'scalar':
+ this.scalar(writer, field.V.T, 2, value, true);
+ break;
+ case 'enum':
+ this.scalar(writer, reflection_info_1.ScalarType.INT32, 2, value, true);
+ break;
+ case 'message':
+ this.message(writer, options, field.V.T(), 2, value);
+ break;
+ }
+ writer.join();
+ }
+ message(writer, options, handler, fieldNo, value) {
+ if (value === undefined)
+ return;
+ handler.internalBinaryWrite(value, writer.tag(fieldNo, binary_format_contract_1.WireType.LengthDelimited).fork(), options);
+ writer.join();
+ }
+ /**
+ * Write a single scalar value.
+ */
+ scalar(writer, type, fieldNo, value, emitDefault) {
+ let [wireType, method, isDefault] = this.scalarInfo(type, value);
+ if (!isDefault || emitDefault) {
+ writer.tag(fieldNo, wireType);
+ writer[method](value);
+ }
+ }
+ /**
+ * Write an array of scalar values in packed format.
+ */
+ packed(writer, type, fieldNo, value) {
+ if (!value.length)
+ return;
+ assert_1.assert(type !== reflection_info_1.ScalarType.BYTES && type !== reflection_info_1.ScalarType.STRING);
+ // write tag
+ writer.tag(fieldNo, binary_format_contract_1.WireType.LengthDelimited);
+ // begin length-delimited
+ writer.fork();
+ // write values without tags
+ let [, method,] = this.scalarInfo(type);
+ for (let i = 0; i < value.length; i++)
+ writer[method](value[i]);
+ // end length delimited
+ writer.join();
+ }
+ /**
+ * Get information for writing a scalar value.
+ *
+ * Returns tuple:
+ * [0]: appropriate WireType
+ * [1]: name of the appropriate method of IBinaryWriter
+ * [2]: whether the given value is a default value
+ *
+ * If argument `value` is omitted, [2] is always false.
+ */
+ scalarInfo(type, value) {
+ let t = binary_format_contract_1.WireType.Varint;
+ let m;
+ let i = value === undefined;
+ let d = value === 0;
+ switch (type) {
+ case reflection_info_1.ScalarType.INT32:
+ m = "int32";
+ break;
+ case reflection_info_1.ScalarType.STRING:
+ d = i || !value.length;
+ t = binary_format_contract_1.WireType.LengthDelimited;
+ m = "string";
+ break;
+ case reflection_info_1.ScalarType.BOOL:
+ d = value === false;
+ m = "bool";
+ break;
+ case reflection_info_1.ScalarType.UINT32:
+ m = "uint32";
+ break;
+ case reflection_info_1.ScalarType.DOUBLE:
+ t = binary_format_contract_1.WireType.Bit64;
+ m = "double";
+ break;
+ case reflection_info_1.ScalarType.FLOAT:
+ t = binary_format_contract_1.WireType.Bit32;
+ m = "float";
+ break;
+ case reflection_info_1.ScalarType.INT64:
+ d = i || pb_long_1.PbLong.from(value).isZero();
+ m = "int64";
+ break;
+ case reflection_info_1.ScalarType.UINT64:
+ d = i || pb_long_1.PbULong.from(value).isZero();
+ m = "uint64";
+ break;
+ case reflection_info_1.ScalarType.FIXED64:
+ d = i || pb_long_1.PbULong.from(value).isZero();
+ t = binary_format_contract_1.WireType.Bit64;
+ m = "fixed64";
+ break;
+ case reflection_info_1.ScalarType.BYTES:
+ d = i || !value.byteLength;
+ t = binary_format_contract_1.WireType.LengthDelimited;
+ m = "bytes";
+ break;
+ case reflection_info_1.ScalarType.FIXED32:
+ t = binary_format_contract_1.WireType.Bit32;
+ m = "fixed32";
+ break;
+ case reflection_info_1.ScalarType.SFIXED32:
+ t = binary_format_contract_1.WireType.Bit32;
+ m = "sfixed32";
+ break;
+ case reflection_info_1.ScalarType.SFIXED64:
+ d = i || pb_long_1.PbLong.from(value).isZero();
+ t = binary_format_contract_1.WireType.Bit64;
+ m = "sfixed64";
+ break;
+ case reflection_info_1.ScalarType.SINT32:
+ m = "sint32";
+ break;
+ case reflection_info_1.ScalarType.SINT64:
+ d = i || pb_long_1.PbLong.from(value).isZero();
+ m = "sint64";
+ break;
+ }
+ return [t, m, i || d];
+ }
+}
+exports.ReflectionBinaryWriter = ReflectionBinaryWriter;
+
+
+/***/ }),
+
+/***/ 9946:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.containsMessageType = void 0;
+const message_type_contract_1 = __webpack_require__(3785);
+/**
+ * Check if the provided object is a proto message.
+ *
+ * Note that this is an experimental feature - it is here to stay, but
+ * implementation details may change without notice.
+ */
+function containsMessageType(msg) {
+ return msg[message_type_contract_1.MESSAGE_TYPE] != null;
+}
+exports.containsMessageType = containsMessageType;
+
+
+/***/ }),
+
+/***/ 5726:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.reflectionCreate = void 0;
+const reflection_scalar_default_1 = __webpack_require__(9526);
+const message_type_contract_1 = __webpack_require__(3785);
+/**
+ * Creates an instance of the generic message, using the field
+ * information.
+ */
+function reflectionCreate(type) {
+ /**
+ * This ternary can be removed in the next major version.
+ * The `Object.create()` code path utilizes a new `messagePrototype`
+ * property on the `IMessageType` which has this same `MESSAGE_TYPE`
+ * non-enumerable property on it. Doing it this way means that we only
+ * pay the cost of `Object.defineProperty()` once per `IMessageType`
+ * class of once per "instance". The falsy code path is only provided
+ * for backwards compatibility in cases where the runtime library is
+ * updated without also updating the generated code.
+ */
+ const msg = type.messagePrototype
+ ? Object.create(type.messagePrototype)
+ : Object.defineProperty({}, message_type_contract_1.MESSAGE_TYPE, { value: type });
+ for (let field of type.fields) {
+ let name = field.localName;
+ if (field.opt)
+ continue;
+ if (field.oneof)
+ msg[field.oneof] = { oneofKind: undefined };
+ else if (field.repeat)
+ msg[name] = [];
+ else
+ switch (field.kind) {
+ case "scalar":
+ msg[name] = reflection_scalar_default_1.reflectionScalarDefault(field.T, field.L);
+ break;
+ case "enum":
+ // we require 0 to be default value for all enums
+ msg[name] = 0;
+ break;
+ case "map":
+ msg[name] = {};
+ break;
+ }
+ }
+ return msg;
+}
+exports.reflectionCreate = reflectionCreate;
+
+
+/***/ }),
+
+/***/ 4827:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.reflectionEquals = void 0;
+const reflection_info_1 = __webpack_require__(7910);
+/**
+ * Determines whether two message of the same type have the same field values.
+ * Checks for deep equality, traversing repeated fields, oneof groups, maps
+ * and messages recursively.
+ * Will also return true if both messages are `undefined`.
+ */
+function reflectionEquals(info, a, b) {
+ if (a === b)
+ return true;
+ if (!a || !b)
+ return false;
+ for (let field of info.fields) {
+ let localName = field.localName;
+ let val_a = field.oneof ? a[field.oneof][localName] : a[localName];
+ let val_b = field.oneof ? b[field.oneof][localName] : b[localName];
+ switch (field.kind) {
+ case "enum":
+ case "scalar":
+ let t = field.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.T;
+ if (!(field.repeat
+ ? repeatedPrimitiveEq(t, val_a, val_b)
+ : primitiveEq(t, val_a, val_b)))
+ return false;
+ break;
+ case "map":
+ if (!(field.V.kind == "message"
+ ? repeatedMsgEq(field.V.T(), objectValues(val_a), objectValues(val_b))
+ : repeatedPrimitiveEq(field.V.kind == "enum" ? reflection_info_1.ScalarType.INT32 : field.V.T, objectValues(val_a), objectValues(val_b))))
+ return false;
+ break;
+ case "message":
+ let T = field.T();
+ if (!(field.repeat
+ ? repeatedMsgEq(T, val_a, val_b)
+ : T.equals(val_a, val_b)))
+ return false;
+ break;
+ }
+ }
+ return true;
+}
+exports.reflectionEquals = reflectionEquals;
+const objectValues = Object.values;
+function primitiveEq(type, a, b) {
+ if (a === b)
+ return true;
+ if (type !== reflection_info_1.ScalarType.BYTES)
+ return false;
+ let ba = a;
+ let bb = b;
+ if (ba.length !== bb.length)
+ return false;
+ for (let i = 0; i < ba.length; i++)
+ if (ba[i] != bb[i])
+ return false;
+ return true;
+}
+function repeatedPrimitiveEq(type, a, b) {
+ if (a.length !== b.length)
+ return false;
+ for (let i = 0; i < a.length; i++)
+ if (!primitiveEq(type, a[i], b[i]))
+ return false;
+ return true;
+}
+function repeatedMsgEq(type, a, b) {
+ if (a.length !== b.length)
+ return false;
+ for (let i = 0; i < a.length; i++)
+ if (!type.equals(a[i], b[i]))
+ return false;
+ return true;
+}
+
+
+/***/ }),
+
+/***/ 7910:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.readMessageOption = exports.readFieldOption = exports.readFieldOptions = exports.normalizeFieldInfo = exports.RepeatType = exports.LongType = exports.ScalarType = void 0;
+const lower_camel_case_1 = __webpack_require__(4073);
+/**
+ * Scalar value types. This is a subset of field types declared by protobuf
+ * enum google.protobuf.FieldDescriptorProto.Type The types GROUP and MESSAGE
+ * are omitted, but the numerical values are identical.
+ */
+var ScalarType;
+(function (ScalarType) {
+ // 0 is reserved for errors.
+ // Order is weird for historical reasons.
+ ScalarType[ScalarType["DOUBLE"] = 1] = "DOUBLE";
+ ScalarType[ScalarType["FLOAT"] = 2] = "FLOAT";
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
+ // negative values are likely.
+ ScalarType[ScalarType["INT64"] = 3] = "INT64";
+ ScalarType[ScalarType["UINT64"] = 4] = "UINT64";
+ // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
+ // negative values are likely.
+ ScalarType[ScalarType["INT32"] = 5] = "INT32";
+ ScalarType[ScalarType["FIXED64"] = 6] = "FIXED64";
+ ScalarType[ScalarType["FIXED32"] = 7] = "FIXED32";
+ ScalarType[ScalarType["BOOL"] = 8] = "BOOL";
+ ScalarType[ScalarType["STRING"] = 9] = "STRING";
+ // Tag-delimited aggregate.
+ // Group type is deprecated and not supported in proto3. However, Proto3
+ // implementations should still be able to parse the group wire format and
+ // treat group fields as unknown fields.
+ // TYPE_GROUP = 10,
+ // TYPE_MESSAGE = 11, // Length-delimited aggregate.
+ // New in version 2.
+ ScalarType[ScalarType["BYTES"] = 12] = "BYTES";
+ ScalarType[ScalarType["UINT32"] = 13] = "UINT32";
+ // TYPE_ENUM = 14,
+ ScalarType[ScalarType["SFIXED32"] = 15] = "SFIXED32";
+ ScalarType[ScalarType["SFIXED64"] = 16] = "SFIXED64";
+ ScalarType[ScalarType["SINT32"] = 17] = "SINT32";
+ ScalarType[ScalarType["SINT64"] = 18] = "SINT64";
+})(ScalarType = exports.ScalarType || (exports.ScalarType = {}));
+/**
+ * JavaScript representation of 64 bit integral types. Equivalent to the
+ * field option "jstype".
+ *
+ * By default, protobuf-ts represents 64 bit types as `bigint`.
+ *
+ * You can change the default behaviour by enabling the plugin parameter
+ * `long_type_string`, which will represent 64 bit types as `string`.
+ *
+ * Alternatively, you can change the behaviour for individual fields
+ * with the field option "jstype":
+ *
+ * ```protobuf
+ * uint64 my_field = 1 [jstype = JS_STRING];
+ * uint64 other_field = 2 [jstype = JS_NUMBER];
+ * ```
+ */
+var LongType;
+(function (LongType) {
+ /**
+ * Use JavaScript `bigint`.
+ *
+ * Field option `[jstype = JS_NORMAL]`.
+ */
+ LongType[LongType["BIGINT"] = 0] = "BIGINT";
+ /**
+ * Use JavaScript `string`.
+ *
+ * Field option `[jstype = JS_STRING]`.
+ */
+ LongType[LongType["STRING"] = 1] = "STRING";
+ /**
+ * Use JavaScript `number`.
+ *
+ * Large values will loose precision.
+ *
+ * Field option `[jstype = JS_NUMBER]`.
+ */
+ LongType[LongType["NUMBER"] = 2] = "NUMBER";
+})(LongType = exports.LongType || (exports.LongType = {}));
+/**
+ * Protobuf 2.1.0 introduced packed repeated fields.
+ * Setting the field option `[packed = true]` enables packing.
+ *
+ * In proto3, all repeated fields are packed by default.
+ * Setting the field option `[packed = false]` disables packing.
+ *
+ * Packed repeated fields are encoded with a single tag,
+ * then a length-delimiter, then the element values.
+ *
+ * Unpacked repeated fields are encoded with a tag and
+ * value for each element.
+ *
+ * `bytes` and `string` cannot be packed.
+ */
+var RepeatType;
+(function (RepeatType) {
+ /**
+ * The field is not repeated.
+ */
+ RepeatType[RepeatType["NO"] = 0] = "NO";
+ /**
+ * The field is repeated and should be packed.
+ * Invalid for `bytes` and `string`, they cannot be packed.
+ */
+ RepeatType[RepeatType["PACKED"] = 1] = "PACKED";
+ /**
+ * The field is repeated but should not be packed.
+ * The only valid repeat type for repeated `bytes` and `string`.
+ */
+ RepeatType[RepeatType["UNPACKED"] = 2] = "UNPACKED";
+})(RepeatType = exports.RepeatType || (exports.RepeatType = {}));
+/**
+ * Turns PartialFieldInfo into FieldInfo.
+ */
+function normalizeFieldInfo(field) {
+ var _a, _b, _c, _d;
+ field.localName = (_a = field.localName) !== null && _a !== void 0 ? _a : lower_camel_case_1.lowerCamelCase(field.name);
+ field.jsonName = (_b = field.jsonName) !== null && _b !== void 0 ? _b : lower_camel_case_1.lowerCamelCase(field.name);
+ field.repeat = (_c = field.repeat) !== null && _c !== void 0 ? _c : RepeatType.NO;
+ field.opt = (_d = field.opt) !== null && _d !== void 0 ? _d : (field.repeat ? false : field.oneof ? false : field.kind == "message");
+ return field;
+}
+exports.normalizeFieldInfo = normalizeFieldInfo;
+/**
+ * Read custom field options from a generated message type.
+ *
+ * @deprecated use readFieldOption()
+ */
+function readFieldOptions(messageType, fieldName, extensionName, extensionType) {
+ var _a;
+ const options = (_a = messageType.fields.find((m, i) => m.localName == fieldName || i == fieldName)) === null || _a === void 0 ? void 0 : _a.options;
+ return options && options[extensionName] ? extensionType.fromJson(options[extensionName]) : undefined;
+}
+exports.readFieldOptions = readFieldOptions;
+function readFieldOption(messageType, fieldName, extensionName, extensionType) {
+ var _a;
+ const options = (_a = messageType.fields.find((m, i) => m.localName == fieldName || i == fieldName)) === null || _a === void 0 ? void 0 : _a.options;
+ if (!options) {
+ return undefined;
+ }
+ const optionVal = options[extensionName];
+ if (optionVal === undefined) {
+ return optionVal;
+ }
+ return extensionType ? extensionType.fromJson(optionVal) : optionVal;
+}
+exports.readFieldOption = readFieldOption;
+function readMessageOption(messageType, extensionName, extensionType) {
+ const options = messageType.options;
+ const optionVal = options[extensionName];
+ if (optionVal === undefined) {
+ return optionVal;
+ }
+ return extensionType ? extensionType.fromJson(optionVal) : optionVal;
+}
+exports.readMessageOption = readMessageOption;
+
+
+/***/ }),
+
+/***/ 6790:
+/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+
+
+Object.defineProperty(exports, "__esModule", ({ value: true }));
+exports.ReflectionJsonReader = void 0;
+const json_typings_1 = __webpack_require__(9999);
+const base64_1 = __webpack_require__(6335);
+const reflection_info_1 = __webpack_require__(7910);
+const pb_long_1 = __webpack_require__(1753);
+const assert_1 = __webpack_require__(8602);
+const reflection_long_convert_1 = __webpack_require__(3402);
+/**
+ * Reads proto3 messages in canonical JSON format using reflection information.
+ *
+ * https://developers.google.com/protocol-buffers/docs/proto3#json
+ */
+class ReflectionJsonReader {
+ constructor(info) {
+ this.info = info;
+ }
+ prepare() {
+ var _a;
+ if (this.fMap === undefined) {
+ this.fMap = {};
+ const fieldsInput = (_a = this.info.fields) !== null && _a !== void 0 ? _a : [];
+ for (const field of fieldsInput) {
+ this.fMap[field.name] = field;
+ this.fMap[field.jsonName] = field;
+ this.fMap[field.localName] = field;
+ }
+ }
+ }
+ // Cannot parse JSON for