Compare commits

..

No commits in common. "main" and "Jcambass-patch-1" have entirely different histories.

117 changed files with 103998 additions and 168065 deletions

View file

@ -1,22 +0,0 @@
# 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'
# 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'

View file

@ -16,4 +16,4 @@ jobs:
name: Basic validation name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with: with:
node-version: '24.x' node-version: '20.x'

View file

@ -16,4 +16,4 @@ jobs:
name: Check dist/ name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with: with:
node-version: '24.x' node-version: '20.x'

View file

@ -24,13 +24,13 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '11'
cache: gradle cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle* cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Create files to cache - name: Create files to cache
@ -51,7 +51,7 @@ jobs:
needs: gradle1-save needs: gradle1-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
@ -76,7 +76,7 @@ jobs:
needs: gradle1-save needs: gradle1-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java

View file

@ -21,16 +21,16 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '11'
cache: gradle cache: gradle
- name: Create files to cache - name: Create files to cache
# Need to avoid using Gradle daemon to stabilize the save process on Windows # Need to avoid using Gradle daemon to stabilize the save process on Windows
@ -46,11 +46,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
needs: gradle-save needs: gradle-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
@ -70,10 +70,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for maven - name: Run setup-java with the cache for maven
uses: ./ uses: ./
id: setup-java id: setup-java
@ -93,11 +93,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
needs: maven-save needs: maven-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for maven - name: Run setup-java with the cache for maven
uses: ./ uses: ./
id: setup-java id: setup-java
@ -121,10 +121,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-22.04] os: [macos-13, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for sbt - name: Run setup-java with the cache for sbt
uses: ./ uses: ./
id: setup-java id: setup-java
@ -133,7 +133,7 @@ jobs:
java-version: '11' java-version: '11'
cache: sbt cache: sbt
- name: Setup SBT - name: Setup SBT
if: matrix.os == 'macos-15-intel' if: matrix.os == 'macos-13'
run: | run: |
echo ""Installing SBT..."" echo ""Installing SBT...""
brew install sbt brew install sbt
@ -141,7 +141,7 @@ jobs:
run: sbt update run: sbt update
- name: Check files to cache on macos-latest - name: Check files to cache on macos-latest
if: matrix.os == 'macos-15-intel' if: matrix.os == 'macos-13'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
@ -170,11 +170,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-22.04] os: [macos-13, windows-latest, ubuntu-latest]
needs: sbt-save needs: sbt-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Run setup-java with the cache for sbt - name: Run setup-java with the cache for sbt
uses: ./ uses: ./
id: setup-java id: setup-java
@ -184,7 +184,7 @@ jobs:
cache: sbt cache: sbt
- name: Confirm that ~/Library/Caches/Coursier directory has been made - name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-15-intel' if: matrix.os == 'macos-13'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"

View file

