mirror of
https://github.com/actions/setup-java.git
synced 2026-06-23 08:10:30 +03:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2061db5b9b | |||
| c1835719f6 | |||
| 8a5fc42d92 | |||
| 05917d5627 | |||
| 651865a8a8 | |||
| 5431e71f9a | |||
| 4baa9b45d2 | |||
| 34df7e6dff | |||
| eab4b0854d | |||
| bf0c0e6df3 | |||
| 92163d3dc6 | |||
| 679e4e46a7 | |||
| 525097081d | |||
| c09b25f3e7 | |||
| dc8e16ad37 | |||
| a263f84254 | |||
| 6929a11922 | |||
| ad52b8c6db | |||
| 2321ab295d | |||
| 3d27da4ac1 | |||
| 849c8f0094 | |||
| cefdecda46 | |||
| 347226bb3b | |||
| 5866e121b4 | |||
| 2872526dc6 | |||
| bb8b13a4a5 | |||
| 957ad8b43e | |||
| ce7f9ce621 | |||
| 6e9017e125 | |||
| baa1691374 | |||
| bc52a13212 | |||
| c9b6aee07e | |||
| f300429fba |
@@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: New Java distribution template
|
||||||
|
about: Suggest a new Java distribution
|
||||||
|
title: ''
|
||||||
|
labels: feature request, needs triage
|
||||||
|
assignees: ''
|
||||||
|
---
|
||||||
|
|
||||||
|
**Description:**
|
||||||
|
Describe your proposal.
|
||||||
|
|
||||||
|
**Justification:**
|
||||||
|
Justification or a use case for your proposal.
|
||||||
|
|
||||||
|
**Download URL:**
|
||||||
|
Download URL for the new distribution.
|
||||||
|
|
||||||
|
**License:**
|
||||||
|
Link to the license for the new distribution.
|
||||||
|
|
||||||
|
**Are you willing to submit a PR?**
|
||||||
|
<!--- We accept contributions! -->
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
**Description:**
|
||||||
|
Describe your changes.
|
||||||
|
|
||||||
|
**Related issue:**
|
||||||
|
Add link to the related issue.
|
||||||
|
|
||||||
|
**Download URL:**
|
||||||
|
Download URL for the new distribution.
|
||||||
|
|
||||||
|
**License:**
|
||||||
|
Link to the license for the new distribution.
|
||||||
|
|
||||||
|
**Check list:**
|
||||||
|
- [ ] Mark if documentation changes are required.
|
||||||
|
- [ ] Mark if tests were added or updated to cover the changes.
|
||||||
|
- [ ] Mark if new distribution is being added.
|
||||||
@@ -9,6 +9,18 @@
|
|||||||
"message": 3
|
"message": 3
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"owner": "javac",
|
||||||
|
"pattern": [
|
||||||
|
{
|
||||||
|
"regexp": "^([^:]+):(\\d+): (warning|error): (.+?)$",
|
||||||
|
"file": 1,
|
||||||
|
"line": 2,
|
||||||
|
"severity": 3,
|
||||||
|
"message": 4
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -10,5 +10,9 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call-codeQL-analysis:
|
call-codeQL-analysis:
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
name: CodeQL analysis
|
name: CodeQL analysis
|
||||||
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
|
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main
|
||||||
|
|||||||
@@ -24,7 +24,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@v7
|
||||||
- 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
|
||||||
@@ -51,7 +51,7 @@ jobs:
|
|||||||
needs: gradle1-save
|
needs: gradle1-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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@v7
|
||||||
- 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
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
@@ -50,7 +50,7 @@ jobs:
|
|||||||
needs: gradle-save
|
needs: gradle-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
os: [macos-15-intel, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
@@ -97,7 +97,7 @@ jobs:
|
|||||||
needs: maven-save
|
needs: maven-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
@@ -124,7 +124,7 @@ jobs:
|
|||||||
os: [macos-15-intel, windows-latest, ubuntu-22.04]
|
os: [macos-15-intel, windows-latest, ubuntu-22.04]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
@@ -174,7 +174,7 @@ jobs:
|
|||||||
needs: sbt-save
|
needs: sbt-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
|
|||||||
@@ -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@v7
|
||||||
- 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@v7
|
||||||
- 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@v7
|
||||||
- name: Download Eclipse Temurin file
|
- name: Download Eclipse Temurin file
|
||||||
run: |
|
run: |
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
|
|||||||
@@ -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@v7
|
||||||
- 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@v7
|
||||||
- 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@v7
|
||||||
- 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@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ jobs:
|
|||||||
version: '24-ea'
|
version: '24-ea'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -99,7 +99,7 @@ jobs:
|
|||||||
version: ['21', '17']
|
version: ['21', '17']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: Install bash
|
- name: Install bash
|
||||||
run: apk add --no-cache bash
|
run: apk add --no-cache bash
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
@@ -149,7 +149,7 @@ jobs:
|
|||||||
version: '17.0.7'
|
version: '17.0.7'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -184,7 +184,7 @@ jobs:
|
|||||||
os: macos-latest
|
os: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -220,7 +220,7 @@ jobs:
|
|||||||
os: macos-latest
|
os: macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -259,7 +259,7 @@ jobs:
|
|||||||
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@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -281,7 +281,7 @@ jobs:
|
|||||||
version: ['17-ea']
|
version: ['17-ea']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -303,7 +303,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@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -390,7 +390,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -418,7 +418,7 @@ jobs:
|
|||||||
version: ['11']
|
version: ['11']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@@ -441,7 +441,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@v7
|
||||||
- name: Create .java-version file
|
- name: Create .java-version file
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "17" > .java-version
|
run: echo "17" > .java-version
|
||||||
@@ -470,7 +470,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@v7
|
||||||
- name: Create .java-version file
|
- name: Create .java-version file
|
||||||
shell: bash
|
shell: bash
|
||||||
run: echo "11" > .java-version
|
run: echo "11" > .java-version
|
||||||
@@ -498,7 +498,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@v7
|
||||||
- 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
|
||||||
@@ -526,7 +526,7 @@ jobs:
|
|||||||
java-version-file: ['.java-version', '.tool-versions', '.sdkmanrc']
|
java-version-file: ['.java-version', '.tool-versions', '.sdkmanrc']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- 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
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checking out
|
- name: Checking out
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v7
|
||||||
- name: Publish
|
- name: Publish
|
||||||
id: publish
|
id: publish
|
||||||
uses: actions/publish-immutable-action@v0.0.4
|
uses: actions/publish-immutable-action@v0.0.4
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/cache"
|
name: "@actions/cache"
|
||||||
version: 5.0.5
|
version: 5.1.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions cache lib
|
summary: Actions cache lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
homepage: https://github.com/actions/toolkit/tree/main/packages/cache
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: debug
|
name: debug
|
||||||
version: 4.3.4
|
version: 4.4.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Lightweight debugging utility for Node.js and the browser
|
summary: Lightweight debugging utility for Node.js and the browser
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: ms
|
name: ms
|
||||||
version: 2.1.2
|
version: 2.1.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: Tiny millisecond conversion utility
|
summary: Tiny millisecond conversion utility
|
||||||
homepage:
|
homepage:
|
||||||
@@ -10,7 +10,7 @@ licenses:
|
|||||||
text: |
|
text: |
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 Zeit, Inc.
|
Copyright (c) 2020 Vercel, Inc.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: undici
|
name: undici
|
||||||
version: 6.24.1
|
version: 6.27.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||||
homepage: https://undici.nodejs.org
|
homepage: https://undici.nodejs.org
|
||||||
|
|||||||
@@ -25,13 +25,6 @@ This action allows you to work with Java and Scala projects.
|
|||||||
|
|
||||||
For more details, see the full release notes on the [releases page](https://github.com/actions/setup-java/releases/tag/v5.0.0)
|
For more details, see the full release notes on the [releases page](https://github.com/actions/setup-java/releases/tag/v5.0.0)
|
||||||
|
|
||||||
## V2 vs V1
|
|
||||||
|
|
||||||
- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
|
|
||||||
- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
|
|
||||||
|
|
||||||
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.
|
||||||
@@ -44,7 +37,7 @@ For information about the latest releases, recent updates, and newly supported d
|
|||||||
|
|
||||||
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
|
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
|
||||||
|
|
||||||
- `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM.
|
- `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM. Note: `distribution` must be set to 'jdkfile' (case-sensitive; all lowercase) when using this option.
|
||||||
|
|
||||||
- `check-latest`: Setting this option makes the action to check for the latest available version for the version spec.
|
- `check-latest`: Setting this option makes the action to check for the latest available version for the version spec.
|
||||||
|
|
||||||
@@ -83,7 +76,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
- run: java HelloWorldApp.java
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Azul Zulu OpenJDK
|
#### Azul Zulu OpenJDK
|
||||||
@@ -94,40 +87,41 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
- run: java HelloWorldApp.java
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 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. The values below are examples, not an exhaustive list:
|
||||||
- major versions: `8`, `11`, `16`, `17`, `21`, `25`
|
- major versions, such as: `8`, `11`, `16`, `17`, `21`, `25`
|
||||||
- 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`
|
||||||
|
|
||||||
#### Supported distributions
|
#### Supported distributions
|
||||||
Currently, the following distributions are supported:
|
Currently, the following distributions are supported:
|
||||||
| Keyword | Distribution | Official site | License
|
| Keyword | Distribution / Official site | License
|
||||||
|-|-|-|-|
|
|-|-|-|
|
||||||
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
|
| `temurin` | [Eclipse Temurin](https://adoptium.net/) | [`temurin` license](https://adoptium.net/about.html)
|
||||||
| `zulu` | Azul Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
| `zulu` | [Azul Zulu OpenJDK](https://www.azul.com/downloads/zulu-community/?package=jdk) | [`zulu` license](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
||||||
| `adopt` or `adopt-hotspot` | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
| `adopt` or `adopt-hotspot` | [AdoptOpenJDK Hotspot](https://adoptopenjdk.net/) | [`adopt-hotspot` license](https://adoptopenjdk.net/about.html) |
|
||||||
| `adopt-openj9` | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
| `adopt-openj9` | [AdoptOpenJDK OpenJ9](https://adoptopenjdk.net/) | [`adopt-openj9` license](https://adoptopenjdk.net/about.html) |
|
||||||
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
|
| `liberica` | [Liberica JDK](https://bell-sw.com/) | [`liberica` license](https://bell-sw.com/liberica_eula/) |
|
||||||
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
|
| `microsoft` | [Microsoft Build of OpenJDK](https://www.microsoft.com/openjdk) | [`microsoft` license](https://docs.microsoft.com/java/openjdk/faq)
|
||||||
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
|
| `corretto` | [Amazon Corretto Build of OpenJDK](https://aws.amazon.com/corretto/) | [`corretto` license](https://aws.amazon.com/corretto/faqs/)
|
||||||
| `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) |
|
| `semeru` | [IBM Semeru Runtime Open Edition](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [`semeru` license](https://openjdk.java.net/legal/gplv2+ce.html) |
|
||||||
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
|
| `oracle` | [Oracle JDK](https://www.oracle.com/java/technologies/downloads/) | [`oracle` license](https://java.com/freeuselicense)
|
||||||
| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/)
|
| `dragonwell` | [Alibaba Dragonwell JDK](https://dragonwell-jdk.io/) | [`dragonwell` license](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](https://sapmachine.io/) | [`sapmachine` license](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)
|
| `graalvm` | [Oracle GraalVM](https://www.graalvm.org/) | [`graalvm` license](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)
|
| `graalvm-community` | [GraalVM Community](https://github.com/graalvm/graalvm-ce-builds/releases) | [`graalvm-community` license](https://github.com/oracle/graal/blob/master/LICENSE)
|
||||||
|
| `jetbrains` | [JetBrains Runtime](https://github.com/JetBrains/JetBrainsRuntime/) | [`jetbrains` license](https://github.com/JetBrains/JetBrainsRuntime/blob/main/LICENSE)
|
||||||
|
| `jdkfile` | Custom JDK Installation | |
|
||||||
|
|
||||||
**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.
|
||||||
**NOTE:** AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` and `adopt-openj9`, to `temurin` and `semeru` respectively, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
|
> - AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` and `adopt-openj9`, to `temurin` and `semeru` respectively, to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
|
||||||
|
> - 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.
|
> - 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.
|
||||||
|
> - GraalVM Community is available as `distribution: 'graalvm-community'` for stable JDK 17 and later releases published on GitHub.
|
||||||
**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.
|
|
||||||
|
|
||||||
**NOTE:** Oracle JDK 17 licensing varies by patch level. As shown on the [JDK 17 Archive](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) (versions up to 17.0.12 are under the [NFTC](https://www.oracle.com/downloads/licenses/no-fee-license.html) license) and the [JDK 17.0.13+ Archive](https://www.oracle.com/java/technologies/javase/jdk17-0-13-later-archive-downloads.html) (versions 17.0.13 and later are under the [OTN](https://www.oracle.com/downloads/licenses/javase-license1.html) license). To stay on the free NFTC license, use `distribution: 'oracle'` with `java-version: '17.0.12'` (or earlier) instead of the floating `'17'`. Alternatively, upgrade to Oracle JDK 21+, which remains under the NFTC license.
|
**NOTE:** Oracle JDK 17 licensing varies by patch level. As shown on the [JDK 17 Archive](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) (versions up to 17.0.12 are under the [NFTC](https://www.oracle.com/downloads/licenses/no-fee-license.html) license) and the [JDK 17.0.13+ Archive](https://www.oracle.com/java/technologies/javase/jdk17-0-13-later-archive-downloads.html) (versions 17.0.13 and later are under the [OTN](https://www.oracle.com/downloads/licenses/javase-license1.html) license). To stay on the free NFTC license, use `distribution: 'oracle'` with `java-version: '17.0.12'` (or earlier) instead of the floating `'17'`. Alternatively, upgrade to Oracle JDK 21+, which remains under the NFTC license.
|
||||||
|
|
||||||
@@ -137,7 +131,7 @@ Currently, the following distributions are supported:
|
|||||||
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:
|
||||||
|
|
||||||
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties`
|
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties`
|
||||||
- maven: `**/pom.xml`
|
- maven: `**/pom.xml` and `**/.mvn/wrapper/maven-wrapper.properties`
|
||||||
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`
|
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`
|
||||||
|
|
||||||
When the option `cache-dependency-path` is specified, the hash is based on the matching file. This option supports wildcards and a list of file names, and is especially useful for monorepos.
|
When the option `cache-dependency-path` is specified, the hash is based on the matching file. This option supports wildcards and a list of file names, and is especially useful for monorepos.
|
||||||
@@ -218,7 +212,7 @@ In the basic examples above, the `check-latest` flag defaults to `false`. When s
|
|||||||
|
|
||||||
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
|
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
|
||||||
|
|
||||||
For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on-flight. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
|
For Java distributions that are not cached on Hosted images, `check-latest` always behaves as `true` and downloads Java on the fly. Check out [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) for more details about pre-cached Java versions.
|
||||||
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -229,7 +223,7 @@ steps:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '25'
|
java-version: '25'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: java HelloWorldApp.java
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Testing against different Java versions
|
### Testing against different Java versions
|
||||||
@@ -248,7 +242,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
- run: java HelloWorldApp.java
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install multiple JDKs
|
### Install multiple JDKs
|
||||||
@@ -282,6 +276,7 @@ In the example above multiple JDKs are installed for the same job. The result af
|
|||||||
- [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)
|
- [GraalVM](docs/advanced-usage.md#GraalVM)
|
||||||
|
- [JetBrains](docs/advanced-usage.md#JetBrains)
|
||||||
- [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)
|
||||||
@@ -293,6 +288,15 @@ 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)
|
||||||
|
|
||||||
|
## V2 vs V1
|
||||||
|
|
||||||
|
Examples in this README use `actions/setup-java@v5`, but the main migration note from V1 still applies to all later major versions (`v2`, `v3`, `v4`, and `v5`):
|
||||||
|
|
||||||
|
- Starting with V2, the action supports custom distributions. V1 supports only Azul Zulu OpenJDK.
|
||||||
|
- Starting with V2, you must specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, so 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).
|
||||||
|
|
||||||
## Recommended permissions
|
## 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:
|
When using the `setup-java` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
|
||||||
|
|||||||
+38
-7
@@ -96,19 +96,48 @@ describe('dependency cache', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('for maven', () => {
|
describe('for maven', () => {
|
||||||
it('throws error if no pom.xml found', async () => {
|
it('throws error if no pom.xml or maven-wrapper.properties found', async () => {
|
||||||
await expect(restore('maven', '')).rejects.toThrow(
|
await expect(restore('maven', '')).rejects.toThrow(
|
||||||
`No file in ${projectRoot(
|
`No file in ${projectRoot(
|
||||||
workspace
|
workspace
|
||||||
)} matched to [**/pom.xml], make sure you have checked out the target repository`
|
)} matched to [**/pom.xml,**/.mvn/wrapper/maven-wrapper.properties], make sure you have checked out the target repository`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('downloads cache', async () => {
|
it('downloads cache based on pom.xml', async () => {
|
||||||
createFile(join(workspace, 'pom.xml'));
|
createFile(join(workspace, 'pom.xml'));
|
||||||
|
|
||||||
await restore('maven', '');
|
await restore('maven', '');
|
||||||
expect(spyCacheRestore).toHaveBeenCalled();
|
expect(spyCacheRestore).toHaveBeenCalledWith(
|
||||||
expect(spyGlobHashFiles).toHaveBeenCalledWith('**/pom.xml');
|
[
|
||||||
|
join(os.homedir(), '.m2', 'repository'),
|
||||||
|
join(os.homedir(), '.m2', 'wrapper', 'dists')
|
||||||
|
],
|
||||||
|
expect.any(String)
|
||||||
|
);
|
||||||
|
expect(spyGlobHashFiles).toHaveBeenCalledWith(
|
||||||
|
'**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties'
|
||||||
|
);
|
||||||
|
expect(spyWarning).not.toHaveBeenCalled();
|
||||||
|
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
|
||||||
|
});
|
||||||
|
it('downloads cache based on maven-wrapper.properties', async () => {
|
||||||
|
createDirectory(join(workspace, '.mvn'));
|
||||||
|
createDirectory(join(workspace, '.mvn', 'wrapper'));
|
||||||
|
createFile(
|
||||||
|
join(workspace, '.mvn', 'wrapper', 'maven-wrapper.properties')
|
||||||
|
);
|
||||||
|
|
||||||
|
await restore('maven', '');
|
||||||
|
expect(spyCacheRestore).toHaveBeenCalledWith(
|
||||||
|
[
|
||||||
|
join(os.homedir(), '.m2', 'repository'),
|
||||||
|
join(os.homedir(), '.m2', 'wrapper', 'dists')
|
||||||
|
],
|
||||||
|
expect.any(String)
|
||||||
|
);
|
||||||
|
expect(spyGlobHashFiles).toHaveBeenCalledWith(
|
||||||
|
'**/pom.xml\n**/.mvn/wrapper/maven-wrapper.properties'
|
||||||
|
);
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
expect(spyWarning).not.toHaveBeenCalled();
|
||||||
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
|
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
|
||||||
});
|
});
|
||||||
@@ -291,10 +320,12 @@ describe('dependency cache', () => {
|
|||||||
await save('maven');
|
await save('maven');
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
expect(spyCacheSave).toHaveBeenCalled();
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
expect(spyWarning).not.toHaveBeenCalled();
|
||||||
expect(spyInfo).toHaveBeenCalled();
|
expect(spyInfo).not.toHaveBeenCalledWith(
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
expect.stringMatching(/^Cache saved with the key:.*/)
|
||||||
);
|
);
|
||||||
|
expect(spyDebug).toHaveBeenCalledWith(
|
||||||
|
expect.stringMatching(/^Cache was not saved for the key:.*/)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('saves with error from toolkit, should fail workflow', async () => {
|
it('saves with error from toolkit, should fail workflow', async () => {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ describe('cleanup', () => {
|
|||||||
jest.restoreAllMocks();
|
jest.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
it('does not warn/fail even when the save process throws a ReserveCacheError', async () => {
|
||||||
spyCacheSave.mockImplementation((paths: string[], key: string) =>
|
spyCacheSave.mockImplementation((paths: string[], key: string) =>
|
||||||
Promise.reject(
|
Promise.reject(
|
||||||
new cache.ReserveCacheError(
|
new cache.ReserveCacheError(
|
||||||
|
|||||||
@@ -79,6 +79,49 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"version": "17.0.18",
|
||||||
|
"stable": true,
|
||||||
|
"release_url": "https://aka.ms/download-jdk",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-macos-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-linux-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-windows-x64.zip",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-x64.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-macos-aarch64.tar.gz",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-aarch64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-linux-aarch64.tar.gz",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-aarch64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-windows-aarch64.zip",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-aarch64.zip"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "17.0.7",
|
"version": "17.0.7",
|
||||||
"stable": true,
|
"stable": true,
|
||||||
|
|||||||
@@ -247,7 +247,7 @@
|
|||||||
{
|
{
|
||||||
"id": 12446,
|
"id": 12446,
|
||||||
"url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
|
"url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
|
||||||
"name": "zulu17.48.15-ca-jdk17.0.10-win_aarhc4.zip",
|
"name": "zulu17.48.15-ca-jdk17.0.10-win_aarch4.zip",
|
||||||
"zulu_version": [17, 48, 15, 0],
|
"zulu_version": [17, 48, 15, 0],
|
||||||
"jdk_version": [17, 0, 10, 7]
|
"jdk_version": [17, 0, 10, 7]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import * as tc from '@actions/tool-cache';
|
|||||||
import * as http from '@actions/http-client';
|
import * as http from '@actions/http-client';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import {GraalVMDistribution} from '../../src/distributions/graalvm/installer';
|
import {
|
||||||
|
GraalVMCommunityDistribution,
|
||||||
|
GraalVMDistribution
|
||||||
|
} from '../../src/distributions/graalvm/installer';
|
||||||
|
import {getJavaDistribution} from '../../src/distributions/distribution-factory';
|
||||||
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
||||||
import * as util from '../../src/util';
|
import * as util from '../../src/util';
|
||||||
|
|
||||||
@@ -41,6 +45,7 @@ beforeAll(() => {
|
|||||||
|
|
||||||
describe('GraalVMDistribution', () => {
|
describe('GraalVMDistribution', () => {
|
||||||
let distribution: GraalVMDistribution;
|
let distribution: GraalVMDistribution;
|
||||||
|
let communityDistribution: GraalVMCommunityDistribution;
|
||||||
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
let mockHttpClient: jest.Mocked<http.HttpClient>;
|
||||||
let spyCoreError: jest.SpyInstance;
|
let spyCoreError: jest.SpyInstance;
|
||||||
|
|
||||||
@@ -55,9 +60,11 @@ describe('GraalVMDistribution', () => {
|
|||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
|
|
||||||
distribution = new GraalVMDistribution(defaultOptions);
|
distribution = new GraalVMDistribution(defaultOptions);
|
||||||
|
communityDistribution = new GraalVMCommunityDistribution(defaultOptions);
|
||||||
|
|
||||||
mockHttpClient = new http.HttpClient() as jest.Mocked<http.HttpClient>;
|
mockHttpClient = new http.HttpClient() as jest.Mocked<http.HttpClient>;
|
||||||
(distribution as any).http = mockHttpClient;
|
(distribution as any).http = mockHttpClient;
|
||||||
|
(communityDistribution as any).http = mockHttpClient;
|
||||||
|
|
||||||
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
(util.getDownloadArchiveExtension as jest.Mock).mockReturnValue('tar.gz');
|
||||||
|
|
||||||
@@ -242,6 +249,23 @@ describe('GraalVMDistribution', () => {
|
|||||||
path: '/cached/java/path'
|
path: '/cached/java/path'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should use a dedicated toolcache folder for GraalVM Community', async () => {
|
||||||
|
const result = await (communityDistribution as any).downloadTool(
|
||||||
|
javaRelease
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(tc.cacheDir).toHaveBeenCalledWith(
|
||||||
|
path.join('/tmp/extracted', 'graalvm-jdk-17.0.5'),
|
||||||
|
'Java_GraalVM_Community_jdk',
|
||||||
|
'17.0.5',
|
||||||
|
'x64'
|
||||||
|
);
|
||||||
|
expect(result).toEqual({
|
||||||
|
version: '17.0.5',
|
||||||
|
path: '/cached/java/path'
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('findPackageForDownload', () => {
|
describe('findPackageForDownload', () => {
|
||||||
@@ -948,5 +972,107 @@ describe('GraalVMDistribution', () => {
|
|||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('GraalVMCommunityDistribution', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jest
|
||||||
|
.spyOn(communityDistribution, 'getPlatform')
|
||||||
|
.mockReturnValue('linux');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should resolve an exact GraalVM Community version from GitHub releases', async () => {
|
||||||
|
mockHttpClient.getJson.mockResolvedValue({
|
||||||
|
result: [
|
||||||
|
{
|
||||||
|
draft: false,
|
||||||
|
prerelease: false,
|
||||||
|
assets: [
|
||||||
|
{
|
||||||
|
name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
|
||||||
|
browser_download_url:
|
||||||
|
'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await (
|
||||||
|
communityDistribution as any
|
||||||
|
).findPackageForDownload('21.0.2');
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
url: 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
|
||||||
|
version: '21.0.2'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should resolve the latest GraalVM Community release for a major version', async () => {
|
||||||
|
mockHttpClient.getJson.mockResolvedValue({
|
||||||
|
result: [
|
||||||
|
{
|
||||||
|
draft: false,
|
||||||
|
prerelease: false,
|
||||||
|
assets: [
|
||||||
|
{
|
||||||
|
name: 'graalvm-community-jdk-21.0.1_linux-x64_bin.tar.gz',
|
||||||
|
browser_download_url:
|
||||||
|
'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.1/graalvm-community-jdk-21.0.1_linux-x64_bin.tar.gz'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
draft: false,
|
||||||
|
prerelease: false,
|
||||||
|
assets: [
|
||||||
|
{
|
||||||
|
name: 'graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
|
||||||
|
browser_download_url:
|
||||||
|
'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
statusCode: 200,
|
||||||
|
headers: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = await (
|
||||||
|
communityDistribution as any
|
||||||
|
).findPackageForDownload('21');
|
||||||
|
|
||||||
|
expect(result).toEqual({
|
||||||
|
url: 'https://github.com/graalvm/graalvm-ce-builds/releases/download/jdk-21.0.2/graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz',
|
||||||
|
version: '21.0.2'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should reject GraalVM Community early access requests', async () => {
|
||||||
|
(communityDistribution as any).stable = false;
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
(communityDistribution as any).findPackageForDownload('23')
|
||||||
|
).rejects.toThrow(
|
||||||
|
'GraalVM Community does not provide early access builds'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('distribution factory', () => {
|
||||||
|
const defaultOptions: JavaInstallerOptions = {
|
||||||
|
version: '17',
|
||||||
|
architecture: 'x64',
|
||||||
|
packageType: 'jdk',
|
||||||
|
checkLatest: false
|
||||||
|
};
|
||||||
|
|
||||||
|
it('should map graalvm-community to the community installer', () => {
|
||||||
|
const community = getJavaDistribution('graalvm-community', defaultOptions);
|
||||||
|
|
||||||
|
expect(community).toBeInstanceOf(GraalVMCommunityDistribution);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ describe('setupJava', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('java is resolved from toolcache including Contents/Home on MacOS', async () => {
|
it('java is resolved from toolcache including Contents/Home on macOS', async () => {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
version: actualJavaVersion,
|
version: actualJavaVersion,
|
||||||
architecture: 'x86',
|
architecture: 'x86',
|
||||||
@@ -262,7 +262,7 @@ describe('setupJava', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('java is unpacked from jdkfile including Contents/Home on MacOS', async () => {
|
it('java is unpacked from jdkfile including Contents/Home on macOS', async () => {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
version: '11.0.289',
|
version: '11.0.289',
|
||||||
architecture: 'x86',
|
architecture: 'x86',
|
||||||
|
|||||||
@@ -44,16 +44,21 @@ describe('findPackageForDownload', () => {
|
|||||||
'21.0.0',
|
'21.0.0',
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-21.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
'https://aka.ms/download-jdk/microsoft-jdk-21.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'17.x',
|
||||||
|
'17.0.18',
|
||||||
|
'https://aka.ms/download-jdk/microsoft-jdk-17.0.18-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'17.0.7',
|
||||||
|
'17.0.7',
|
||||||
|
'https://aka.ms/download-jdk/microsoft-jdk-17.0.7-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'17.0.1',
|
'17.0.1',
|
||||||
'17.0.1+12.1',
|
'17.0.1+12.1',
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'17.x',
|
|
||||||
'17.0.7',
|
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-17.0.7-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'16.0.x',
|
'16.0.x',
|
||||||
'16.0.2+7.1',
|
'16.0.2+7.1',
|
||||||
@@ -119,7 +124,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = await distro['findPackageForDownload'](version);
|
const result = await distro['findPackageForDownload'](version);
|
||||||
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-${distroArch}.tar.gz`;
|
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-${distroArch}.tar.gz`;
|
||||||
|
|
||||||
expect(result.url).toBe(expectedUrl);
|
expect(result.url).toBe(expectedUrl);
|
||||||
}
|
}
|
||||||
@@ -145,7 +150,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = await distro['findPackageForDownload'](version);
|
const result = await distro['findPackageForDownload'](version);
|
||||||
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-${distroArch}.tar.gz`;
|
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-${distroArch}.tar.gz`;
|
||||||
|
|
||||||
expect(result.url).toBe(expectedUrl);
|
expect(result.url).toBe(expectedUrl);
|
||||||
}
|
}
|
||||||
@@ -171,7 +176,7 @@ describe('findPackageForDownload', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const result = await distro['findPackageForDownload'](version);
|
const result = await distro['findPackageForDownload'](version);
|
||||||
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-${distroArch}.zip`;
|
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-${distroArch}.zip`;
|
||||||
|
|
||||||
expect(result.url).toBe(expectedUrl);
|
expect(result.url).toBe(expectedUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ describe('isVersionSatisfies', () => {
|
|||||||
['2.5.1+3', '2.5.1+3', true],
|
['2.5.1+3', '2.5.1+3', true],
|
||||||
['2.5.1+3', '2.5.1+2', false],
|
['2.5.1+3', '2.5.1+2', false],
|
||||||
['15.0.0+14', '15.0.0+14.1.202003190635', false],
|
['15.0.0+14', '15.0.0+14.1.202003190635', false],
|
||||||
['15.0.0+14.1.202003190635', '15.0.0+14.1.202003190635', true]
|
['15.0.0+14.1.202003190635', '15.0.0+14.1.202003190635', true],
|
||||||
|
// 4-segment versions (e.g. JetBrains Runtime '17.0.8.1+1080.1') are not
|
||||||
|
// valid semver — they should be rejected, not throw.
|
||||||
|
['25.0.3+480.61', '17.0.8.1+1080.1', false],
|
||||||
|
['17', '17.0.8.1+1080.1', false]
|
||||||
])(
|
])(
|
||||||
'%s, %s -> %s',
|
'%s, %s -> %s',
|
||||||
(inputRange: string, inputVersion: string, expected: boolean) => {
|
(inputRange: string, inputVersion: string, expected: boolean) => {
|
||||||
|
|||||||
+7
-3
@@ -5,8 +5,10 @@ author: 'GitHub'
|
|||||||
inputs:
|
inputs:
|
||||||
java-version:
|
java-version:
|
||||||
description: 'The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file'
|
description: 'The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file'
|
||||||
|
required: false
|
||||||
java-version-file:
|
java-version-file:
|
||||||
description: 'The path to the `.java-version` file. See examples of supported syntax in README file'
|
description: 'The path to a file containing the Java version to set up (.java-version, .tool-versions, .sdkmanrc). Used when java-version is not set. See examples of supported syntax in README file'
|
||||||
|
required: false
|
||||||
distribution:
|
distribution:
|
||||||
description: 'Java distribution. See the list of supported distributions in README file'
|
description: 'Java distribution. See the list of supported distributions in README file'
|
||||||
required: true
|
required: true
|
||||||
@@ -49,9 +51,9 @@ inputs:
|
|||||||
gpg-private-key:
|
gpg-private-key:
|
||||||
description: 'GPG private key to import. Default is empty string.'
|
description: 'GPG private key to import. Default is empty string.'
|
||||||
required: false
|
required: false
|
||||||
|
default: ''
|
||||||
gpg-passphrase:
|
gpg-passphrase:
|
||||||
description: 'Environment variable name for the GPG private key passphrase. Default is
|
description: 'Environment variable name for the GPG private key passphrase. Defaults to GPG_PASSPHRASE when gpg-private-key is set; ignored otherwise.'
|
||||||
$GPG_PASSPHRASE.'
|
|
||||||
required: false
|
required: false
|
||||||
cache:
|
cache:
|
||||||
description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".'
|
description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".'
|
||||||
@@ -61,9 +63,11 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
job-status:
|
job-status:
|
||||||
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
||||||
|
required: false
|
||||||
default: ${{ job.status }}
|
default: ${{ job.status }}
|
||||||
token:
|
token:
|
||||||
description: The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
description: The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
||||||
|
required: false
|
||||||
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
||||||
mvn-toolchain-id:
|
mvn-toolchain-id:
|
||||||
description: 'Name of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. See examples of supported syntax in Advanced Usage file'
|
description: 'Name of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. See examples of supported syntax in Advanced Usage file'
|
||||||
|
|||||||
Vendored
+415
-142
@@ -49,7 +49,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.FinalizeCacheError = exports.ReserveCacheError = exports.ValidationError = void 0;
|
exports.FinalizeCacheError = exports.CacheWriteDeniedError = exports.CACHE_WRITE_DENIED_PREFIX = exports.ReserveCacheError = exports.ValidationError = void 0;
|
||||||
exports.isFeatureAvailable = isFeatureAvailable;
|
exports.isFeatureAvailable = isFeatureAvailable;
|
||||||
exports.restoreCache = restoreCache;
|
exports.restoreCache = restoreCache;
|
||||||
exports.saveCache = saveCache;
|
exports.saveCache = saveCache;
|
||||||
@@ -77,6 +77,26 @@ class ReserveCacheError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.ReserveCacheError = ReserveCacheError;
|
exports.ReserveCacheError = ReserveCacheError;
|
||||||
|
/**
|
||||||
|
* Stable prefix used by the cache receiver to signal that the token has
|
||||||
|
* no writable scopes (read-only cache policy). Consumers can match on
|
||||||
|
* this prefix to distinguish policy denials from ordinary contention.
|
||||||
|
*/
|
||||||
|
exports.CACHE_WRITE_DENIED_PREFIX = 'cache write denied:';
|
||||||
|
/**
|
||||||
|
* Extends ReserveCacheError for source-compatibility: existing
|
||||||
|
* `instanceof ReserveCacheError` checks and `typedError.name ===
|
||||||
|
* ReserveCacheError.name` paths keep working, while consumers that want to
|
||||||
|
* distinguish a policy denial can check for CacheWriteDeniedError.name.
|
||||||
|
*/
|
||||||
|
class CacheWriteDeniedError extends ReserveCacheError {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'CacheWriteDeniedError';
|
||||||
|
Object.setPrototypeOf(this, CacheWriteDeniedError.prototype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.CacheWriteDeniedError = CacheWriteDeniedError;
|
||||||
class FinalizeCacheError extends Error {
|
class FinalizeCacheError extends Error {
|
||||||
constructor(message) {
|
constructor(message) {
|
||||||
super(message);
|
super(message);
|
||||||
@@ -387,7 +407,11 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
|
const detailMessage = (_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message;
|
||||||
|
if (detailMessage === null || detailMessage === void 0 ? void 0 : detailMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${detailMessage}`);
|
||||||
|
}
|
||||||
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${detailMessage}`);
|
||||||
}
|
}
|
||||||
core.debug(`Saving Cache (ID: ${cacheId})`);
|
core.debug(`Saving Cache (ID: ${cacheId})`);
|
||||||
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
yield cacheHttpClient.saveCache(cacheId, archivePath, '', options);
|
||||||
@@ -397,6 +421,9 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -435,6 +462,7 @@ function saveCacheV1(paths_1, key_1, options_1) {
|
|||||||
*/
|
*/
|
||||||
function saveCacheV2(paths_1, key_1, options_1) {
|
function saveCacheV2(paths_1, key_1, options_1) {
|
||||||
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
return __awaiter(this, arguments, void 0, function* (paths, key, options, enableCrossOsArchive = false) {
|
||||||
|
var _a;
|
||||||
// Override UploadOptions to force the use of Azure
|
// Override UploadOptions to force the use of Azure
|
||||||
// ...options goes first because we want to override the default values
|
// ...options goes first because we want to override the default values
|
||||||
// set in UploadOptions with these specific figures
|
// set in UploadOptions with these specific figures
|
||||||
@@ -470,7 +498,11 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
try {
|
try {
|
||||||
const response = yield twirpClient.CreateCacheEntry(request);
|
const response = yield twirpClient.CreateCacheEntry(request);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
if (response.message) {
|
// Skip the redundant inner warning when the receiver signalled a
|
||||||
|
// policy denial: the outer catch arm below will log a single
|
||||||
|
// customer-facing warning.
|
||||||
|
if (response.message &&
|
||||||
|
!response.message.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
core.warning(`Cache reservation failed: ${response.message}`);
|
core.warning(`Cache reservation failed: ${response.message}`);
|
||||||
}
|
}
|
||||||
throw new Error(response.message || 'Response was not ok');
|
throw new Error(response.message || 'Response was not ok');
|
||||||
@@ -479,6 +511,10 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.debug(`Failed to reserve cache: ${error}`);
|
core.debug(`Failed to reserve cache: ${error}`);
|
||||||
|
const errorMessage = (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '';
|
||||||
|
if (errorMessage.startsWith(exports.CACHE_WRITE_DENIED_PREFIX)) {
|
||||||
|
throw new CacheWriteDeniedError(`Unable to reserve cache with key ${key}. More details: ${errorMessage}`);
|
||||||
|
}
|
||||||
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache.`);
|
||||||
}
|
}
|
||||||
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
core.debug(`Attempting to upload cache located at: ${archivePath}`);
|
||||||
@@ -503,6 +539,9 @@ function saveCacheV2(paths_1, key_1, options_1) {
|
|||||||
if (typedError.name === ValidationError.name) {
|
if (typedError.name === ValidationError.name) {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
else if (typedError.name === CacheWriteDeniedError.name) {
|
||||||
|
core.warning(`Failed to save: ${typedError.message}`);
|
||||||
|
}
|
||||||
else if (typedError.name === ReserveCacheError.name) {
|
else if (typedError.name === ReserveCacheError.name) {
|
||||||
core.info(`Failed to save: ${typedError.message}`);
|
core.info(`Failed to save: ${typedError.message}`);
|
||||||
}
|
}
|
||||||
@@ -18118,14 +18157,17 @@ function useColors() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let m;
|
||||||
|
|
||||||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||||
|
// eslint-disable-next-line no-return-assign
|
||||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||||
// Is firefox >= v31?
|
// Is firefox >= v31?
|
||||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
|
||||||
// Double check webkit in userAgent just in case we are in a worker
|
// Double check webkit in userAgent just in case we are in a worker
|
||||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||||
}
|
}
|
||||||
@@ -18209,7 +18251,7 @@ function save(namespaces) {
|
|||||||
function load() {
|
function load() {
|
||||||
let r;
|
let r;
|
||||||
try {
|
try {
|
||||||
r = exports.storage.getItem('debug');
|
r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Swallow
|
// Swallow
|
||||||
// XXX (@Qix-) should we be logging these?
|
// XXX (@Qix-) should we be logging these?
|
||||||
@@ -18435,26 +18477,64 @@ function setup(env) {
|
|||||||
createDebug.names = [];
|
createDebug.names = [];
|
||||||
createDebug.skips = [];
|
createDebug.skips = [];
|
||||||
|
|
||||||
let i;
|
const split = (typeof namespaces === 'string' ? namespaces : '')
|
||||||
const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
.trim()
|
||||||
const len = split.length;
|
.replace(/\s+/g, ',')
|
||||||
|
.split(',')
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
for (i = 0; i < len; i++) {
|
for (const ns of split) {
|
||||||
if (!split[i]) {
|
if (ns[0] === '-') {
|
||||||
// ignore empty strings
|
createDebug.skips.push(ns.slice(1));
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespaces = split[i].replace(/\*/g, '.*?');
|
|
||||||
|
|
||||||
if (namespaces[0] === '-') {
|
|
||||||
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
||||||
} else {
|
} else {
|
||||||
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
createDebug.names.push(ns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given string matches a namespace template, honoring
|
||||||
|
* asterisks as wildcards.
|
||||||
|
*
|
||||||
|
* @param {String} search
|
||||||
|
* @param {String} template
|
||||||
|
* @return {Boolean}
|
||||||
|
*/
|
||||||
|
function matchesTemplate(search, template) {
|
||||||
|
let searchIndex = 0;
|
||||||
|
let templateIndex = 0;
|
||||||
|
let starIndex = -1;
|
||||||
|
let matchIndex = 0;
|
||||||
|
|
||||||
|
while (searchIndex < search.length) {
|
||||||
|
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
||||||
|
// Match character or proceed with wildcard
|
||||||
|
if (template[templateIndex] === '*') {
|
||||||
|
starIndex = templateIndex;
|
||||||
|
matchIndex = searchIndex;
|
||||||
|
templateIndex++; // Skip the '*'
|
||||||
|
} else {
|
||||||
|
searchIndex++;
|
||||||
|
templateIndex++;
|
||||||
|
}
|
||||||
|
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
||||||
|
// Backtrack to the last '*' and try to match more characters
|
||||||
|
templateIndex = starIndex + 1;
|
||||||
|
matchIndex++;
|
||||||
|
searchIndex = matchIndex;
|
||||||
|
} else {
|
||||||
|
return false; // No match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle trailing '*' in template
|
||||||
|
while (templateIndex < template.length && template[templateIndex] === '*') {
|
||||||
|
templateIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return templateIndex === template.length;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable debug output.
|
* Disable debug output.
|
||||||
*
|
*
|
||||||
@@ -18463,8 +18543,8 @@ function setup(env) {
|
|||||||
*/
|
*/
|
||||||
function disable() {
|
function disable() {
|
||||||
const namespaces = [
|
const namespaces = [
|
||||||
...createDebug.names.map(toNamespace),
|
...createDebug.names,
|
||||||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
...createDebug.skips.map(namespace => '-' + namespace)
|
||||||
].join(',');
|
].join(',');
|
||||||
createDebug.enable('');
|
createDebug.enable('');
|
||||||
return namespaces;
|
return namespaces;
|
||||||
@@ -18478,21 +18558,14 @@ function setup(env) {
|
|||||||
* @api public
|
* @api public
|
||||||
*/
|
*/
|
||||||
function enabled(name) {
|
function enabled(name) {
|
||||||
if (name[name.length - 1] === '*') {
|
for (const skip of createDebug.skips) {
|
||||||
return true;
|
if (matchesTemplate(name, skip)) {
|
||||||
}
|
|
||||||
|
|
||||||
let i;
|
|
||||||
let len;
|
|
||||||
|
|
||||||
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
||||||
if (createDebug.skips[i].test(name)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
for (const ns of createDebug.names) {
|
||||||
if (createDebug.names[i].test(name)) {
|
if (matchesTemplate(name, ns)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18500,19 +18573,6 @@ function setup(env) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert regexp to namespace
|
|
||||||
*
|
|
||||||
* @param {RegExp} regxep
|
|
||||||
* @return {String} namespace
|
|
||||||
* @api private
|
|
||||||
*/
|
|
||||||
function toNamespace(regexp) {
|
|
||||||
return regexp.toString()
|
|
||||||
.substring(2, regexp.toString().length - 2)
|
|
||||||
.replace(/\.\*\?$/, '*');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Coerce `val`.
|
* Coerce `val`.
|
||||||
*
|
*
|
||||||
@@ -18754,11 +18814,11 @@ function getDate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invokes `util.format()` with the specified arguments and writes to stderr.
|
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function log(...args) {
|
function log(...args) {
|
||||||
return process.stderr.write(util.format(...args) + '\n');
|
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28277,8 +28337,6 @@ function defaultFactory (origin, opts) {
|
|||||||
|
|
||||||
class Agent extends DispatcherBase {
|
class Agent extends DispatcherBase {
|
||||||
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
constructor ({ factory = defaultFactory, maxRedirections = 0, connect, ...options } = {}) {
|
||||||
super()
|
|
||||||
|
|
||||||
if (typeof factory !== 'function') {
|
if (typeof factory !== 'function') {
|
||||||
throw new InvalidArgumentError('factory must be a function.')
|
throw new InvalidArgumentError('factory must be a function.')
|
||||||
}
|
}
|
||||||
@@ -28291,6 +28349,8 @@ class Agent extends DispatcherBase {
|
|||||||
throw new InvalidArgumentError('maxRedirections must be a positive number')
|
throw new InvalidArgumentError('maxRedirections must be a positive number')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super(options)
|
||||||
|
|
||||||
if (connect && typeof connect !== 'function') {
|
if (connect && typeof connect !== 'function') {
|
||||||
connect = { ...connect }
|
connect = { ...connect }
|
||||||
}
|
}
|
||||||
@@ -28664,6 +28724,9 @@ const EMPTY_BUF = Buffer.alloc(0)
|
|||||||
const FastBuffer = Buffer[Symbol.species]
|
const FastBuffer = Buffer[Symbol.species]
|
||||||
const addListener = util.addListener
|
const addListener = util.addListener
|
||||||
const removeAllListeners = util.removeAllListeners
|
const removeAllListeners = util.removeAllListeners
|
||||||
|
const kIdleSocketValidation = Symbol('kIdleSocketValidation')
|
||||||
|
const kIdleSocketValidationTimeout = Symbol('kIdleSocketValidationTimeout')
|
||||||
|
const kSocketUsed = Symbol('kSocketUsed')
|
||||||
|
|
||||||
let extractBody
|
let extractBody
|
||||||
|
|
||||||
@@ -28886,15 +28949,60 @@ class Parser {
|
|||||||
|
|
||||||
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
|
const offset = llhttp.llhttp_get_error_pos(this.ptr) - currentBufferPtr
|
||||||
|
|
||||||
|
if (ret !== constants.ERROR.OK) {
|
||||||
|
const body = data.subarray(offset)
|
||||||
|
|
||||||
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
if (ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||||
this.onUpgrade(data.slice(offset))
|
this.onUpgrade(body)
|
||||||
} else if (ret === constants.ERROR.PAUSED) {
|
} else if (ret === constants.ERROR.PAUSED) {
|
||||||
this.paused = true
|
this.paused = true
|
||||||
socket.unshift(data.slice(offset))
|
socket.unshift(body)
|
||||||
} else if (ret !== constants.ERROR.OK) {
|
} else {
|
||||||
|
throw this.createError(ret, body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
util.destroy(socket, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
finish () {
|
||||||
|
assert(currentParser === null)
|
||||||
|
assert(this.ptr != null)
|
||||||
|
assert(!this.paused)
|
||||||
|
|
||||||
|
const { llhttp } = this
|
||||||
|
|
||||||
|
let ret
|
||||||
|
|
||||||
|
try {
|
||||||
|
currentParser = this
|
||||||
|
ret = llhttp.llhttp_finish(this.ptr)
|
||||||
|
} finally {
|
||||||
|
currentParser = null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret === constants.ERROR.OK) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret === constants.ERROR.PAUSED || ret === constants.ERROR.PAUSED_UPGRADE) {
|
||||||
|
this.paused = true
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.createError(ret, EMPTY_BUF)
|
||||||
|
}
|
||||||
|
|
||||||
|
createError (ret, data) {
|
||||||
|
const { llhttp, contentLength, bytesRead } = this
|
||||||
|
|
||||||
|
if (contentLength && bytesRead !== parseInt(contentLength, 10)) {
|
||||||
|
return new ResponseContentLengthMismatchError()
|
||||||
|
}
|
||||||
|
|
||||||
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
|
const ptr = llhttp.llhttp_get_error_reason(this.ptr)
|
||||||
let message = ''
|
let message = ''
|
||||||
/* istanbul ignore else: difficult to make a test case for */
|
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0)
|
||||||
message =
|
message =
|
||||||
@@ -28902,11 +29010,8 @@ class Parser {
|
|||||||
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
Buffer.from(llhttp.memory.buffer, ptr, len).toString() +
|
||||||
')'
|
')'
|
||||||
}
|
}
|
||||||
throw new HTTPParserError(message, constants.ERROR[ret], data.slice(offset))
|
|
||||||
}
|
return new HTTPParserError(message, constants.ERROR[ret], data)
|
||||||
} catch (err) {
|
|
||||||
util.destroy(socket, err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy () {
|
destroy () {
|
||||||
@@ -28936,6 +29041,11 @@ class Parser {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client[kRunning] === 0) {
|
||||||
|
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
const request = client[kQueue][client[kRunningIdx]]
|
const request = client[kQueue][client[kRunningIdx]]
|
||||||
if (!request) {
|
if (!request) {
|
||||||
return -1
|
return -1
|
||||||
@@ -29039,6 +29149,11 @@ class Parser {
|
|||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client[kRunning] === 0) {
|
||||||
|
util.destroy(socket, new SocketError('bad response', util.getSocketInfo(socket)))
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
const request = client[kQueue][client[kRunningIdx]]
|
const request = client[kQueue][client[kRunningIdx]]
|
||||||
|
|
||||||
/* istanbul ignore next: difficult to make a test case for */
|
/* istanbul ignore next: difficult to make a test case for */
|
||||||
@@ -29212,6 +29327,7 @@ class Parser {
|
|||||||
request.onComplete(headers)
|
request.onComplete(headers)
|
||||||
|
|
||||||
client[kQueue][client[kRunningIdx]++] = null
|
client[kQueue][client[kRunningIdx]++] = null
|
||||||
|
socket[kSocketUsed] = true
|
||||||
|
|
||||||
if (socket[kWriting]) {
|
if (socket[kWriting]) {
|
||||||
assert(client[kRunning] === 0)
|
assert(client[kRunning] === 0)
|
||||||
@@ -29270,6 +29386,9 @@ async function connectH1 (client, socket) {
|
|||||||
socket[kWriting] = false
|
socket[kWriting] = false
|
||||||
socket[kReset] = false
|
socket[kReset] = false
|
||||||
socket[kBlocking] = false
|
socket[kBlocking] = false
|
||||||
|
socket[kIdleSocketValidation] = 0
|
||||||
|
socket[kIdleSocketValidationTimeout] = null
|
||||||
|
socket[kSocketUsed] = false
|
||||||
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
socket[kParser] = new Parser(client, socket, llhttpInstance)
|
||||||
|
|
||||||
addListener(socket, 'error', function (err) {
|
addListener(socket, 'error', function (err) {
|
||||||
@@ -29280,8 +29399,11 @@ async function connectH1 (client, socket) {
|
|||||||
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
// On Mac OS, we get an ECONNRESET even if there is a full body to be forwarded
|
||||||
// to the user.
|
// to the user.
|
||||||
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
if (err.code === 'ECONNRESET' && parser.statusCode && !parser.shouldKeepAlive) {
|
||||||
// We treat all incoming data so for as a valid response.
|
const parserErr = parser.finish()
|
||||||
parser.onMessageComplete()
|
if (parserErr) {
|
||||||
|
this[kError] = parserErr
|
||||||
|
this[kClient][kOnError](parserErr)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29300,8 +29422,10 @@ async function connectH1 (client, socket) {
|
|||||||
const parser = this[kParser]
|
const parser = this[kParser]
|
||||||
|
|
||||||
if (parser.statusCode && !parser.shouldKeepAlive) {
|
if (parser.statusCode && !parser.shouldKeepAlive) {
|
||||||
// We treat all incoming data so far as a valid response.
|
const parserErr = parser.finish()
|
||||||
parser.onMessageComplete()
|
if (parserErr) {
|
||||||
|
util.destroy(this, parserErr)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29311,10 +29435,11 @@ async function connectH1 (client, socket) {
|
|||||||
const client = this[kClient]
|
const client = this[kClient]
|
||||||
const parser = this[kParser]
|
const parser = this[kParser]
|
||||||
|
|
||||||
|
clearIdleSocketValidation(this)
|
||||||
|
|
||||||
if (parser) {
|
if (parser) {
|
||||||
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
if (!this[kError] && parser.statusCode && !parser.shouldKeepAlive) {
|
||||||
// We treat all incoming data so far as a valid response.
|
this[kError] = parser.finish() || this[kError]
|
||||||
parser.onMessageComplete()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this[kParser].destroy()
|
this[kParser].destroy()
|
||||||
@@ -29377,7 +29502,7 @@ async function connectH1 (client, socket) {
|
|||||||
return socket.destroyed
|
return socket.destroyed
|
||||||
},
|
},
|
||||||
busy (request) {
|
busy (request) {
|
||||||
if (socket[kWriting] || socket[kReset] || socket[kBlocking]) {
|
if (socket[kWriting] || socket[kReset] || socket[kBlocking] || socket[kIdleSocketValidation] === 1) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29415,6 +29540,31 @@ async function connectH1 (client, socket) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearIdleSocketValidation (socket) {
|
||||||
|
if (socket[kIdleSocketValidationTimeout]) {
|
||||||
|
clearTimeout(socket[kIdleSocketValidationTimeout])
|
||||||
|
socket[kIdleSocketValidationTimeout] = null
|
||||||
|
}
|
||||||
|
|
||||||
|
socket[kIdleSocketValidation] = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function scheduleIdleSocketValidation (client, socket) {
|
||||||
|
socket[kIdleSocketValidation] = 1
|
||||||
|
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
||||||
|
socket[kIdleSocketValidationTimeout] = null
|
||||||
|
socket[kIdleSocketValidation] = 2
|
||||||
|
|
||||||
|
if (client[kSocket] === socket && !socket.destroyed) {
|
||||||
|
client[kResume]()
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
socket[kIdleSocketValidationTimeout].unref?.()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('./client.js')} client
|
||||||
|
*/
|
||||||
function resumeH1 (client) {
|
function resumeH1 (client) {
|
||||||
const socket = client[kSocket]
|
const socket = client[kSocket]
|
||||||
|
|
||||||
@@ -29429,6 +29579,32 @@ function resumeH1 (client) {
|
|||||||
socket[kNoRef] = false
|
socket[kNoRef] = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client[kRunning] === 0 && client[kPending] > 0 && socket[kSocketUsed]) {
|
||||||
|
if (socket[kIdleSocketValidation] === 0) {
|
||||||
|
scheduleIdleSocketValidation(client, socket)
|
||||||
|
socket[kParser].readMore()
|
||||||
|
if (socket.destroyed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (socket[kIdleSocketValidation] === 1) {
|
||||||
|
socket[kParser].readMore()
|
||||||
|
if (socket.destroyed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client[kRunning] === 0) {
|
||||||
|
socket[kParser].readMore()
|
||||||
|
if (socket.destroyed) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (client[kSize] === 0) {
|
if (client[kSize] === 0) {
|
||||||
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
|
if (socket[kParser].timeoutType !== TIMEOUT_KEEP_ALIVE) {
|
||||||
socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE)
|
socket[kParser].setTimeout(client[kKeepAliveTimeoutValue], TIMEOUT_KEEP_ALIVE)
|
||||||
@@ -29522,6 +29698,7 @@ function writeH1 (client, request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const socket = client[kSocket]
|
const socket = client[kSocket]
|
||||||
|
clearIdleSocketValidation(socket)
|
||||||
|
|
||||||
const abort = (err) => {
|
const abort = (err) => {
|
||||||
if (request.aborted || request.completed) {
|
if (request.aborted || request.completed) {
|
||||||
@@ -30843,9 +31020,10 @@ class Client extends DispatcherBase {
|
|||||||
autoSelectFamilyAttemptTimeout,
|
autoSelectFamilyAttemptTimeout,
|
||||||
// h2
|
// h2
|
||||||
maxConcurrentStreams,
|
maxConcurrentStreams,
|
||||||
allowH2
|
allowH2,
|
||||||
|
webSocket
|
||||||
} = {}) {
|
} = {}) {
|
||||||
super()
|
super({ webSocket })
|
||||||
|
|
||||||
if (keepAlive !== undefined) {
|
if (keepAlive !== undefined) {
|
||||||
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
throw new InvalidArgumentError('unsupported keepAlive, use pipelining=0 instead')
|
||||||
@@ -31378,15 +31556,24 @@ const { kDestroy, kClose, kClosed, kDestroyed, kDispatch, kInterceptors } = __nc
|
|||||||
const kOnDestroyed = Symbol('onDestroyed')
|
const kOnDestroyed = Symbol('onDestroyed')
|
||||||
const kOnClosed = Symbol('onClosed')
|
const kOnClosed = Symbol('onClosed')
|
||||||
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
|
const kInterceptedDispatch = Symbol('Intercepted Dispatch')
|
||||||
|
const kWebSocketOptions = Symbol('webSocketOptions')
|
||||||
|
|
||||||
class DispatcherBase extends Dispatcher {
|
class DispatcherBase extends Dispatcher {
|
||||||
constructor () {
|
constructor (opts) {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
this[kDestroyed] = false
|
this[kDestroyed] = false
|
||||||
this[kOnDestroyed] = null
|
this[kOnDestroyed] = null
|
||||||
this[kClosed] = false
|
this[kClosed] = false
|
||||||
this[kOnClosed] = []
|
this[kOnClosed] = []
|
||||||
|
this[kWebSocketOptions] = opts?.webSocket ?? {}
|
||||||
|
}
|
||||||
|
|
||||||
|
get webSocketOptions () {
|
||||||
|
return {
|
||||||
|
maxFragments: this[kWebSocketOptions].maxFragments ?? 131072,
|
||||||
|
maxPayloadSize: this[kWebSocketOptions].maxPayloadSize ?? 128 * 1024 * 1024
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get destroyed () {
|
get destroyed () {
|
||||||
@@ -31950,8 +32137,8 @@ const kRemoveClient = Symbol('remove client')
|
|||||||
const kStats = Symbol('stats')
|
const kStats = Symbol('stats')
|
||||||
|
|
||||||
class PoolBase extends DispatcherBase {
|
class PoolBase extends DispatcherBase {
|
||||||
constructor () {
|
constructor (opts) {
|
||||||
super()
|
super(opts)
|
||||||
|
|
||||||
this[kQueue] = new FixedQueue()
|
this[kQueue] = new FixedQueue()
|
||||||
this[kClients] = []
|
this[kClients] = []
|
||||||
@@ -32211,8 +32398,6 @@ class Pool extends PoolBase {
|
|||||||
allowH2,
|
allowH2,
|
||||||
...options
|
...options
|
||||||
} = {}) {
|
} = {}) {
|
||||||
super()
|
|
||||||
|
|
||||||
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
|
if (connections != null && (!Number.isFinite(connections) || connections < 0)) {
|
||||||
throw new InvalidArgumentError('invalid connections')
|
throw new InvalidArgumentError('invalid connections')
|
||||||
}
|
}
|
||||||
@@ -32237,6 +32422,8 @@ class Pool extends PoolBase {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super(options)
|
||||||
|
|
||||||
this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
|
this[kInterceptors] = options.interceptors?.Pool && Array.isArray(options.interceptors.Pool)
|
||||||
? options.interceptors.Pool
|
? options.interceptors.Pool
|
||||||
: []
|
: []
|
||||||
@@ -37321,32 +37508,25 @@ function parseUnparsedAttributes (unparsedAttributes, cookieAttributeList = {})
|
|||||||
// If the attribute-name case-insensitively matches the string
|
// If the attribute-name case-insensitively matches the string
|
||||||
// "SameSite", the user agent MUST process the cookie-av as follows:
|
// "SameSite", the user agent MUST process the cookie-av as follows:
|
||||||
|
|
||||||
// 1. Let enforcement be "Default".
|
|
||||||
let enforcement = 'Default'
|
|
||||||
|
|
||||||
const attributeValueLowercase = attributeValue.toLowerCase()
|
const attributeValueLowercase = attributeValue.toLowerCase()
|
||||||
|
|
||||||
|
// 1. If cookie-av's attribute-value is a case-insensitive match for
|
||||||
|
// "None", append an attribute to the cookie-attribute-list with an
|
||||||
|
// attribute-name of "SameSite" and an attribute-value of "None".
|
||||||
|
if (attributeValueLowercase === 'none') {
|
||||||
|
cookieAttributeList.sameSite = 'None'
|
||||||
|
} else if (attributeValueLowercase === 'strict') {
|
||||||
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
// 2. If cookie-av's attribute-value is a case-insensitive match for
|
||||||
// "None", set enforcement to "None".
|
// "Strict", append an attribute to the cookie-attribute-list with
|
||||||
if (attributeValueLowercase.includes('none')) {
|
// an attribute-name of "SameSite" and an attribute-value of
|
||||||
enforcement = 'None'
|
// "Strict".
|
||||||
}
|
cookieAttributeList.sameSite = 'Strict'
|
||||||
|
} else if (attributeValueLowercase === 'lax') {
|
||||||
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
// 3. If cookie-av's attribute-value is a case-insensitive match for
|
||||||
// "Strict", set enforcement to "Strict".
|
// "Lax", append an attribute to the cookie-attribute-list with an
|
||||||
if (attributeValueLowercase.includes('strict')) {
|
// attribute-name of "SameSite" and an attribute-value of "Lax".
|
||||||
enforcement = 'Strict'
|
cookieAttributeList.sameSite = 'Lax'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. If cookie-av's attribute-value is a case-insensitive match for
|
|
||||||
// "Lax", set enforcement to "Lax".
|
|
||||||
if (attributeValueLowercase.includes('lax')) {
|
|
||||||
enforcement = 'Lax'
|
|
||||||
}
|
|
||||||
|
|
||||||
// 5. Append an attribute to the cookie-attribute-list with an
|
|
||||||
// attribute-name of "SameSite" and an attribute-value of
|
|
||||||
// enforcement.
|
|
||||||
cookieAttributeList.sameSite = enforcement
|
|
||||||
} else {
|
} else {
|
||||||
cookieAttributeList.unparsed ??= []
|
cookieAttributeList.unparsed ??= []
|
||||||
|
|
||||||
@@ -50052,40 +50232,35 @@ const tail = Buffer.from([0x00, 0x00, 0xff, 0xff])
|
|||||||
const kBuffer = Symbol('kBuffer')
|
const kBuffer = Symbol('kBuffer')
|
||||||
const kLength = Symbol('kLength')
|
const kLength = Symbol('kLength')
|
||||||
|
|
||||||
// Default maximum decompressed message size: 4 MB
|
|
||||||
const kDefaultMaxDecompressedSize = 4 * 1024 * 1024
|
|
||||||
|
|
||||||
class PerMessageDeflate {
|
class PerMessageDeflate {
|
||||||
/** @type {import('node:zlib').InflateRaw} */
|
/** @type {import('node:zlib').InflateRaw} */
|
||||||
#inflate
|
#inflate
|
||||||
|
|
||||||
#options = {}
|
#options = {}
|
||||||
|
|
||||||
/** @type {boolean} */
|
#maxPayloadSize = 0
|
||||||
#aborted = false
|
|
||||||
|
|
||||||
/** @type {Function|null} */
|
|
||||||
#currentCallback = null
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Map<string, string>} extensions
|
* @param {Map<string, string>} extensions
|
||||||
*/
|
*/
|
||||||
constructor (extensions) {
|
constructor (extensions, options) {
|
||||||
this.#options.serverNoContextTakeover = extensions.has('server_no_context_takeover')
|
this.#options.serverNoContextTakeover = extensions.has('server_no_context_takeover')
|
||||||
this.#options.serverMaxWindowBits = extensions.get('server_max_window_bits')
|
this.#options.serverMaxWindowBits = extensions.get('server_max_window_bits')
|
||||||
|
|
||||||
|
this.#maxPayloadSize = options.maxPayloadSize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decompress a compressed payload.
|
||||||
|
* @param {Buffer} chunk Compressed data
|
||||||
|
* @param {boolean} fin Final fragment flag
|
||||||
|
* @param {Function} callback Callback function
|
||||||
|
*/
|
||||||
decompress (chunk, fin, callback) {
|
decompress (chunk, fin, callback) {
|
||||||
// An endpoint uses the following algorithm to decompress a message.
|
// An endpoint uses the following algorithm to decompress a message.
|
||||||
// 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the
|
// 1. Append 4 octets of 0x00 0x00 0xff 0xff to the tail end of the
|
||||||
// payload of the message.
|
// payload of the message.
|
||||||
// 2. Decompress the resulting data using DEFLATE.
|
// 2. Decompress the resulting data using DEFLATE.
|
||||||
|
|
||||||
if (this.#aborted) {
|
|
||||||
callback(new MessageSizeExceededError())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.#inflate) {
|
if (!this.#inflate) {
|
||||||
let windowBits = Z_DEFAULT_WINDOWBITS
|
let windowBits = Z_DEFAULT_WINDOWBITS
|
||||||
|
|
||||||
@@ -50108,23 +50283,12 @@ class PerMessageDeflate {
|
|||||||
this.#inflate[kLength] = 0
|
this.#inflate[kLength] = 0
|
||||||
|
|
||||||
this.#inflate.on('data', (data) => {
|
this.#inflate.on('data', (data) => {
|
||||||
if (this.#aborted) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#inflate[kLength] += data.length
|
this.#inflate[kLength] += data.length
|
||||||
|
|
||||||
if (this.#inflate[kLength] > kDefaultMaxDecompressedSize) {
|
if (this.#maxPayloadSize > 0 && this.#inflate[kLength] > this.#maxPayloadSize) {
|
||||||
this.#aborted = true
|
callback(new MessageSizeExceededError())
|
||||||
this.#inflate.removeAllListeners()
|
this.#inflate.removeAllListeners()
|
||||||
this.#inflate.destroy()
|
|
||||||
this.#inflate = null
|
this.#inflate = null
|
||||||
|
|
||||||
if (this.#currentCallback) {
|
|
||||||
const cb = this.#currentCallback
|
|
||||||
this.#currentCallback = null
|
|
||||||
cb(new MessageSizeExceededError())
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50137,14 +50301,13 @@ class PerMessageDeflate {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#currentCallback = callback
|
|
||||||
this.#inflate.write(chunk)
|
this.#inflate.write(chunk)
|
||||||
if (fin) {
|
if (fin) {
|
||||||
this.#inflate.write(tail)
|
this.#inflate.write(tail)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#inflate.flush(() => {
|
this.#inflate.flush(() => {
|
||||||
if (this.#aborted || !this.#inflate) {
|
if (!this.#inflate) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50152,7 +50315,6 @@ class PerMessageDeflate {
|
|||||||
|
|
||||||
this.#inflate[kBuffer].length = 0
|
this.#inflate[kBuffer].length = 0
|
||||||
this.#inflate[kLength] = 0
|
this.#inflate[kLength] = 0
|
||||||
this.#currentCallback = null
|
|
||||||
|
|
||||||
callback(null, full)
|
callback(null, full)
|
||||||
})
|
})
|
||||||
@@ -50188,6 +50350,12 @@ const {
|
|||||||
const { WebsocketFrameSend } = __nccwpck_require__(3264)
|
const { WebsocketFrameSend } = __nccwpck_require__(3264)
|
||||||
const { closeWebSocketConnection } = __nccwpck_require__(86897)
|
const { closeWebSocketConnection } = __nccwpck_require__(86897)
|
||||||
const { PerMessageDeflate } = __nccwpck_require__(19469)
|
const { PerMessageDeflate } = __nccwpck_require__(19469)
|
||||||
|
const { MessageSizeExceededError } = __nccwpck_require__(68707)
|
||||||
|
|
||||||
|
function failWebsocketConnectionWithCode (ws, code, reason) {
|
||||||
|
closeWebSocketConnection(ws, code, reason, Buffer.byteLength(reason))
|
||||||
|
failWebsocketConnection(ws, reason)
|
||||||
|
}
|
||||||
|
|
||||||
// This code was influenced by ws released under the MIT license.
|
// This code was influenced by ws released under the MIT license.
|
||||||
// Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
// Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
|
||||||
@@ -50196,6 +50364,7 @@ const { PerMessageDeflate } = __nccwpck_require__(19469)
|
|||||||
|
|
||||||
class ByteParser extends Writable {
|
class ByteParser extends Writable {
|
||||||
#buffers = []
|
#buffers = []
|
||||||
|
#fragmentsBytes = 0
|
||||||
#byteOffset = 0
|
#byteOffset = 0
|
||||||
#loop = false
|
#loop = false
|
||||||
|
|
||||||
@@ -50207,18 +50376,27 @@ class ByteParser extends Writable {
|
|||||||
/** @type {Map<string, PerMessageDeflate>} */
|
/** @type {Map<string, PerMessageDeflate>} */
|
||||||
#extensions
|
#extensions
|
||||||
|
|
||||||
|
/** @type {number} */
|
||||||
|
#maxFragments
|
||||||
|
|
||||||
|
/** @type {number} */
|
||||||
|
#maxPayloadSize
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import('./websocket').WebSocket} ws
|
* @param {import('./websocket').WebSocket} ws
|
||||||
* @param {Map<string, string>|null} extensions
|
* @param {Map<string, string>|null} extensions
|
||||||
|
* @param {{ maxFragments?: number, maxPayloadSize?: number }} [options]
|
||||||
*/
|
*/
|
||||||
constructor (ws, extensions) {
|
constructor (ws, extensions, options = {}) {
|
||||||
super()
|
super()
|
||||||
|
|
||||||
this.ws = ws
|
this.ws = ws
|
||||||
this.#extensions = extensions == null ? new Map() : extensions
|
this.#extensions = extensions == null ? new Map() : extensions
|
||||||
|
this.#maxFragments = options.maxFragments ?? 0
|
||||||
|
this.#maxPayloadSize = options.maxPayloadSize ?? 0
|
||||||
|
|
||||||
if (this.#extensions.has('permessage-deflate')) {
|
if (this.#extensions.has('permessage-deflate')) {
|
||||||
this.#extensions.set('permessage-deflate', new PerMessageDeflate(extensions))
|
this.#extensions.set('permessage-deflate', new PerMessageDeflate(extensions, options))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50234,6 +50412,19 @@ class ByteParser extends Writable {
|
|||||||
this.run(callback)
|
this.run(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#validatePayloadLength () {
|
||||||
|
if (
|
||||||
|
this.#maxPayloadSize > 0 &&
|
||||||
|
!isControlFrame(this.#info.opcode) &&
|
||||||
|
this.#info.payloadLength + this.#fragmentsBytes > this.#maxPayloadSize
|
||||||
|
) {
|
||||||
|
failWebsocketConnectionWithCode(this.ws, 1009, 'Payload size exceeds maximum allowed size')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs whenever a new chunk is received.
|
* Runs whenever a new chunk is received.
|
||||||
* Callback is called whenever there are no more chunks buffering,
|
* Callback is called whenever there are no more chunks buffering,
|
||||||
@@ -50322,6 +50513,10 @@ class ByteParser extends Writable {
|
|||||||
if (payloadLength <= 125) {
|
if (payloadLength <= 125) {
|
||||||
this.#info.payloadLength = payloadLength
|
this.#info.payloadLength = payloadLength
|
||||||
this.#state = parserStates.READ_DATA
|
this.#state = parserStates.READ_DATA
|
||||||
|
|
||||||
|
if (!this.#validatePayloadLength()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
} else if (payloadLength === 126) {
|
} else if (payloadLength === 126) {
|
||||||
this.#state = parserStates.PAYLOADLENGTH_16
|
this.#state = parserStates.PAYLOADLENGTH_16
|
||||||
} else if (payloadLength === 127) {
|
} else if (payloadLength === 127) {
|
||||||
@@ -50346,6 +50541,10 @@ class ByteParser extends Writable {
|
|||||||
|
|
||||||
this.#info.payloadLength = buffer.readUInt16BE(0)
|
this.#info.payloadLength = buffer.readUInt16BE(0)
|
||||||
this.#state = parserStates.READ_DATA
|
this.#state = parserStates.READ_DATA
|
||||||
|
|
||||||
|
if (!this.#validatePayloadLength()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
} else if (this.#state === parserStates.PAYLOADLENGTH_64) {
|
} else if (this.#state === parserStates.PAYLOADLENGTH_64) {
|
||||||
if (this.#byteOffset < 8) {
|
if (this.#byteOffset < 8) {
|
||||||
return callback()
|
return callback()
|
||||||
@@ -50368,6 +50567,10 @@ class ByteParser extends Writable {
|
|||||||
|
|
||||||
this.#info.payloadLength = lower
|
this.#info.payloadLength = lower
|
||||||
this.#state = parserStates.READ_DATA
|
this.#state = parserStates.READ_DATA
|
||||||
|
|
||||||
|
if (!this.#validatePayloadLength()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
} else if (this.#state === parserStates.READ_DATA) {
|
} else if (this.#state === parserStates.READ_DATA) {
|
||||||
if (this.#byteOffset < this.#info.payloadLength) {
|
if (this.#byteOffset < this.#info.payloadLength) {
|
||||||
return callback()
|
return callback()
|
||||||
@@ -50380,27 +50583,43 @@ class ByteParser extends Writable {
|
|||||||
this.#state = parserStates.INFO
|
this.#state = parserStates.INFO
|
||||||
} else {
|
} else {
|
||||||
if (!this.#info.compressed) {
|
if (!this.#info.compressed) {
|
||||||
this.#fragments.push(body)
|
if (!this.writeFragments(body)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||||
|
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// If the frame is not fragmented, a message has been received.
|
// If the frame is not fragmented, a message has been received.
|
||||||
// If the frame is fragmented, it will terminate with a fin bit set
|
// If the frame is fragmented, it will terminate with a fin bit set
|
||||||
// and an opcode of 0 (continuation), therefore we handle that when
|
// and an opcode of 0 (continuation), therefore we handle that when
|
||||||
// parsing continuation frames, not here.
|
// parsing continuation frames, not here.
|
||||||
if (!this.#info.fragmented && this.#info.fin) {
|
if (!this.#info.fragmented && this.#info.fin) {
|
||||||
const fullMessage = Buffer.concat(this.#fragments)
|
websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
|
||||||
websocketMessageReceived(this.ws, this.#info.binaryType, fullMessage)
|
|
||||||
this.#fragments.length = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#state = parserStates.INFO
|
this.#state = parserStates.INFO
|
||||||
} else {
|
} else {
|
||||||
this.#extensions.get('permessage-deflate').decompress(body, this.#info.fin, (error, data) => {
|
this.#extensions.get('permessage-deflate').decompress(
|
||||||
|
body,
|
||||||
|
this.#info.fin,
|
||||||
|
(error, data) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
failWebsocketConnection(this.ws, error.message)
|
const code = error instanceof MessageSizeExceededError ? 1009 : 1007
|
||||||
|
failWebsocketConnectionWithCode(this.ws, code, error.message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.#fragments.push(data)
|
if (!this.writeFragments(data)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.#maxPayloadSize > 0 && this.#fragmentsBytes > this.#maxPayloadSize) {
|
||||||
|
failWebsocketConnectionWithCode(this.ws, 1009, new MessageSizeExceededError().message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (!this.#info.fin) {
|
if (!this.#info.fin) {
|
||||||
this.#state = parserStates.INFO
|
this.#state = parserStates.INFO
|
||||||
@@ -50409,13 +50628,13 @@ class ByteParser extends Writable {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
websocketMessageReceived(this.ws, this.#info.binaryType, Buffer.concat(this.#fragments))
|
websocketMessageReceived(this.ws, this.#info.binaryType, this.consumeFragments())
|
||||||
|
|
||||||
this.#loop = true
|
this.#loop = true
|
||||||
this.#state = parserStates.INFO
|
this.#state = parserStates.INFO
|
||||||
this.#fragments.length = 0
|
|
||||||
this.run(callback)
|
this.run(callback)
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
this.#loop = false
|
this.#loop = false
|
||||||
break
|
break
|
||||||
@@ -50467,6 +50686,35 @@ class ByteParser extends Writable {
|
|||||||
return buffer
|
return buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writeFragments (fragment) {
|
||||||
|
if (
|
||||||
|
this.#maxFragments > 0 &&
|
||||||
|
this.#fragments.length === this.#maxFragments
|
||||||
|
) {
|
||||||
|
failWebsocketConnectionWithCode(this.ws, 1008, 'Too many message fragments')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.#fragmentsBytes += fragment.length
|
||||||
|
this.#fragments.push(fragment)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
consumeFragments () {
|
||||||
|
const fragments = this.#fragments
|
||||||
|
|
||||||
|
if (fragments.length === 1) {
|
||||||
|
this.#fragmentsBytes = 0
|
||||||
|
return fragments.shift()
|
||||||
|
}
|
||||||
|
|
||||||
|
const output = Buffer.concat(fragments, this.#fragmentsBytes)
|
||||||
|
this.#fragments = []
|
||||||
|
this.#fragmentsBytes = 0
|
||||||
|
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
|
||||||
parseCloseBody (data) {
|
parseCloseBody (data) {
|
||||||
assert(data.length !== 1)
|
assert(data.length !== 1)
|
||||||
|
|
||||||
@@ -51502,7 +51750,14 @@ class WebSocket extends EventTarget {
|
|||||||
// once this happens, the connection is open
|
// once this happens, the connection is open
|
||||||
this[kResponse] = response
|
this[kResponse] = response
|
||||||
|
|
||||||
const parser = new ByteParser(this, parsedExtensions)
|
const webSocketOptions = this[kController]?.dispatcher?.webSocketOptions
|
||||||
|
const maxFragments = webSocketOptions?.maxFragments
|
||||||
|
const maxPayloadSize = webSocketOptions?.maxPayloadSize
|
||||||
|
|
||||||
|
const parser = new ByteParser(this, parsedExtensions, {
|
||||||
|
maxFragments,
|
||||||
|
maxPayloadSize
|
||||||
|
})
|
||||||
parser.on('drain', onParserDrain)
|
parser.on('drain', onParserDrain)
|
||||||
parser.on('error', onParserError.bind(this))
|
parser.on('error', onParserError.bind(this))
|
||||||
|
|
||||||
@@ -51713,9 +51968,12 @@ const CACHE_KEY_PREFIX = 'setup-java';
|
|||||||
const supportedPackageManager = [
|
const supportedPackageManager = [
|
||||||
{
|
{
|
||||||
id: 'maven',
|
id: 'maven',
|
||||||
path: [(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository')],
|
path: [
|
||||||
|
(0, path_1.join)(os_1.default.homedir(), '.m2', 'repository'),
|
||||||
|
(0, path_1.join)(os_1.default.homedir(), '.m2', 'wrapper', 'dists')
|
||||||
|
],
|
||||||
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
|
||||||
pattern: ['**/pom.xml']
|
pattern: ['**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'gradle',
|
id: 'gradle',
|
||||||
@@ -51828,7 +52086,15 @@ function save(id) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
yield cache.saveCache(packageManager.path, primaryKey);
|
const cacheId = yield cache.saveCache(packageManager.path, primaryKey);
|
||||||
|
if (cacheId === -1) {
|
||||||
|
// saveCache returns -1 without throwing when the cache was not saved,
|
||||||
|
// e.g. a reserve collision or a read-only token (fork PR). @actions/cache
|
||||||
|
// has already logged the reason at the appropriate severity, so just
|
||||||
|
// trace it instead of misreporting that the cache was saved.
|
||||||
|
core.debug(`Cache was not saved for the key: ${primaryKey}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -52187,6 +52453,13 @@ function getDownloadArchiveExtension() {
|
|||||||
exports.getDownloadArchiveExtension = getDownloadArchiveExtension;
|
exports.getDownloadArchiveExtension = getDownloadArchiveExtension;
|
||||||
function isVersionSatisfies(range, version) {
|
function isVersionSatisfies(range, version) {
|
||||||
var _a;
|
var _a;
|
||||||
|
// Some distributions (e.g. JetBrains Runtime) publish 4-segment versions
|
||||||
|
// like '17.0.8.1+1080.1' that semver rejects. If the candidate version
|
||||||
|
// isn't valid semver, it can't match — bail out rather than letting
|
||||||
|
// compareBuild / satisfies throw.
|
||||||
|
if (!semver.valid(version)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (semver.valid(range)) {
|
if (semver.valid(range)) {
|
||||||
// if full version with build digit is provided as a range (such as '1.2.3+4')
|
// if full version with build digit is provided as a range (such as '1.2.3+4')
|
||||||
// we should check for exact equal via compareBuild
|
// we should check for exact equal via compareBuild
|
||||||
@@ -93780,7 +94053,7 @@ function randomUUID() {
|
|||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.0.5","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
module.exports = /*#__PURE__*/JSON.parse('{"name":"@actions/cache","version":"5.1.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^2.0.0","@actions/exec":"^2.0.0","@actions/glob":"^0.5.1","@protobuf-ts/runtime-rpc":"^2.11.1","@actions/http-client":"^3.0.2","@actions/io":"^2.0.0","@azure/abort-controller":"^1.1.0","@azure/core-rest-pipeline":"^1.22.0","@azure/storage-blob":"^12.29.1","semver":"^6.3.1"},"devDependencies":{"@types/node":"^24.1.0","@types/semver":"^6.0.0","@protobuf-ts/plugin":"^2.9.4","typescript":"^5.2.2"},"overrides":{"uri-js":"npm:uri-js-replace@^1.0.1","node-fetch":"^3.3.2"}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
Vendored
+536
-155
File diff suppressed because it is too large
Load Diff
@@ -34,7 +34,7 @@ Requiring a default version will break users that are pinned to `@main` as they
|
|||||||
|
|
||||||
`setup-java` should be structured in such a way that will allow the open source community to easily add support for extra distributions.
|
`setup-java` should be structured in such a way that will allow the open source community to easily add support for extra distributions.
|
||||||
|
|
||||||
Existing code will be restructured so that distribution specific code will be easily separated. Currently the core download logic is in a single file, `installer.ts`. This file will be split up and abstracted out so that there will be no vendor specified logic. Each distribution will have it's own files under `src/distributions` that will contain the core setup logic for a specific distribution.
|
Existing code will be restructured so that distribution specific code will be easily separated. Currently the core download logic is in a single file, `installer.ts`. This file will be split up and abstracted out so that there will be no vendor specified logic. Each distribution will have its own files under `src/distributions` that will contain the core setup logic for a specific distribution.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
∟ src/
|
∟ src/
|
||||||
|
|||||||
+1
-1
@@ -16,4 +16,4 @@ This folder includes ADRs for the setup-java action. ADRs are proposed in the fo
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- More information about ADRs can be found [here](https://github.com/joelparkerhenderson/architecture_decision_record).
|
- See [more information about ADRs](https://github.com/joelparkerhenderson/architecture_decision_record).
|
||||||
+60
-19
@@ -10,8 +10,10 @@
|
|||||||
- [Alibaba Dragonwell](#Alibaba-Dragonwell)
|
- [Alibaba Dragonwell](#Alibaba-Dragonwell)
|
||||||
- [SapMachine](#SapMachine)
|
- [SapMachine](#SapMachine)
|
||||||
- [GraalVM](#GraalVM)
|
- [GraalVM](#GraalVM)
|
||||||
|
- [GraalVM Community](#GraalVM-Community)
|
||||||
- [JetBrains](#JetBrains)
|
- [JetBrains](#JetBrains)
|
||||||
- [Installing custom Java package type](#Installing-custom-Java-package-type)
|
- [Installing custom Java package type](#Installing-custom-Java-package-type)
|
||||||
|
- [JavaFX Maven project](#JavaFX-Maven-project)
|
||||||
- [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)
|
||||||
- [Testing against different Java distributions](#Testing-against-different-Java-distributions)
|
- [Testing against different Java distributions](#Testing-against-different-Java-distributions)
|
||||||
@@ -36,7 +38,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Adopt
|
### Adopt
|
||||||
@@ -49,7 +51,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'adopt-hotspot'
|
distribution: 'adopt-hotspot'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Zulu
|
### Zulu
|
||||||
@@ -62,7 +64,7 @@ steps:
|
|||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Liberica
|
### Liberica
|
||||||
@@ -75,7 +77,7 @@ steps:
|
|||||||
distribution: 'liberica'
|
distribution: 'liberica'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
java-package: jdk # optional (jdk, jre, jdk+fx or jre+fx) - defaults to jdk
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Microsoft
|
### Microsoft
|
||||||
@@ -87,7 +89,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'microsoft'
|
distribution: 'microsoft'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Microsoft distribution on GHES
|
### Using Microsoft distribution on GHES
|
||||||
@@ -116,7 +118,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'corretto'
|
distribution: 'corretto'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Oracle
|
### Oracle
|
||||||
@@ -129,7 +131,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'oracle'
|
distribution: 'oracle'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### Alibaba Dragonwell
|
### Alibaba Dragonwell
|
||||||
@@ -142,7 +144,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'dragonwell'
|
distribution: 'dragonwell'
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### SapMachine
|
### SapMachine
|
||||||
@@ -154,7 +156,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'sapmachine'
|
distribution: 'sapmachine'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
### GraalVM
|
### GraalVM
|
||||||
@@ -167,6 +169,21 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'graalvm'
|
distribution: 'graalvm'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
- run: |
|
||||||
|
java --version
|
||||||
|
native-image --version
|
||||||
|
```
|
||||||
|
|
||||||
|
### GraalVM Community
|
||||||
|
**NOTE:** GraalVM Community is available for stable JDK 17 and later releases.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
distribution: 'graalvm-community'
|
||||||
|
java-version: '21'
|
||||||
- run: |
|
- run: |
|
||||||
java -cp java HelloWorldApp
|
java -cp java HelloWorldApp
|
||||||
native-image -cp java HelloWorldApp
|
native-image -cp java HelloWorldApp
|
||||||
@@ -176,7 +193,7 @@ steps:
|
|||||||
|
|
||||||
**NOTE:** JetBrains is only available for LTS versions on 11 or later (11, 17, 21, etc.).
|
**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.
|
Not all minor LTS versions are guaranteed 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.
|
For example, `11.0.24` is not available but `11.0.16` is.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -186,7 +203,7 @@ steps:
|
|||||||
with:
|
with:
|
||||||
distribution: 'jetbrains'
|
distribution: 'jetbrains'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
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
|
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
|
||||||
@@ -202,7 +219,7 @@ steps:
|
|||||||
java-package: 'jdk' # optional (jdk, jre, jdk+jcef, jre+jcef, jdk+ft, or jre+ft) - defaults to jdk
|
java-package: 'jdk' # optional (jdk, jre, jdk+jcef, jre+jcef, jdk+ft, or jre+ft) - defaults to jdk
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
You can specify your package type (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)) in the `java-package` parameter.
|
You can specify your package type (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)) in the `java-package` parameter.
|
||||||
@@ -225,7 +242,31 @@ steps:
|
|||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
java-package: jdk # optional (jdk or jre) - defaults to jdk
|
java-package: jdk # optional (jdk or jre) - defaults to jdk
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
|
```
|
||||||
|
|
||||||
|
### JavaFX Maven project
|
||||||
|
|
||||||
|
For JavaFX projects that use Maven, use `jdk+fx` (or `jre+fx`) as the `java-package` value together with a distribution that supports it (e.g. `zulu` or `liberica`). Then include the [`javafx-maven-plugin`](https://openjfx.io/openjfx-docs/#maven) in your `pom.xml` as described in the [Getting Started with JavaFX](https://openjfx.io/openjfx-docs/#maven) guide.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
distribution: 'zulu'
|
||||||
|
java-version: '21'
|
||||||
|
java-package: jdk+fx
|
||||||
|
cache: maven
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn --no-transfer-progress compile
|
||||||
|
```
|
||||||
|
|
||||||
|
To run the JavaFX application in CI:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Run with Maven
|
||||||
|
run: mvn --no-transfer-progress javafx:run
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installing custom Java architecture
|
## Installing custom Java architecture
|
||||||
@@ -238,7 +279,7 @@ steps:
|
|||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
architecture: x86 # optional - default value derived from the runner machine
|
architecture: x86 # optional - default value derived from the runner machine
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installing Java from local file
|
## Installing Java from local file
|
||||||
@@ -256,7 +297,7 @@ steps:
|
|||||||
java-version: '11.0.0'
|
java-version: '11.0.0'
|
||||||
architecture: x64
|
architecture: x64
|
||||||
|
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
If your use-case requires a custom distribution (in the example, alpine-linux is used) or a version that is not provided by setup-java and you want to always install the latest version during runtime, then you can use the following code to auto-download the latest JDK, determine the semver needed for setup-java, and setup-java will take care of the installation and caching on the VM:
|
If your use-case requires a custom distribution (in the example, alpine-linux is used) or a version that is not provided by setup-java and you want to always install the latest version during runtime, then you can use the following code to auto-download the latest JDK, determine the semver needed for setup-java, and setup-java will take care of the installation and caching on the VM:
|
||||||
@@ -281,7 +322,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
|
|||||||
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
||||||
java-version: {{ steps.fetch_latest_jdk.outputs.java_version }}
|
java-version: {{ steps.fetch_latest_jdk.outputs.java_version }}
|
||||||
architecture: x64
|
architecture: x64
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing against different Java distributions
|
## Testing against different Java distributions
|
||||||
@@ -302,7 +343,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.distribution }}
|
distribution: ${{ matrix.distribution }}
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Testing against different platforms
|
#### Testing against different platforms
|
||||||
@@ -322,7 +363,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Publishing using Apache Maven
|
## Publishing using Apache Maven
|
||||||
@@ -580,7 +621,7 @@ steps:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
mvn-toolchain-id: 'some_other_id'
|
mvn-toolchain-id: 'some_other_id'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java --version
|
||||||
```
|
```
|
||||||
|
|
||||||
In case you install multiple versions of Java at once you can use the same syntax as used in `java-versions`. Please note that you have to declare an ID for all Java versions that will be installed or the `mvn-toolchain-id` instruction will be skipped wholesale due to mapping ambiguities.
|
In case you install multiple versions of Java at once you can use the same syntax as used in `java-versions`. Please note that you have to declare an ID for all Java versions that will be installed or the `mvn-toolchain-id` instruction will be skipped wholesale due to mapping ambiguities.
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ We have prepared a short guide so that the process of making your contribution i
|
|||||||
|
|
||||||
## How can I contribute...
|
## How can I contribute...
|
||||||
|
|
||||||
* [Contribute Documentation:green_book:](#contribute-documentation)
|
* [:green_book: Contribute Documentation](#contribute-documentation)
|
||||||
|
|
||||||
* [Contribute Code :computer:](#contribute-code)
|
* [:computer: Contribute Code](#contribute-code)
|
||||||
|
|
||||||
* [Provide Support on Issues:pencil:](#provide-support-on-issues)
|
* [:pencil: Provide Support on Issues](#provide-support-on-issues)
|
||||||
|
|
||||||
* [Review Pull Requests:mag:](#review-pull-requests)
|
* [:mag: Review Pull Requests](#review-pull-requests)
|
||||||
|
|
||||||
## Contribute documentation
|
## Contribute documentation
|
||||||
|
|
||||||
|
|||||||
Generated
+210
-38
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-java",
|
"name": "setup-java",
|
||||||
"version": "5.2.0",
|
"version": "5.3.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "setup-java",
|
"name": "setup-java",
|
||||||
"version": "5.2.0",
|
"version": "5.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^5.0.5",
|
"@actions/cache": "^5.1.0",
|
||||||
"@actions/core": "^2.0.3",
|
"@actions/core": "^2.0.3",
|
||||||
"@actions/exec": "^2.0.0",
|
"@actions/exec": "^2.0.0",
|
||||||
"@actions/glob": "^0.5.1",
|
"@actions/glob": "^0.5.1",
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^25.9.3",
|
"@types/node": "^26.0.0",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
||||||
"@typescript-eslint/parser": "^8.35.1",
|
"@typescript-eslint/parser": "^8.61.1",
|
||||||
"@vercel/ncc": "^0.44.0",
|
"@vercel/ncc": "^0.44.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
@@ -50,9 +50,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/cache": {
|
"node_modules/@actions/cache": {
|
||||||
"version": "5.0.5",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-5.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-5.1.0.tgz",
|
||||||
"integrity": "sha512-jiQSg0gfd+C2KPgcmdCOq7dCuCIQQWQ4b1YfGIRaaA9w7PJbRwTOcCz4LiFEUnqZGf0ha/8OKL3BeNwetHzYsQ==",
|
"integrity": "sha512-kTIj4YPrjjRPKSGlj7f8eq+Pijoy/SKBEbJcAwNsQTFGEF29NGqj1mqD02/PmhV6r4bRAixycexAWpmUJ2aCwg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^2.0.0",
|
"@actions/core": "^2.0.0",
|
||||||
@@ -1993,13 +1993,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "25.9.3",
|
"version": "26.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.0.0.tgz",
|
||||||
"integrity": "sha512-603BddQMv3pUcr4U2dhujk83N2tTDVr/34wII2B6bJy6g+8WD6yUb11jszNs0gdi4PesVWl7ABt8nYMVpnLUcg==",
|
"integrity": "sha512-vf2YFi1iY9lHGwNJMs01biZFbKJkrZR1T6/MlzjhJLPdntOHLhTrDSnSVcdtvjihi4VQNlrFRIxLsDBlQpAipA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": ">=7.24.0 <7.24.7"
|
"undici-types": "~8.3.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/semver": {
|
"node_modules/@types/semver": {
|
||||||
@@ -2072,17 +2072,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "8.48.0",
|
"version": "8.61.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.61.1.tgz",
|
||||||
"integrity": "sha512-jCzKdm/QK0Kg4V4IK/oMlRZlY+QOcdjv89U2NgKHZk1CYTj82/RVSx1mV/0gqCVMJ/DA+Zf/S4NBWNF8GQ+eqQ==",
|
"integrity": "sha512-PJ5vePq5/ognBbrIcoC5+SHO5dfpeLPzP9FpLkzWrguoYQEeeSjlJpVwOpo1JRSTEi7dRcwNy4h4dzV70PqHcg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "8.48.0",
|
"@typescript-eslint/scope-manager": "8.61.1",
|
||||||
"@typescript-eslint/types": "8.48.0",
|
"@typescript-eslint/types": "8.61.1",
|
||||||
"@typescript-eslint/typescript-estree": "8.48.0",
|
"@typescript-eslint/typescript-estree": "8.61.1",
|
||||||
"@typescript-eslint/visitor-keys": "8.48.0",
|
"@typescript-eslint/visitor-keys": "8.61.1",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.4.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
@@ -2092,8 +2092,177 @@
|
|||||||
"url": "https://opencollective.com/typescript-eslint"
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": "^8.57.0 || ^9.0.0",
|
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
||||||
"typescript": ">=4.8.4 <6.0.0"
|
"typescript": ">=4.8.4 <6.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/project-service": {
|
||||||
|
"version": "8.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.61.1.tgz",
|
||||||
|
"integrity": "sha512-PrC4JYGmR241lYnfhmKGTXkFqv8+ymbTFgSAY0fVXpY82/QkMw5TZPl+vGzuDDU2QYJk9fIDOBTntF+yDv9LEA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/tsconfig-utils": "^8.61.1",
|
||||||
|
"@typescript-eslint/types": "^8.61.1",
|
||||||
|
"debug": "^4.4.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4 <6.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
|
||||||
|
"version": "8.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.61.1.tgz",
|
||||||
|
"integrity": "sha512-L2bdIeoQS8FlKAvONAr20w6OcLXeB+qiDKbAooS9A0Ben+iSIkBef0FxqwKWYqt5sa0i4KJtxVyVmhMylKzF5w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/types": "8.61.1",
|
||||||
|
"@typescript-eslint/visitor-keys": "8.61.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/tsconfig-utils": {
|
||||||
|
"version": "8.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.61.1.tgz",
|
||||||
|
"integrity": "sha512-UN/H4di+OO7EWx2ovME+8t31YO+KVnK0RRKEHR3kOt21/Ay8BOq3M1OMvWs5vNiqcFCYGYoxK3MXPZzmMUE+yg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4 <6.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
|
||||||
|
"version": "8.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.61.1.tgz",
|
||||||
|
"integrity": "sha512-G+CRlPqLv7Bz1IZVs03x5K59F1veqL0EJUROAdGhKsEq8qOiRiZbI+HUojPq5l0fEGOKModD9br6lObhB8zkoA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
|
||||||
|
"version": "8.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.61.1.tgz",
|
||||||
|
"integrity": "sha512-u+oQD3BqYWPc8YV9Zab4vaJElJuwOLPRc10Jm1o/qS+6Qwen14HCWwx0Seo4LnSn2wxea2Ik8DxPt2/FHmuhrg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/project-service": "8.61.1",
|
||||||
|
"@typescript-eslint/tsconfig-utils": "8.61.1",
|
||||||
|
"@typescript-eslint/types": "8.61.1",
|
||||||
|
"@typescript-eslint/visitor-keys": "8.61.1",
|
||||||
|
"debug": "^4.4.3",
|
||||||
|
"minimatch": "^10.2.2",
|
||||||
|
"semver": "^7.7.3",
|
||||||
|
"tinyglobby": "^0.2.15",
|
||||||
|
"ts-api-utils": "^2.5.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": ">=4.8.4 <6.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
|
||||||
|
"version": "8.61.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.61.1.tgz",
|
||||||
|
"integrity": "sha512-6fJ9MHWtK14C1DSkiMlHUSOmrVebL7150xZJBlJiL62jjhIA4JmOq6flwBgDxIdBKKdoiZRel+dfPD5MLfny3w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@typescript-eslint/types": "8.61.1",
|
||||||
|
"eslint-visitor-keys": "^5.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/typescript-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/balanced-match": {
|
||||||
|
"version": "4.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
|
||||||
|
"integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": "18 || 20 || >=22"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/brace-expansion": {
|
||||||
|
"version": "5.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
|
||||||
|
"integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"balanced-match": "^4.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "18 || 20 || >=22"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/eslint-visitor-keys": {
|
||||||
|
"version": "5.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
|
||||||
|
"integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"engines": {
|
||||||
|
"node": "^20.19.0 || ^22.13.0 || >=24"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://opencollective.com/eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@typescript-eslint/parser/node_modules/minimatch": {
|
||||||
|
"version": "10.2.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
|
||||||
|
"integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "BlueOak-1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^5.0.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "18 || 20 || >=22"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/project-service": {
|
"node_modules/@typescript-eslint/project-service": {
|
||||||
@@ -3131,11 +3300,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/debug": {
|
"node_modules/debug": {
|
||||||
"version": "4.3.4",
|
"version": "4.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
|
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||||
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
|
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ms": "2.1.2"
|
"ms": "^2.1.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0"
|
"node": ">=6.0"
|
||||||
@@ -5165,9 +5335,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ms": {
|
"node_modules/ms": {
|
||||||
"version": "2.1.2",
|
"version": "2.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/napi-postinstall": {
|
"node_modules/napi-postinstall": {
|
||||||
"version": "0.3.4",
|
"version": "0.3.4",
|
||||||
@@ -6095,10 +6266,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/ts-api-utils": {
|
"node_modules/ts-api-utils": {
|
||||||
"version": "2.1.0",
|
"version": "2.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
|
||||||
"integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==",
|
"integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.12"
|
"node": ">=18.12"
|
||||||
},
|
},
|
||||||
@@ -6247,18 +6419,18 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "6.24.1",
|
"version": "6.27.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-6.27.0.tgz",
|
||||||
"integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==",
|
"integrity": "sha512-YmfV3YnEDzXRC5lZ2jWtWWHKGUm1zIt8AhesR1tens+HTNv+YZlN/dp6G727LOvMJ8xjP9Be7Y2Sdr96LDm+pg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.17"
|
"node": ">=18.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/undici-types": {
|
"node_modules/undici-types": {
|
||||||
"version": "7.24.6",
|
"version": "8.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
|
||||||
"integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
|
"integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-java",
|
"name": "setup-java",
|
||||||
"version": "5.2.0",
|
"version": "5.3.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup java action",
|
"description": "setup java action",
|
||||||
"main": "dist/setup/index.js",
|
"main": "dist/setup/index.js",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^5.0.5",
|
"@actions/cache": "^5.1.0",
|
||||||
"@actions/core": "^2.0.3",
|
"@actions/core": "^2.0.3",
|
||||||
"@actions/exec": "^2.0.0",
|
"@actions/exec": "^2.0.0",
|
||||||
"@actions/glob": "^0.5.1",
|
"@actions/glob": "^0.5.1",
|
||||||
@@ -41,10 +41,10 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^30.0.0",
|
"@types/jest": "^30.0.0",
|
||||||
"@types/node": "^25.9.3",
|
"@types/node": "^26.0.0",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
||||||
"@typescript-eslint/parser": "^8.35.1",
|
"@typescript-eslint/parser": "^8.61.1",
|
||||||
"@vercel/ncc": "^0.44.0",
|
"@vercel/ncc": "^0.44.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^10.1.8",
|
"eslint-config-prettier": "^10.1.8",
|
||||||
|
|||||||
+14
-3
@@ -23,9 +23,12 @@ interface PackageManager {
|
|||||||
const supportedPackageManager: PackageManager[] = [
|
const supportedPackageManager: PackageManager[] = [
|
||||||
{
|
{
|
||||||
id: 'maven',
|
id: 'maven',
|
||||||
path: [join(os.homedir(), '.m2', 'repository')],
|
path: [
|
||||||
|
join(os.homedir(), '.m2', 'repository'),
|
||||||
|
join(os.homedir(), '.m2', 'wrapper', 'dists')
|
||||||
|
],
|
||||||
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---maven
|
||||||
pattern: ['**/pom.xml']
|
pattern: ['**/pom.xml', '**/.mvn/wrapper/maven-wrapper.properties']
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'gradle',
|
id: 'gradle',
|
||||||
@@ -146,7 +149,15 @@ export async function save(id: string) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await cache.saveCache(packageManager.path, primaryKey);
|
const cacheId = await cache.saveCache(packageManager.path, primaryKey);
|
||||||
|
if (cacheId === -1) {
|
||||||
|
// saveCache returns -1 without throwing when the cache was not saved,
|
||||||
|
// e.g. a reserve collision or a read-only token (fork PR). @actions/cache
|
||||||
|
// has already logged the reason at the appropriate severity, so just
|
||||||
|
// trace it instead of misreporting that the cache was saved.
|
||||||
|
core.debug(`Cache was not saved for the key: ${primaryKey}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
core.info(`Cache saved with the key: ${primaryKey}`);
|
core.info(`Cache saved with the key: ${primaryKey}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const err = error as Error;
|
const err = error as Error;
|
||||||
|
|||||||
@@ -11,7 +11,10 @@ import {CorrettoDistribution} from './corretto/installer';
|
|||||||
import {OracleDistribution} from './oracle/installer';
|
import {OracleDistribution} from './oracle/installer';
|
||||||
import {DragonwellDistribution} from './dragonwell/installer';
|
import {DragonwellDistribution} from './dragonwell/installer';
|
||||||
import {SapMachineDistribution} from './sapmachine/installer';
|
import {SapMachineDistribution} from './sapmachine/installer';
|
||||||
import {GraalVMDistribution} from './graalvm/installer';
|
import {
|
||||||
|
GraalVMCommunityDistribution,
|
||||||
|
GraalVMDistribution
|
||||||
|
} from './graalvm/installer';
|
||||||
import {JetBrainsDistribution} from './jetbrains/installer';
|
import {JetBrainsDistribution} from './jetbrains/installer';
|
||||||
|
|
||||||
enum JavaDistribution {
|
enum JavaDistribution {
|
||||||
@@ -29,6 +32,7 @@ enum JavaDistribution {
|
|||||||
Dragonwell = 'dragonwell',
|
Dragonwell = 'dragonwell',
|
||||||
SapMachine = 'sapmachine',
|
SapMachine = 'sapmachine',
|
||||||
GraalVM = 'graalvm',
|
GraalVM = 'graalvm',
|
||||||
|
GraalVMCommunity = 'graalvm-community',
|
||||||
JetBrains = 'jetbrains'
|
JetBrains = 'jetbrains'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +78,8 @@ export function getJavaDistribution(
|
|||||||
return new SapMachineDistribution(installerOptions);
|
return new SapMachineDistribution(installerOptions);
|
||||||
case JavaDistribution.GraalVM:
|
case JavaDistribution.GraalVM:
|
||||||
return new GraalVMDistribution(installerOptions);
|
return new GraalVMDistribution(installerOptions);
|
||||||
|
case JavaDistribution.GraalVMCommunity:
|
||||||
|
return new GraalVMCommunityDistribution(installerOptions);
|
||||||
case JavaDistribution.JetBrains:
|
case JavaDistribution.JetBrains:
|
||||||
return new JetBrainsDistribution(installerOptions);
|
return new JetBrainsDistribution(installerOptions);
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import * as core from '@actions/core';
|
|||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import semver from 'semver';
|
||||||
import {JavaBase} from '../base-installer';
|
import {JavaBase} from '../base-installer';
|
||||||
import {HttpCodes} from '@actions/http-client';
|
import {HttpCodes} from '@actions/http-client';
|
||||||
import {GraalVMEAVersion} from './models';
|
import {GraalVMEAVersion} from './models';
|
||||||
@@ -11,14 +12,26 @@ import {
|
|||||||
JavaInstallerResults
|
JavaInstallerResults
|
||||||
} from '../base-models';
|
} from '../base-models';
|
||||||
import {
|
import {
|
||||||
|
convertVersionToSemver,
|
||||||
extractJdkFile,
|
extractJdkFile,
|
||||||
getDownloadArchiveExtension,
|
getDownloadArchiveExtension,
|
||||||
getGitHubHttpHeaders,
|
getGitHubHttpHeaders,
|
||||||
renameWinArchive
|
getNextPageUrlFromLinkHeader,
|
||||||
|
isVersionSatisfies,
|
||||||
|
MAX_PAGINATION_PAGES,
|
||||||
|
renameWinArchive,
|
||||||
|
validatePaginationUrl
|
||||||
} from '../../util';
|
} from '../../util';
|
||||||
|
|
||||||
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
|
||||||
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
const GRAALVM_DOWNLOAD_URL = 'https://www.graalvm.org/downloads/';
|
||||||
|
const GRAALVM_COMMUNITY_RELEASES_URL =
|
||||||
|
'https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=100';
|
||||||
|
const GRAALVM_COMMUNITY_RELEASES_PAGE_ORIGIN = 'https://api.github.com';
|
||||||
|
const GRAALVM_COMMUNITY_DOWNLOAD_URL =
|
||||||
|
'https://github.com/graalvm/graalvm-ce-builds/releases';
|
||||||
|
const GRAALVM_COMMUNITY_ASSET_PREFIX = 'graalvm-community-jdk-';
|
||||||
|
const GRAALVM_COMMUNITY_VERSION_PATTERN = /^\d+(?:\.\d+)*$/;
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
|
||||||
const GRAALVM_MIN_VERSION = 17;
|
const GRAALVM_MIN_VERSION = 17;
|
||||||
@@ -26,9 +39,23 @@ const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'] as const;
|
|||||||
type SupportedArchitecture = (typeof SUPPORTED_ARCHITECTURES)[number];
|
type SupportedArchitecture = (typeof SUPPORTED_ARCHITECTURES)[number];
|
||||||
type OsVersions = 'linux' | 'macos' | 'windows';
|
type OsVersions = 'linux' | 'macos' | 'windows';
|
||||||
|
|
||||||
|
interface GraalVMCommunityAsset {
|
||||||
|
name: string;
|
||||||
|
browser_download_url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GraalVMCommunityRelease {
|
||||||
|
draft: boolean;
|
||||||
|
prerelease: boolean;
|
||||||
|
assets: GraalVMCommunityAsset[];
|
||||||
|
}
|
||||||
|
|
||||||
export class GraalVMDistribution extends JavaBase {
|
export class GraalVMDistribution extends JavaBase {
|
||||||
constructor(installerOptions: JavaInstallerOptions) {
|
constructor(
|
||||||
super('GraalVM', installerOptions);
|
installerOptions: JavaInstallerOptions,
|
||||||
|
distributionName = 'GraalVM'
|
||||||
|
) {
|
||||||
|
super(distributionName, installerOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async downloadTool(
|
protected async downloadTool(
|
||||||
@@ -85,40 +112,14 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
protected async findPackageForDownload(
|
protected async findPackageForDownload(
|
||||||
range: string
|
range: string
|
||||||
): Promise<JavaDownloadRelease> {
|
): Promise<JavaDownloadRelease> {
|
||||||
// Add input validation
|
this.validateVersionRange(range);
|
||||||
if (!range || typeof range !== 'string') {
|
const arch = this.getSupportedArchitecture();
|
||||||
throw new Error('Version range is required and must be a string');
|
|
||||||
}
|
|
||||||
|
|
||||||
const arch = this.distributionArchitecture();
|
|
||||||
if (!SUPPORTED_ARCHITECTURES.includes(arch as SupportedArchitecture)) {
|
|
||||||
throw new Error(
|
|
||||||
`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.stable) {
|
if (!this.stable) {
|
||||||
return this.findEABuildDownloadUrl(`${range}-ea`);
|
return this.findEABuildDownloadUrl(`${range}-ea`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.packageType !== 'jdk') {
|
const {platform, extension, major} = this.validateStableBuildRequest(range);
|
||||||
throw new Error('GraalVM provides only the `jdk` package type');
|
|
||||||
}
|
|
||||||
|
|
||||||
const platform = this.getPlatform();
|
|
||||||
const extension = getDownloadArchiveExtension();
|
|
||||||
const major = range.includes('.') ? range.split('.')[0] : range;
|
|
||||||
const majorVersion = parseInt(major);
|
|
||||||
|
|
||||||
if (isNaN(majorVersion)) {
|
|
||||||
throw new Error(`Invalid version format: ${range}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (majorVersion < GRAALVM_MIN_VERSION) {
|
|
||||||
throw new Error(
|
|
||||||
`GraalVM is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fileUrl = this.constructFileUrl(
|
const fileUrl = this.constructFileUrl(
|
||||||
range,
|
range,
|
||||||
@@ -134,6 +135,56 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
return {url: fileUrl, version: range};
|
return {url: fileUrl, version: range};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected validateVersionRange(range: string): void {
|
||||||
|
if (!range || typeof range !== 'string') {
|
||||||
|
throw new Error('Version range is required and must be a string');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getSupportedArchitecture(): SupportedArchitecture {
|
||||||
|
const arch = this.distributionArchitecture();
|
||||||
|
if (!SUPPORTED_ARCHITECTURES.includes(arch as SupportedArchitecture)) {
|
||||||
|
throw new Error(
|
||||||
|
`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return arch as SupportedArchitecture;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected validateStableBuildRequest(range: string): {
|
||||||
|
platform: OsVersions;
|
||||||
|
extension: string;
|
||||||
|
major: string;
|
||||||
|
} {
|
||||||
|
if (this.packageType !== 'jdk') {
|
||||||
|
throw new Error(
|
||||||
|
`${this.distribution} provides only the \`jdk\` package type`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const platform = this.getPlatform();
|
||||||
|
const extension = getDownloadArchiveExtension();
|
||||||
|
const major = range.includes('.') ? range.split('.')[0] : range;
|
||||||
|
const majorVersion = parseInt(major);
|
||||||
|
|
||||||
|
if (isNaN(majorVersion)) {
|
||||||
|
throw new Error(`Invalid version format: ${range}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (majorVersion < GRAALVM_MIN_VERSION) {
|
||||||
|
throw new Error(
|
||||||
|
`${this.distribution} is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
platform,
|
||||||
|
major,
|
||||||
|
extension
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private constructFileUrl(
|
private constructFileUrl(
|
||||||
range: string,
|
range: string,
|
||||||
major: string,
|
major: string,
|
||||||
@@ -280,3 +331,131 @@ export class GraalVMDistribution extends JavaBase {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class GraalVMCommunityDistribution extends GraalVMDistribution {
|
||||||
|
constructor(installerOptions: JavaInstallerOptions) {
|
||||||
|
super(installerOptions, 'GraalVM Community');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected get toolcacheFolderName(): string {
|
||||||
|
return `Java_GraalVM_Community_${this.packageType}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async findPackageForDownload(
|
||||||
|
range: string
|
||||||
|
): Promise<JavaDownloadRelease> {
|
||||||
|
this.validateVersionRange(range);
|
||||||
|
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('GraalVM Community does not provide early access builds');
|
||||||
|
}
|
||||||
|
|
||||||
|
const arch = this.getSupportedArchitecture();
|
||||||
|
const {platform, extension} = this.validateStableBuildRequest(range);
|
||||||
|
// GraalVM Community asset names embed the platform, architecture and
|
||||||
|
// archive type, e.g. `graalvm-community-jdk-21.0.2_linux-x64_bin.tar.gz`.
|
||||||
|
const assetSuffix = `_${platform}-${arch}_bin.${extension}`;
|
||||||
|
const availableVersions = await this.getAvailableVersions(assetSuffix);
|
||||||
|
|
||||||
|
const satisfiedVersion = availableVersions
|
||||||
|
.filter(item => isVersionSatisfies(range, item.version))
|
||||||
|
.sort((a, b) => -semver.compareBuild(a.version, b.version))[0];
|
||||||
|
|
||||||
|
if (!satisfiedVersion) {
|
||||||
|
const error = this.createVersionNotFoundError(
|
||||||
|
range,
|
||||||
|
availableVersions.map(item => item.version),
|
||||||
|
`Platform: ${platform}`
|
||||||
|
);
|
||||||
|
error.message += `\nPlease check if this version is available at ${GRAALVM_COMMUNITY_DOWNLOAD_URL}.`;
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
return satisfiedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getAvailableVersions(
|
||||||
|
assetSuffix: string
|
||||||
|
): Promise<JavaDownloadRelease[]> {
|
||||||
|
const headers = getGitHubHttpHeaders();
|
||||||
|
const versions = new Map<string, JavaDownloadRelease>();
|
||||||
|
let releasesUrl: string | null = GRAALVM_COMMUNITY_RELEASES_URL;
|
||||||
|
|
||||||
|
for (
|
||||||
|
let pageIndex = 0;
|
||||||
|
releasesUrl && pageIndex < MAX_PAGINATION_PAGES;
|
||||||
|
pageIndex++
|
||||||
|
) {
|
||||||
|
const response = await this.http.getJson<GraalVMCommunityRelease[]>(
|
||||||
|
releasesUrl,
|
||||||
|
headers
|
||||||
|
);
|
||||||
|
|
||||||
|
const releases = Array.isArray(response.result) ? response.result : [];
|
||||||
|
if (releases.length === 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const release of releases) {
|
||||||
|
if (release.draft || release.prerelease) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const asset of release.assets ?? []) {
|
||||||
|
const version = this.extractAssetVersion(asset.name, assetSuffix);
|
||||||
|
if (version) {
|
||||||
|
versions.set(version, {
|
||||||
|
version,
|
||||||
|
url: asset.browser_download_url
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
releasesUrl = this.getNextReleasesUrl(response.headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [...versions.values()];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the GraalVM JDK version encoded in a release asset name when it
|
||||||
|
// matches the requested platform/architecture/archive suffix, otherwise null.
|
||||||
|
private extractAssetVersion(
|
||||||
|
assetName: string,
|
||||||
|
assetSuffix: string
|
||||||
|
): string | null {
|
||||||
|
if (
|
||||||
|
!assetName.startsWith(GRAALVM_COMMUNITY_ASSET_PREFIX) ||
|
||||||
|
!assetName.endsWith(assetSuffix)
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rawVersion = assetName.slice(
|
||||||
|
GRAALVM_COMMUNITY_ASSET_PREFIX.length,
|
||||||
|
-assetSuffix.length
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!GRAALVM_COMMUNITY_VERSION_PATTERN.test(rawVersion)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return convertVersionToSemver(rawVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getNextReleasesUrl(
|
||||||
|
headers: Record<string, string | string[] | undefined>
|
||||||
|
): string | null {
|
||||||
|
const nextUrl = getNextPageUrlFromLinkHeader(headers);
|
||||||
|
if (
|
||||||
|
nextUrl &&
|
||||||
|
!validatePaginationUrl(nextUrl, GRAALVM_COMMUNITY_RELEASES_PAGE_ORIGIN)
|
||||||
|
) {
|
||||||
|
core.warning(
|
||||||
|
`Ignoring pagination link with unexpected origin: ${nextUrl}`
|
||||||
|
);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return nextUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -171,6 +171,49 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"version": "17.0.18",
|
||||||
|
"stable": true,
|
||||||
|
"release_url": "https://aka.ms/download-jdk",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-macos-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-linux-x64.tar.gz",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-x64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-windows-x64.zip",
|
||||||
|
"arch": "x64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-x64.zip"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-macos-aarch64.tar.gz",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "darwin",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-macos-aarch64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-linux-aarch64.tar.gz",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "linux",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-linux-aarch64.tar.gz"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename": "microsoft-jdk-17.0.18-windows-aarch64.zip",
|
||||||
|
"arch": "aarch64",
|
||||||
|
"platform": "win32",
|
||||||
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.18-windows-aarch64.zip"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"version": "17.0.10",
|
"version": "17.0.10",
|
||||||
"stable": true,
|
"stable": true,
|
||||||
@@ -180,7 +223,7 @@
|
|||||||
"filename": "microsoft-jdk-17.0.10-macos-x64.tar.gz",
|
"filename": "microsoft-jdk-17.0.10-macos-x64.tar.gz",
|
||||||
"arch": "x64",
|
"arch": "x64",
|
||||||
"platform": "darwin",
|
"platform": "darwin",
|
||||||
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-x64.tar.gz"
|
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.10-macos-x64.tar.gz"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename": "microsoft-jdk-17.0.10-linux-x64.tar.gz",
|
"filename": "microsoft-jdk-17.0.10-linux-x64.tar.gz",
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ export function getDownloadArchiveExtension() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isVersionSatisfies(range: string, version: string): boolean {
|
export function isVersionSatisfies(range: string, version: string): boolean {
|
||||||
|
// Some distributions (e.g. JetBrains Runtime) publish 4-segment versions
|
||||||
|
// like '17.0.8.1+1080.1' that semver rejects. If the candidate version
|
||||||
|
// isn't valid semver, it can't match — bail out rather than letting
|
||||||
|
// compareBuild / satisfies throw.
|
||||||
|
if (!semver.valid(version)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (semver.valid(range)) {
|
if (semver.valid(range)) {
|
||||||
// if full version with build digit is provided as a range (such as '1.2.3+4')
|
// if full version with build digit is provided as a range (such as '1.2.3+4')
|
||||||
// we should check for exact equal via compareBuild
|
// we should check for exact equal via compareBuild
|
||||||
|
|||||||
Reference in New Issue
Block a user