@ -21,7 +21,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Download Adopt OpenJDK file - name: Download Adopt OpenJDK file
run: | run: |
if ($IsLinux) { if ($IsLinux) {
@ -58,7 +58,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Download Zulu OpenJDK file - name: Download Zulu OpenJDK file
run: | run: |
if ($IsLinux) { if ($IsLinux) {
@ -95,7 +95,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Download Eclipse Temurin file - name: Download Eclipse Temurin file
run: | run: |
if ($IsLinux) { if ($IsLinux) {

View file

@ -25,7 +25,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -60,7 +60,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Create fake settings.xml - name: Create fake settings.xml
run: | run: |
$xmlDirectory = Join-Path $HOME ".m2" $xmlDirectory = Join-Path $HOME ".m2"
@ -96,7 +96,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Create fake settings.xml - name: Create fake settings.xml
run: | run: |
$xmlDirectory = Join-Path $HOME ".m2" $xmlDirectory = Join-Path $HOME ".m2"
@ -133,7 +133,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java

View file

@ -20,7 +20,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
distribution: [ distribution: [
'temurin', 'temurin',
'adopt', 'adopt',
@ -31,57 +31,34 @@ jobs:
'semeru', 'semeru',
'corretto', 'corretto',
'dragonwell', 'dragonwell',
'sapmachine', 'sapmachine'
'jetbrains'
] # internally 'adopt-hotspot' is the same as 'adopt' ] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['21', '11', '17'] version: ['21', '11', '17']
exclude: exclude:
- distribution: microsoft - distribution: microsoft
version: 8 version: 8
- distribution: dragonwell - distribution: dragonwell
os: macos-15-intel os: macos-13
include: include:
- distribution: microsoft
os: windows-latest
version: 25
- distribution: microsoft
os: ubuntu-latest
version: 25
- distribution: microsoft
os: macos-latest
version: 25
- distribution: oracle - distribution: oracle
os: macos-15-intel os: macos-13
version: 17 version: 17
- distribution: oracle - distribution: oracle
os: windows-latest os: windows-latest
version: 21 version: 20
- distribution: oracle - distribution: oracle
os: ubuntu-latest os: ubuntu-latest
version: 21 version: 20
- distribution: graalvm
os: macos-latest
version: 17.0.12
- distribution: graalvm
os: windows-latest
version: 21
- distribution: graalvm
os: ubuntu-latest
version: 21
- distribution: graalvm
os: ubuntu-latest
version: '24-ea'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
with: with:
java-version: ${{ matrix.version }} java-version: ${{ matrix.version }}
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java - name: Verify Java
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
shell: bash shell: bash
@ -102,10 +79,7 @@ jobs:
include: include:
- distribution: oracle - distribution: oracle
os: ubuntu-latest os: ubuntu-latest
version: '21.0.4' version: '20.0.1'
- distribution: graalvm
os: ubuntu-latest
version: '21.0.4'
- distribution: dragonwell - distribution: dragonwell
os: ubuntu-latest os: ubuntu-latest
version: '11.0' version: '11.0'
@ -115,15 +89,9 @@ jobs:
- distribution: sapmachine - distribution: sapmachine
os: ubuntu-latest os: ubuntu-latest
version: '17.0.7' version: '17.0.7'
- distribution: jetbrains
os: ubuntu-latest
version: '11.0.11'
- distribution: jetbrains
os: ubuntu-latest
version: '17.0.7'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -133,8 +101,6 @@ jobs:
- name: Verify Java - name: Verify Java
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
shell: bash shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
setup-java-check-latest: setup-java-check-latest:
name: ${{ matrix.distribution }} ${{ matrix.version }} - check-latest flag - ${{ matrix.os }} name: ${{ matrix.distribution }} ${{ matrix.version }} - check-latest flag - ${{ matrix.os }}
@ -145,20 +111,13 @@ jobs:
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: distribution:
[ ['temurin', 'zulu', 'liberica', 'dragonwell', 'sapmachine']
'temurin',
'zulu',
'liberica',
'dragonwell',
'sapmachine',
'jetbrains'
]
exclude: exclude:
- distribution: dragonwell - distribution: dragonwell
os: macos-latest os: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -166,8 +125,6 @@ jobs:
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
java-version: 11 java-version: 11
check-latest: true check-latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java - name: Verify Java
run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}" run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
shell: bash shell: bash
@ -181,20 +138,13 @@ jobs:
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: distribution:
[ ['temurin', 'zulu', 'liberica', 'dragonwell', 'sapmachine']
'temurin',
'zulu',
'liberica',
'dragonwell',
'sapmachine',
'jetbrains'
]
exclude: exclude:
- distribution: dragonwell - distribution: dragonwell
os: macos-latest os: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -203,8 +153,6 @@ jobs:
java-version: | java-version: |
11 11
17 17
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java env variables - name: Verify Java env variables
run: | run: |
$versionsArr = "11","17" $versionsArr = "11","17"
@ -229,11 +177,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
version: ['17-ea', '15.0.0-ea.14'] version: ['17-ea', '15.0.0-ea.14']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -255,7 +203,7 @@ jobs:
version: ['17-ea'] version: ['17-ea']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -277,7 +225,7 @@ jobs:
version: ['17-ea', '21-ea'] version: ['17-ea', '21-ea']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -295,9 +243,8 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-15-intel, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
distribution: distribution: ['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine']
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
java-package: ['jre'] java-package: ['jre']
version: ['17.0'] version: ['17.0']
include: include:
@ -321,50 +268,9 @@ jobs:
java-package: jre java-package: jre
version: '8' version: '8'
os: windows-latest os: windows-latest
- distribution: 'jetbrains'
java-package: jdk+jcef
version: '11'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jdk+jcef
version: '17'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jdk+jcef
version: '21'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jre+jcef
version: '11'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jre+jcef
version: '17'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jre+jcef
version: '21'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jdk+ft
version: '17'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jdk+ft
version: '21'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jre+ft
version: '17'
os: ubuntu-latest
- distribution: 'jetbrains'
java-package: jre+ft
version: '21'
os: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -372,8 +278,6 @@ jobs:
java-version: ${{ matrix.version }} java-version: ${{ matrix.version }}
java-package: ${{ matrix.java-package }} java-package: ${{ matrix.java-package }}
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java - name: Verify Java
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
shell: bash shell: bash
@ -387,12 +291,12 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
# x86 is not supported on macOS # x86 is not supported on macOS
os: [windows-latest, ubuntu-22.04] os: [windows-latest, ubuntu-latest]
distribution: ['liberica', 'zulu', 'corretto'] distribution: ['liberica', 'zulu', 'corretto']
version: ['11'] version: ['11']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -415,7 +319,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "17" > .java-version run: echo "17" > .java-version
@ -444,7 +348,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "11" > .java-version run: echo "11" > .java-version
@ -472,7 +376,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "17.0.10" > .java-version run: echo "17.0.10" > .java-version
@ -490,26 +394,23 @@ jobs:
shell: bash shell: bash
setup-java-version-from-file-major-minor-patch-with-dist: setup-java-version-from-file-major-minor-patch-with-dist:
name: ${{ matrix.distribution }} version from file '${{ matrix.java-version-file }}' - ${{ matrix.os }} name: ${{ matrix.distribution }} version from file 'openjdk64-17.0.10' - ${{ matrix.os }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['adopt', 'zulu', 'liberica'] distribution: ['adopt', 'zulu', 'liberica']
java-version-file: ['.java-version', '.tool-versions', '.sdkmanrc'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "openjdk64-17.0.10" > .java-version run: echo "openjdk64-17.0.10" > .java-version
- name: Create .tool-versions file - name: Create .tool-versions file
shell: bash shell: bash
run: echo "java openjdk64-17.0.10" > .tool-versions run: echo "java openjdk64-17.0.10" > .tool-versions
- name: Create .sdkmanrc file
shell: bash
run: echo "java=17.0.10-tem" > .sdkmanrc
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java

View file

@ -2,8 +2,7 @@ name: 'Publish Immutable Action Version'
on: on:
release: release:
types: [released] types: [published]
workflow_dispatch:
jobs: jobs:
publish: publish:
@ -15,7 +14,7 @@ jobs:
steps: steps:
- name: Checking out - name: Checking out
uses: actions/checkout@v6 uses: actions/checkout@v4
- name: Publish - name: Publish
id: publish id: publish
uses: actions/publish-immutable-action@v0.0.4 uses: actions/publish-immutable-action@0.0.3

View file

@ -23,7 +23,7 @@ jobs:
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag id: update-major-tag
uses: actions/publish-action@v0.4.0 uses: actions/publish-action@v0.2.2
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View file

@ -13,4 +13,3 @@ allowed:
reviewed: reviewed:
npm: npm:
- "@actions/http-client" # MIT (license text present), but detected as "other"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@azure/ms-rest-js.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@types/node-fetch.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@types/tunnel.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/delayed-stream.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-2.5.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-4.0.0.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lru-cache.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/node-fetch.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/sax.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-1.14.1.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/webidl-conversions.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/whatwg-url.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/xmlbuilder.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/yallist.dep.yml generated Normal file

Binary file not shown.

View file

@ -18,20 +18,11 @@ The `setup-java` action provides the following functionality for GitHub Actions
This action allows you to work with Java and Scala projects. 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 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 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. - 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.
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).
## Usage ## 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. - `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.
@ -78,28 +69,28 @@ For information about the latest releases, recent updates, and newly supported d
#### Eclipse Temurin #### Eclipse Temurin
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' # See 'Supported distributions' for available options distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '25' java-version: '21'
- run: java HelloWorldApp.java - run: java HelloWorldApp.java
``` ```
#### Azul Zulu OpenJDK #### Azul Zulu OpenJDK
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'zulu' # See 'Supported distributions' for available options distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '25' java-version: '21'
- run: java HelloWorldApp.java - run: java HelloWorldApp.java
``` ```
#### Supported version syntax #### Supported version syntax
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation: 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` - major versions: `8`, `11`, `16`, `17`, `21`
- more specific versions: `8.0.282+8`, `8.0.232`, `11.0`, `11.0.4`, `17.0` - 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` - early access (EA) versions: `15-ea`, `15.0.0-ea`
@ -118,8 +109,6 @@ Currently, the following distributions are supported:
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense) | `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/) | `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) | `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)
**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. **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.
@ -127,8 +116,6 @@ Currently, the following distributions are supported:
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness. **NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
**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.
### Caching packages dependencies ### 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: 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:
@ -145,31 +132,26 @@ The cache input is optional, and caching is turned off by default.
#### Caching gradle dependencies #### Caching gradle dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '25' java-version: '21'
cache: 'gradle' cache: 'gradle'
cache-dependency-path: | # optional cache-dependency-path: | # optional
sub-project/*.gradle* sub-project/*.gradle*
sub-project/**/gradle-wrapper.properties sub-project/**/gradle-wrapper.properties
- run: ./gradlew build --no-daemon - run: ./gradlew build --no-daemon
``` ```
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 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 #### Caching maven dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '25' java-version: '21'
cache: 'maven' cache: 'maven'
cache-dependency-path: 'sub-project/pom.xml' # optional cache-dependency-path: 'sub-project/pom.xml' # optional
- name: Build with Maven - name: Build with Maven
@ -179,11 +161,11 @@ steps:
#### Caching sbt dependencies #### Caching sbt dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '25' java-version: '21'
cache: 'sbt' cache: 'sbt'
cache-dependency-path: | # optional cache-dependency-path: | # optional
sub-project/build.sbt sub-project/build.sbt
@ -199,11 +181,11 @@ Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a
env: env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5' SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '25' java-version: '21'
cache: 'gradle' cache: 'gradle'
- run: ./gradlew build --no-daemon - run: ./gradlew build --no-daemon
``` ```
@ -219,11 +201,11 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '25' java-version: '21'
check-latest: true check-latest: true
- run: java HelloWorldApp.java - run: java HelloWorldApp.java
``` ```
@ -235,12 +217,12 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
java: [ '8', '11', '17', '21', '25' ] java: [ '8', '11', '17', '21' ]
name: Java ${{ matrix.Java }} sample name: Java ${{ matrix.Java }} sample
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Setup java - name: Setup java
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -249,11 +231,11 @@ jobs:
### Install multiple JDKs ### Install multiple JDKs
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. All versions are added to the PATH. The last version will be used and available globally. Other Java versions can be accessed through env variables with such specification as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'.
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@ -277,7 +259,6 @@ In the example above multiple JDKs are installed for the same job. The result af
- [Oracle](docs/advanced-usage.md#Oracle) - [Oracle](docs/advanced-usage.md#Oracle)
- [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell) - [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
- [SapMachine](docs/advanced-usage.md#SapMachine) - [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 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 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) - [Installing custom Java distribution from local file](docs/advanced-usage.md#Installing-Java-from-local-file)
@ -289,15 +270,6 @@ In the example above multiple JDKs are installed for the same job. The result af
- [Modifying Maven Toolchains](docs/advanced-usage.md#Modifying-Maven-Toolchains) - [Modifying Maven Toolchains](docs/advanced-usage.md#Modifying-Maven-Toolchains)
- [Java Version File](docs/advanced-usage.md#Java-version-file) - [Java Version File](docs/advanced-usage.md#Java-version-file)
## Recommended permissions
When using the `setup-java` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
```yaml
permissions:
contents: read # access to check out code and install dependencies
```
## License ## License
The scripts and documentation in this project are released under the [MIT License](LICENSE). The scripts and documentation in this project are released under the [MIT License](LICENSE).

File diff suppressed because it is too large Load diff

View file

@ -1,47 +1,4 @@
[ [
{
"version": "25.0.0",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
},
{
"filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
"arch": "aarch64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
}
]
},
{ {
"version": "21.0.0", "version": "21.0.0",
"stable": true, "stable": true,

View file

@ -1,135 +0,0 @@
6.0.119-zulu, 6.0.119
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-kona, 8.0.432
8.0.432-librca, 8.0.432
8.0.432-sem, 8.0.432
8.0.432-tem, 8.0.432
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-librca, 8.0.442
8.0.442-tem, 8.0.442
8.0.442-zulu, 8.0.442
8.0.442.fx-librca, 8.0.442
8.0.442.fx-zulu, 8.0.442
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-kona, 11.0.25
11.0.25-librca, 11.0.25
11.0.25-ms, 11.0.25
11.0.25-sapmchn, 11.0.25
11.0.25-sem, 11.0.25
11.0.25-tem, 11.0.25
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-librca, 11.0.26
11.0.26-ms, 11.0.26
11.0.26-sapmchn, 11.0.26
11.0.26-zulu, 11.0.26
11.0.26.fx-librca, 11.0.26
11.0.26.fx-zulu, 11.0.26
17.0.12-graal, 17.0.12
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-kona, 17.0.13
17.0.13-librca, 17.0.13
17.0.13-ms, 17.0.13
17.0.13-sapmchn, 17.0.13
17.0.13-sem, 17.0.13
17.0.13-tem, 17.0.13
17.0.13-zulu, 17.0.13
17.0.13.crac-librca, 17.0.13
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-librca, 17.0.14
17.0.14-ms, 17.0.14
17.0.14-sapmchn, 17.0.14
17.0.14-zulu, 17.0.14
17.0.14.fx-librca, 17.0.14
17.0.14.fx-zulu, 17.0.14
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-graal, 21.0.5
21.0.5-jbr, 21.0.5
21.0.5-kona, 21.0.5
21.0.5-librca, 21.0.5
21.0.5-ms, 21.0.5
21.0.5-oracle, 21.0.5
21.0.5-sapmchn, 21.0.5
21.0.5-sem, 21.0.5
21.0.5-tem, 21.0.5
21.0.5-zulu, 21.0.5
21.0.5.crac-librca, 21.0.5
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-graal, 21.0.6
21.0.6-librca, 21.0.6
21.0.6-ms, 21.0.6
21.0.6-oracle, 21.0.6
21.0.6-sapmchn, 21.0.6
21.0.6-tem, 21.0.6
21.0.6-zulu, 21.0.6
21.0.6.fx-librca, 21.0.6
21.0.6.fx-zulu, 21.0.6
22.0.2-oracle, 22.0.2
22.1.0.1.r11-gln, 22.1.0
22.1.0.1.r17-gln, 22.1.0
22.3.5.r11-nik, 22.3.5
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-graal, 23.0.1
23.0.1-graalce, 23.0.1
23.0.1-librca, 23.0.1
23.0.1-open, 23.0.1
23.0.1-oracle, 23.0.1
23.0.1-sapmchn, 23.0.1
23.0.1-tem, 23.0.1
23.0.1-zulu, 23.0.1
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-graal, 23.0.2
23.0.2-graalce, 23.0.2
23.0.2-librca, 23.0.2
23.0.2-oracle, 23.0.2
23.0.2-sapmchn, 23.0.2
23.0.2-tem, 23.0.2
23.0.2-zulu, 23.0.2
23.0.2.fx-librca, 23.0.2
23.0.2.fx-zulu, 23.0.2
23.0.6.fx-nik, 23.0.6
23.0.6.r17-mandrel, 23.0.6
23.0.6.r17-nik, 23.0.6
23.1.5.fx-nik, 23.1.5
23.1.5.r21-mandrel, 23.1.5
23.1.5.r21-nik, 23.1.5
24.0.2.r22-mandrel, 24.0.2
24.ea.27-graal, 24.0.0
24.ea.28-graal, 24.0.0
24.ea.31-open, 24.0.0
24.ea.32-open, 24.0.0
24.1.1.r23-mandrel, 24.1.1
24.1.1.r23-nik, 24.1.1
25.ea.4-graal, 25.0.0
25.ea.5-graal, 25.0.0
25.ea.5-open, 25.0.0
25.ea.6-open, 25.0.0
1 6.0.119-zulu 6.0.119
2 7.0.352-zulu 7.0.352
3 8.0.282-trava 8.0.282
4 8.0.432-albba 8.0.432
5 8.0.432-amzn 8.0.432
6 8.0.432-kona 8.0.432
7 8.0.432-librca 8.0.432
8 8.0.432-sem 8.0.432
9 8.0.432-tem 8.0.432
10 8.0.432-zulu 8.0.432
11 8.0.432.fx-librca 8.0.432
12 8.0.432.fx-zulu 8.0.432
13 8.0.442-amzn 8.0.442
14 8.0.442-librca 8.0.442
15 8.0.442-tem 8.0.442
16 8.0.442-zulu 8.0.442
17 8.0.442.fx-librca 8.0.442
18 8.0.442.fx-zulu 8.0.442
19 11.0.14.1-jbr 11.0.14
20 11.0.15-trava 11.0.15
21 11.0.25-albba 11.0.25
22 11.0.25-amzn 11.0.25
23 11.0.25-kona 11.0.25
24 11.0.25-librca 11.0.25
25 11.0.25-ms 11.0.25
26 11.0.25-sapmchn 11.0.25
27 11.0.25-sem 11.0.25
28 11.0.25-tem 11.0.25
29 11.0.25-zulu 11.0.25
30 11.0.25.fx-librca 11.0.25
31 11.0.25.fx-zulu 11.0.25
32 11.0.26-amzn 11.0.26
33 11.0.26-librca 11.0.26
34 11.0.26-ms 11.0.26
35 11.0.26-sapmchn 11.0.26
36 11.0.26-zulu 11.0.26
37 11.0.26.fx-librca 11.0.26
38 11.0.26.fx-zulu 11.0.26
39 17.0.12-graal 17.0.12
40 17.0.12-jbr 17.0.12
41 17.0.12-oracle 17.0.12
42 17.0.13-albba 17.0.13
43 17.0.13-amzn 17.0.13
44 17.0.13-kona 17.0.13
45 17.0.13-librca 17.0.13
46 17.0.13-ms 17.0.13
47 17.0.13-sapmchn 17.0.13
48 17.0.13-sem 17.0.13
49 17.0.13-tem 17.0.13
50 17.0.13-zulu 17.0.13
51 17.0.13.crac-librca 17.0.13
52 17.0.13.crac-zulu 17.0.13
53 17.0.13.fx-librca 17.0.13
54 17.0.13.fx-zulu 17.0.13
55 17.0.14-amzn 17.0.14
56 17.0.14-librca 17.0.14
57 17.0.14-ms 17.0.14
58 17.0.14-sapmchn 17.0.14
59 17.0.14-zulu 17.0.14
60 17.0.14.fx-librca 17.0.14
61 17.0.14.fx-zulu 17.0.14
62 17.0.9-graalce 17.0.9
63 21.0.2-graalce 21.0.2
64 21.0.2-open 21.0.2
65 21.0.5-amzn 21.0.5
66 21.0.5-graal 21.0.5
67 21.0.5-jbr 21.0.5
68 21.0.5-kona 21.0.5
69 21.0.5-librca 21.0.5
70 21.0.5-ms 21.0.5
71 21.0.5-oracle 21.0.5
72 21.0.5-sapmchn 21.0.5
73 21.0.5-sem 21.0.5
74 21.0.5-tem 21.0.5
75 21.0.5-zulu 21.0.5
76 21.0.5.crac-librca 21.0.5
77 21.0.5.crac-zulu 21.0.5
78 21.0.5.fx-librca 21.0.5
79 21.0.5.fx-zulu 21.0.5
80 21.0.6-amzn 21.0.6
81 21.0.6-graal 21.0.6
82 21.0.6-librca 21.0.6
83 21.0.6-ms 21.0.6
84 21.0.6-oracle 21.0.6
85 21.0.6-sapmchn 21.0.6
86 21.0.6-tem 21.0.6
87 21.0.6-zulu 21.0.6
88 21.0.6.fx-librca 21.0.6
89 21.0.6.fx-zulu 21.0.6
90 22.0.2-oracle 22.0.2
91 22.1.0.1.r11-gln 22.1.0
92 22.1.0.1.r17-gln 22.1.0
93 22.3.5.r11-nik 22.3.5
94 22.3.5.r17-mandrel 22.3.5
95 22.3.5.r17-nik 22.3.5
96 23-open 23
97 23.0.1-amzn 23.0.1
98 23.0.1-graal 23.0.1
99 23.0.1-graalce 23.0.1
100 23.0.1-librca 23.0.1
101 23.0.1-open 23.0.1
102 23.0.1-oracle 23.0.1
103 23.0.1-sapmchn 23.0.1
104 23.0.1-tem 23.0.1
105 23.0.1-zulu 23.0.1
106 23.0.1.crac-zulu 23.0.1
107 23.0.1.fx-librca 23.0.1
108 23.0.1.fx-zulu 23.0.1
109 23.0.2-amzn 23.0.2
110 23.0.2-graal 23.0.2
111 23.0.2-graalce 23.0.2
112 23.0.2-librca 23.0.2
113 23.0.2-oracle 23.0.2
114 23.0.2-sapmchn 23.0.2
115 23.0.2-tem 23.0.2
116 23.0.2-zulu 23.0.2
117 23.0.2.fx-librca 23.0.2
118 23.0.2.fx-zulu 23.0.2
119 23.0.6.fx-nik 23.0.6
120 23.0.6.r17-mandrel 23.0.6
121 23.0.6.r17-nik 23.0.6
122 23.1.5.fx-nik 23.1.5
123 23.1.5.r21-mandrel 23.1.5
124 23.1.5.r21-nik 23.1.5
125 24.0.2.r22-mandrel 24.0.2
126 24.ea.27-graal 24.0.0
127 24.ea.28-graal 24.0.0
128 24.ea.31-open 24.0.0
129 24.ea.32-open 24.0.0
130 24.1.1.r23-mandrel 24.1.1
131 24.1.1.r23-nik 24.1.1
132 25.ea.4-graal 25.0.0
133 25.ea.5-graal 25.0.0
134 25.ea.5-open 25.0.0
135 25.ea.6-open 25.0.0

View file

@ -191,9 +191,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const installerOptions: JavaInstallerOptions = { const installerOptions: JavaInstallerOptions = {
version: '17', version: '17',

View file

@ -287,7 +287,7 @@ describe('setupJava', () => {
spyCoreSetOutput = jest.spyOn(core, 'setOutput'); spyCoreSetOutput = jest.spyOn(core, 'setOutput');
spyCoreSetOutput.mockImplementation(() => undefined); spyCoreSetOutput.mockImplementation(() => undefined);
jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>); jest.spyOn(os, 'arch').mockReturnValue('x86');
}); });
afterEach(() => { afterEach(() => {

View file

@ -150,8 +150,9 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = const availableVersion = await distribution['findPackageForDownload'](
await distribution['findPackageForDownload'](version); version
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
}); });
@ -202,27 +203,29 @@ describe('getAvailableVersions', () => {
}); });
it.each([ it.each([
['amd64', 'x64'], ['arm64', 'aarch64'],
['arm64', 'aarch64'] ['amd64', 'x64']
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new CorrettoDistribution({ const version = '17';
version: '17', const installerOptions: JavaInstallerOptions = {
version,
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
checkLatest: false checkLatest: false
}); };
const distribution = new CorrettoDistribution(installerOptions);
mockPlatform(distribution, 'macos'); mockPlatform(distribution, 'macos');
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`; const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
const availableVersion = const availableVersion = await distribution['findPackageForDownload'](
await distribution['findPackageForDownload']('17'); version
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View file

@ -206,8 +206,9 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = const availableVersion = await distribution['findPackageForDownload'](
await distribution['findPackageForDownload'](jdkVersion); jdkVersion
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View file

@ -1,924 +0,0 @@
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 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');
jest.mock('../../src/util', () => ({
...jest.requireActual('../../src/util'),
extractJdkFile: jest.fn(),
getDownloadArchiveExtension: jest.fn(),
renameWinArchive: jest.fn(),
getGitHubHttpHeaders: jest.fn().mockReturnValue({Accept: 'application/json'})
}));
jest.mock('fs', () => ({
...jest.requireActual('fs'),
readdirSync: jest.fn(),
existsSync: jest.fn()
}));
beforeAll(() => {
process.env.NODE_ENV = 'test';
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!');
}
console.log('✅ All external dependencies are properly mocked');
});
describe('GraalVMDistribution', () => {
let distribution: GraalVMDistribution;
let mockHttpClient: jest.Mocked<http.HttpClient>;
const defaultOptions: JavaInstallerOptions = {
version: '17',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
};
beforeEach(() => {
jest.clearAllMocks();
distribution = new GraalVMDistribution(defaultOptions);
mockHttpClient = new http.HttpClient() as jest.Mocked<http.HttpClient>;
(distribution as any).http = mockHttpClient;
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
});
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();
});
describe('getPlatform', () => {
it('should map darwin to macos', () => {
const result = distribution.getPlatform('darwin');
expect(result).toBe('macos');
});
it('should map win32 to windows', () => {
const result = distribution.getPlatform('win32');
expect(result).toBe('windows');
});
it('should map linux to linux', () => {
const result = distribution.getPlatform('linux');
expect(result).toBe('linux');
});
it('should throw error for unsupported platform', () => {
expect(() => distribution.getPlatform('aix' as NodeJS.Platform)).toThrow(
"Platform 'aix' is not supported. Supported platforms: 'linux', 'macos', 'windows'"
);
});
});
describe('downloadTool', () => {
const javaRelease = {
version: '17.0.5',
url: 'https://example.com/graalvm.tar.gz'
};
beforeEach(() => {
(tc.downloadTool as jest.Mock).mockResolvedValue('/tmp/archive.tar.gz');
(tc.cacheDir as jest.Mock).mockResolvedValue('/cached/java/path');
(util.extractJdkFile as jest.Mock).mockResolvedValue('/tmp/extracted');
// Mock renameWinArchive - it returns the same path (no renaming)
(util.renameWinArchive as jest.Mock).mockImplementation((p: string) => p);
(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.readdirSync as jest.Mock).mockReturnValue(['graalvm-jdk-17.0.5']);
jest
.spyOn(distribution as any, 'getToolcacheVersionName')
.mockImplementation(version => version);
});
it('should download, extract and cache the tool successfully', async () => {
const result = await (distribution as any).downloadTool(javaRelease);
// Verify the download was initiated
expect(tc.downloadTool).toHaveBeenCalledWith(javaRelease.url);
// The implementation uses the original path for extraction
expect(util.extractJdkFile).toHaveBeenCalledWith(
'/tmp/archive.tar.gz', // Original path
'tar.gz'
);
// Verify path existence check
expect(fs.existsSync).toHaveBeenCalledWith('/tmp/extracted');
// Verify directory reading
expect(fs.readdirSync).toHaveBeenCalledWith('/tmp/extracted');
// Verify caching with correct parameters
expect(tc.cacheDir).toHaveBeenCalledWith(
path.join('/tmp/extracted', 'graalvm-jdk-17.0.5'),
'Java_GraalVM_jdk',
'17.0.5',
'x64'
);
// Verify the result
expect(result).toEqual({
version: '17.0.5',
path: '/cached/java/path'
});
// Verify logging
expect(core.info).toHaveBeenCalledWith(
'Downloading Java 17.0.5 (GraalVM) from https://example.com/graalvm.tar.gz ...'
);
expect(core.info).toHaveBeenCalledWith('Extracting Java archive...');
});
it('should throw error when extracted path does not exist', async () => {
(fs.existsSync as jest.Mock).mockReturnValue(false);
await expect(
(distribution as any).downloadTool(javaRelease)
).rejects.toThrow(
'Extraction failed: path /tmp/extracted does not exist'
);
expect(core.error).toHaveBeenCalledWith(
expect.stringContaining('Failed to download and extract GraalVM:')
);
});
it('should throw error when extracted directory is empty', async () => {
(fs.existsSync as jest.Mock).mockReturnValue(true);
(fs.readdirSync as jest.Mock).mockReturnValue([]);
await expect(
(distribution as any).downloadTool(javaRelease)
).rejects.toThrow(
'Extraction failed: no files found in extracted directory'
);
expect(core.error).toHaveBeenCalledWith(
expect.stringContaining('Failed to download and extract GraalVM:')
);
});
it('should handle download errors', async () => {
const downloadError = new Error('Network error during download');
(tc.downloadTool as jest.Mock).mockRejectedValue(downloadError);
await expect(
(distribution as any).downloadTool(javaRelease)
).rejects.toThrow('Network error during download');
expect(core.error).toHaveBeenCalledWith(
'Failed to download and extract GraalVM: Error: Network error during download'
);
});
it('should handle extraction errors', async () => {
const extractError = new Error('Failed to extract archive');
(util.extractJdkFile as jest.Mock).mockRejectedValue(extractError);
await expect(
(distribution as any).downloadTool(javaRelease)
).rejects.toThrow('Failed to extract archive');
expect(core.error).toHaveBeenCalledWith(
'Failed to download and extract GraalVM: Error: Failed to extract archive'
);
});
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');
const zipRelease = {
version: '17.0.5',
url: 'https://example.com/graalvm.zip'
};
const result = await (distribution as any).downloadTool(zipRelease);
expect(util.extractJdkFile).toHaveBeenCalledWith(
'/tmp/archive.zip',
'zip'
);
expect(result).toEqual({
version: '17.0.5',
path: '/cached/java/path'
});
});
});
describe('findPackageForDownload', () => {
beforeEach(() => {
jest.spyOn(distribution, 'getPlatform').mockReturnValue('linux');
});
describe('input validation', () => {
it('should throw error for null version range', async () => {
await expect(
(distribution as any).findPackageForDownload(null)
).rejects.toThrow('Version range is required and must be a string');
});
it('should throw error for undefined version range', async () => {
await expect(
(distribution as any).findPackageForDownload(undefined)
).rejects.toThrow('Version range is required and must be a string');
});
it('should throw error for empty string version range', async () => {
await expect(
(distribution as any).findPackageForDownload('')
).rejects.toThrow('Version range is required and must be a string');
});
it('should throw error for non-string version range', async () => {
await expect(
(distribution as any).findPackageForDownload(123)
).rejects.toThrow('Version range is required and must be a string');
});
it('should throw error for invalid version format', async () => {
await expect(
(distribution as any).findPackageForDownload('abc')
).rejects.toThrow('Invalid version format: abc');
});
});
describe('stable builds', () => {
it('should construct correct URL for specific version', async () => {
const mockResponse = {
message: {statusCode: 200}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload(
'17.0.5'
);
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'
});
expect(mockHttpClient.head).toHaveBeenCalledWith(result.url);
});
it('should construct correct URL for major version (latest)', async () => {
const mockResponse = {
message: {statusCode: 200}
} as http.HttpClientResponse;
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'
});
});
it('should throw error for unsupported architecture', async () => {
distribution = new GraalVMDistribution({
...defaultOptions,
architecture: 'x86'
});
(distribution as any).http = mockHttpClient;
await expect(
(distribution as any).findPackageForDownload('17')
).rejects.toThrow(
'Unsupported architecture: x86. Supported architectures are: x64, aarch64'
);
});
it('should throw error for JDK versions less than 17', async () => {
await expect(
(distribution as any).findPackageForDownload('11')
).rejects.toThrow(
'GraalVM is only supported for JDK 17 and later. Requested version: 11'
);
});
it('should throw error for non-jdk package types', async () => {
distribution = new GraalVMDistribution({
...defaultOptions,
packageType: 'jre'
});
(distribution as any).http = mockHttpClient;
await expect(
(distribution as any).findPackageForDownload('17')
).rejects.toThrow('GraalVM provides only the `jdk` package type');
});
it('should throw error when file not found (404)', async () => {
const mockResponse = {
message: {statusCode: 404}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
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'
);
});
it('should throw error for unauthorized access (401)', async () => {
const mockResponse = {
message: {statusCode: 401}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
(distribution as any).findPackageForDownload('17')
).rejects.toThrow(
'Access denied when downloading GraalVM. Status code: 401. Please check your credentials or permissions.'
);
});
it('should throw error for forbidden access (403)', async () => {
const mockResponse = {
message: {statusCode: 403}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
(distribution as any).findPackageForDownload('17')
).rejects.toThrow(
'Access denied when downloading GraalVM. Status code: 403. Please check your credentials or permissions.'
);
});
it('should throw error for other HTTP errors with status message', async () => {
const mockResponse = {
message: {
statusCode: 500,
statusMessage: 'Internal Server Error'
}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
(distribution as any).findPackageForDownload('17')
).rejects.toThrow(
'HTTP request for GraalVM failed with status code: 500 (Internal Server Error)'
);
});
it('should throw error for other HTTP errors without status message', async () => {
const mockResponse = {
message: {statusCode: 500}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
await expect(
(distribution as any).findPackageForDownload('17')
).rejects.toThrow(
'HTTP request for GraalVM failed with status code: 500 (Unknown error)'
);
});
});
describe('EA builds', () => {
beforeEach(() => {
distribution = new GraalVMDistribution(defaultOptions);
(distribution as any).http = mockHttpClient;
(distribution as any).stable = false;
});
it('should delegate to findEABuildDownloadUrl for unstable versions', async () => {
const currentPlatform =
process.platform === 'win32' ? 'windows' : process.platform;
const mockEAVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-x64_bin.tar.gz'
},
{
arch: 'aarch64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-aarch64_bin.tar.gz'
}
]
}
];
mockHttpClient.getJson.mockResolvedValue({
result: mockEAVersions,
statusCode: 200,
headers: {}
});
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('x64');
const result = await (distribution as any).findPackageForDownload('23');
expect(result).toEqual({
url: 'https://example.com/download/graalvm-jdk-23_linux-x64_bin.tar.gz',
version: '23-ea-20240716'
});
expect(mockHttpClient.getJson).toHaveBeenCalledWith(
'https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/23-ea.json?ref=main',
{Accept: 'application/json'}
);
});
it('should throw error when no latest EA version found', async () => {
const currentPlatform =
process.platform === 'win32' ? 'windows' : process.platform;
const mockEAVersions = [
{
version: '23-ea-20240716',
latest: false,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-x64_bin.tar.gz'
}
]
}
];
mockHttpClient.getJson.mockResolvedValue({
result: mockEAVersions,
statusCode: 200,
headers: {}
});
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('x64');
await expect(
(distribution as any).findPackageForDownload('23')
).rejects.toThrow("Unable to find latest version for '23-ea'");
// Verify error logging
expect(core.error).toHaveBeenCalledWith(
'Available versions: 23-ea-20240716'
);
});
it('should throw error when no matching file for architecture in EA build', async () => {
const currentPlatform =
process.platform === 'win32' ? 'windows' : process.platform;
const mockEAVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'arm64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-arm64_bin.tar.gz'
}
]
}
];
mockHttpClient.getJson.mockResolvedValue({
result: mockEAVersions,
statusCode: 200,
headers: {}
});
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('x64');
await expect(
(distribution as any).findPackageForDownload('23')
).rejects.toThrow(
`Unable to find file for architecture 'x64' and platform '${currentPlatform}'`
);
// Verify error logging
expect(core.error).toHaveBeenCalledWith(
expect.stringContaining('Available files for architecture x64:')
);
});
it('should throw error when no matching platform in EA build', async () => {
const mockEAVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: 'different-platform',
filename: 'graalvm-jdk-23_different-x64_bin.tar.gz'
}
]
}
];
mockHttpClient.getJson.mockResolvedValue({
result: mockEAVersions,
statusCode: 200,
headers: {}
});
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('x64');
const currentPlatform =
process.platform === 'win32' ? 'windows' : process.platform;
await expect(
(distribution as any).findPackageForDownload('23')
).rejects.toThrow(
`Unable to find file for architecture 'x64' and platform '${currentPlatform}'`
);
});
it('should throw error when filename does not start with graalvm-jdk-', async () => {
const currentPlatform =
process.platform === 'win32' ? 'windows' : process.platform;
const mockEAVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: currentPlatform,
filename: 'wrong-prefix-23_linux-x64_bin.tar.gz'
}
]
}
];
mockHttpClient.getJson.mockResolvedValue({
result: mockEAVersions,
statusCode: 200,
headers: {}
});
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('x64');
await expect(
(distribution as any).findPackageForDownload('23')
).rejects.toThrow(
"Invalid filename format: wrong-prefix-23_linux-x64_bin.tar.gz. Expected to start with 'graalvm-jdk-'"
);
});
it('should throw error when EA version JSON is not found', async () => {
mockHttpClient.getJson.mockResolvedValue({
result: null,
statusCode: 404,
headers: {}
});
await expect(
(distribution as any).findPackageForDownload('23')
).rejects.toThrow(
"No GraalVM EA build found for version '23-ea'. Please check if the version is correct."
);
});
});
});
describe('findEABuildDownloadUrl', () => {
const currentPlatform =
process.platform === 'win32' ? 'windows' : process.platform;
const mockEAVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-x64_bin.tar.gz'
},
{
arch: 'aarch64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-aarch64_bin.tar.gz'
}
]
},
{
version: '23-ea-20240709',
latest: false,
download_base_url: 'https://example.com/old/',
files: [
{
arch: 'x64',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-x64_bin.tar.gz'
}
]
}
];
let fetchEASpy: jest.SpyInstance;
beforeEach(() => {
fetchEASpy = jest.spyOn(distribution as any, 'fetchEAJson');
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('x64');
});
it('should find latest version and return correct URL', async () => {
fetchEASpy.mockResolvedValue(mockEAVersions);
const result = await (distribution as any).findEABuildDownloadUrl(
'23-ea'
);
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'
});
// Verify debug logging
expect(core.debug).toHaveBeenCalledWith('Searching for EA build: 23-ea');
expect(core.debug).toHaveBeenCalledWith('Found 2 EA versions');
expect(core.debug).toHaveBeenCalledWith(
'Latest version found: 23-ea-20240716'
);
expect(core.debug).toHaveBeenCalledWith(
'Download URL: https://example.com/download/graalvm-jdk-23_linux-x64_bin.tar.gz'
);
});
it('should throw error when no latest version found', async () => {
const noLatestVersions = mockEAVersions.map(v => ({...v, latest: false}));
fetchEASpy.mockResolvedValue(noLatestVersions);
await expect(
(distribution as any).findEABuildDownloadUrl('23-ea')
).rejects.toThrow("Unable to find latest version for '23-ea'");
expect(core.error).toHaveBeenCalledWith(
'Available versions: 23-ea-20240716, 23-ea-20240709'
);
});
it('should throw error when no matching file for architecture', async () => {
const wrongArchVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'arm',
platform: currentPlatform,
filename: 'graalvm-jdk-23_linux-arm_bin.tar.gz'
}
]
}
];
fetchEASpy.mockResolvedValue(wrongArchVersions);
await expect(
(distribution as any).findEABuildDownloadUrl('23-ea')
).rejects.toThrow(
`Unable to find file for architecture 'x64' and platform '${currentPlatform}'`
);
expect(core.error).toHaveBeenCalledWith(
expect.stringContaining('Available files for architecture x64:')
);
});
it('should throw error when filename does not start with graalvm-jdk-', async () => {
const badFilenameVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: currentPlatform,
filename: 'wrong-name.tar.gz'
}
]
}
];
fetchEASpy.mockResolvedValue(badFilenameVersions);
await expect(
(distribution as any).findEABuildDownloadUrl('23-ea')
).rejects.toThrow(
"Invalid filename format: wrong-name.tar.gz. Expected to start with 'graalvm-jdk-'"
);
});
it('should work with aarch64 architecture', async () => {
jest
.spyOn(distribution as any, 'distributionArchitecture')
.mockReturnValue('aarch64');
fetchEASpy.mockResolvedValue(mockEAVersions);
const result = await (distribution as any).findEABuildDownloadUrl(
'23-ea'
);
expect(result).toEqual({
url: 'https://example.com/download/graalvm-jdk-23_linux-aarch64_bin.tar.gz',
version: '23-ea-20240716'
});
});
it('should throw error when platform does not match', async () => {
const wrongPlatformVersions = [
{
version: '23-ea-20240716',
latest: true,
download_base_url: 'https://example.com/download/',
files: [
{
arch: 'x64',
platform: 'different-platform',
filename: 'graalvm-jdk-23_different-x64_bin.tar.gz'
}
]
}
];
fetchEASpy.mockResolvedValue(wrongPlatformVersions);
await expect(
(distribution as any).findEABuildDownloadUrl('23-ea')
).rejects.toThrow(
`Unable to find file for architecture 'x64' and platform '${currentPlatform}'`
);
});
});
describe('fetchEAJson', () => {
it('should fetch and return EA version data', async () => {
const mockData = [{version: '23-ea', files: []}];
mockHttpClient.getJson.mockResolvedValue({
result: mockData,
statusCode: 200,
headers: {}
});
const result = await (distribution as any).fetchEAJson('23-ea');
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(result).toEqual(mockData);
expect(core.debug).toHaveBeenCalled();
});
it('should throw error when no data returned', async () => {
mockHttpClient.getJson.mockResolvedValue({
result: null,
statusCode: 200,
headers: {}
});
await expect((distribution as any).fetchEAJson('23-ea')).rejects.toThrow(
"No GraalVM EA build found for version '23-ea'. Please check if the version is correct."
);
});
it('should handle 404 errors with specific message', async () => {
const error404 = new Error('Not Found: 404');
mockHttpClient.getJson.mockRejectedValue(error404);
await expect((distribution as any).fetchEAJson('23-ea')).rejects.toThrow(
"GraalVM EA version '23-ea' not found. Please verify the version exists in the EA builds repository."
);
});
it('should handle generic HTTP errors with context', async () => {
const networkError = new Error('Network timeout');
mockHttpClient.getJson.mockRejectedValue(networkError);
await expect((distribution as any).fetchEAJson('23-ea')).rejects.toThrow(
"Failed to fetch GraalVM EA version information for '23-ea': Network timeout"
);
});
it('should handle non-Error exceptions', async () => {
mockHttpClient.getJson.mockRejectedValue('String error');
await expect((distribution as any).fetchEAJson('23-ea')).rejects.toThrow(
"Failed to fetch GraalVM EA version information for '23-ea'"
);
});
});
describe('Integration tests', () => {
it('should handle different architectures correctly', async () => {
const architectures = ['x64', 'aarch64'];
for (const arch of architectures) {
distribution = new GraalVMDistribution({
...defaultOptions,
architecture: arch
});
(distribution as any).http = mockHttpClient;
const mockResponse = {
message: {statusCode: 200}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload('17');
expect(result.url).toContain(arch);
}
});
it('should handle different platforms correctly', async () => {
const platforms = [
{process: 'darwin', expected: 'macos'},
{process: 'win32', expected: 'windows'},
{process: 'linux', expected: 'linux'}
];
const originalPlatform = process.platform;
for (const {process: proc, expected} of platforms) {
Object.defineProperty(process, 'platform', {
value: proc,
configurable: true
});
distribution = new GraalVMDistribution(defaultOptions);
(distribution as any).http = mockHttpClient;
const mockResponse = {
message: {statusCode: 200}
} as http.HttpClientResponse;
mockHttpClient.head.mockResolvedValue(mockResponse);
const result = await (distribution as any).findPackageForDownload('17');
expect(result.url).toContain(expected);
}
Object.defineProperty(process, 'platform', {
value: originalPlatform,
configurable: true
});
});
});
});

View file

@ -1,117 +0,0 @@
import https from 'https';
import {HttpClient} from '@actions/http-client';
import {JetBrainsDistribution} from '../../src/distributions/jetbrains/installer';
import manifestData from '../data/jetbrains.json';
import os from 'os';
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('load available versions', async () => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData as any
});
const distribution = new JetBrainsDistribution({
version: '17',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();
const length =
os.platform() === 'win32' ? manifestData.length : manifestData.length + 2;
expect(availableVersions.length).toBe(length);
}, 10_000);
});
describe('findPackageForDownload', () => {
it.each([
['17', '17.0.11+1207.24'],
['11.0', '11.0.16+2043.64'],
['11.0.11', '11.0.11+1542.1'],
['21.0.2', '21.0.2+375.1'],
['21', '21.0.3+465.3'],
['x', '21.0.3+465.3']
])('version is resolved correctly %s -> %s', async (input, expected) => {
const distribution = new JetBrainsDistribution({
version: input,
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload'](input);
expect(resolvedVersion.version).toBe(expected);
});
it.each(['17', '11.0', '11.0.11', '21.0.2', '21'])(
'version %s can be downloaded',
async input => {
const distribution = new JetBrainsDistribution({
version: input,
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion =
await distribution['findPackageForDownload'](input);
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();
});
}
);
it('version is not found', async () => {
const distribution = new JetBrainsDistribution({
version: '8.0.452',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(distribution['findPackageForDownload']('8.x')).rejects.toThrow(
/Could not find satisfied version for SemVer */
);
});
it('version list is empty', async () => {
const distribution = new JetBrainsDistribution({
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
/Could not find satisfied version for SemVer */
);
});
});

View file

@ -105,11 +105,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distributions = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
@ -119,11 +117,11 @@ describe('getAvailableVersions', () => {
const additionalParams = const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion'; 'updateVersion%2CbuildVersion';
distributions['getPlatformOption'] = () => 'macos'; distribution['getPlatformOption'] = () => 'macos';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`; const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`;
await distributions['getAvailableVersions'](); await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1); expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);

View file

@ -105,9 +105,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',

View file

@ -105,9 +105,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',

View file

@ -29,11 +29,6 @@ describe('findPackageForDownload', () => {
}); });
it.each([ it.each([
[
'25.x',
'25.0.0',
'https://aka.ms/download-jdk/microsoft-jdk-25.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[ [
'21.x', '21.x',
'21.0.0', '21.0.0',
@ -100,9 +95,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('darwin'); jest.spyOn(os, 'platform').mockReturnValue('darwin');
const version = '17'; const version = '17';
@ -126,9 +119,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('linux'); jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '17'; const version = '17';
@ -152,9 +143,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('win32'); jest.spyOn(os, 'platform').mockReturnValue('win32');
const version = '17'; const version = '17';

View file

@ -95,9 +95,7 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('linux'); jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '18'; const version = '18';

View file

@ -61,8 +61,9 @@ describe('getAvailableVersions', () => {
mockPlatform(distribution, 'linux'); mockPlatform(distribution, 'linux');
const availableVersion = const availableVersion = await distribution['findPackageForDownload'](
await distribution['findPackageForDownload'](version); version
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe( expect(availableVersion.url).toBe(
'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz' 'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz'
@ -229,8 +230,9 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = const availableVersion = await distribution['findPackageForDownload'](
await distribution['findPackageForDownload'](normalizedVersion); normalizedVersion
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View file

@ -147,9 +147,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest jest.spyOn(os, 'arch').mockReturnValue(distroArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const installerOptions: JavaInstallerOptions = { const installerOptions: JavaInstallerOptions = {
version: '17', version: '17',

View file

@ -1,4 +1,5 @@
import {HttpClient} from '@actions/http-client'; import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
import {ZuluDistribution} from '../../src/distributions/zulu/installer'; import {ZuluDistribution} from '../../src/distributions/zulu/installer';
import {IZuluVersions} from '../../src/distributions/zulu/models'; import {IZuluVersions} from '../../src/distributions/zulu/models';
import * as utils from '../../src/util'; import * as utils from '../../src/util';
@ -125,9 +126,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',

View file

@ -126,9 +126,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',
@ -137,9 +135,7 @@ describe('getAvailableVersions', () => {
checkLatest: false checkLatest: false
}); });
distribution['getPlatformOption'] = () => 'linux'; distribution['getPlatformOption'] = () => 'linux';
// Override extension for linux default arch case to match util behavior const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
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`;
await distribution['getAvailableVersions'](); await distribution['getAvailableVersions']();

View file

@ -126,9 +126,7 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest jest.spyOn(os, 'arch').mockReturnValue(osArch);
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',

View file

@ -1,13 +1,9 @@
import * as cache from '@actions/cache'; import * as cache from '@actions/cache';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as fs from 'fs';
import * as path from 'path';
import { import {
convertVersionToSemver, convertVersionToSemver,
getVersionFromFileContent,
isVersionSatisfies, isVersionSatisfies,
isCacheFeatureAvailable, isCacheFeatureAvailable
isGhes
} from '../src/util'; } from '../src/util';
jest.mock('@actions/cache'); jest.mock('@actions/cache');
@ -84,78 +80,3 @@ describe('convertVersionToSemver', () => {
expect(actual).toBe(expected); expect(actual).toBe(expected);
}); });
}); });
describe('getVersionFromFileContent', () => {
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);
});
describe('known versions', () => {
const csv = fs.readFileSync(
path.join(__dirname, 'data/sdkman-java-versions.csv'),
'utf8'
);
const versions = csv.split('\n').map(r => r.split(', '));
it.each(versions)(
'parsing %s should return %s',
(sdkmanJavaVersion: string, expected: string) => {
const asContent = `java=${sdkmanJavaVersion}`;
const actual = getVersionFromFileContent(
asContent,
'openjdk',
'.sdkmanrc'
);
expect(actual).toBe(expected);
}
);
});
});
});
describe('isGhes', () => {
const pristineEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...pristineEnv};
});
afterAll(() => {
process.env = pristineEnv;
});
it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => {
delete process.env['GITHUB_SERVER_URL'];
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost';
expect(isGhes()).toBeFalsy();
});
it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com';
expect(isGhes()).toBeTruthy();
});
});

View file

@ -81,6 +81,6 @@ outputs:
cache-hit: cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key' description: 'A boolean value to indicate an exact match was found for the primary key'
runs: runs:
using: 'node24' using: 'node20'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
post: 'dist/cleanup/index.js' post: 'dist/cleanup/index.js'

133342
dist/cleanup/index.js vendored

File diff suppressed because one or more lines are too long

132565
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -9,8 +9,6 @@
- [Oracle](#Oracle) - [Oracle](#Oracle)
- [Alibaba Dragonwell](#Alibaba-Dragonwell) - [Alibaba Dragonwell](#Alibaba-Dragonwell)
- [SapMachine](#SapMachine) - [SapMachine](#SapMachine)
- [GraalVM](#GraalVM)
- [JetBrains](#JetBrains)
- [Installing custom Java package type](#Installing-custom-Java-package-type) - [Installing custom Java package type](#Installing-custom-Java-package-type)
- [Installing custom Java architecture](#Installing-custom-Java-architecture) - [Installing custom Java architecture](#Installing-custom-Java-architecture)
- [Installing custom Java distribution from local file](#Installing-Java-from-local-file) - [Installing custom Java distribution from local file](#Installing-Java-from-local-file)
@ -31,8 +29,8 @@ Inputs `java-version` and `distribution` are mandatory and needs to be provided.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@ -44,8 +42,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
java-version: '11' java-version: '11'
@ -56,8 +54,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'zulu' distribution: 'zulu'
java-version: '21' java-version: '21'
@ -69,8 +67,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'liberica' distribution: 'liberica'
java-version: '21' java-version: '21'
@ -82,8 +80,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'microsoft' distribution: 'microsoft'
java-version: '21' java-version: '21'
@ -97,7 +95,7 @@ steps:
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
```yaml ```yaml
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
token: ${{ secrets.GH_DOTCOM_TOKEN }} token: ${{ secrets.GH_DOTCOM_TOKEN }}
distribution: 'microsoft' distribution: 'microsoft'
@ -111,8 +109,8 @@ If the runner is not able to access github.com, any Java versions requested duri
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'corretto' distribution: 'corretto'
java-version: '21' java-version: '21'
@ -124,8 +122,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'oracle' distribution: 'oracle'
java-version: '21' java-version: '21'
@ -137,8 +135,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'dragonwell' distribution: 'dragonwell'
java-version: '8' java-version: '8'
@ -149,78 +147,19 @@ steps:
**NOTE:** An OpenJDK release maintained and supported by SAP **NOTE:** An OpenJDK release maintained and supported by SAP
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'sapmachine' distribution: 'sapmachine'
java-version: '21' java-version: '21'
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
### GraalVM
**NOTE:** Oracle GraalVM is only available for JDK 17 and later.
```yaml
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'graalvm'
java-version: '21'
- run: |
java -cp java HelloWorldApp
native-image -cp java HelloWorldApp
```
### JetBrains
**NOTE:** JetBrains is only available for LTS versions on 11 or later (11, 17, 21, etc.).
Not all minor LTS versions are guarenteed to be available, since JetBrains considers what to ship IntelliJ IDEA with, most commonly on JDK 11.
For example, `11.0.24` is not available but `11.0.16` is.
```yaml
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'jetbrains'
java-version: '11'
- run: java -cp java HelloWorldApp
```
The JetBrains installer uses the GitHub API to fetch the latest version. If you believe your project is going to be running into rate limits, you can provide a
GitHub token to the action to increase the rate limit. Set the `GITHUB_TOKEN` environment variable to the value of your GitHub token in the workflow file.
```yaml
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: 'jetbrains'
java-version: '17'
java-package: 'jdk' # optional (jdk, jre, jdk+jcef, jre+jcef, jdk+ft, or jre+ft) - defaults to jdk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: java -cp java HelloWorldApp
```
You can specify your package type (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)) in the `java-package` parameter.
The available package types are:
- `jdk` - JBRSDK
- `jre` - JBR (Vanilla)
- `jdk+jcef` - JBRSDK with JCEF
- `jre+jcef` - JBR with JCEF
- `jdk+ft` - JBRSDK (FreeType)
- `jre+ft` - JBR (FreeType)
## Installing custom Java package type ## Installing custom Java package type
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -228,12 +167,13 @@ steps:
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
## Installing custom Java architecture ## Installing custom Java architecture
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -249,7 +189,7 @@ steps:
- run: | - run: |
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz" download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -275,7 +215,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver') latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver')
echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT" echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT"
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -296,9 +236,9 @@ jobs:
java: [ '8', '11' ] java: [ '8', '11' ]
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Setup java - name: Setup java
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -316,9 +256,9 @@ jobs:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Setup java - name: Setup java
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -333,9 +273,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -349,7 +289,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
- name: Set up Apache Maven Central - name: Set up Apache Maven Central
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml with: # running setup-java again overwrites the settings.xml
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@ -446,9 +386,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Set up JDK 11 for Shared Runner - name: Set up JDK 11 for Shared Runner
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -472,10 +412,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v5 uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -509,14 +449,14 @@ Subsequent calls to `setup-java` with distinct distribution and version paramete
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
8 8
11 11
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '15' java-version: '15'
@ -528,7 +468,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -545,7 +485,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -560,7 +500,7 @@ In case you install multiple versions of Java at once with multi-line `java-vers
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@ -574,8 +514,8 @@ Each JDK provider will receive a default `id` based on the combination of `distr
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v6 - uses: actions/checkout@v4
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@ -587,7 +527,7 @@ In case you install multiple versions of Java at once you can use the same synta
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v5 - uses: actions/setup-java@v4
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@ -601,37 +541,18 @@ steps:
## Java version file ## Java version file
If the `java-version-file` input is specified, the action will extract the version from the file and install it. If the `java-version-file` input is specified, the action will extract the version from the file and install it.
Supported files are `.java-version`, `.tool-versions` and `.sdkmanrc`. Supported files are .java-version and .tool-versions.
* In `.java-version` file, only the version should be specified (e.g., 17.0.7). The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv). In .java-version file, only the version should be specified (e.g., 17.0.7).
* In `.tool-versions` file, java version should be preceded by the java keyword (e.g., java 17.0.7). The `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf) standards, adhering to Semantic Versioning ([semver](https://semver.org/)). In .tool-versions file, java version should be preceded by the java keyword (e.g., java 17.0.7).
* In `.sdkmanrc` file, java version should be preceded by the `java=` prefix (e.g., java=17.0.7-tem) and include the distribution. The `.sdkmanrc` file supports version specifications in accordance with [file format](https://sdkman.io/usage#env-command), see [Sdkman! documentation](https://sdkman.io/jdks) for more information. The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv). Similarly, the `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf) standards, adhering to Semantic Versioning ([semver](https://semver.org/)).
If both java-version and java-version-file inputs are provided, the java-version input will be used.
If both `java-version` and `java-version-file` **inputs** are provided, the `java-version` input will be used. Valid entry options:
**Example step using `Sdkman!`**:
```yml
- name: Setup java
uses: actions/setup-java@v5
with:
java-version-file: '.sdkmanrc'
distribution: 'temurin'
```
**Example `.sdkmanrc`**:
```
java=17.0.7-tem
```
Valid entry options (does not apply to `.sdkmanrc`):
``` ```
major versions: 8, 11, 16, 17, 21 major versions: 8, 11, 16, 17, 21
more specific versions: 8.0.282+8, 8.0.232, 11.0, 11.0.4, 17.0 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 early access (EA) versions: 15-ea, 15.0.0-ea
versions with specified distribution: openjdk64-11.0.2 versions with specified distribution: openjdk64-11.0.2
LTS versions : temurin-21.0.5+11.0.LTS
``` ```
If the file contains multiple versions, only the first one will be recognized. If the file contains multiple versions, only the first one will be recognized.
***NOTE***:
For the tool-version file, ensure that you use standard semantic versioning (semver) formats, as non-standard formats (such as jetbrains-21b212.1) may not be parsed correctly. Additionally, for complex version strings containing multiple version-like segments (for example, java semeru-openj9-11.0.15+10_openj9-0.32.0), the extraction logic may incorrectly capture the last segment (0.32.0) instead of the main version (11.0.15+10).

View file

@ -68,7 +68,7 @@ Pull requests are the easiest way to contribute changes to git repos at GitHub.
Adding or changing tests is an integral part of making a change to the code. Adding or changing tests is an integral part of making a change to the code.
Unit tests are in the `__tests__` folder, and end-to-end tests are in the `workflows` folder, particularly take a look at the files with `e2e` prefix, for instance, [e2e-cache.yml](https://github.com/actions/setup-java/blob/main/.github/workflows/e2e-cache.yml). Unit tests are in the `__tests__` folder, and end-to-end tests are in the `workflows` folder, particularly take a look at the files with `e2e` prefix, for instance, [e2e-cache.yml](https://github.com/actions/setup-java/blob/main/.github/workflows/e2e-cache.yml).
- The contributor can add various types of tests (like unit tests or end-to-end tests), which, in their opinion, will be necessary and sufficient for testing new or changed functionality - The contributor can add various types of tests (like unit tests or end-to-end tests), which, in his opinion, will be necessary and sufficient for testing new or changed functionality
- Tests should cover a successful execution, as well as some edge cases and possible errors - Tests should cover a successful execution, as well as some edge cases and possible errors
- As already mentioned, pull requests without tests will be considered more carefully by maintainers. If you are sure that in this situation the tests are not needed or cannot be implemented with a commensurate effort - please add this clarification message to your pull request - As already mentioned, pull requests without tests will be considered more carefully by maintainers. If you are sure that in this situation the tests are not needed or cannot be implemented with a commensurate effort - please add this clarification message to your pull request
@ -76,7 +76,7 @@ Unit tests are in the `__tests__` folder, and end-to-end tests are in the `workf
- CI will start automatically with some checks. Wait until the end of the execution and make sure that all checks passed successfully. If some checks fail, you can open them one by one, try to find the reason for failing and make changes to your code to resolve the problem - CI will start automatically with some checks. Wait until the end of the execution and make sure that all checks passed successfully. If some checks fail, you can open them one by one, try to find the reason for failing and make changes to your code to resolve the problem
- Maintainers will review your pull request - Maintainers will review your pull request
- If a maintainer requests changes, first of all, try to think about their request critically and only after that implement and request another review - If a maintainer requests changes, first of all, try to think about his request critically and only after that implement and request another review
- If your PR gets accepted, it will soon be merged into the main branch. But your contribution will take effect only after the release of a new version of the action and updating the major tag - If your PR gets accepted, it will soon be merged into the main branch. But your contribution will take effect only after the release of a new version of the action and updating the major tag
> Sometimes maintainers reject pull requests and that's ok! Usually, along with rejection, we supply the reason for it. Nonetheless, we still really appreciate you taking the time to do it, and we don't take that lightly :heart: > Sometimes maintainers reject pull requests and that's ok! Usually, along with rejection, we supply the reason for it. Nonetheless, we still really appreciate you taking the time to do it, and we don't take that lightly :heart:

1605
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,12 +1,9 @@
{ {
"name": "setup-java", "name": "setup-java",
"version": "5.2.0", "version": "4.0.0",
"private": true, "private": true,
"description": "setup java action", "description": "setup java action",
"main": "dist/setup/index.js", "main": "dist/setup/index.js",
"engines": {
"node": ">=24.0.0"
},
"scripts": { "scripts": {
"build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts", "build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"", "format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
@ -29,31 +26,31 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^5.0.1", "@actions/cache": "^3.2.4",
"@actions/core": "^1.10.0", "@actions/core": "^1.10.0",
"@actions/exec": "^1.0.4", "@actions/exec": "^1.0.4",
"@actions/glob": "^0.5.0", "@actions/glob": "^0.4.0",
"@actions/http-client": "^2.2.3", "@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"semver": "^7.6.0", "semver": "^7.6.0",
"xmlbuilder2": "^2.4.0" "xmlbuilder2": "^2.4.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.12",
"@types/node": "^24.1.0", "@types/node": "^20.11.24",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^8.35.1", "@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^8.35.1", "@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^8.57.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^29.0.1", "eslint-plugin-jest": "^27.9.0",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"prettier": "^3.6.2", "prettier": "^2.8.4",
"ts-jest": "^29.3.0", "ts-jest": "^29.1.2",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
"bugs": { "bugs": {

View file

@ -98,7 +98,7 @@ async function computeCacheKey(
`No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository` `No file in ${process.cwd()} matched to [${pattern}], make sure you have checked out the target repository`
); );
} }
return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${packageManager.id}-${fileHash}`; return `${CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${packageManager.id}-${fileHash}`;
} }
/** /**

View file

@ -15,8 +15,7 @@ import {
import { import {
extractJdkFile, extractJdkFile,
getDownloadArchiveExtension, getDownloadArchiveExtension,
isVersionSatisfies, isVersionSatisfies
renameWinArchive
} from '../../util'; } from '../../util';
export enum AdoptImplementation { export enum AdoptImplementation {
@ -74,13 +73,11 @@ export class AdoptDistribution extends JavaBase {
core.info( core.info(
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...` `Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
); );
let javaArchivePath = await tc.downloadTool(javaRelease.url); const javaArchivePath = await tc.downloadTool(javaRelease.url);
core.info(`Extracting Java archive...`); core.info(`Extracting Java archive...`);
const extension = getDownloadArchiveExtension(); const extension = getDownloadArchiveExtension();
if (process.platform === 'win32') {
javaArchivePath = renameWinArchive(javaArchivePath);
}
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension); const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
const archiveName = fs.readdirSync(extractedJavaPath)[0]; const archiveName = fs.readdirSync(extractedJavaPath)[0];

View file

@ -51,115 +51,17 @@ export abstract class JavaBase {
core.info(`Resolved Java ${foundJava.version} from tool-cache`); core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else { } else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
const MAX_RETRIES = 4; const javaRelease = await this.findPackageForDownload(this.version);
const RETRY_DELAY_MS = 2000; core.info(`Resolved latest version as ${javaRelease.version}`);
const retryableCodes = [ if (foundJava?.version === javaRelease.version) {
'ETIMEDOUT', core.info(`Resolved Java ${foundJava.version} from tool-cache`);
'ECONNRESET', } else {
'ENOTFOUND', core.info('Trying to download...');
'ECONNREFUSED' foundJava = await this.downloadTool(javaRelease);
]; core.info(`Java ${foundJava.version} was downloaded`);
let retries = MAX_RETRIES;
while (retries > 0) {
try {
// Clear console timers before each attempt to prevent conflicts
if (retries < MAX_RETRIES && core.isDebug()) {
const consoleAny = console as any;
consoleAny._times?.clear?.();
}
const javaRelease = await this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
if (foundJava?.version === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else {
core.info('Trying to download...');
foundJava = await this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
}
break;
} catch (error: any) {
retries--;
// Check if error is retryable (including aggregate errors)
const isRetryable =
(error instanceof tc.HTTPError &&
error.httpStatusCode &&
[429, 502, 503, 504, 522].includes(error.httpStatusCode)) ||
retryableCodes.includes(error?.code) ||
(error?.errors &&
Array.isArray(error.errors) &&
error.errors.some((err: any) =>
retryableCodes.includes(err?.code)
));
if (retries > 0 && isRetryable) {
core.debug(
`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`
);
await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue;
}
if (error instanceof tc.HTTPError) {
if (error.httpStatusCode === 403) {
core.error('HTTP 403: Permission denied or access restricted.');
} else if (error.httpStatusCode === 429) {
core.warning(
'HTTP 429: Rate limit exceeded. Please retry later.'
);
} else {
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
}
} else if (error && error.errors && Array.isArray(error.errors)) {
core.error(
`Java setup failed due to network or configuration error(s)`
);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
for (const err of error.errors) {
const endpoint = err?.address || err?.hostname || '';
const port = err?.port ? `:${err.port}` : '';
const message = err?.message || 'Aggregate error';
const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo =
err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage);
core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
} else {
const message =
error instanceof Error ? error.message : JSON.stringify(error);
core.error(`Java setup process failed due to: ${message}`);
if (typeof error?.code === 'string') {
core.debug(error.stack);
}
const errorDetails = {
name: error.name,
message: error.message,
...Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce<{[key: string]: any}>((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {})
};
Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
throw error;
}
} }
} }
if (!foundJava) {
throw new Error('Failed to resolve Java version');
}
// JDK folder may contain postfix "Contents/Home" on macOS // JDK folder may contain postfix "Contents/Home" on macOS
const macOSPostfixPath = path.join( const macOSPostfixPath = path.join(
foundJava.path, foundJava.path,

Some files were not shown because too many files have changed in this diff Show more