Compare commits

..

9 Commits

Author SHA1 Message Date
Sankalp Kotewar
40635cc059 Upgraded actions/cache to 3.0.4 2022-10-17 15:14:19 +05:30
Sankalp Kotewar
88646268d9
Revert "Update actions/cache to 3.0.4 (latest)"
This reverts commit 0ed0637d81b49bbb848f1a9c401946f71c394584.
2022-10-17 09:36:49 +00:00
Sankalp Kotewar
28643dda61
Revert "Updated cache version in license file"
This reverts commit 31e6e0efdf36d9c43290c98ebb2ebeae87cb63da.
2022-10-17 09:36:40 +00:00
Sankalp Kotewar
7e737fcd5c
Revert "Updated lockfile to be in sync with package.json"
This reverts commit 2661c0c4e3f2d1e793b8abf3b23880f38617930b.
2022-10-17 09:36:27 +00:00
Sankalp Kotewar
9645ab43e3
Revert "Updated license files"
This reverts commit 45cf7ca3f39de17c588436c3b6d4dd84ce7eed9d.
2022-10-17 09:36:08 +00:00
Sankalp Kotewar
45cf7ca3f3
Updated license files 2022-10-17 05:40:11 +00:00
Sankalp Kotewar
2661c0c4e3
Updated lockfile to be in sync with package.json 2022-10-11 12:23:46 +00:00
Sankalp Kotewar
31e6e0efdf
Updated cache version in license file 2022-10-11 12:22:02 +00:00
Sankalp Kotewar
0ed0637d81
Update actions/cache to 3.0.4 (latest) 2022-10-11 12:17:52 +00:00
132 changed files with 49509 additions and 100361 deletions

View File

@ -1,6 +0,0 @@
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!src/

View File

@ -1,51 +0,0 @@
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:eslint-plugin-jest/recommended',
'eslint-config-prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'eslint-plugin-node', 'eslint-plugin-jest'],
rules: {
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-ignore': 'allow-with-description'
}
],
'no-console': 'error',
'yoda': 'error',
'prefer-const': [
'error',
{
destructuring: 'all'
}
],
'no-control-regex': 'off',
'no-constant-condition': ['error', {checkLoops: false}],
'node/no-extraneous-import': 'error'
},
overrides: [
{
files: ['**/*{test,spec}.ts'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'jest/no-standalone-expect': 'off',
'jest/no-conditional-expect': 'off',
'no-console': 'off',
}
}
],
env: {
node: true,
es6: true,
'jest/globals': true
}
};

1
.gitattributes vendored
View File

@ -1,4 +1,3 @@
* text=auto eol=lf
dist/index.js -diff -merge dist/index.js -diff -merge
dist/index.js linguist-generated=true dist/index.js linguist-generated=true
.licenses/** -diff linguist-generated=true .licenses/** -diff linguist-generated=true

3
.github/CODEOWNERS vendored
View File

@ -1 +1,2 @@
* @actions/setup-actions-team * @actions/actions-service
* @actions/virtual-environments-owners

View File

@ -1,19 +0,0 @@
name: Basic validation
on:
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
call-basic-validation:
name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with:
node-version: '20.x'

31
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Build Action
on:
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v3
- name: Setup Node.JS 16
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm test

View File

@ -1,3 +1,8 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/ name: Check dist/
on: on:
@ -12,8 +17,36 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call-check-dist: check-dist:
name: Check dist/ runs-on: ubuntu-latest
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
steps:
- uses: actions/checkout@v3
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with: with:
node-version: '20.x' node-version: 16.x
cache: npm
- name: Install dependencies
run: npm ci
- name: Rebuild the dist/ directory
run: npm run build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/

View File

@ -1,14 +0,0 @@
name: CodeQL analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 3 * * 0'
jobs:
call-codeQL-analysis:
name: CodeQL analysis
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main

View File

@ -1,93 +0,0 @@
name: Validate cache with cache-dependency-path option
on:
push:
branches:
- main
- releases/*
paths-ignore:
- '**.md'
pull_request:
paths-ignore:
- '**.md'
defaults:
run:
shell: bash
jobs:
gradle1-save:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle
uses: ./
id: setup-java
with:
distribution: 'adopt'
java-version: '11'
cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Create files to cache
# Need to avoid using Gradle daemon to stabilize the save process on Windows
# https://github.com/actions/cache/issues/454#issuecomment-840493935
run: |
gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1
if [ ! -d ~/.gradle/caches ]; then
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
exit 1
fi
gradle1-restore:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
needs: gradle1-save
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle
uses: ./
id: setup-java
with:
distribution: 'adopt'
java-version: '11'
cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Confirm that ~/.gradle/caches directory has been made
run: |
if [ ! -d ~/.gradle/caches ]; then
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
exit 1
fi
ls ~/.gradle/caches/
gradle2-restore:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
needs: gradle1-save
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run setup-java with the cache for gradle
uses: ./
id: setup-java
with:
distribution: 'adopt'
java-version: '11'
cache: gradle
cache-dependency-path: __tests__/cache/gradle2/*.gradle*
- name: Confirm that ~/.gradle/caches directory has not been made
run: |
if [ -d ~/.gradle/caches ]; then
echo "::error::The ~/.gradle/caches directory exists unexpectedly"
exit 1
fi

View File

@ -1,5 +1,4 @@
name: Validate cache name: Validate cache
on: on:
push: push:
branches: branches:
@ -21,10 +20,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- 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
@ -36,7 +35,7 @@ jobs:
# Need to avoid using Gradle daemon to stabilize the save process on Windows # Need to avoid using Gradle daemon to stabilize the save process on Windows
# https://github.com/actions/cache/issues/454#issuecomment-840493935 # https://github.com/actions/cache/issues/454#issuecomment-840493935
run: | run: |
gradle downloadDependencies --no-daemon -p __tests__/cache/gradle1 gradle downloadDependencies --no-daemon -p __tests__/cache/gradle
if [ ! -d ~/.gradle/caches ]; then if [ ! -d ~/.gradle/caches ]; then
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly" echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
exit 1 exit 1
@ -46,11 +45,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
needs: gradle-save needs: gradle-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
@ -70,10 +69,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Run setup-java with the cache for maven - name: Run setup-java with the cache for maven
uses: ./ uses: ./
id: setup-java id: setup-java
@ -93,11 +92,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
needs: maven-save needs: maven-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Run setup-java with the cache for maven - name: Run setup-java with the cache for maven
uses: ./ uses: ./
id: setup-java id: setup-java
@ -121,10 +120,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- 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
@ -132,21 +131,17 @@ jobs:
distribution: 'adopt' distribution: 'adopt'
java-version: '11' java-version: '11'
cache: sbt cache: sbt
- name: Setup SBT
if: matrix.os == 'macos-13'
run: |
echo ""Installing SBT...""
brew install sbt
- name: Create files to cache - name: Create files to cache
run: sbt update run: sbt update
- name: Check files to cache on macos-latest - name: Check files to cache on macos-latest
if: matrix.os == 'macos-13' if: matrix.os == 'macos-latest'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
exit 1 exit 1
fi fi
- name: Check files to cache on windows-latest - name: Check files to cache on windows-latest
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: | run: |
@ -154,6 +149,8 @@ jobs:
echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly" echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly"
exit 1 exit 1
fi fi
- name: Check files to cache on ubuntu-latest - name: Check files to cache on ubuntu-latest
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: | run: |
@ -161,6 +158,7 @@ jobs:
echo "::error::The ~/.cache/coursier directory does not exist unexpectedly" echo "::error::The ~/.cache/coursier directory does not exist unexpectedly"
exit 1 exit 1
fi fi
sbt-restore: sbt-restore:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
defaults: defaults:
@ -170,11 +168,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
needs: sbt-save needs: sbt-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: Run setup-java with the cache for sbt - name: Run setup-java with the cache for sbt
uses: ./ uses: ./
id: setup-java id: setup-java
@ -184,13 +182,14 @@ jobs:
cache: sbt cache: sbt
- name: Confirm that ~/Library/Caches/Coursier directory has been made - name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-13' if: matrix.os == 'macos-latest'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
exit 1 exit 1
fi fi
ls ~/Library/Caches/Coursier ls ~/Library/Caches/Coursier
- name: Confirm that ~/AppData/Local/Coursier/Cache directory has been made - name: Confirm that ~/AppData/Local/Coursier/Cache directory has been made
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: | run: |
@ -199,6 +198,7 @@ jobs:
exit 1 exit 1
fi fi
ls ~/AppData/Local/Coursier/Cache ls ~/AppData/Local/Coursier/Cache
- name: Confirm that ~/.cache/coursier directory has been made - name: Confirm that ~/.cache/coursier directory has been made
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: | run: |

View File

@ -1,5 +1,4 @@
name: Validate local file name: Validate local file
on: on:
push: push:
branches: branches:
@ -21,7 +20,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@v4 uses: actions/checkout@v3
- name: Download Adopt OpenJDK file - name: Download Adopt OpenJDK file
run: | run: |
if ($IsLinux) { if ($IsLinux) {
@ -58,7 +57,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@v4 uses: actions/checkout@v3
- name: Download Zulu OpenJDK file - name: Download Zulu OpenJDK file
run: | run: |
if ($IsLinux) { if ($IsLinux) {
@ -95,7 +94,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@v4 uses: actions/checkout@v3
- name: Download Eclipse Temurin file - name: Download Eclipse Temurin file
run: | run: |
if ($IsLinux) { if ($IsLinux) {

View File

@ -1,5 +1,4 @@
name: Validate publishing functionality name: Validate publishing functionality
on: on:
push: push:
branches: branches:
@ -25,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@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -60,7 +59,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@v4 uses: actions/checkout@v3
- name: Create fake settings.xml - name: Create fake settings.xml
run: | run: |
$xmlDirectory = Join-Path $HOME ".m2" $xmlDirectory = Join-Path $HOME ".m2"
@ -96,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@v4 uses: actions/checkout@v3
- name: Create fake settings.xml - name: Create fake settings.xml
run: | run: |
$xmlDirectory = Join-Path $HOME ".m2" $xmlDirectory = Join-Path $HOME ".m2"
@ -133,7 +132,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@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java

View File

@ -1,5 +1,4 @@
name: Validate Java e2e name: Validate Java e2e
on: on:
push: push:
branches: branches:
@ -20,38 +19,15 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: [ distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft', 'corretto' ] # internally 'adopt-hotspot' is the same as 'adopt'
'temurin', version: ['8', '11', '16']
'adopt',
'adopt-openj9',
'zulu',
'liberica',
'microsoft',
'semeru',
'corretto',
'dragonwell'
] # internally 'adopt-hotspot' is the same as 'adopt'
version: ['21', '11', '17']
exclude: exclude:
- distribution: microsoft - distribution: microsoft
version: 8 version: 8
- distribution: dragonwell
os: macos-13
include:
- distribution: oracle
os: macos-13
version: 17
- distribution: oracle
os: windows-latest
version: 20
- distribution: oracle
os: ubuntu-latest
version: 20
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -73,21 +49,11 @@ jobs:
distribution: ['temurin', 'zulu', 'liberica'] distribution: ['temurin', 'zulu', 'liberica']
version: version:
- '11.0' - '11.0'
- '21.0' - '8.0.302'
- '17.0.7+7' - '16.0.2+7'
include:
- distribution: oracle
os: ubuntu-latest
version: '20.0.1'
- distribution: dragonwell
os: ubuntu-latest
version: '11.0'
- distribution: dragonwell
os: ubuntu-latest
version: '11.0.13+9'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -106,13 +72,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell'] distribution: ['temurin', 'zulu', 'liberica']
exclude:
- distribution: dragonwell
os: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -132,13 +95,10 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell'] distribution: ['temurin', 'zulu', 'liberica']
exclude:
- distribution: dragonwell
os: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -171,11 +131,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
version: ['17-ea', '15.0.0-ea.14'] version: ['17-ea', '15.0.0-ea.14']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -197,7 +157,7 @@ jobs:
version: ['17-ea'] version: ['17-ea']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -215,22 +175,22 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica', 'semeru'] distribution: ['temurin', 'zulu', 'liberica']
java-package: ['jre'] java-package: ['jre']
version: ['17.0'] version: ['17.0']
include: include:
- distribution: 'zulu' - distribution: 'zulu'
java-package: jre+fx java-package: jre+fx
version: '21' version: '8'
os: ubuntu-latest os: ubuntu-latest
- distribution: 'zulu' - distribution: 'zulu'
java-package: jdk+fx java-package: jdk+fx
version: '21.0' version: '8.0.242'
os: ubuntu-latest os: ubuntu-latest
- distribution: 'liberica' - distribution: 'liberica'
java-package: jdk+fx java-package: jdk+fx
version: '21' version: '8'
os: ubuntu-latest os: ubuntu-latest
- distribution: 'liberica' - distribution: 'liberica'
java-package: jre+fx java-package: jre+fx
@ -242,7 +202,7 @@ jobs:
os: windows-latest os: windows-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -268,7 +228,7 @@ jobs:
version: ['11'] version: ['11']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v3
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@ -280,115 +240,4 @@ jobs:
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
shell: bash shell: bash
setup-java-version-both-version-inputs-presents: # Only Microsoft provides AArch64. However, GitHub-hosted runners do not support this architecture.
name: ${{ matrix.distribution }} version (should be from input) - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'microsoft', 'corretto']
java-version-file: ['.java-version', '.tool-versions']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create .java-version file
shell: bash
run: echo "17" > .java-version
- name: Create .tool-versions file
shell: bash
run: echo "java 17" > .tool-versions
- name: setup-java
uses: ./
id: setup-java
with:
distribution: ${{ matrix.distribution }}
java-version: 11
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
shell: bash
setup-java-version-from-file-major-notation:
name: ${{ matrix.distribution }} version from file X - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica', 'microsoft', 'corretto']
java-version-file: ['.java-version', '.tool-versions']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create .java-version file
shell: bash
run: echo "11" > .java-version
- name: Create .tool-versions file
shell: bash
run: echo "java 11" > .tool-versions
- name: setup-java
uses: ./
id: setup-java
with:
distribution: ${{ matrix.distribution }}
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
shell: bash
setup-java-version-from-file-major-minor-patch-notation:
name: ${{ matrix.distribution }} version from file X.Y.Z - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['adopt', 'adopt-openj9', 'zulu']
java-version-file: ['.java-version', '.tool-versions']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create .java-version file
shell: bash
run: echo "17.0.10" > .java-version
- name: Create .tool-versions file
shell: bash
run: echo "java 17.0.10" > .tool-versions
- name: setup-java
uses: ./
id: setup-java
with:
distribution: ${{ matrix.distribution }}
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
run: bash __tests__/verify-java.sh "17.0.10" "${{ steps.setup-java.outputs.path }}"
shell: bash
setup-java-version-from-file-major-minor-patch-with-dist:
name: ${{ matrix.distribution }} version from file 'openjdk64-17.0.10' - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
distribution: ['adopt', 'zulu', 'liberica']
java-version-file: ['.java-version', '.tool-versions']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create .java-version file
shell: bash
run: echo "openjdk64-17.0.10" > .java-version
- name: Create .tool-versions file
shell: bash
run: echo "java openjdk64-17.0.10" > .tool-versions
- name: setup-java
uses: ./
id: setup-java
with:
distribution: ${{ matrix.distribution }}
java-version-file: ${{matrix.java-version-file }}
- name: Verify Java
run: bash __tests__/verify-java.sh "17.0.10" "${{ steps.setup-java.outputs.path }}"
shell: bash

View File

@ -10,6 +10,16 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
call-licensed: test:
name: Licensed runs-on: ubuntu-latest
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main name: Check licenses
steps:
- uses: actions/checkout@v3
- run: npm ci
- name: Install licensed
run: |
cd $RUNNER_TEMP
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
sudo tar -xzf licensed.tar.gz
sudo mv licensed /usr/local/bin/licensed
- run: licensed status

View File

@ -1,5 +1,4 @@
name: Release new action version name: Release new action version
on: on:
release: release:
types: [released] types: [released]
@ -23,7 +22,7 @@ jobs:
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag id: update-major-tag
uses: actions/publish-action@v0.2.2 uses: actions/publish-action@v0.1.0
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -1,11 +0,0 @@
name: Update configuration files
on:
schedule:
- cron: '0 3 * * 0'
workflow_dispatch:
jobs:
call-update-configuration-files:
name: Update configuration files
uses: actions/reusable-workflows/.github/workflows/update-config-files.yml@main

3
.gitignore vendored
View File

@ -94,6 +94,3 @@ typings/
# DynamoDB Local files # DynamoDB Local files
.dynamodb/ .dynamodb/
.vscode/ .vscode/
# IntelliJ / WebStorm
/.idea/

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/cache" name: "@actions/cache"
version: 3.2.4 version: 3.0.4
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

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/core" name: "@actions/core"
version: 1.10.1 version: 1.10.0
type: npm type: npm
summary: Actions core lib summary: Actions core lib
homepage: https://github.com/actions/toolkit/tree/main/packages/core homepage: https://github.com/actions/toolkit/tree/main/packages/core

View File

@ -1,20 +1,30 @@
--- ---
name: "@actions/exec" name: "@actions/exec"
version: 1.1.1 version: 1.0.4
type: npm type: npm
summary: Actions exec lib summary: Actions exec lib
homepage: https://github.com/actions/toolkit/tree/main/packages/exec homepage: https://github.com/actions/toolkit/tree/master/packages/exec
license: mit license: mit
licenses: licenses:
- sources: LICENSE.md - sources: Auto-generated MIT license text
text: |- text: |
The MIT License (MIT) MIT License
Copyright 2019 GitHub Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: [] notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/glob" name: "@actions/glob"
version: 0.4.0 version: 0.2.0
type: npm type: npm
summary: Actions glob lib summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/main/packages/glob homepage: https://github.com/actions/toolkit/tree/main/packages/glob

View File

@ -0,0 +1,32 @@
---
name: "@actions/http-client"
version: 1.0.11
type: npm
summary: Actions Http Client
homepage: https://github.com/actions/http-client#readme
license: mit
licenses:
- sources: LICENSE
text: |
Actions Http Client for Node.js
Copyright (c) GitHub, Inc.
All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/http-client" name: "@actions/http-client"
version: 2.2.1 version: 2.0.1
type: npm type: npm
summary: Actions Http Client summary: Actions Http Client
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client homepage: https://github.com/actions/toolkit/tree/main/packages/http-client

View File

@ -1,20 +1,30 @@
--- ---
name: "@actions/io" name: "@actions/io"
version: 1.1.3 version: 1.0.2
type: npm type: npm
summary: Actions io lib summary: Actions io lib
homepage: https://github.com/actions/toolkit/tree/main/packages/io homepage: https://github.com/actions/toolkit/tree/master/packages/io
license: mit license: mit
licenses: licenses:
- sources: LICENSE.md - sources: Auto-generated MIT license text
text: |- text: |
The MIT License (MIT) MIT License
Copyright 2019 GitHub Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: [] notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: "@actions/tool-cache" name: "@actions/tool-cache"
version: 2.0.1 version: 1.6.1
type: npm type: npm
summary: Actions tool-cache lib summary: Actions tool-cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache

View File

@ -1,9 +1,9 @@
--- ---
name: "@azure/abort-controller" name: "@azure/abort-controller"
version: 1.1.0 version: 1.0.4
type: npm type: npm
summary: Microsoft Azure SDK for JavaScript - Aborter summary: Microsoft Azure SDK for JavaScript - Aborter
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/core/abort-controller/README.md
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@ -1,9 +1,9 @@
--- ---
name: "@azure/core-util" name: "@azure/core-asynciterator-polyfill"
version: 1.6.1 version: 1.0.2
type: npm type: npm
summary: Core library for shared utility methods summary: Polyfill for IE/Node 8 for Symbol.asyncIterator
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/ homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-asynciterator-polyfill/README.md
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-auth" name: "@azure/core-auth"
version: 1.5.0 version: 1.3.2
type: npm type: npm
summary: Provides low-level interfaces and helper methods for authentication in Azure summary: Provides low-level interfaces and helper methods for authentication in Azure
SDK SDK

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-http" name: "@azure/core-http"
version: 3.0.4 version: 2.2.4
type: npm type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest libraries generated using AutoRest

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-lro" name: "@azure/core-lro"
version: 2.5.4 version: 2.2.4
type: npm type: npm
summary: Isomorphic client library for supporting long-running operations in node.js summary: Isomorphic client library for supporting long-running operations in node.js
and browser. and browser.

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/core-paging" name: "@azure/core-paging"
version: 1.5.0 version: 1.2.1
type: npm type: npm
summary: Core types for paging async iterable iterators summary: Core types for paging async iterable iterators
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/logger" name: "@azure/logger"
version: 1.0.4 version: 1.0.3
type: npm type: npm
summary: Microsoft Azure SDK for JavaScript - Logger summary: Microsoft Azure SDK for JavaScript - Logger
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/ms-rest-js" name: "@azure/ms-rest-js"
version: 2.7.0 version: 2.6.1
type: npm type: npm
summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client summary: Isomorphic client Runtime for Typescript/node.js/browser javascript client
libraries generated using AutoRest libraries generated using AutoRest

View File

@ -1,6 +1,6 @@
--- ---
name: "@azure/storage-blob" name: "@azure/storage-blob"
version: 12.17.0 version: 12.9.0
type: npm type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/ homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/

View File

@ -1,30 +0,0 @@
---
name: "@fastify/busboy"
version: 2.1.0
type: npm
summary: A streaming parser for HTML form data for node.js
homepage:
license: mit
licenses:
- sources: LICENSE
text: |-
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
notices: []

View File

@ -1,9 +1,9 @@
--- ---
name: "@opentelemetry/api" name: "@opentelemetry/api"
version: 1.7.0 version: 1.0.4
type: npm type: npm
summary: Public API for OpenTelemetry summary: Public API for OpenTelemetry
homepage: https://github.com/open-telemetry/opentelemetry-js/tree/main/api homepage: https://github.com/open-telemetry/opentelemetry-js-api#readme
license: apache-2.0 license: apache-2.0
licenses: licenses:
- sources: LICENSE - sources: LICENSE
@ -216,8 +216,10 @@ licenses:
[opentelemetry-js]: https://github.com/open-telemetry/opentelemetry-js [opentelemetry-js]: https://github.com/open-telemetry/opentelemetry-js
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions [discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/api/LICENSE [license-url]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat [license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/tracing.md [npm-url]: https://www.npmjs.com/package/@opentelemetry/api
[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/sdk-registration.md [npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi.svg
[docs-tracing]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/tracing.md
[docs-sdk-registration]: https://github.com/open-telemetry/opentelemetry-js-api/blob/main/docs/sdk-registration.md
notices: [] notices: []

32
.licenses/npm/@types/node-14.6.2.dep.yml generated Normal file
View File

@ -0,0 +1,32 @@
---
name: "@types/node"
version: 14.6.2
type: npm
summary: TypeScript definitions for Node.js
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped#readme
license: mit
licenses:
- sources: LICENSE
text: |2
MIT License
Copyright (c) Microsoft Corporation.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
notices: []

View File

@ -1,8 +1,8 @@
--- ---
name: "@types/node" name: "@types/node"
version: 20.11.24 version: 16.11.25
type: npm type: npm
summary: TypeScript definitions for node summary: TypeScript definitions for Node.js
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
license: mit license: mit
licenses: licenses:

View File

@ -1,6 +1,6 @@
--- ---
name: "@types/node-fetch" name: "@types/node-fetch"
version: 2.6.9 version: 2.6.1
type: npm type: npm
summary: TypeScript definitions for node-fetch summary: TypeScript definitions for node-fetch
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node-fetch

View File

@ -1,6 +1,6 @@
--- ---
name: balanced-match name: balanced-match
version: 1.0.2 version: 1.0.0
type: npm type: npm
summary: Match balanced character pairs, like "{" and "}" summary: Match balanced character pairs, like "{" and "}"
homepage: https://github.com/juliangruber/balanced-match homepage: https://github.com/juliangruber/balanced-match

33
.licenses/npm/form-data-3.0.1.dep.yml generated Normal file
View File

@ -0,0 +1,33 @@
---
name: form-data
version: 3.0.1
type: npm
summary: A library to create readable "multipart/form-data" streams. Can be used to
submit forms and file uploads to other web applications.
homepage: https://github.com/form-data/form-data#readme
license: mit
licenses:
- sources: License
text: |
Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
- sources: Readme.md
text: Form-Data is released under the [MIT](License) license.
notices: []

View File

@ -1,16 +1,16 @@
--- ---
name: undici name: ip-regex
version: 5.28.4 version: 2.1.0
type: npm type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js summary: Regular expression for matching IP addresses (IPv4 & IPv6)
homepage: https://undici.nodejs.org homepage: https://github.com/sindresorhus/ip-regex#readme
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: license
text: | text: |
MIT License The MIT License (MIT)
Copyright (c) Matteo Collina and Undici contributors Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
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
@ -19,16 +19,16 @@ licenses:
copies of the Software, and to permit persons to whom the Software is copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in
copies or substantial portions of the Software. all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
SOFTWARE. THE SOFTWARE.
- sources: README.md - sources: readme.md
text: MIT text: MIT © [Sindre Sorhus](https://sindresorhus.com)
notices: [] notices: []

View File

@ -1,34 +1,33 @@
--- ---
name: mime-db name: mime-db
version: 1.52.0 version: 1.46.0
type: npm type: npm
summary: Media Type Database summary: Media Type Database
homepage: homepage: https://github.com/jshttp/mime-db#readme
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: | text: |2
(The MIT License)
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com> The MIT License (MIT)
Copyright (c) 2015-2022 Douglas Christopher Wilson <doug@somethingdoug.com>
Permission is hereby granted, free of charge, to any person obtaining Copyright (c) 2014 Jonathan Ong me@jongleberry.com
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be Permission is hereby granted, free of charge, to any person obtaining a copy
included in all copies or substantial portions of the Software. of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, The above copyright notice and this permission notice shall be included in
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF all copies or substantial portions of the Software.
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
notices: [] notices: []

View File

@ -1,9 +1,9 @@
--- ---
name: mime-types name: mime-types
version: 2.1.35 version: 2.1.29
type: npm type: npm
summary: The ultimate javascript content-type utility. summary: The ultimate javascript content-type utility.
homepage: homepage: https://github.com/jshttp/mime-types#readme
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE
@ -36,7 +36,7 @@ licenses:
[MIT](LICENSE) [MIT](LICENSE)
[ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci [ci-image]: https://badgen.net/github/checks/jshttp/mime-types/master?label=ci
[ci-url]: https://github.com/jshttp/mime-types/actions/workflows/ci.yml [ci-url]: https://github.com/jshttp/mime-types/actions?query=workflow%3Aci
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master [coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/mime-types/master
[coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master [coveralls-url]: https://coveralls.io/r/jshttp/mime-types?branch=master
[node-version-image]: https://badgen.net/npm/node/mime-types [node-version-image]: https://badgen.net/npm/node/mime-types

View File

@ -1,6 +1,6 @@
--- ---
name: minimatch name: minimatch
version: 3.1.2 version: 3.0.4
type: npm type: npm
summary: a glob matcher in javascript summary: a glob matcher in javascript
homepage: https://github.com/isaacs/minimatch#readme homepage: https://github.com/isaacs/minimatch#readme

View File

@ -1,6 +1,6 @@
--- ---
name: node-fetch name: node-fetch
version: 2.7.0 version: 2.6.7
type: npm type: npm
summary: A light-weight module that brings window.fetch to node.js summary: A light-weight module that brings window.fetch to node.js
homepage: https://github.com/bitinn/node-fetch homepage: https://github.com/bitinn/node-fetch

43
.licenses/npm/psl.dep.yml generated Normal file
View File

@ -0,0 +1,43 @@
---
name: psl
version: 1.8.0
type: npm
summary: Domain name parser based on the Public Suffix List
homepage: https://github.com/lupomontero/psl#readme
license: mit
licenses:
- sources: LICENSE
text: |
The MIT License (MIT)
Copyright (c) 2017 Lupo Montero lupomontero@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: |-
The MIT License (MIT)
Copyright (c) 2017 Lupo Montero <lupomontero@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
notices: []

34
.licenses/npm/punycode.dep.yml generated Normal file
View File

@ -0,0 +1,34 @@
---
name: punycode
version: 2.1.1
type: npm
summary: A robust Punycode converter that fully complies to RFC 3492 and RFC 5891,
and works on nearly all JavaScript platforms.
homepage: https://mths.be/punycode
license: mit
licenses:
- sources: LICENSE-MIT.txt
text: |
Copyright Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: Punycode.js is available under the [MIT](https://mths.be/mit) license.
notices: []

View File

@ -1,16 +1,16 @@
--- ---
name: sax name: sax
version: 1.3.0 version: 1.2.4
type: npm type: npm
summary: An evented streaming XML parser in JavaScript summary: An evented streaming XML parser in JavaScript
homepage: homepage: https://github.com/isaacs/sax-js#readme
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: | text: |
The ISC License The ISC License
Copyright (c) 2010-2022 Isaac Z. Schlueter and Contributors Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above purpose with or without fee is hereby granted, provided that the above
@ -29,7 +29,7 @@ licenses:
`String.fromCodePoint` by Mathias Bynens used according to terms of MIT `String.fromCodePoint` by Mathias Bynens used according to terms of MIT
License, as follows: License, as follows:
Copyright (c) 2010-2022 Mathias Bynens <https://mathiasbynens.be/> Copyright Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@ -1,9 +1,9 @@
--- ---
name: semver name: semver
version: 6.3.1 version: 6.3.0
type: npm type: npm
summary: The semantic version parser used by npm. summary: The semantic version parser used by npm.
homepage: homepage: https://github.com/npm/node-semver#readme
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@ -1,9 +1,9 @@
--- ---
name: semver name: semver
version: 7.6.0 version: 7.3.4
type: npm type: npm
summary: The semantic version parser used by npm. summary: The semantic version parser used by npm.
homepage: homepage: https://github.com/npm/node-semver#readme
license: isc license: isc
licenses: licenses:
- sources: LICENSE - sources: LICENSE

23
.licenses/npm/tough-cookie-3.0.1.dep.yml generated Normal file
View File

@ -0,0 +1,23 @@
---
name: tough-cookie
version: 3.0.1
type: npm
summary: RFC6265 Cookies and Cookie Jar for node.js
homepage: https://github.com/salesforce/tough-cookie
license: bsd-3-clause
licenses:
- sources: LICENSE
text: |
Copyright (c) 2015, Salesforce.com, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
notices: []

23
.licenses/npm/tough-cookie-4.0.0.dep.yml generated Normal file
View File

@ -0,0 +1,23 @@
---
name: tough-cookie
version: 4.0.0
type: npm
summary: RFC6265 Cookies and Cookie Jar for node.js
homepage: https://github.com/salesforce/tough-cookie
license: bsd-3-clause
licenses:
- sources: LICENSE
text: |
Copyright (c) 2015, Salesforce.com, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
notices: []

35
.licenses/npm/tslib-2.3.1.dep.yml generated Normal file
View File

@ -0,0 +1,35 @@
---
name: tslib
version: 2.3.1
type: npm
summary: Runtime library for TypeScript helper functions
homepage: https://www.typescriptlang.org/
license: 0bsd
licenses:
- sources: LICENSE.txt
text: |-
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
notices:
- sources: CopyrightNotice.txt
text: "/*! *****************************************************************************\r\nCopyright
(c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute
this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE
SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS
SOFTWARE.\r\n*****************************************************************************
*/"

View File

@ -1,23 +0,0 @@
---
name: tslib
version: 2.6.2
type: npm
summary: Runtime library for TypeScript helper functions
homepage: https://www.typescriptlang.org/
license: 0bsd
licenses:
- sources: LICENSE.txt
text: |-
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
notices: []

View File

@ -1,30 +0,0 @@
---
name: undici-types
version: 5.26.5
type: npm
summary: A stand-alone types package for Undici
homepage: https://undici.nodejs.org
license: mit
licenses:
- sources: Auto-generated MIT license text
text: |
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

33
.licenses/npm/universalify.dep.yml generated Normal file
View File

@ -0,0 +1,33 @@
---
name: universalify
version: 0.1.2
type: npm
summary: Make a callback- or promise-based function support both promises and callbacks.
homepage: https://github.com/RyanZim/universalify#readme
license: mit
licenses:
- sources: LICENSE
text: |
(The MIT License)
Copyright (c) 2017, Ryan Zimmerman <opensrc@ryanzim.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.md
text: MIT
notices: []

View File

@ -1,6 +1,6 @@
--- ---
name: xml2js name: xml2js
version: 0.5.0 version: 0.4.23
type: npm type: npm
summary: Simple XML to JavaScript object converter. summary: Simple XML to JavaScript object converter.
homepage: https://github.com/Leonidas-from-XIV/node-xml2js homepage: https://github.com/Leonidas-from-XIV/node-xml2js

View File

@ -1,6 +1,6 @@
--- ---
name: xmlbuilder2 name: xmlbuilder2
version: 2.4.1 version: 2.4.0
type: npm type: npm
summary: An XML builder for node.js summary: An XML builder for node.js
homepage: http://github.com/oozcitak/xmlbuilder2 homepage: http://github.com/oozcitak/xmlbuilder2

View File

@ -1,7 +0,0 @@
# Ignore list
/*
# Do not ignore these folders:
!__tests__/
!.github/
!src/

View File

@ -1,11 +0,0 @@
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
trailingComma: 'none',
bracketSpacing: false,
arrowParens: 'avoid'
};

11
.prettierrc.json Normal file
View File

@ -0,0 +1,11 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"parser": "typescript"
}

138
README.md
View File

@ -1,52 +1,46 @@
# Setup Java # Setup Java
[![Basic validation](https://github.com/actions/setup-java/actions/workflows/basic-validation.yml/badge.svg?branch=main)](https://github.com/actions/setup-java/actions/workflows/basic-validation.yml) [![Main workflow](https://github.com/actions/setup-java/actions/workflows/workflow.yml/badge.svg)](https://github.com/actions/setup-java/actions/workflows/workflow.yml)
[![Validate Java e2e](https://github.com/actions/setup-java/actions/workflows/e2e-versions.yml/badge.svg?branch=main)](https://github.com/actions/setup-java/actions/workflows/e2e-versions.yml)
[![Validate cache](https://github.com/actions/setup-java/actions/workflows/e2e-cache.yml/badge.svg?branch=main)](https://github.com/actions/setup-java/actions/workflows/e2e-cache.yml)
The `setup-java` action provides the following functionality for GitHub Actions runners: The `setup-java` action provides the following functionality for GitHub Actions runners:
- Downloading and setting up a requested version of Java. See [Usage](#usage) for a list of supported distributions. - Downloading and setting up a requested version of Java. See [Usage](#Usage) for a list of supported distributions
- Extracting and caching custom version of Java from a local file. - Extracting and caching custom version of Java from a local file
- Configuring runner for publishing using Apache Maven. - Configuring runner for publishing using Apache Maven
- Configuring runner for publishing using Gradle. - Configuring runner for publishing using Gradle
- Configuring runner for using GPG private key. - Configuring runner for using GPG private key
- Registering problem matchers for error output. - Registering problem matchers for error output
- Caching dependencies managed by Apache Maven. - Caching dependencies managed by Apache Maven
- Caching dependencies managed by Gradle. - Caching dependencies managed by Gradle
- Caching dependencies managed by sbt. - Caching dependencies managed by sbt
- [Maven Toolchains declaration](https://maven.apache.org/guides/mini/guide-using-toolchains.html) for specified JDK versions. - [Maven Toolchains declaration](https://maven.apache.org/guides/mini/guide-using-toolchains.html) for specified JDK versions
This action allows you to work with Java and Scala projects. This action allows you to work with Java and Scala projects.
## V2 vs V1 ## V2 vs V1
- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK. - V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK
- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2. - V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2
## 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`: _(required)_ The Java version to set up. Takes a whole or [semver](#supported-version-syntax) Java version.
- `java-version-file`: The path to a file containing java version. Supported file types are `.java-version` and `.tool-versions`. See more details in [about .java-version-file](docs/advanced-usage.md#Java-version-file).
- `distribution`: _(required)_ Java [distribution](#supported-distributions). - `distribution`: _(required)_ Java [distribution](#supported-distributions).
- `java-package`: The packaging variant of the chosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`. - `java-package`: The packaging variant of the choosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`.
- `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: `x64`.
- `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.
- `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.
- `cache`: Quick [setup caching](#caching-packages-dependencies) for the dependencies managed through one of the predefined package managers. It can be one of "maven", "gradle" or "sbt". - `cache`: Quick [setup caching](#caching-packages-dependencies) for the dependencies managed through one of the predifined package managers. It can be one of "maven", "gradle" or "sbt".
- `cache-dependency-path`: The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.
#### Maven options #### Maven options
The action has a bunch of inputs to generate maven's [settings.xml](https://maven.apache.org/settings.html) on the fly and pass the values to Apache Maven GPG Plugin as well as Apache Maven Toolchains. See [advanced usage](docs/advanced-usage.md) for more. The action has a bunch of inputs to generate maven's [settings.xml](https://maven.apache.org/settings.html) on the fly and pass the values to Apache Maven GPG Plugin as well as Apache Maven Toolchains. See [advanced usage](docs/advanced-usage.md) for more.
- `overwrite-settings`: By default action overwrites the settings.xml. In order to skip generation of file if it exists, set this to `false`. - `overwrite-settings`: By default action overwrites the settings.xml. In order to skip generation of file if it exists set this to `false`.
- `server-id`: ID of the distributionManagement repository in the pom.xml file. Default is `github`. - `server-id`: ID of the distributionManagement repository in the pom.xml file. Default is `github`.
@ -54,11 +48,11 @@ This action allows you to work with Java and Scala projects.
- `server-password`: Environment variable name for password or token for authentication to the Apache Maven repository. Default is GITHUB_TOKEN. - `server-password`: Environment variable name for password or token for authentication to the Apache Maven repository. Default is GITHUB_TOKEN.
- `settings-path`: Maven related setting to point to the directory where the settings.xml file will be written. Default is ~/.m2. - `settings-path`: Maven related setting to point to the diractory where the settings.xml file will be written. Default is ~/.m2.
- `gpg-private-key`: GPG private key to import. Default is empty string. - `gpg-private-key`: GPG private key to import. Default is empty string.'
- `gpg-passphrase`: Environment variable name for the GPG private key passphrase. Default is GPG_PASSPHRASE. - `gpg-passphrase`: description: 'Environment variable name for the GPG private key passphrase. Default is GPG_PASSPHRASE.
- `mvn-toolchain-id`: Name of Maven Toolchain ID if the default name of `${distribution}_${java-version}` is not wanted. - `mvn-toolchain-id`: Name of Maven Toolchain ID if the default name of `${distribution}_${java-version}` is not wanted.
@ -69,30 +63,30 @@ This action allows you to work with Java and Scala projects.
#### Eclipse Temurin #### Eclipse Temurin
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' # See 'Supported distributions' for available options distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21' java-version: '17'
- run: java HelloWorldApp.java - run: java HelloWorldApp.java
``` ```
#### Azul Zulu OpenJDK #### Azul Zulu OpenJDK
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'zulu' # See 'Supported distributions' for available options distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21' java-version: '17'
- run: java HelloWorldApp.java - run: java HelloWorldApp.java
``` ```
#### Supported version syntax #### Supported version syntax
The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation: The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
- major versions: `8`, `11`, `16`, `17`, `21` - major versions: `8`, `11`, `16`, `17`
- more specific versions: `8.0.282+8`, `8.0.232`, `11.0`, `11.0.4`, `17.0` - more specific versions: `17.0`, `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
- early access (EA) versions: `15-ea`, `15.0.0-ea` - early access (EA) versions: `15-ea`, `15.0.0-ea`, `15.0.0-ea.2`, `15.0.0+2-ea`
#### Supported distributions #### Supported distributions
Currently, the following distributions are supported: Currently, the following distributions are supported:
@ -105,24 +99,18 @@ Currently, the following distributions are supported:
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) | | `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq) | `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/) | `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
| `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) |
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/)
**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/). **NOTE:** AdoptOpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` to `temurin` 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/).
**NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness. **NOTE:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
### Caching packages dependencies ### Caching packages dependencies
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files: The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/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: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties`
- maven: `**/pom.xml` - maven: `**/pom.xml`
- 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,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.
The workflow output `cache-hit` is set to indicate if an exact match was found for the key [as actions/cache does](https://github.com/actions/cache/tree/main#outputs). The workflow output `cache-hit` is set to indicate if an exact match was found for the key [as actions/cache does](https://github.com/actions/cache/tree/main#outputs).
@ -131,28 +119,24 @@ The cache input is optional, and caching is turned off by default.
#### Caching gradle dependencies #### Caching gradle dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '17'
cache: 'gradle' cache: 'gradle'
cache-dependency-path: | # optional
sub-project/*.gradle*
sub-project/**/gradle-wrapper.properties
- run: ./gradlew build --no-daemon - run: ./gradlew build --no-daemon
``` ```
#### Caching maven dependencies #### Caching maven dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '17'
cache: 'maven' cache: 'maven'
cache-dependency-path: 'sub-project/pom.xml' # optional
- name: Build with Maven - name: Build with Maven
run: mvn -B package --file pom.xml run: mvn -B package --file pom.xml
``` ```
@ -160,35 +144,16 @@ steps:
#### Caching sbt dependencies #### Caching sbt dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '17'
cache: 'sbt' cache: 'sbt'
cache-dependency-path: | # optional
sub-project/build.sbt
sub-project/project/build.properties
- name: Build with SBT - name: Build with SBT
run: sbt package run: sbt package
``` ```
#### Cache segment restore timeout
Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a segment download gets stuck, which causes the workflow job to be stuck. The cache segment download timeout [was introduced](https://github.com/actions/toolkit/tree/main/packages/cache#cache-segment-restore-timeout) to solve this issue as it allows the segment download to get aborted and hence allows the job to proceed with a cache miss. The default value of the cache segment download timeout is set to 10 minutes and can be customized by specifying an environment variable named `SEGMENT_DOWNLOAD_TIMEOUT_MINS` with a timeout value in minutes.
```yaml
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- run: ./gradlew build --no-daemon
```
### Check latest ### Check latest
In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download. In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download.
@ -200,11 +165,11 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '17'
check-latest: true check-latest: true
- run: java HelloWorldApp.java - run: java HelloWorldApp.java
``` ```
@ -216,12 +181,12 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
matrix: matrix:
java: [ '8', '11', '17', '21' ] java: [ '8', '11', '17' ]
name: Java ${{ matrix.Java }} sample name: Java ${{ matrix.Java }} sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -234,7 +199,7 @@ All versions are added to the PATH. The last version will be used and available
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@ -255,8 +220,6 @@ In the example above multiple JDKs are installed for the same job. The result af
- [Liberica](docs/advanced-usage.md#Liberica) - [Liberica](docs/advanced-usage.md#Liberica)
- [Microsoft](docs/advanced-usage.md#Microsoft) - [Microsoft](docs/advanced-usage.md#Microsoft)
- [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto) - [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto)
- [Oracle](docs/advanced-usage.md#Oracle)
- [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
- [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)
@ -266,7 +229,6 @@ In the example above multiple JDKs are installed for the same job. The result af
- [Publishing using Gradle](docs/advanced-usage.md#Publishing-using-Gradle) - [Publishing using Gradle](docs/advanced-usage.md#Publishing-using-Gradle)
- [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache) - [Hosted Tool Cache](docs/advanced-usage.md#Hosted-Tool-Cache)
- [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)
## License ## License

View File

@ -1,7 +1,7 @@
import * as io from '@actions/io'; import io = require('@actions/io');
import fs = require('fs');
import path = require('path');
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as fs from 'fs';
import * as path from 'path';
import os from 'os'; import os from 'os';
import * as auth from '../src/auth'; import * as auth from '../src/auth';
@ -42,13 +42,7 @@ describe('auth tests', () => {
const altSettingsFile = path.join(altHome, MVN_SETTINGS_FILE); const altSettingsFile = path.join(altHome, MVN_SETTINGS_FILE);
await io.rmRF(altHome); // ensure it doesn't already exist await io.rmRF(altHome); // ensure it doesn't already exist
await auth.createAuthenticationSettings( await auth.createAuthenticationSettings(id, username, password, altHome, true);
id,
username,
password,
altHome,
true
);
expect(fs.existsSync(m2Dir)).toBe(false); expect(fs.existsSync(m2Dir)).toBe(false);
expect(fs.existsSync(settingsFile)).toBe(false); expect(fs.existsSync(settingsFile)).toBe(false);
@ -67,19 +61,11 @@ describe('auth tests', () => {
const username = 'UNAME'; const username = 'UNAME';
const password = 'TOKEN'; const password = 'TOKEN';
await auth.createAuthenticationSettings( await auth.createAuthenticationSettings(id, username, password, m2Dir, true);
id,
username,
password,
m2Dir,
true
);
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true); expect(fs.existsSync(settingsFile)).toBe(true);
expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual( expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual(auth.generate(id, username, password));
auth.generate(id, username, password)
);
}, 100000); }, 100000);
it('creates settings.xml with additional configuration', async () => { it('creates settings.xml with additional configuration', async () => {
@ -88,14 +74,7 @@ describe('auth tests', () => {
const password = 'TOKEN'; const password = 'TOKEN';
const gpgPassphrase = 'GPG'; const gpgPassphrase = 'GPG';
await auth.createAuthenticationSettings( await auth.createAuthenticationSettings(id, username, password, m2Dir, true, gpgPassphrase);
id,
username,
password,
m2Dir,
true,
gpgPassphrase
);
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true); expect(fs.existsSync(settingsFile)).toBe(true);
@ -114,19 +93,11 @@ describe('auth tests', () => {
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true); expect(fs.existsSync(settingsFile)).toBe(true);
await auth.createAuthenticationSettings( await auth.createAuthenticationSettings(id, username, password, m2Dir, true);
id,
username,
password,
m2Dir,
true
);
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true); expect(fs.existsSync(settingsFile)).toBe(true);
expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual( expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual(auth.generate(id, username, password));
auth.generate(id, username, password)
);
}, 100000); }, 100000);
it('does not overwrite existing settings.xml files', async () => { it('does not overwrite existing settings.xml files', async () => {
@ -139,13 +110,7 @@ describe('auth tests', () => {
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true); expect(fs.existsSync(settingsFile)).toBe(true);
await auth.createAuthenticationSettings( await auth.createAuthenticationSettings(id, username, password, m2Dir, false);
id,
username,
password,
m2Dir,
false
);
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(settingsFile)).toBe(true); expect(fs.existsSync(settingsFile)).toBe(true);
@ -194,8 +159,6 @@ describe('auth tests', () => {
</servers> </servers>
</settings>`; </settings>`;
expect(auth.generate(id, username, password, gpgPassphrase)).toEqual( expect(auth.generate(id, username, password, gpgPassphrase)).toEqual(expectedSettings);
expectedSettings
);
}); });
}); });

View File

@ -6,7 +6,6 @@ import * as fs from 'fs';
import * as os from 'os'; import * as os from 'os';
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as cache from '@actions/cache'; import * as cache from '@actions/cache';
import * as glob from '@actions/glob';
describe('dependency cache', () => { describe('dependency cache', () => {
const ORIGINAL_RUNNER_OS = process.env['RUNNER_OS']; const ORIGINAL_RUNNER_OS = process.env['RUNNER_OS'];
@ -65,30 +64,21 @@ describe('dependency cache', () => {
ReturnType<typeof cache.restoreCache>, ReturnType<typeof cache.restoreCache>,
Parameters<typeof cache.restoreCache> Parameters<typeof cache.restoreCache>
>; >;
let spyGlobHashFiles: jest.SpyInstance<
ReturnType<typeof glob.hashFiles>,
Parameters<typeof glob.hashFiles>
>;
beforeEach(() => { beforeEach(() => {
spyCacheRestore = jest spyCacheRestore = jest
.spyOn(cache, 'restoreCache') .spyOn(cache, 'restoreCache')
.mockImplementation((paths: string[], primaryKey: string) => .mockImplementation((paths: string[], primaryKey: string) => Promise.resolve(undefined));
Promise.resolve(undefined)
);
spyGlobHashFiles = jest.spyOn(glob, 'hashFiles');
spyWarning.mockImplementation(() => null); spyWarning.mockImplementation(() => null);
}); });
it('throws error if unsupported package manager specified', () => { it('throws error if unsupported package manager specified', () => {
return expect(restore('ant', '')).rejects.toThrow( return expect(restore('ant')).rejects.toThrowError('unknown package manager specified: ant');
'unknown package manager specified: ant'
);
}); });
describe('for maven', () => { describe('for maven', () => {
it('throws error if no pom.xml found', async () => { it('throws error if no pom.xml found', async () => {
await expect(restore('maven', '')).rejects.toThrow( await expect(restore('maven')).rejects.toThrowError(
`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], make sure you have checked out the target repository`
@ -97,160 +87,61 @@ describe('dependency cache', () => {
it('downloads cache', async () => { it('downloads cache', async () => {
createFile(join(workspace, 'pom.xml')); createFile(join(workspace, 'pom.xml'));
await restore('maven', ''); await restore('maven');
expect(spyCacheRestore).toHaveBeenCalled(); expect(spyCacheRestore).toBeCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith('**/pom.xml'); expect(spyWarning).not.toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyInfo).toBeCalledWith('maven cache is not found');
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
}); });
}); });
describe('for gradle', () => { describe('for gradle', () => {
it('throws error if no build.gradle found', async () => { it('throws error if no build.gradle found', async () => {
await expect(restore('gradle', '')).rejects.toThrow( await expect(restore('gradle')).rejects.toThrowError(
`No file in ${projectRoot( `No file in ${projectRoot(
workspace workspace
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml,**/versions.properties], make sure you have checked out the target repository` )} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt], make sure you have checked out the target repository`
); );
}); });
it('downloads cache based on build.gradle', async () => { it('downloads cache based on build.gradle', async () => {
createFile(join(workspace, 'build.gradle')); createFile(join(workspace, 'build.gradle'));
await restore('gradle', ''); await restore('gradle');
expect(spyCacheRestore).toHaveBeenCalled(); expect(spyCacheRestore).toBeCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith( expect(spyWarning).not.toBeCalled();
'**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties' expect(spyInfo).toBeCalledWith('gradle cache is not found');
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
}); });
it('downloads cache based on build.gradle.kts', async () => { it('downloads cache based on build.gradle.kts', async () => {
createFile(join(workspace, 'build.gradle.kts')); createFile(join(workspace, 'build.gradle.kts'));
await restore('gradle', ''); await restore('gradle');
expect(spyCacheRestore).toHaveBeenCalled(); expect(spyCacheRestore).toBeCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith( expect(spyWarning).not.toBeCalled();
'**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties' expect(spyInfo).toBeCalledWith('gradle cache is not found');
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
}); });
it('downloads cache based on libs.versions.toml', async () => {
createDirectory(join(workspace, 'gradle'));
createFile(join(workspace, 'gradle', 'libs.versions.toml'));
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
'**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
}); });
it('downloads cache based on buildSrc/Versions.kt', async () => { it('downloads cache based on buildSrc/Versions.kt', async () => {
createDirectory(join(workspace, 'buildSrc')); createDirectory(join(workspace, 'buildSrc'));
createFile(join(workspace, 'buildSrc', 'Versions.kt')); createFile(join(workspace, 'buildSrc', 'Versions.kt'));
await restore('gradle', ''); await restore('gradle');
expect(spyCacheRestore).toHaveBeenCalled(); expect(spyCacheRestore).toBeCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith( expect(spyWarning).not.toBeCalled();
'**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties' expect(spyInfo).toBeCalledWith('gradle cache is not found');
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
});
}); });
describe('for sbt', () => { describe('for sbt', () => {
it('throws error if no build.sbt found', async () => { it('throws error if no build.sbt found', async () => {
await expect(restore('sbt', '')).rejects.toThrow( await expect(restore('sbt')).rejects.toThrowError(
`No file in ${projectRoot( `No file in ${projectRoot(
workspace workspace
)} matched to [**/*.sbt,**/project/build.properties,**/project/**.scala,**/project/**.sbt], make sure you have checked out the target repository` )} matched to [**/*.sbt,**/project/build.properties,**/project/**.{scala,sbt}], make sure you have checked out the target repository`
); );
}); });
it('downloads cache', async () => { it('downloads cache', async () => {
createFile(join(workspace, 'build.sbt')); createFile(join(workspace, 'build.sbt'));
await restore('sbt', ''); await restore('sbt');
expect(spyCacheRestore).toHaveBeenCalled(); expect(spyCacheRestore).toBeCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith( expect(spyWarning).not.toBeCalled();
'**/*.sbt\n**/project/build.properties\n**/project/**.scala\n**/project/**.sbt' expect(spyInfo).toBeCalledWith('sbt cache is not found');
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('sbt cache is not found');
});
it('detects scala and sbt changes under **/project/ folder', async () => {
createFile(join(workspace, 'build.sbt'));
createDirectory(join(workspace, 'project'));
createFile(join(workspace, 'project/DependenciesV1.scala'));
await restore('sbt', '');
const firstCall = spySaveState.mock.calls.toString();
spySaveState.mockClear();
await restore('sbt', '');
const secondCall = spySaveState.mock.calls.toString();
// Make sure multiple restores produce the same cache
expect(firstCall).toBe(secondCall);
spySaveState.mockClear();
createFile(join(workspace, 'project/DependenciesV2.scala'));
await restore('sbt', '');
const thirdCall = spySaveState.mock.calls.toString();
expect(firstCall).not.toBe(thirdCall);
});
});
it('downloads cache based on versions.properties', async () => {
createFile(join(workspace, 'versions.properties'));
await restore('gradle', '');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
'**/*.gradle*\n**/gradle-wrapper.properties\nbuildSrc/**/Versions.kt\nbuildSrc/**/Dependencies.kt\ngradle/*.versions.toml\n**/versions.properties'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
});
describe('cache-dependency-path', () => {
it('throws error if no matching dependency file found', async () => {
createFile(join(workspace, 'build.gradle.kts'));
await expect(
restore('gradle', 'sub-project/**/build.gradle.kts')
).rejects.toThrow(
`No file in ${projectRoot(
workspace
)} matched to [sub-project/**/build.gradle.kts], make sure you have checked out the target repository`
);
});
it('downloads cache based on the specified pattern', async () => {
createFile(join(workspace, 'build.gradle.kts'));
createDirectory(join(workspace, 'sub-project1'));
createFile(join(workspace, 'sub-project1', 'build.gradle.kts'));
createDirectory(join(workspace, 'sub-project2'));
createFile(join(workspace, 'sub-project2', 'build.gradle.kts'));
await restore('gradle', 'build.gradle.kts');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith('build.gradle.kts');
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
await restore('gradle', 'sub-project1/**/*.gradle*\n');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
'sub-project1/**/*.gradle*'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
await restore('gradle', '*.gradle*\nsub-project2/**/*.gradle*\n');
expect(spyCacheRestore).toHaveBeenCalled();
expect(spyGlobHashFiles).toHaveBeenCalledWith(
'*.gradle*\nsub-project2/**/*.gradle*'
);
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
}); });
}); });
}); });
@ -263,16 +154,12 @@ describe('dependency cache', () => {
beforeEach(() => { beforeEach(() => {
spyCacheSave = jest spyCacheSave = jest
.spyOn(cache, 'saveCache') .spyOn(cache, 'saveCache')
.mockImplementation((paths: string[], key: string) => .mockImplementation((paths: string[], key: string) => Promise.resolve(0));
Promise.resolve(0)
);
spyWarning.mockImplementation(() => null); spyWarning.mockImplementation(() => null);
}); });
it('throws error if unsupported package manager specified', () => { it('throws error if unsupported package manager specified', () => {
return expect(save('ant')).rejects.toThrow( return expect(save('ant')).rejects.toThrowError('unknown package manager specified: ant');
'unknown package manager specified: ant'
);
}); });
it('save with -1 cacheId , should not fail workflow', async () => { it('save with -1 cacheId , should not fail workflow', async () => {
@ -280,12 +167,10 @@ describe('dependency cache', () => {
createStateForMissingBuildFile(); createStateForMissingBuildFile();
await save('maven'); await save('maven');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
expect(spyInfo).toHaveBeenCalled(); expect(spyInfo).toBeCalled();
expect(spyInfo).toHaveBeenCalledWith( expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
expect.stringMatching(/^Cache saved with the key:.*/)
);
}); });
it('saves with error from toolkit, should fail workflow', async () => { it('saves with error from toolkit, should fail workflow', async () => {
@ -295,37 +180,31 @@ describe('dependency cache', () => {
createStateForMissingBuildFile(); createStateForMissingBuildFile();
expect.assertions(1); expect.assertions(1);
await expect(save('maven')).rejects.toEqual( await expect(save('maven')).rejects.toEqual(new cache.ValidationError('Validation failed'));
new cache.ValidationError('Validation failed')
);
}); });
describe('for maven', () => { describe('for maven', () => {
it('uploads cache even if no pom.xml found', async () => { it('uploads cache even if no pom.xml found', async () => {
createStateForMissingBuildFile(); createStateForMissingBuildFile();
await save('maven'); await save('maven');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
}); });
it('does not upload cache if no restore run before', async () => { it('does not upload cache if no restore run before', async () => {
createFile(join(workspace, 'pom.xml')); createFile(join(workspace, 'pom.xml'));
await save('maven'); await save('maven');
expect(spyCacheSave).not.toHaveBeenCalled(); expect(spyCacheSave).not.toBeCalled();
expect(spyWarning).toHaveBeenCalledWith( expect(spyWarning).toBeCalledWith('Error retrieving key from state.');
'Error retrieving key from state.'
);
}); });
it('uploads cache', async () => { it('uploads cache', async () => {
createFile(join(workspace, 'pom.xml')); createFile(join(workspace, 'pom.xml'));
createStateForSuccessfulRestore(); createStateForSuccessfulRestore();
await save('maven'); await save('maven');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
expect(spyInfo).toHaveBeenCalledWith( expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
expect.stringMatching(/^Cache saved with the key:.*/)
);
}); });
}); });
describe('for gradle', () => { describe('for gradle', () => {
@ -333,39 +212,33 @@ describe('dependency cache', () => {
createStateForMissingBuildFile(); createStateForMissingBuildFile();
await save('gradle'); await save('gradle');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
}); });
it('does not upload cache if no restore run before', async () => { it('does not upload cache if no restore run before', async () => {
createFile(join(workspace, 'build.gradle')); createFile(join(workspace, 'build.gradle'));
await save('gradle'); await save('gradle');
expect(spyCacheSave).not.toHaveBeenCalled(); expect(spyCacheSave).not.toBeCalled();
expect(spyWarning).toHaveBeenCalledWith( expect(spyWarning).toBeCalledWith('Error retrieving key from state.');
'Error retrieving key from state.'
);
}); });
it('uploads cache based on build.gradle', async () => { it('uploads cache based on build.gradle', async () => {
createFile(join(workspace, 'build.gradle')); createFile(join(workspace, 'build.gradle'));
createStateForSuccessfulRestore(); createStateForSuccessfulRestore();
await save('gradle'); await save('gradle');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
expect(spyInfo).toHaveBeenCalledWith( expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
expect.stringMatching(/^Cache saved with the key:.*/)
);
}); });
it('uploads cache based on build.gradle.kts', async () => { it('uploads cache based on build.gradle.kts', async () => {
createFile(join(workspace, 'build.gradle.kts')); createFile(join(workspace, 'build.gradle.kts'));
createStateForSuccessfulRestore(); createStateForSuccessfulRestore();
await save('gradle'); await save('gradle');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
expect(spyInfo).toHaveBeenCalledWith( expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
expect.stringMatching(/^Cache saved with the key:.*/)
);
}); });
it('uploads cache based on buildSrc/Versions.kt', async () => { it('uploads cache based on buildSrc/Versions.kt', async () => {
createDirectory(join(workspace, 'buildSrc')); createDirectory(join(workspace, 'buildSrc'));
@ -373,50 +246,33 @@ describe('dependency cache', () => {
createStateForSuccessfulRestore(); createStateForSuccessfulRestore();
await save('gradle'); await save('gradle');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
expect(spyInfo).toHaveBeenCalledWith( expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
expect.stringMatching(/^Cache saved with the key:.*/)
);
}); });
}); });
describe('for sbt', () => { describe('for sbt', () => {
it('uploads cache even if no build.sbt found', async () => { it('uploads cache even if no build.sbt found', async () => {
createStateForMissingBuildFile(); createStateForMissingBuildFile();
await save('sbt'); await save('sbt');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
}); });
it('does not upload cache if no restore run before', async () => { it('does not upload cache if no restore run before', async () => {
createFile(join(workspace, 'build.sbt')); createFile(join(workspace, 'build.sbt'));
await save('sbt'); await save('sbt');
expect(spyCacheSave).not.toHaveBeenCalled(); expect(spyCacheSave).not.toBeCalled();
expect(spyWarning).toHaveBeenCalledWith( expect(spyWarning).toBeCalledWith('Error retrieving key from state.');
'Error retrieving key from state.'
);
}); });
it('uploads cache', async () => { it('uploads cache', async () => {
createFile(join(workspace, 'build.sbt')); createFile(join(workspace, 'build.sbt'));
createStateForSuccessfulRestore(); createStateForSuccessfulRestore();
await save('sbt'); await save('sbt');
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
expect(spyInfo).toHaveBeenCalledWith( expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
expect.stringMatching(/^Cache saved with the key:.*/)
);
});
it('uploads cache based on versions.properties', async () => {
createFile(join(workspace, 'versions.properties'));
createStateForSuccessfulRestore();
await save('gradle');
expect(spyCacheSave).toHaveBeenCalled();
expect(spyWarning).not.toHaveBeenCalled();
expect(spyInfo).toHaveBeenCalledWith(
expect.stringMatching(/^Cache saved with the key:.*/)
);
}); });
}); });
}); });

View File

@ -1,12 +0,0 @@
.gradle
**/build/
!src/**/build/
# Ignore Gradle GUI config
gradle-app.setting
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
# Cache of project
.gradletasknamecache

View File

@ -1,17 +0,0 @@
plugins {
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
}
tasks.register('downloadDependencies') {
doLast {
def total = configurations.compileClasspath.inject (0) { sum, file ->
sum + file.length()
}
println total
}
}

View File

@ -38,8 +38,8 @@ describe('cleanup', () => {
return name === 'cache' ? 'gradle' : ''; return name === 'cache' ? 'gradle' : '';
}); });
await cleanup(); await cleanup();
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
expect(spyWarning).not.toHaveBeenCalled(); expect(spyWarning).not.toBeCalled();
}); });
it('does not fail even though the save process throws error', async () => { it('does not fail even though the save process throws error', async () => {
@ -50,7 +50,7 @@ describe('cleanup', () => {
return name === 'cache' ? 'gradle' : ''; return name === 'cache' ? 'gradle' : '';
}); });
await cleanup(); await cleanup();
expect(spyCacheSave).toHaveBeenCalled(); expect(spyCacheSave).toBeCalled();
}); });
}); });

File diff suppressed because it is too large Load Diff

View File

@ -1,443 +0,0 @@
[
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-linux-amd64.zip",
"interimVersion": 0,
"version": "14+36",
"featureVersion": 14
},
{
"buildVersion": 9,
"updateVersion": 11,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.11+9/bellsoft-jdk11.0.11+9-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.11+9",
"featureVersion": 11
},
{
"buildVersion": 8,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.1+8/bellsoft-jdk14.0.1+8-linux-amd64.zip",
"interimVersion": 0,
"version": "14.0.1+8",
"featureVersion": 14
},
{
"buildVersion": 10,
"updateVersion": 262,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u262+10/bellsoft-jdk8u262+10-linux-amd64.zip",
"interimVersion": 0,
"version": "8u262+10",
"featureVersion": 8
},
{
"buildVersion": 1,
"updateVersion": 275,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u275+1/bellsoft-jdk8u275+1-linux-amd64.zip",
"interimVersion": 0,
"version": "8u275+1",
"featureVersion": 8
},
{
"buildVersion": 1,
"updateVersion": 9,
"patchVersion": 1,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.9.1+1",
"featureVersion": 11
},
{
"buildVersion": 8,
"updateVersion": 202,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u202/bellsoft-jdk8u202-linux-amd64.zip",
"interimVersion": 0,
"version": "8u202+8",
"featureVersion": 8
},
{
"buildVersion": 33,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12/bellsoft-jdk12-linux-amd64.zip",
"interimVersion": 0,
"version": "12+33",
"featureVersion": 12
},
{
"buildVersion": 8,
"updateVersion": 282,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jdk8u282+8-linux-amd64.zip",
"interimVersion": 0,
"version": "8u282+8",
"featureVersion": 8
},
{
"buildVersion": 11,
"updateVersion": 9,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+11/bellsoft-jdk11.0.9+11-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.9+11",
"featureVersion": 11
},
{
"buildVersion": 33,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13/bellsoft-jdk13-linux-amd64.zip",
"interimVersion": 0,
"version": "13+33",
"featureVersion": 13
},
{
"buildVersion": 12,
"updateVersion": 9,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+12/bellsoft-jdk11.0.9+12-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.9+12",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 242,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u242+7/bellsoft-jdk8u242+7-linux-amd64.zip",
"interimVersion": 0,
"version": "8u242+7",
"featureVersion": 8
},
{
"buildVersion": 9,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.2+9/bellsoft-jdk13.0.2+9-linux-amd64.zip",
"interimVersion": 0,
"version": "13.0.2+9",
"featureVersion": 13
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1/bellsoft-jdk13.0.1-linux-amd64.zip",
"interimVersion": 0,
"version": "13.0.1+9",
"featureVersion": 13
},
{
"buildVersion": 1,
"updateVersion": 265,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u265+1/bellsoft-jdk8u265+1-linux-amd64.zip",
"interimVersion": 0,
"version": "8u265+1",
"featureVersion": 8
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.1+9/bellsoft-jdk15.0.1+9-linux-amd64.zip",
"interimVersion": 0,
"version": "15.0.1+9",
"featureVersion": 15
},
{
"buildVersion": 10,
"updateVersion": 272,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u272+10/bellsoft-jdk8u272+10-linux-amd64.zip",
"interimVersion": 0,
"version": "8u272+10",
"featureVersion": 8
},
{
"buildVersion": 7,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.2+7/bellsoft-jdk16.0.2+7-linux-amd64.zip",
"interimVersion": 0,
"version": "16.0.2+7",
"featureVersion": 16
},
{
"buildVersion": 10,
"updateVersion": 6,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.6+10/bellsoft-jdk11.0.6+10-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.6+10",
"featureVersion": 11
},
{
"buildVersion": 9,
"updateVersion": 252,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jdk8u252+9-linux-amd64.zip",
"interimVersion": 0,
"version": "8u252+9",
"featureVersion": 8
},
{
"buildVersion": 12,
"updateVersion": 212,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u212/bellsoft-jdk8u212-linux-amd64.zip",
"interimVersion": 0,
"version": "8u212+12",
"featureVersion": 8
},
{
"buildVersion": 10,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+10/bellsoft-jdk15.0.2+10-linux-amd64.zip",
"interimVersion": 0,
"version": "15.0.2+10",
"featureVersion": 15
},
{
"buildVersion": 9,
"updateVersion": 10,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.10+9/bellsoft-jdk11.0.10+9-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.10+9",
"featureVersion": 11
},
{
"buildVersion": 0,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.1/bellsoft-jdk11.0.1-linux-amd64.tar.gz",
"interimVersion": 0,
"version": "11.0.1+0",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 12,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.12+7/bellsoft-jdk11.0.12+7-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.12+7",
"featureVersion": 11
},
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16+36/bellsoft-jdk16+36-linux-amd64.zip",
"interimVersion": 0,
"version": "16+36",
"featureVersion": 16
},
{
"buildVersion": 12,
"updateVersion": 3,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.3/bellsoft-jdk11.0.3-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.3+12",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 8,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.8+10/bellsoft-jdk11.0.8+10-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.8+10",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.2/bellsoft-jdk11.0.2-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.2+7",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5/bellsoft-jdk11.0.5-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.5+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 4,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.4/bellsoft-jdk11.0.4-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.4+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.2/bellsoft-jdk12.0.2-linux-amd64.zip",
"interimVersion": 0,
"version": "12.0.2+10",
"featureVersion": 12
},
{
"buildVersion": 12,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.1/bellsoft-jdk12.0.1-linux-amd64.zip",
"interimVersion": 0,
"version": "12.0.1+12",
"featureVersion": 12
},
{
"buildVersion": 10,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1+10/bellsoft-jdk13.0.1+10-linux-amd64.zip",
"interimVersion": 0,
"version": "13.0.1+10",
"featureVersion": 13
},
{
"buildVersion": 11,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-linux-amd64.tar.gz",
"interimVersion": 0,
"version": "11.0.5+11",
"featureVersion": 11
},
{
"buildVersion": 11,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.5+11",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 292,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u292+10/bellsoft-jdk8u292+10-linux-amd64.zip",
"interimVersion": 0,
"version": "8u292+10",
"featureVersion": 8
},
{
"buildVersion": 11,
"updateVersion": 222,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u222/bellsoft-jdk8u222-linux-amd64.zip",
"interimVersion": 0,
"version": "8u222+11",
"featureVersion": 8
},
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15+36/bellsoft-jdk15+36-linux-amd64.zip",
"interimVersion": 0,
"version": "15+36",
"featureVersion": 15
},
{
"buildVersion": 10,
"updateVersion": 7,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.7+10/bellsoft-jdk11.0.7+10-linux-amd64.zip",
"interimVersion": 0,
"version": "11.0.7+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 232,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232+10/bellsoft-jdk8u232+10-linux-amd64.zip",
"interimVersion": 0,
"version": "8u232+10",
"featureVersion": 8
},
{
"buildVersion": 8,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+8/bellsoft-jdk15.0.2+8-linux-amd64.zip",
"interimVersion": 0,
"version": "15.0.2+8",
"featureVersion": 15
},
{
"buildVersion": 8,
"updateVersion": 302,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u302+8/bellsoft-jdk8u302+8-linux-amd64.zip",
"interimVersion": 0,
"version": "8u302+8",
"featureVersion": 8
},
{
"buildVersion": 12,
"updateVersion": 192,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u192.all/bellsoft-jdk1.8.0-linux-amd64.tar.gz",
"interimVersion": 0,
"version": "8u192+12",
"featureVersion": 8
},
{
"buildVersion": 13,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.2+13/bellsoft-jdk14.0.2+13-linux-amd64.zip",
"interimVersion": 0,
"version": "14.0.2+13",
"featureVersion": 14
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.1+9/bellsoft-jdk16.0.1+9-linux-amd64.zip",
"interimVersion": 0,
"version": "16.0.1+9",
"featureVersion": 16
},
{
"buildVersion": 9,
"updateVersion": 232,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232/bellsoft-jdk8u232-linux-amd64.zip",
"interimVersion": 0,
"version": "8u232+9",
"featureVersion": 8
},
{
"buildVersion": 13,
"updateVersion": 10,
"patchVersion": 0,
"downloadUrl":"https://download.bell-sw.com/java/17.0.10+13/bellsoft-jdk17.0.10+13-linux-amd64.tar.gz",
"interimVersion": 0,
"version": "17.0.10+13",
"featureVersion": 17
}
]

View File

@ -1,452 +0,0 @@
[
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-windows-amd64.zip",
"interimVersion": 0,
"version": "14+36",
"featureVersion": 14
},
{
"buildVersion": 9,
"updateVersion": 11,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.11+9/bellsoft-jdk11.0.11+9-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.11+9",
"featureVersion": 11
},
{
"buildVersion": 8,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.1+8/bellsoft-jdk14.0.1+8-windows-amd64.zip",
"interimVersion": 0,
"version": "14.0.1+8",
"featureVersion": 14
},
{
"buildVersion": 10,
"updateVersion": 262,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u262+10/bellsoft-jdk8u262+10-windows-amd64.zip",
"interimVersion": 0,
"version": "8u262+10",
"featureVersion": 8
},
{
"buildVersion": 1,
"updateVersion": 275,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u275+1/bellsoft-jdk8u275+1-windows-amd64.zip",
"interimVersion": 0,
"version": "8u275+1",
"featureVersion": 8
},
{
"buildVersion": 1,
"updateVersion": 9,
"patchVersion": 1,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9.1+1/bellsoft-jdk11.0.9.1+1-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.9.1+1",
"featureVersion": 11
},
{
"buildVersion": 8,
"updateVersion": 202,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u202/bellsoft-jdk8u202-windows-amd64.zip",
"interimVersion": 0,
"version": "8u202+8",
"featureVersion": 8
},
{
"buildVersion": 33,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12/bellsoft-jdk12-windows-amd64.zip",
"interimVersion": 0,
"version": "12+33",
"featureVersion": 12
},
{
"buildVersion": 8,
"updateVersion": 282,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u282+8/bellsoft-jdk8u282+8-windows-amd64.zip",
"interimVersion": 0,
"version": "8u282+8",
"featureVersion": 8
},
{
"buildVersion": 11,
"updateVersion": 9,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+11/bellsoft-jdk11.0.9+11-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.9+11",
"featureVersion": 11
},
{
"buildVersion": 33,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13/bellsoft-jdk13-windows-amd64.zip",
"interimVersion": 0,
"version": "13+33",
"featureVersion": 13
},
{
"buildVersion": 12,
"updateVersion": 9,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.9+12/bellsoft-jdk11.0.9+12-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.9+12",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 242,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u242+7/bellsoft-jdk8u242+7-windows-amd64.zip",
"interimVersion": 0,
"version": "8u242+7",
"featureVersion": 8
},
{
"buildVersion": 9,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.2+9/bellsoft-jdk13.0.2+9-windows-amd64.zip",
"interimVersion": 0,
"version": "13.0.2+9",
"featureVersion": 13
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1/bellsoft-jdk13.0.1-windows-amd64.zip",
"interimVersion": 0,
"version": "13.0.1+9",
"featureVersion": 13
},
{
"buildVersion": 1,
"updateVersion": 265,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u265+1/bellsoft-jdk8u265+1-windows-amd64.zip",
"interimVersion": 0,
"version": "8u265+1",
"featureVersion": 8
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.1+9/bellsoft-jdk15.0.1+9-windows-amd64.zip",
"interimVersion": 0,
"version": "15.0.1+9",
"featureVersion": 15
},
{
"buildVersion": 10,
"updateVersion": 272,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u272+10/bellsoft-jdk8u272+10-windows-amd64.zip",
"interimVersion": 0,
"version": "8u272+10",
"featureVersion": 8
},
{
"buildVersion": 7,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.2+7/bellsoft-jdk16.0.2+7-windows-amd64.zip",
"interimVersion": 0,
"version": "16.0.2+7",
"featureVersion": 16
},
{
"buildVersion": 10,
"updateVersion": 6,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.6+10/bellsoft-jdk11.0.6+10-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.6+10",
"featureVersion": 11
},
{
"buildVersion": 9,
"updateVersion": 252,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u252+9/bellsoft-jdk8u252+9-windows-amd64.zip",
"interimVersion": 0,
"version": "8u252+9",
"featureVersion": 8
},
{
"buildVersion": 12,
"updateVersion": 212,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u212/bellsoft-jdk8u212-windows-amd64.zip",
"interimVersion": 0,
"version": "8u212+12",
"featureVersion": 8
},
{
"buildVersion": 10,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+10/bellsoft-jdk15.0.2+10-windows-amd64.zip",
"interimVersion": 0,
"version": "15.0.2+10",
"featureVersion": 15
},
{
"buildVersion": 9,
"updateVersion": 10,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.10+9/bellsoft-jdk11.0.10+9-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.10+9",
"featureVersion": 11
},
{
"buildVersion": 0,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.1/bellsoft-jdk11.0.1-windows-amd64.tar.gz",
"interimVersion": 0,
"version": "11.0.1+0",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 12,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.12+7/bellsoft-jdk11.0.12+7-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.12+7",
"featureVersion": 11
},
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16+36/bellsoft-jdk16+36-windows-amd64.zip",
"interimVersion": 0,
"version": "16+36",
"featureVersion": 16
},
{
"buildVersion": 12,
"updateVersion": 3,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.3/bellsoft-jdk11.0.3-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.3+12",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 8,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.8+10/bellsoft-jdk11.0.8+10-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.8+10",
"featureVersion": 11
},
{
"buildVersion": 7,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.2/bellsoft-jdk11.0.2-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.2+7",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5/bellsoft-jdk11.0.5-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.5+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 4,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.4/bellsoft-jdk11.0.4-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.4+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.2/bellsoft-jdk12.0.2-windows-amd64.zip",
"interimVersion": 0,
"version": "12.0.2+10",
"featureVersion": 12
},
{
"buildVersion": 12,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/12.0.1/bellsoft-jdk12.0.1-windows-amd64.zip",
"interimVersion": 0,
"version": "12.0.1+12",
"featureVersion": 12
},
{
"buildVersion": 10,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/13.0.1+10/bellsoft-jdk13.0.1+10-windows-amd64.zip",
"interimVersion": 0,
"version": "13.0.1+10",
"featureVersion": 13
},
{
"buildVersion": 11,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-windows-amd64.tar.gz",
"interimVersion": 0,
"version": "11.0.5+11",
"featureVersion": 11
},
{
"buildVersion": 11,
"updateVersion": 5,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.5+11/bellsoft-jdk11.0.5+11-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.5+11",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 292,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u292+10/bellsoft-jdk8u292+10-windows-amd64.zip",
"interimVersion": 0,
"version": "8u292+10",
"featureVersion": 8
},
{
"buildVersion": 11,
"updateVersion": 222,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u222/bellsoft-jdk8u222-windows-amd64.zip",
"interimVersion": 0,
"version": "8u222+11",
"featureVersion": 8
},
{
"buildVersion": 36,
"updateVersion": 0,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15+36/bellsoft-jdk15+36-windows-amd64.zip",
"interimVersion": 0,
"version": "15+36",
"featureVersion": 15
},
{
"buildVersion": 10,
"updateVersion": 7,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/11.0.7+10/bellsoft-jdk11.0.7+10-windows-amd64.zip",
"interimVersion": 0,
"version": "11.0.7+10",
"featureVersion": 11
},
{
"buildVersion": 10,
"updateVersion": 232,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232+10/bellsoft-jdk8u232+10-windows-amd64.zip",
"interimVersion": 0,
"version": "8u232+10",
"featureVersion": 8
},
{
"buildVersion": 8,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/15.0.2+8/bellsoft-jdk15.0.2+8-windows-amd64.zip",
"interimVersion": 0,
"version": "15.0.2+8",
"featureVersion": 15
},
{
"buildVersion": 8,
"updateVersion": 302,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u302+8/bellsoft-jdk8u302+8-windows-amd64.zip",
"interimVersion": 0,
"version": "8u302+8",
"featureVersion": 8
},
{
"buildVersion": 12,
"updateVersion": 192,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u192.all/bellsoft-jdk1.8.0-windows-amd64.tar.gz",
"interimVersion": 0,
"version": "8u192+12",
"featureVersion": 8
},
{
"buildVersion": 13,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14.0.2+13/bellsoft-jdk14.0.2+13-windows-amd64.zip",
"interimVersion": 0,
"version": "14.0.2+13",
"featureVersion": 14
},
{
"buildVersion": 9,
"updateVersion": 1,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/16.0.1+9/bellsoft-jdk16.0.1+9-windows-amd64.zip",
"interimVersion": 0,
"version": "16.0.1+9",
"featureVersion": 16
},
{
"buildVersion": 9,
"updateVersion": 232,
"patchVersion": 0,
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/8u232/bellsoft-jdk8u232-windows-amd64.zip",
"interimVersion": 0,
"version": "8u232+9",
"featureVersion": 8
},
{
"buildVersion": 14,
"updateVersion": 2,
"patchVersion": 0,
"downloadUrl": "https://download.bell-sw.com/java/21.0.2+14/bellsoft-jdk21.0.2+14-windows-aarch64.zip",
"interimVersion": 0,
"version": "21.0.2+14",
"featureVersion": 21
},
{
"buildVersion": 13,
"updateVersion": 10,
"patchVersion": 0,
"downloadUrl": "https://download.bell-sw.com/java/17.0.10+13/bellsoft-jdk17.0.10+13-windows-aarch64.zip",
"interimVersion": 0,
"version": "17.0.10+13",
"featureVersion": 17
}
]

View File

@ -1,261 +0,0 @@
[
{
"version": "21.0.0",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-21.0.0-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.0-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.0-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-x64.zip"
},
{
"filename": "microsoft-jdk-21.0.0-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.0-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-linux-aarch64.tar.gz"
}
]
},
{
"version": "17.0.7",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-17.0.7-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.7-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.7-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-x64.zip"
},
{
"filename": "microsoft-jdk-17.0.7-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.7-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-linux-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.7-windows-aarch64.zip",
"arch": "aarch64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-aarch64.zip"
}
]
},
{
"version": "17.0.1+12.1",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-17.0.1.12.1-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.1.12.1-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.1.12.1-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-windows-x64.zip"
},
{
"filename": "microsoft-jdk-17.0.1.12.1-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-17.0.1.12.1-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-linux-aarch64.tar.gz"
}
]
},
{
"version": "16.0.2+7.1",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-16.0.2.7.1-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-16.0.2.7.1-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-16.0.2.7.1-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-16.0.2.7.1-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-16.0.2.7.1-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-16.0.2.7.1-windows-x64.zip"
},
{
"filename": "microsoft-jdk-16.0.2.7.1-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-16.0.2.7.1-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-16.0.2.7.1-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-16.0.2.7.1-linux-aarch64.tar.gz"
}
]
},
{
"version": "11.0.19",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-11.0.19-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.19-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.19-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-windows-x64.zip"
},
{
"filename": "microsoft-jdk-11.0.19-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.19-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.19-linux-aarch64.tar.gz"
}
]
},
{
"version": "11.0.15",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-11.0.15-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.15-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.15-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-windows-x64.zip"
},
{
"filename": "microsoft-jdk-11.0.15-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.15-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.15-linux-aarch64.tar.gz"
}
]
},
{
"version": "11.0.13+8.1",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-11.0.13.8.1-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.13.8.1-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-11.0.13.8.1-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-x64.zip"
},
{
"filename": "microsoft-jdk-11.0.13.8.1-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-linux-aarch64.tar.gz"
}
]
}
]

File diff suppressed because it is too large Load Diff

View File

@ -1,254 +0,0 @@
[
{
"id": 10996,
"url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-linux.tar.gz",
"name": "zulu1.8.0_05-8.1.0.10-linux.tar.gz",
"zulu_version": [8, 1, 0, 10],
"jdk_version": [8, 0, 5, 13]
},
{
"id": 10997,
"url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-linux.tar.gz",
"name": "zulu1.8.0_11-8.2.0.1-linux.tar.gz",
"zulu_version": [8, 2, 0, 1],
"jdk_version": [8, 0, 11, 12]
},
{
"id": 10346,
"url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz",
"name": "zulu8.21.0.1-jdk8.0.131-linux_x64.tar.gz",
"zulu_version": [8, 21, 0, 1],
"jdk_version": [8, 0, 131, 11]
},
{
"id": 10362,
"url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
"name": "zulu8.23.0.3-jdk8.0.144-linux_x64.tar.gz",
"zulu_version": [8, 23, 0, 3],
"jdk_version": [8, 0, 144, 1]
},
{
"id": 10399,
"url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz",
"name": "zulu8.25.0.1-jdk8.0.152-linux_x64.tar.gz",
"zulu_version": [8, 25, 0, 1],
"jdk_version": [8, 0, 152, 16]
},
{
"id": 11355,
"url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz",
"name": "zulu8.46.0.19-ca-jdk8.0.252-linux_x64.tar.gz",
"zulu_version": [8, 46, 0, 19],
"jdk_version": [8, 0, 252, 14]
},
{
"id": 11481,
"url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz",
"name": "zulu8.48.0.47-ca-jdk8.0.262-linux_x64.tar.gz",
"zulu_version": [8, 48, 0, 47],
"jdk_version": [8, 0, 262, 17]
},
{
"id": 11622,
"url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz",
"name": "zulu8.48.0.51-ca-jdk8.0.262-linux_x64.tar.gz",
"zulu_version": [8, 48, 0, 51],
"jdk_version": [8, 0, 262, 19]
},
{
"id": 11535,
"url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz",
"name": "zulu8.48.0.49-ca-jdk8.0.262-linux_x64.tar.gz",
"zulu_version": [8, 48, 0, 49],
"jdk_version": [8, 0, 262, 18]
},
{
"id": 12424,
"url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz",
"name": "zulu8.52.0.23-ca-jdk8.0.282-linux_x64.tar.gz",
"zulu_version": [8, 52, 0, 23],
"jdk_version": [8, 0, 282, 8]
},
{
"id": 10383,
"url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz",
"name": "zulu9.0.0.15-jdk9.0.0-linux_x64.tar.gz",
"zulu_version": [9, 0, 0, 15],
"jdk_version": [9, 0, 0, 0]
},
{
"id": 10413,
"url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz",
"name": "zulu9.0.1.3-jdk9.0.1-linux_x64.tar.gz",
"zulu_version": [9, 0, 1, 3],
"jdk_version": [9, 0, 1, 0]
},
{
"id": 10503,
"url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-linux_x64.tar.gz",
"name": "zulu10.2+3-jdk10.0.1-linux_x64.tar.gz",
"zulu_version": [10, 2, 3, 0],
"jdk_version": [10, 0, 1, 9]
},
{
"id": 10541,
"url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-linux_x64.tar.gz",
"name": "zulu10.3+5-jdk10.0.2-linux_x64.tar.gz",
"zulu_version": [10, 3, 5, 0],
"jdk_version": [10, 0, 2, 13]
},
{
"id": 10576,
"url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz",
"name": "zulu11.2.3-jdk11.0.1-linux_x64.tar.gz",
"zulu_version": [11, 2, 3, 0],
"jdk_version": [11, 0, 1, 13]
},
{
"id": 10604,
"url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz",
"name": "zulu11.29.3-ca-jdk11.0.2-linux_x64.tar.gz",
"zulu_version": [11, 29, 3, 0],
"jdk_version": [11, 0, 2, 7]
},
{
"id": 10687,
"url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz",
"name": "zulu11.31.11-ca-jdk11.0.3-linux_x64.tar.gz",
"zulu_version": [11, 31, 11, 0],
"jdk_version": [11, 0, 3, 7]
},
{
"id": 10856,
"url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz",
"name": "zulu11.35.13-ca-jdk11.0.5-linux_x64.tar.gz",
"zulu_version": [11, 35, 13, 0],
"jdk_version": [11, 0, 5, 10]
},
{
"id": 10933,
"url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
"name": "zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
"zulu_version": [11, 35, 15, 0],
"jdk_version": [11, 0, 5, 10]
},
{
"id": 10933,
"url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-linux_x64.tar.gz",
"name": "zulu11.35.15-ca-jdk11.0.5-linux_x64.tar.gz",
"zulu_version": [11, 35, 11, 0],
"jdk_version": [11, 0, 5, 10]
},
{
"id": 12397,
"url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz",
"name": "zulu11.45.27-ca-jdk11.0.10-linux_x64.tar.gz",
"zulu_version": [11, 45, 27, 0],
"jdk_version": [11, 0, 10, 9]
},
{
"id": 10667,
"url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz",
"name": "zulu12.1.3-ca-jdk12.0.0-linux_x64.tar.gz",
"zulu_version": [12, 1, 3, 0],
"jdk_version": [12, 0, 0, 33]
},
{
"id": 10710,
"url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz",
"name": "zulu12.2.3-ca-jdk12.0.1-linux_x64.tar.gz",
"zulu_version": [12, 2, 3, 0],
"jdk_version": [12, 0, 1, 12]
},
{
"id": 10780,
"url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz",
"name": "zulu12.3.11-ca-jdk12.0.2-linux_x64.tar.gz",
"zulu_version": [12, 3, 11, 0],
"jdk_version": [12, 0, 2, 3]
},
{
"id": 10846,
"url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz",
"name": "zulu13.27.9-ca-jdk13.0.0-linux_x64.tar.gz",
"zulu_version": [13, 27, 9, 0],
"jdk_version": [13, 0, 0, 33]
},
{
"id": 10888,
"url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz",
"name": "zulu13.28.11-ca-jdk13.0.1-linux_x64.tar.gz",
"zulu_version": [13, 28, 11, 0],
"jdk_version": [13, 0, 1, 10]
},
{
"id": 11073,
"url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz",
"name": "zulu13.29.9-ca-jdk13.0.2-linux_x64.tar.gz",
"zulu_version": [13, 29, 9, 0],
"jdk_version": [13, 0, 2, 6]
},
{
"id": 12408,
"url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz",
"name": "zulu13.37.21-ca-jdk13.0.6-linux_x64.tar.gz",
"zulu_version": [13, 37, 21, 0],
"jdk_version": [13, 0, 6, 5]
},
{
"id": 11236,
"url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz",
"name": "zulu14.27.1-ca-jdk14.0.0-linux_x64.tar.gz",
"zulu_version": [14, 27, 1, 0],
"jdk_version": [14, 0, 0, 36]
},
{
"id": 11349,
"url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz",
"name": "zulu14.28.21-ca-jdk14.0.1-linux_x64.tar.gz",
"zulu_version": [14, 28, 21, 0],
"jdk_version": [14, 0, 1, 8]
},
{
"id": 11513,
"url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz",
"name": "zulu14.29.23-ca-jdk14.0.2-linux_x64.tar.gz",
"zulu_version": [14, 29, 23, 0],
"jdk_version": [14, 0, 2, 12]
},
{
"id": 11780,
"url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz",
"name": "zulu15.27.17-ca-jdk15.0.0-linux_x64.tar.gz",
"zulu_version": [15, 27, 17, 0],
"jdk_version": [15, 0, 0, 36]
},
{
"id": 11924,
"url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz",
"name": "zulu15.28.13-ca-jdk15.0.1-linux_x64.tar.gz",
"zulu_version": [15, 28, 13, 0],
"jdk_version": [15, 0, 1, 8]
},
{
"id": 12101,
"url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz",
"name": "zulu15.28.51-ca-jdk15.0.1-linux_x64.tar.gz",
"zulu_version": [15, 28, 51, 0],
"jdk_version": [15, 0, 1, 9]
},
{
"id": 12445,
"url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz",
"name": "zulu15.29.15-ca-jdk15.0.2-linux_x64.tar.gz",
"zulu_version": [15, 29, 15, 0],
"jdk_version": [15, 0, 2, 7]
},
{
"id": 12447,
"url": "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz",
"name": "zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz",
"zulu_version": [21, 32, 17, 0],
"jdk_version": [21, 0, 2, 6]
}
]

View File

@ -1,254 +0,0 @@
[
{
"id": 10996,
"url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_05-8.1.0.10-windows.tar.gz",
"name": "zulu1.8.0_05-8.1.0.10-windows.tar.gz",
"zulu_version": [8, 1, 0, 10],
"jdk_version": [8, 0, 5, 13]
},
{
"id": 10997,
"url": "https://cdn.azul.com/zulu/bin/zulu1.8.0_11-8.2.0.1-windows.tar.gz",
"name": "zulu1.8.0_11-8.2.0.1-windows.tar.gz",
"zulu_version": [8, 2, 0, 1],
"jdk_version": [8, 0, 11, 12]
},
{
"id": 10346,
"url": "https://cdn.azul.com/zulu/bin/zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz",
"name": "zulu8.21.0.1-jdk8.0.131-windows_x64.tar.gz",
"zulu_version": [8, 21, 0, 1],
"jdk_version": [8, 0, 131, 11]
},
{
"id": 10362,
"url": "https://cdn.azul.com/zulu/bin/zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz",
"name": "zulu8.23.0.3-jdk8.0.144-windows_x64.tar.gz",
"zulu_version": [8, 23, 0, 3],
"jdk_version": [8, 0, 144, 1]
},
{
"id": 10399,
"url": "https://cdn.azul.com/zulu/bin/zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz",
"name": "zulu8.25.0.1-jdk8.0.152-windows_x64.tar.gz",
"zulu_version": [8, 25, 0, 1],
"jdk_version": [8, 0, 152, 16]
},
{
"id": 11355,
"url": "https://cdn.azul.com/zulu/bin/zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz",
"name": "zulu8.46.0.19-ca-jdk8.0.252-windows_x64.tar.gz",
"zulu_version": [8, 46, 0, 19],
"jdk_version": [8, 0, 252, 14]
},
{
"id": 11481,
"url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz",
"name": "zulu8.48.0.47-ca-jdk8.0.262-windows_x64.tar.gz",
"zulu_version": [8, 48, 0, 47],
"jdk_version": [8, 0, 262, 17]
},
{
"id": 11622,
"url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz",
"name": "zulu8.48.0.51-ca-jdk8.0.262-windows_x64.tar.gz",
"zulu_version": [8, 48, 0, 51],
"jdk_version": [8, 0, 262, 19]
},
{
"id": 11535,
"url": "https://cdn.azul.com/zulu/bin/zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz",
"name": "zulu8.48.0.49-ca-jdk8.0.262-windows_x64.tar.gz",
"zulu_version": [8, 48, 0, 49],
"jdk_version": [8, 0, 262, 18]
},
{
"id": 12424,
"url": "https://cdn.azul.com/zulu/bin/zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz",
"name": "zulu8.52.0.23-ca-jdk8.0.282-windows_x64.tar.gz",
"zulu_version": [8, 52, 0, 23],
"jdk_version": [8, 0, 282, 8]
},
{
"id": 10383,
"url": "https://cdn.azul.com/zulu/bin/zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz",
"name": "zulu9.0.0.15-jdk9.0.0-windows_x64.tar.gz",
"zulu_version": [9, 0, 0, 15],
"jdk_version": [9, 0, 0, 0]
},
{
"id": 10413,
"url": "https://cdn.azul.com/zulu/bin/zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz",
"name": "zulu9.0.1.3-jdk9.0.1-windows_x64.tar.gz",
"zulu_version": [9, 0, 1, 3],
"jdk_version": [9, 0, 1, 0]
},
{
"id": 10503,
"url": "https://cdn.azul.com/zulu/bin/zulu10.2+3-jdk10.0.1-windows_x64.tar.gz",
"name": "zulu10.2+3-jdk10.0.1-windows_x64.tar.gz",
"zulu_version": [10, 2, 3, 0],
"jdk_version": [10, 0, 1, 9]
},
{
"id": 10541,
"url": "https://cdn.azul.com/zulu/bin/zulu10.3+5-jdk10.0.2-windows_x64.tar.gz",
"name": "zulu10.3+5-jdk10.0.2-windows_x64.tar.gz",
"zulu_version": [10, 3, 5, 0],
"jdk_version": [10, 0, 2, 13]
},
{
"id": 10576,
"url": "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-windows_x64.tar.gz",
"name": "zulu11.2.3-jdk11.0.1-windows_x64.tar.gz",
"zulu_version": [11, 2, 3, 0],
"jdk_version": [11, 0, 1, 13]
},
{
"id": 10604,
"url": "https://cdn.azul.com/zulu/bin/zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz",
"name": "zulu11.29.3-ca-jdk11.0.2-windows_x64.tar.gz",
"zulu_version": [11, 29, 3, 0],
"jdk_version": [11, 0, 2, 7]
},
{
"id": 10687,
"url": "https://cdn.azul.com/zulu/bin/zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz",
"name": "zulu11.31.11-ca-jdk11.0.3-windows_x64.tar.gz",
"zulu_version": [11, 31, 11, 0],
"jdk_version": [11, 0, 3, 7]
},
{
"id": 10856,
"url": "https://cdn.azul.com/zulu/bin/zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz",
"name": "zulu11.35.13-ca-jdk11.0.5-windows_x64.tar.gz",
"zulu_version": [11, 35, 13, 0],
"jdk_version": [11, 0, 5, 10]
},
{
"id": 10933,
"url": "https://cdn.azul.com/zulu/bin/zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
"name": "zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
"zulu_version": [11, 35, 15, 0],
"jdk_version": [11, 0, 5, 10]
},
{
"id": 10933,
"url": "https://cdn.azul.com/zulu/bin/zulu11.35.11-ca-jdk11.0.5-windows_x64.tar.gz",
"name": "zulu11.35.15-ca-jdk11.0.5-windows_x64.tar.gz",
"zulu_version": [11, 35, 11, 0],
"jdk_version": [11, 0, 5, 10]
},
{
"id": 12397,
"url": "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz",
"name": "zulu11.45.27-ca-jdk11.0.10-windows_x64.tar.gz",
"zulu_version": [11, 45, 27, 0],
"jdk_version": [11, 0, 10, 9]
},
{
"id": 10667,
"url": "https://cdn.azul.com/zulu/bin/zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz",
"name": "zulu12.1.3-ca-jdk12.0.0-windows_x64.tar.gz",
"zulu_version": [12, 1, 3, 0],
"jdk_version": [12, 0, 0, 33]
},
{
"id": 10710,
"url": "https://cdn.azul.com/zulu/bin/zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz",
"name": "zulu12.2.3-ca-jdk12.0.1-windows_x64.tar.gz",
"zulu_version": [12, 2, 3, 0],
"jdk_version": [12, 0, 1, 12]
},
{
"id": 10780,
"url": "https://cdn.azul.com/zulu/bin/zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz",
"name": "zulu12.3.11-ca-jdk12.0.2-windows_x64.tar.gz",
"zulu_version": [12, 3, 11, 0],
"jdk_version": [12, 0, 2, 3]
},
{
"id": 10846,
"url": "https://cdn.azul.com/zulu/bin/zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz",
"name": "zulu13.27.9-ca-jdk13.0.0-windows_x64.tar.gz",
"zulu_version": [13, 27, 9, 0],
"jdk_version": [13, 0, 0, 33]
},
{
"id": 10888,
"url": "https://cdn.azul.com/zulu/bin/zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz",
"name": "zulu13.28.11-ca-jdk13.0.1-windows_x64.tar.gz",
"zulu_version": [13, 28, 11, 0],
"jdk_version": [13, 0, 1, 10]
},
{
"id": 11073,
"url": "https://cdn.azul.com/zulu/bin/zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz",
"name": "zulu13.29.9-ca-jdk13.0.2-windows_x64.tar.gz",
"zulu_version": [13, 29, 9, 0],
"jdk_version": [13, 0, 2, 6]
},
{
"id": 12408,
"url": "https://cdn.azul.com/zulu/bin/zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz",
"name": "zulu13.37.21-ca-jdk13.0.6-windows_x64.tar.gz",
"zulu_version": [13, 37, 21, 0],
"jdk_version": [13, 0, 6, 5]
},
{
"id": 11236,
"url": "https://cdn.azul.com/zulu/bin/zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz",
"name": "zulu14.27.1-ca-jdk14.0.0-windows_x64.tar.gz",
"zulu_version": [14, 27, 1, 0],
"jdk_version": [14, 0, 0, 36]
},
{
"id": 11349,
"url": "https://cdn.azul.com/zulu/bin/zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz",
"name": "zulu14.28.21-ca-jdk14.0.1-windows_x64.tar.gz",
"zulu_version": [14, 28, 21, 0],
"jdk_version": [14, 0, 1, 8]
},
{
"id": 11513,
"url": "https://cdn.azul.com/zulu/bin/zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz",
"name": "zulu14.29.23-ca-jdk14.0.2-windows_x64.tar.gz",
"zulu_version": [14, 29, 23, 0],
"jdk_version": [14, 0, 2, 12]
},
{
"id": 11780,
"url": "https://cdn.azul.com/zulu/bin/zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz",
"name": "zulu15.27.17-ca-jdk15.0.0-windows_x64.tar.gz",
"zulu_version": [15, 27, 17, 0],
"jdk_version": [15, 0, 0, 36]
},
{
"id": 11924,
"url": "https://cdn.azul.com/zulu/bin/zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz",
"name": "zulu15.28.13-ca-jdk15.0.1-windows_x64.tar.gz",
"zulu_version": [15, 28, 13, 0],
"jdk_version": [15, 0, 1, 8]
},
{
"id": 12101,
"url": "https://cdn.azul.com/zulu/bin/zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz",
"name": "zulu15.28.51-ca-jdk15.0.1-windows_x64.tar.gz",
"zulu_version": [15, 28, 51, 0],
"jdk_version": [15, 0, 1, 9]
},
{
"id": 12445,
"url": "https://cdn.azul.com/zulu/bin/zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz",
"name": "zulu15.29.15-ca-jdk15.0.2-windows_x64.tar.gz",
"zulu_version": [15, 29, 15, 0],
"jdk_version": [15, 0, 2, 7]
},
{
"id": 12446,
"url": "https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip",
"name": "zulu17.48.15-ca-jdk17.0.10-win_aarhc4.zip",
"zulu_version": [17, 48, 15, 0],
"jdk_version": [17, 0, 10, 7]
}
]

View File

@ -1,14 +1,11 @@
import { HttpClient } from '@actions/http-client'; import { HttpClient } from '@actions/http-client';
import {IAdoptAvailableVersions} from '../../src/distributions/adopt/models';
import { import { AdoptDistribution, AdoptImplementation } from '../../src/distributions/adopt/installer';
AdoptDistribution,
AdoptImplementation
} from '../../src/distributions/adopt/installer';
import { JavaInstallerOptions } from '../../src/distributions/base-models'; import { JavaInstallerOptions } from '../../src/distributions/base-models';
import os from 'os'; import os from 'os';
import manifestData from '../data/adopt.json'; let manifestData = require('../data/adopt.json') as [];
describe('getAvailableVersions', () => { describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance; let spyHttpClient: jest.SpyInstance;
@ -30,82 +27,42 @@ describe('getAvailableVersions', () => {
it.each([ it.each([
[ [
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot, AdoptImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot, AdoptImplementation.Hotspot,
'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
AdoptImplementation.Hotspot, AdoptImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '11-ea', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11-ea',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot, AdoptImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.OpenJ9, AdoptImplementation.OpenJ9,
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
], ],
[ [
{ { version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.OpenJ9, AdoptImplementation.OpenJ9,
'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0' 'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
], ],
[ [
{ { version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
AdoptImplementation.OpenJ9, AdoptImplementation.OpenJ9,
'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=openj9&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
], ],
[ [
{ { version: '11-ea', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11-ea',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.OpenJ9, AdoptImplementation.OpenJ9,
'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=openj9&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=openj9&page_size=20&page=0'
] ]
@ -117,8 +74,7 @@ describe('getAvailableVersions', () => {
expectedParameters expectedParameters
) => { ) => {
const distribution = new AdoptDistribution(installerOptions, impl); const distribution = new AdoptDistribution(installerOptions, impl);
const baseUrl = const baseUrl = 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`; const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
distribution['getPlatformOption'] = () => 'mac'; distribution['getPlatformOption'] = () => 'mac';
@ -135,12 +91,12 @@ describe('getAvailableVersions', () => {
.mockReturnValueOnce({ .mockReturnValueOnce({
statusCode: 200, statusCode: 200,
headers: {}, headers: {},
result: manifestData as any result: manifestData
}) })
.mockReturnValueOnce({ .mockReturnValueOnce({
statusCode: 200, statusCode: 200,
headers: {}, headers: {},
result: manifestData as any result: manifestData
}) })
.mockReturnValueOnce({ .mockReturnValueOnce({
statusCode: 200, statusCode: 200,
@ -149,12 +105,7 @@ describe('getAvailableVersions', () => {
}); });
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot AdoptImplementation.Hotspot
); );
const availableVersions = await distribution['getAvailableVersions'](); const availableVersions = await distribution['getAvailableVersions']();
@ -171,12 +122,7 @@ describe('getAvailableVersions', () => {
'find right toolchain folder', 'find right toolchain folder',
(impl: AdoptImplementation, packageType: string, expected: string) => { (impl: AdoptImplementation, packageType: string, expected: string) => {
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(
{ { version: '11', architecture: 'x64', packageType: packageType, checkLatest: false },
version: '11',
architecture: 'x64',
packageType: packageType,
checkLatest: false
},
impl impl
); );
@ -202,12 +148,8 @@ describe('getAvailableVersions', () => {
const expectedParameters = `os=mac&architecture=${distroArch}&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0`; const expectedParameters = `os=mac&architecture=${distroArch}&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0`;
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(installerOptions, AdoptImplementation.Hotspot);
installerOptions, const baseUrl = 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
AdoptImplementation.Hotspot
);
const baseUrl =
'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`; const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
distribution['getPlatformOption'] = () => 'mac'; distribution['getPlatformOption'] = () => 'mac';
@ -234,63 +176,43 @@ describe('findPackageForDownload', () => {
['15.0.1+9.1', '15.0.1+9.1'] ['15.0.1+9.1', '15.0.1+9.1']
])('version is resolved correctly %s -> %s', async (input, expected) => { ])('version is resolved correctly %s -> %s', async (input, expected) => {
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot AdoptImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData;
const resolvedVersion = await distribution['findPackageForDownload'](input); const resolvedVersion = await distribution['findPackageForDownload'](input);
expect(resolvedVersion.version).toBe(expected); expect(resolvedVersion.version).toBe(expected);
}); });
it('version is found but binaries list is empty', async () => { it('version is found but binaries list is empty', async () => {
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot AdoptImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData;
await expect( await expect(distribution['findPackageForDownload']('9.0.8')).rejects.toThrowError(
distribution['findPackageForDownload']('9.0.8') /Could not find satisfied version for SemVer */
).rejects.toThrow(/Could not find satisfied version for SemVer */); );
}); });
it('version is not found', async () => { it('version is not found', async () => {
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot AdoptImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData;
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow( await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrowError(
/Could not find satisfied version for SemVer */ /Could not find satisfied version for SemVer */
); );
}); });
it('version list is empty', async () => { it('version list is empty', async () => {
const distribution = new AdoptDistribution( const distribution = new AdoptDistribution(
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
AdoptImplementation.Hotspot AdoptImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => []; distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow( await expect(distribution['findPackageForDownload']('11')).rejects.toThrowError(
/Could not find satisfied version for SemVer */ /Could not find satisfied version for SemVer */
); );
}); });

View File

@ -19,23 +19,14 @@ class EmptyJavaBase extends JavaBase {
super('Empty', installerOptions); super('Empty', installerOptions);
} }
protected async downloadTool( protected async downloadTool(javaRelease: JavaDownloadRelease): Promise<JavaInstallerResults> {
javaRelease: JavaDownloadRelease
): Promise<JavaInstallerResults> {
return { return {
version: '11.0.9', version: '11.0.9',
path: path.join( path: path.join('toolcache', this.toolcacheFolderName, '11.0.9', this.architecture)
'toolcache',
this.toolcacheFolderName,
'11.0.9',
this.architecture
)
}; };
} }
protected async findPackageForDownload( protected async findPackageForDownload(range: string): Promise<JavaDownloadRelease> {
range: string
): Promise<JavaDownloadRelease> {
const availableVersion = '11.0.9'; const availableVersion = '11.0.9';
if (!semver.satisfies(availableVersion, range)) { if (!semver.satisfies(availableVersion, range)) {
throw new Error('Available version not found'); throw new Error('Available version not found');
@ -69,111 +60,44 @@ describe('findInToolcache', () => {
it.each([ it.each([
[ [
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
{ version: actualJavaVersion, path: javaPath } { version: actualJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11.0', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11.0',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
{ version: actualJavaVersion, path: javaPath } { version: actualJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11.0.8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
{ version: actualJavaVersion, path: javaPath } { version: actualJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: true },
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: true
},
{ version: actualJavaVersion, path: javaPath } { version: actualJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11.0', architecture: 'x64', packageType: 'jdk', checkLatest: true },
version: '11.0',
architecture: 'x64',
packageType: 'jdk',
checkLatest: true
},
{ version: actualJavaVersion, path: javaPath } { version: actualJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: true },
version: '11.0.8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: true
},
{ version: actualJavaVersion, path: javaPath } { version: actualJavaVersion, path: javaPath }
], ],
[ [{ version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false }, null],
{ [{ version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false }, null],
version: '11', [{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false }, null],
architecture: 'x64', [{ version: '11', architecture: 'x86', packageType: 'jre', checkLatest: false }, null]
packageType: 'jre',
checkLatest: false
},
null
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
null
],
[
{
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
null
],
[
{
version: '11',
architecture: 'x86',
packageType: 'jre',
checkLatest: false
},
null
]
])(`should find java for path %s -> %s`, (input, expected) => { ])(`should find java for path %s -> %s`, (input, expected) => {
spyTcFindAllVersions.mockReturnValue([actualJavaVersion]); spyTcFindAllVersions.mockReturnValue([actualJavaVersion]);
spyGetToolcachePath.mockImplementation( spyGetToolcachePath.mockImplementation(
(toolname: string, javaVersion: string, architecture: string) => { (toolname: string, javaVersion: string, architecture: string) => {
const semverVersion = new semver.Range(javaVersion); const semverVersion = new semver.Range(javaVersion);
if ( if (path.basename(javaPath) !== architecture || !javaPath.includes(toolname)) {
path.basename(javaPath) !== architecture ||
!javaPath.includes(toolname)
) {
return ''; return '';
} }
return semver.satisfies(actualJavaVersion, semverVersion) return semver.satisfies(actualJavaVersion, semverVersion) ? javaPath : '';
? javaPath
: '';
} }
); );
mockJavaBase = new EmptyJavaBase(input); mockJavaBase = new EmptyJavaBase(input);
@ -188,15 +112,10 @@ describe('findInToolcache', () => {
['15', { version: '15.0.2+4', versionInPath: '15.0.2-4' }], ['15', { version: '15.0.2+4', versionInPath: '15.0.2-4' }],
['x', { version: '15.0.2+4', versionInPath: '15.0.2-4' }], ['x', { version: '15.0.2+4', versionInPath: '15.0.2-4' }],
['x-ea', { version: '17.4.4', versionInPath: '17.4.4-ea' }], ['x-ea', { version: '17.4.4', versionInPath: '17.4.4-ea' }],
[ ['11-ea', { version: '11.3.3+5.2.1231421', versionInPath: '11.3.3-ea.5.2.1231421' }],
'11-ea',
{version: '11.3.3+5.2.1231421', versionInPath: '11.3.3-ea.5.2.1231421'}
],
['11.2-ea', { version: '11.2.1', versionInPath: '11.2.1-ea' }], ['11.2-ea', { version: '11.2.1', versionInPath: '11.2.1-ea' }],
['11.2.1-ea', { version: '11.2.1', versionInPath: '11.2.1-ea' }] ['11.2.1-ea', { version: '11.2.1', versionInPath: '11.2.1-ea' }]
])( ])('should choose correct java from tool-cache for input %s', (input, expected) => {
'should choose correct java from tool-cache for input %s',
(input, expected) => {
spyTcFindAllVersions.mockReturnValue([ spyTcFindAllVersions.mockReturnValue([
'17.4.4-ea', '17.4.4-ea',
'11.0.2', '11.0.2',
@ -224,20 +143,14 @@ describe('findInToolcache', () => {
version: expected.version, version: expected.version,
path: `/hostedtoolcache/Java_Empty_jdk/${expected.versionInPath}/x64` path: `/hostedtoolcache/Java_Empty_jdk/${expected.versionInPath}/x64`
}); });
} });
);
}); });
describe('setupJava', () => { describe('setupJava', () => {
const actualJavaVersion = '11.0.9'; const actualJavaVersion = '11.0.9';
const installedJavaVersion = '11.0.8'; const installedJavaVersion = '11.0.8';
const javaPath = path.join('Java_Empty_jdk', installedJavaVersion, 'x86'); const javaPath = path.join('Java_Empty_jdk', installedJavaVersion, 'x86');
const javaPathInstalled = path.join( const javaPathInstalled = path.join('toolcache', 'Java_Empty_jdk', actualJavaVersion, 'x86');
'toolcache',
'Java_Empty_jdk',
actualJavaVersion,
'x86'
);
let mockJavaBase: EmptyJavaBase; let mockJavaBase: EmptyJavaBase;
@ -255,16 +168,11 @@ describe('setupJava', () => {
(toolname: string, javaVersion: string, architecture: string) => { (toolname: string, javaVersion: string, architecture: string) => {
const semverVersion = new semver.Range(javaVersion); const semverVersion = new semver.Range(javaVersion);
if ( if (path.basename(javaPath) !== architecture || !javaPath.includes(toolname)) {
path.basename(javaPath) !== architecture ||
!javaPath.includes(toolname)
) {
return ''; return '';
} }
return semver.satisfies(installedJavaVersion, semverVersion) return semver.satisfies(installedJavaVersion, semverVersion) ? javaPath : '';
? javaPath
: '';
} }
); );
@ -298,46 +206,27 @@ describe('setupJava', () => {
it.each([ it.each([
[ [
{ { version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
{ version: installedJavaVersion, path: javaPath } { version: installedJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11.0', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11.0',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
{ version: installedJavaVersion, path: javaPath } { version: installedJavaVersion, path: javaPath }
], ],
[ [
{ { version: '11.0.8', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11.0.8',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
{ version: installedJavaVersion, path: javaPath } { version: installedJavaVersion, path: javaPath }
], ],
[ [
{ version: '11', architecture: '', packageType: 'jdk', checkLatest: false }, { version: '11', architecture: '', packageType: 'jdk', checkLatest: false },
{ version: installedJavaVersion, path: javaPath } { version: installedJavaVersion, path: javaPath }
] ]
])('should find java locally for %s', async (input, expected) => { ])('should find java locally for %s', (input, expected) => {
mockJavaBase = new EmptyJavaBase(input); mockJavaBase = new EmptyJavaBase(input);
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected); expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyGetToolcachePath).toHaveBeenCalled(); expect(spyGetToolcachePath).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${expected.version} from tool-cache`);
`Resolved Java ${expected.version} from tool-cache` expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Setting Java ${expected.version} as the default`
);
expect(spyCoreInfo).not.toHaveBeenCalledWith( expect(spyCoreInfo).not.toHaveBeenCalledWith(
'Trying to resolve the latest version from remote' 'Trying to resolve the latest version from remote'
); );
@ -346,47 +235,20 @@ describe('setupJava', () => {
it.each([ it.each([
[ [
{ { version: '11', architecture: 'x86', packageType: 'jre', checkLatest: false },
version: '11', { path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x86'), version: '11.0.9' }
architecture: 'x86',
packageType: 'jre',
checkLatest: false
},
{
path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x86'),
version: '11.0.9'
}
], ],
[ [
{ { version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11', { path: path.join('toolcache', 'Java_Empty_jdk', '11.0.9', 'x64'), version: '11.0.9' }
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
{
path: path.join('toolcache', 'Java_Empty_jdk', '11.0.9', 'x64'),
version: '11.0.9'
}
], ],
[ [
{ { version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false },
version: '11', { path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x64'), version: '11.0.9' }
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
{
path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x64'),
version: '11.0.9'
}
], ],
[ [
{ version: '11', architecture: '', packageType: 'jre', checkLatest: false }, { version: '11', architecture: '', packageType: 'jre', checkLatest: false },
{ { path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x86'), version: '11.0.9' }
path: path.join('toolcache', 'Java_Empty_jre', '11.0.9', 'x86'),
version: '11.0.9'
}
] ]
])('download java with configuration %s', async (input, expected) => { ])('download java with configuration %s', async (input, expected) => {
mockJavaBase = new EmptyJavaBase(input); mockJavaBase = new EmptyJavaBase(input);
@ -395,154 +257,75 @@ describe('setupJava', () => {
expect(spyCoreAddPath).toHaveBeenCalled(); expect(spyCoreAddPath).toHaveBeenCalled();
expect(spyCoreExportVariable).toHaveBeenCalled(); expect(spyCoreExportVariable).toHaveBeenCalled();
expect(spyCoreExportVariable).toHaveBeenCalledWith( expect(spyCoreExportVariable).toHaveBeenCalledWith(
`JAVA_HOME_${input.version}_${( `JAVA_HOME_${input.version}_${(input.architecture || 'x86').toLocaleUpperCase()}`,
input.architecture || 'x86'
).toLocaleUpperCase()}`,
expected.path expected.path
); );
expect(spyCoreSetOutput).toHaveBeenCalled(); expect(spyCoreSetOutput).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
'Trying to resolve the latest version from remote' expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${expected.version}`);
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Resolved latest version as ${expected.version}`
);
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...'); expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Java ${expected.version} was downloaded`);
`Java ${expected.version} was downloaded` expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Setting Java ${expected.version} as the default`
);
}); });
it.each([ it.each([
[ [
{ { version: '11.0.9', architecture: 'x86', packageType: 'jdk', checkLatest: true },
version: '11.0.9',
architecture: 'x86',
packageType: 'jdk',
checkLatest: true
},
{ version: '11.0.9', path: javaPathInstalled } { version: '11.0.9', path: javaPathInstalled }
], ],
[ [
{ { version: '11.0.9', architecture: '', packageType: 'jdk', checkLatest: true },
version: '11.0.9',
architecture: '',
packageType: 'jdk',
checkLatest: true
},
{ version: '11.0.9', path: javaPathInstalled } { version: '11.0.9', path: javaPathInstalled }
] ]
])( ])('should check the latest java version for %s and resolve locally', async (input, expected) => {
'should check the latest java version for %s and resolve locally',
async (input, expected) => {
mockJavaBase = new EmptyJavaBase(input); mockJavaBase = new EmptyJavaBase(input);
mockJavaBase['findInToolcache'] = () => ({ mockJavaBase['findInToolcache'] = () => ({ version: '11.0.9', path: expected.path });
version: '11.0.9',
path: expected.path
});
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected); await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
'Trying to resolve the latest version from remote' expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${expected.version}`);
); expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${expected.version} from tool-cache`);
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
`Resolved latest version as ${expected.version}` });
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Resolved Java ${expected.version} from tool-cache`
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Setting Java ${expected.version} as the default`
);
}
);
it.each([ it.each([
[ [
{ { version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: true },
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: true
},
{ version: actualJavaVersion, path: javaPathInstalled } { version: actualJavaVersion, path: javaPathInstalled }
], ],
[ [
{ { version: '11.0', architecture: 'x86', packageType: 'jdk', checkLatest: true },
version: '11.0',
architecture: 'x86',
packageType: 'jdk',
checkLatest: true
},
{ version: actualJavaVersion, path: javaPathInstalled } { version: actualJavaVersion, path: javaPathInstalled }
], ],
[ [
{ { version: '11.0.x', architecture: 'x86', packageType: 'jdk', checkLatest: true },
version: '11.0.x',
architecture: 'x86',
packageType: 'jdk',
checkLatest: true
},
{ version: actualJavaVersion, path: javaPathInstalled } { version: actualJavaVersion, path: javaPathInstalled }
], ],
[ [
{ version: '11', architecture: '', packageType: 'jdk', checkLatest: true }, { version: '11', architecture: '', packageType: 'jdk', checkLatest: true },
{ version: actualJavaVersion, path: javaPathInstalled } { version: actualJavaVersion, path: javaPathInstalled }
] ]
])( ])('should check the latest java version for %s and download', async (input, expected) => {
'should check the latest java version for %s and download',
async (input, expected) => {
mockJavaBase = new EmptyJavaBase(input); mockJavaBase = new EmptyJavaBase(input);
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected); await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyGetToolcachePath).toHaveBeenCalled(); expect(spyGetToolcachePath).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
'Trying to resolve the latest version from remote' expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${actualJavaVersion}`);
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Resolved latest version as ${actualJavaVersion}`
);
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...'); expect(spyCoreInfo).toHaveBeenCalledWith('Trying to download...');
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Java ${actualJavaVersion} was downloaded`);
`Java ${actualJavaVersion} was downloaded` expect(spyCoreInfo).toHaveBeenCalledWith(`Setting Java ${expected.version} as the default`);
); });
expect(spyCoreInfo).toHaveBeenCalledWith(
`Setting Java ${expected.version} as the default`
);
}
);
it.each([ it.each([
[ [{ version: '15', architecture: 'x86', packageType: 'jre', checkLatest: false }],
{ [{ version: '11.0.7', architecture: 'x64', packageType: 'jre', checkLatest: false }]
version: '15', ])('should throw an error for Available version not found for %s', async input => {
architecture: 'x86',
packageType: 'jre',
checkLatest: false
}
],
[
{
version: '11.0.7',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
}
]
])(
'should throw an error for Available version not found for %s',
async input => {
mockJavaBase = new EmptyJavaBase(input); mockJavaBase = new EmptyJavaBase(input);
await expect(mockJavaBase.setupJava()).rejects.toThrow( await expect(mockJavaBase.setupJava()).rejects.toThrowError('Available version not found');
'Available version not found'
);
expect(spyTcFindAllVersions).toHaveBeenCalled(); expect(spyTcFindAllVersions).toHaveBeenCalled();
expect(spyCoreAddPath).not.toHaveBeenCalled(); expect(spyCoreAddPath).not.toHaveBeenCalled();
expect(spyCoreExportVariable).not.toHaveBeenCalled(); expect(spyCoreExportVariable).not.toHaveBeenCalled();
expect(spyCoreSetOutput).not.toHaveBeenCalled(); expect(spyCoreSetOutput).not.toHaveBeenCalled();
} });
);
}); });
describe('normalizeVersion', () => { describe('normalizeVersion', () => {
@ -555,16 +338,12 @@ describe('normalizeVersion', () => {
['11-ea', { version: '11', stable: false }], ['11-ea', { version: '11', stable: false }],
['11.0.2-ea', { version: '11.0.2', stable: false }] ['11.0.2-ea', { version: '11.0.2', stable: false }]
])('normalizeVersion from %s to %s', (input, expected) => { ])('normalizeVersion from %s to %s', (input, expected) => {
expect(DummyJavaBase.prototype.normalizeVersion.call(null, input)).toEqual( expect(DummyJavaBase.prototype.normalizeVersion.call(null, input)).toEqual(expected);
expected
);
}); });
it('normalizeVersion should throw an error for non semver', () => { it('normalizeVersion should throw an error for non semver', () => {
const version = '11g'; const version = '11g';
expect( expect(DummyJavaBase.prototype.normalizeVersion.bind(null, version)).toThrowError(
DummyJavaBase.prototype.normalizeVersion.bind(null, version)
).toThrow(
`The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information` `The string '${version}' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information`
); );
}); });

View File

@ -6,7 +6,7 @@ import * as util from '../../src/util';
import os from 'os'; import os from 'os';
import { isGeneratorFunction } from 'util/types'; import { isGeneratorFunction } from 'util/types';
import manifestData from '../data/corretto.json'; const manifestData = require('../data/corretto.json') as [];
describe('getAvailableVersions', () => { describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance; let spyHttpClient: jest.SpyInstance;
@ -19,10 +19,7 @@ describe('getAvailableVersions', () => {
headers: {}, headers: {},
result: manifestData result: manifestData
}); });
spyGetDownloadArchiveExtension = jest.spyOn( spyGetDownloadArchiveExtension = jest.spyOn(util, 'getDownloadArchiveExtension');
util,
'getDownloadArchiveExtension'
);
}); });
afterEach(() => { afterEach(() => {
@ -47,66 +44,16 @@ describe('getAvailableVersions', () => {
}); });
it.each([ it.each([
[{ version: '16', architecture: 'x64', packageType: 'jdk', checkLatest: false }, 'macos', 6],
[{ version: '16', architecture: 'x86', packageType: 'jdk', checkLatest: false }, 'macos', 0],
[{ version: '16', architecture: 'x64', packageType: 'jre', checkLatest: false }, 'macos', 0],
[{ version: '16', architecture: 'x64', packageType: 'jdk', checkLatest: false }, 'linux', 6],
[ [
{ { version: '18', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '16',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'macos',
6
],
[
{
version: '16',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'macos',
0
],
[
{
version: '16',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'macos',
0
],
[
{
version: '16',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'linux',
6
],
[
{
version: '18',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'windows', 'windows',
6 6
], ],
[ [{ version: '18', architecture: 'x64', packageType: 'jre', checkLatest: false }, 'windows', 1]
{
version: '18',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'windows',
1
]
])( ])(
'fetch expected amount of available versions for %s', 'fetch expected amount of available versions for %s',
async ( async (
@ -119,9 +66,7 @@ describe('getAvailableVersions', () => {
const availableVersions = await distribution['getAvailableVersions'](); const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull(); expect(availableVersions).not.toBeNull();
expect(availableVersions.length).toBe( expect(availableVersions.length).toBe(expectedAmountOfAvailableVersions);
expectedAmountOfAvailableVersions
);
} }
); );
}); });
@ -150,9 +95,7 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion = await distribution['findPackageForDownload'](version);
version
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
}); });
@ -167,9 +110,9 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, 'linux'); mockPlatform(distribution, 'linux');
await expect( await expect(distribution['findPackageForDownload'](version)).rejects.toThrowError(
distribution['findPackageForDownload'](version) 'Early access versions are not supported'
).rejects.toThrow('Early access versions are not supported'); );
}); });
it('with non major version expect to throw not supported error', async () => { it('with non major version expect to throw not supported error', async () => {
@ -182,9 +125,9 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, 'linux'); mockPlatform(distribution, 'linux');
await expect( await expect(distribution['findPackageForDownload'](version)).rejects.toThrowError(
distribution['findPackageForDownload'](version) 'Only major versions are supported'
).rejects.toThrow('Only major versions are supported'); );
}); });
it('with unfound version throw could not find error', async () => { it('with unfound version throw could not find error', async () => {
@ -197,9 +140,9 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, 'linux'); mockPlatform(distribution, 'linux');
await expect( await expect(distribution['findPackageForDownload'](version)).rejects.toThrowError(
distribution['findPackageForDownload'](version) "Could not find satisfied version for SemVer '4'"
).rejects.toThrow("Could not find satisfied version for SemVer '4'"); );
}); });
it.each([ it.each([
@ -223,19 +166,14 @@ describe('getAvailableVersions', () => {
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`; const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
const availableVersion = await distribution['findPackageForDownload']( const availableVersion = await distribution['findPackageForDownload'](version);
version
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }
); );
}); });
const mockPlatform = ( const mockPlatform = (distribution: CorrettoDistribution, platform: string) => {
distribution: CorrettoDistribution,
platform: string
) => {
distribution['getPlatformOption'] = () => platform; distribution['getPlatformOption'] = () => platform;
const mockedExtension = platform === 'windows' ? 'zip' : 'tar.gz'; const mockedExtension = platform === 'windows' ? 'zip' : 'tar.gz';
spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension); spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension);

View File

@ -1,257 +0,0 @@
import {HttpClient} from '@actions/http-client';
import {DragonwellDistribution} from '../../src/distributions/dragonwell/installer';
import * as utils from '../../src/util';
import manifestData from '../data/dragonwell.json';
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: manifestData
});
spyUtilGetDownloadArchiveExtension = jest.spyOn(
utils,
'getDownloadArchiveExtension'
);
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
const mockPlatform = (
distribution: DragonwellDistribution,
platform: string
) => {
distribution['getPlatformOption'] = () => platform;
const mockedExtension = platform == 'windows' ? 'zip' : 'tar.gz';
spyUtilGetDownloadArchiveExtension.mockReturnValue(mockedExtension);
};
describe('getAvailableVersions', () => {
it.each([
['8', 'x86', 'linux', 0],
['8', 'aarch64', 'linux', 28],
['8.6.6', 'x64', 'linux', 31],
['8', 'x86', 'anolis', 0],
['8', 'x86', 'windows', 0],
['8', 'x86', 'mac', 0],
['11', 'x64', 'linux', 31],
['11', 'aarch64', 'linux', 28],
['17', 'riscv', 'linux', 3],
['16.0.1', 'x64', 'linux', 31],
['21', 'x64', 'linux', 31]
])(
'should get right number of available versions from JSON',
async (
jdkVersion: string,
arch: string,
platform: string,
len: number
) => {
const distribution = new DragonwellDistribution({
version: jdkVersion,
architecture: arch,
packageType: 'jdk',
checkLatest: false
});
mockPlatform(distribution, platform);
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();
expect(availableVersions.length).toBe(len);
}
);
});
describe('findPackageForDownload', () => {
it.each([
[
'8',
'linux',
'x64',
'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz'
],
[
'8',
'linux',
'aarch64',
'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_aarch64_linux.tar.gz'
],
[
'8',
'windows',
'x64',
'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_windows.zip'
],
[
'8.13.14',
'linux',
'x64',
'https://github.com/alibaba/dragonwell8/releases/download/dragonwell-extended-8.13.14_jdk8u352-ga/Alibaba_Dragonwell_Extended_8.13.14_x64_linux.tar.gz'
],
[
'11',
'linux',
'x64',
'https://github.com/dragonwell-project/dragonwell11/releases/download/dragonwell-extended-11.0.23.20_jdk-11.0.23-ga/Alibaba_Dragonwell_Extended_11.0.23.20.9_x64_linux.tar.gz'
],
[
'11',
'linux',
'aarch64',
'https://github.com/dragonwell-project/dragonwell11/releases/download/dragonwell-extended-11.0.23.20_jdk-11.0.23-ga/Alibaba_Dragonwell_Extended_11.0.23.20.9_aarch64_linux.tar.gz'
],
[
'11',
'linux',
'riscv',
'https://github.com/dragonwell-project/dragonwell11/releases/download/dragonwell-extended-11.0.23.20_jdk-11.0.23-ga/Alibaba_Dragonwell_Extended_11.0.23.20.9_riscv64_linux.tar.gz'
],
[
'11',
'windows',
'x64',
'https://github.com/dragonwell-project/dragonwell11/releases/download/dragonwell-extended-11.0.23.20_jdk-11.0.23-ga/Alibaba_Dragonwell_Extended_11.0.23.20.9_x64_windows.zip'
],
[
'11',
'alpine-linux',
'x64',
'https://github.com/dragonwell-project/dragonwell11/releases/download/dragonwell-extended-11.0.23.20_jdk-11.0.23-ga/Alibaba_Dragonwell_Extended_11.0.23.20.9_x64_alpine-linux.tar.gz'
],
[
'11.0.17',
'linux',
'x64',
'https://github.com/alibaba/dragonwell11/releases/download/dragonwell-extended-11.0.17.13_jdk-11.0.17-ga/Alibaba_Dragonwell_Extended_11.0.17.13.8_x64_linux.tar.gz'
],
[
'17',
'linux',
'x64',
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_linux.tar.gz'
],
[
'17',
'linux',
'aarch64',
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_aarch64_linux.tar.gz'
],
[
'17',
'windows',
'x64',
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_windows.zip'
],
[
'17',
'alpine-linux',
'x64',
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.5.0.5%2B8_jdk-17.0.5-ga/Alibaba_Dragonwell_Standard_17.0.5.0.5.8_x64_alpine-linux.tar.gz'
],
[
'17.0.4',
'linux',
'x64',
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz'
],
[
'17.0.4+8',
'linux',
'x64',
'https://github.com/alibaba/dragonwell17/releases/download/dragonwell-standard-17.0.4.0.4%2B8_jdk-17.0.4-ga/Alibaba_Dragonwell_Standard_17.0.4.0.4%2B8_x64_linux.tar.gz'
],
[
'21',
'linux',
'aarch64',
'https://github.com/dragonwell-project/dragonwell21/releases/download/dragonwell-standard-21.0.3.0.3%2B9_jdk-21.0.3-ga/Alibaba_Dragonwell_Standard_21.0.3.0.3.9_aarch64_linux.tar.gz'
],
[
'21.0.3+9',
'linux',
'riscv',
'https://github.com/dragonwell-project/dragonwell21/releases/download/dragonwell-standard-21.0.3.0.3%2B9_jdk-21.0.3-ga/Alibaba_Dragonwell_Standard_21.0.3.0.3.9_riscv64_linux.tar.gz'
],
[
'21.0.1+12',
'linux',
'x64',
'https://github.com/dragonwell-project/dragonwell21/releases/download/dragonwell-standard-21.0.1.0.1%2B12_jdk-21.0.1-ga/Alibaba_Dragonwell_Standard_21.0.1.0.1.12_x64_linux.tar.gz'
]
])(
'should return proper link according to the specified java-version, platform and arch',
async (
jdkVersion: string,
platform: string,
arch: string,
expectedLink: string
) => {
const distribution = new DragonwellDistribution({
version: jdkVersion,
architecture: arch,
packageType: 'jdk',
checkLatest: false
});
mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload'](
jdkVersion
);
expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink);
}
);
it.each([
['8', 'alpine-linux', 'x64'],
['8', 'macos', 'aarch64'],
['11', 'macos', 'aarch64'],
['17', 'linux', 'riscv']
])(
'should throw when required version of JDK can not be found in the JSON',
async (jdkVersion: string, platform: string, arch: string) => {
const distribution = new DragonwellDistribution({
version: jdkVersion,
architecture: arch,
packageType: 'jdk',
checkLatest: false
});
mockPlatform(distribution, platform);
await expect(
distribution['findPackageForDownload'](jdkVersion)
).rejects.toThrow(
`Couldn't find any satisfied version for the specified java-version: "${jdkVersion}" and architecture: "${arch}".`
);
}
);
it('should throw when required package type is not jdk', async () => {
const jdkVersion = '17';
const arch = 'x64';
const platform = 'linux';
const distribution = new DragonwellDistribution({
version: jdkVersion,
architecture: arch,
packageType: 'jre',
checkLatest: false
});
mockPlatform(distribution, platform);
await expect(
distribution['findPackageForDownload'](jdkVersion)
).rejects.toThrow('Dragonwell provides only the `jdk` package type');
});
});
});

View File

@ -1,12 +1,9 @@
import { LibericaDistributions } from '../../src/distributions/liberica/installer'; import { LibericaDistributions } from '../../src/distributions/liberica/installer';
import { import { ArchitectureOptions, LibericaVersion } from '../../src/distributions/liberica/models';
ArchitectureOptions,
LibericaVersion
} from '../../src/distributions/liberica/models';
import { HttpClient } from '@actions/http-client'; import { HttpClient } from '@actions/http-client';
import os from 'os'; import os from 'os';
import manifestData from '../data/liberica.json'; const manifestData = require('../data/liberica.json') as LibericaVersion[];
describe('getAvailableVersions', () => { describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance; let spyHttpClient: jest.SpyInstance;
@ -16,7 +13,7 @@ describe('getAvailableVersions', () => {
spyHttpClient.mockReturnValue({ spyHttpClient.mockReturnValue({
statusCode: 200, statusCode: 200,
headers: {}, headers: {},
result: manifestData as LibericaVersion[] result: manifestData
}); });
}); });
@ -28,57 +25,27 @@ describe('getAvailableVersions', () => {
it.each([ it.each([
[ [
{ { version: '11.x', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11.x',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=32&arch=x86&build-type=all' 'bundle-type=jdk&bitness=32&arch=x86&build-type=all'
], ],
[ [
{ { version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11-ea',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=32&arch=x86&build-type=ea' 'bundle-type=jdk&bitness=32&arch=x86&build-type=ea'
], ],
[ [
{ { version: '16.0.2', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '16.0.2',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=64&arch=x86&build-type=all' 'bundle-type=jdk&bitness=64&arch=x86&build-type=all'
], ],
[ [
{ { version: '16.0.2', architecture: 'x64', packageType: 'jre', checkLatest: false },
version: '16.0.2',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'bundle-type=jre&bitness=64&arch=x86&build-type=all' 'bundle-type=jre&bitness=64&arch=x86&build-type=all'
], ],
[ [
{ { version: '8', architecture: 'armv7', packageType: 'jdk+fx', checkLatest: false },
version: '8',
architecture: 'armv7',
packageType: 'jdk+fx',
checkLatest: false
},
'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all' 'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all'
], ],
[ [
{ { version: '8', architecture: 'aarch64', packageType: 'jre+fx', checkLatest: false },
version: '8',
architecture: 'aarch64',
packageType: 'jre+fx',
checkLatest: false
},
'bundle-type=jre-full&bitness=64&arch=arm&build-type=all' 'bundle-type=jre-full&bitness=64&arch=arm&build-type=all'
] ]
])('build correct url for %s -> %s', async (input, urlParams) => { ])('build correct url for %s -> %s', async (input, urlParams) => {
@ -147,9 +114,7 @@ describe('getArchitectureOptions', () => {
['armv7', { bitness: '32', arch: 'arm' }], ['armv7', { bitness: '32', arch: 'arm' }],
['aarch64', { bitness: '64', arch: 'arm' }], ['aarch64', { bitness: '64', arch: 'arm' }],
['ppc64le', { bitness: '64', arch: 'ppc' }] ['ppc64le', { bitness: '64', arch: 'ppc' }]
] as [string, ArchitectureOptions][])( ] as [string, ArchitectureOptions][])('parse architecture %s -> %s', (input, expected) => {
'parse architecture %s -> %s',
(input, expected) => {
const distributions = new LibericaDistributions({ const distributions = new LibericaDistributions({
architecture: input, architecture: input,
checkLatest: false, checkLatest: false,
@ -158,8 +123,7 @@ describe('getArchitectureOptions', () => {
}); });
expect(distributions['getArchitectureOptions']()).toEqual(expected); expect(distributions['getArchitectureOptions']()).toEqual(expected);
} });
);
it.each(['armv6', 's390x'])('not support architecture %s', input => { it.each(['armv6', 's390x'])('not support architecture %s', input => {
const distributions = new LibericaDistributions({ const distributions = new LibericaDistributions({
@ -235,9 +199,9 @@ describe('getPlatformOption', () => {
it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])( it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])(
'not support os version %s', 'not support os version %s',
input => { input => {
expect(() => expect(() => distributions['getPlatformOption'](input as NodeJS.Platform)).toThrow(
distributions['getPlatformOption'](input as NodeJS.Platform) /Platform '\w+' is not supported\. Supported platforms: .+/
).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/); );
} }
); );
}); });
@ -251,33 +215,9 @@ describe('convertVersionToSemver', () => {
}); });
it.each([ it.each([
[ [{ featureVersion: 11, interimVersion: 0, updateVersion: 12, buildVersion: 7 }, '11.0.12+7'],
{ [{ featureVersion: 11, interimVersion: 0, updateVersion: 12, buildVersion: 0 }, '11.0.12'],
featureVersion: 11, [{ featureVersion: 11, interimVersion: 0, updateVersion: 0, buildVersion: 13 }, '11.0.0+13']
interimVersion: 0,
updateVersion: 12,
buildVersion: 7
},
'11.0.12+7'
],
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 12,
buildVersion: 0
},
'11.0.12'
],
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 0,
buildVersion: 13
},
'11.0.0+13'
]
])('%s -> %s', (input, expected) => { ])('%s -> %s', (input, expected) => {
const actual = distributions['convertVersionToSemver']({ const actual = distributions['convertVersionToSemver']({
downloadUrl: '', downloadUrl: '',

View File

@ -1,290 +0,0 @@
import {LibericaDistributions} from '../../src/distributions/liberica/installer';
import {
ArchitectureOptions,
LibericaVersion
} from '../../src/distributions/liberica/models';
import {HttpClient} from '@actions/http-client';
import os from 'os';
import manifestData from '../data/liberica-linux.json';
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: manifestData as LibericaVersion[]
});
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
it.each([
[
{
version: '11.x',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=32&arch=x86&build-type=all'
],
[
{
version: '11-ea',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=32&arch=x86&build-type=ea'
],
[
{
version: '16.0.2',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=64&arch=x86&build-type=all'
],
[
{
version: '16.0.2',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'bundle-type=jre&bitness=64&arch=x86&build-type=all'
],
[
{
version: '8',
architecture: 'armv7',
packageType: 'jdk+fx',
checkLatest: false
},
'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all'
],
[
{
version: '8',
architecture: 'aarch64',
packageType: 'jre+fx',
checkLatest: false
},
'bundle-type=jre-full&bitness=64&arch=arm&build-type=all'
]
])('build correct url for %s -> %s', async (input, urlParams) => {
const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion';
const distribution = new LibericaDistributions(input);
distribution['getPlatformOption'] = () => 'linux';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=linux&${urlParams}${additionalParams}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
type DistroArch = {
bitness: string;
arch: string;
};
it.each([
['amd64', {bitness: '64', arch: 'x86'}],
['arm64', {bitness: '64', arch: 'arm'}]
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
const distribution = new LibericaDistributions({
version: '17',
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion';
distribution['getPlatformOption'] = () => 'linux';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=linux&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
}
);
it('load available versions', async () => {
const distribution = new LibericaDistributions({
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).toEqual(manifestData);
});
});
describe('getArchitectureOptions', () => {
it.each([
['x86', {bitness: '32', arch: 'x86'}],
['x64', {bitness: '64', arch: 'x86'}],
['armv7', {bitness: '32', arch: 'arm'}],
['aarch64', {bitness: '64', arch: 'arm'}],
['ppc64le', {bitness: '64', arch: 'ppc'}]
] as [string, ArchitectureOptions][])(
'parse architecture %s -> %s',
(input, expected) => {
const distributions = new LibericaDistributions({
architecture: input,
checkLatest: false,
packageType: '',
version: ''
});
expect(distributions['getArchitectureOptions']()).toEqual(expected);
}
);
it.each(['armv6', 's390x'])('not support architecture %s', input => {
const distributions = new LibericaDistributions({
architecture: input,
checkLatest: false,
packageType: '',
version: ''
});
expect(() => distributions['getArchitectureOptions']()).toThrow(
/Architecture '\w+' is not supported\. Supported architectures: .*/
);
});
});
describe('findPackageForDownload', () => {
let distribution: LibericaDistributions;
beforeEach(() => {
distribution = new LibericaDistributions({
version: '',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
});
it.each([
['8', '8.0.302+8'],
['11.x', '11.0.12+7'],
['8.0', '8.0.302+8'],
['11.0.x', '11.0.12+7'],
['15', '15.0.2+10'],
['15.0', '15.0.2+10'],
['15.0.0', '15.0.0+36'],
['8.0.232', '8.0.232+10'],
['8.0.232+9', '8.0.232+9'],
['15.0.2+8', '15.0.2+8'],
['15.0.2+10', '15.0.2+10']
])('version is %s -> %s', async (input, expected) => {
const result = await distribution['findPackageForDownload'](input);
expect(result.version).toBe(expected);
});
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
/Could not find satisfied version for semver */
);
});
});
describe('getPlatformOption', () => {
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
packageType: 'jdk',
checkLatest: false
});
it.each([
['linux', 'linux'],
['darwin', 'macos'],
['win32', 'windows'],
['cygwin', 'windows'],
['sunos', 'solaris']
])('os version %s -> %s', (input, expected) => {
const actual = distributions['getPlatformOption'](input as NodeJS.Platform);
expect(actual).toEqual(expected);
});
it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])(
'not support os version %s',
input => {
expect(() =>
distributions['getPlatformOption'](input as NodeJS.Platform)
).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/);
}
);
});
describe('convertVersionToSemver', () => {
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
packageType: 'jdk',
checkLatest: false
});
it.each([
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 12,
buildVersion: 7
},
'11.0.12+7'
],
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 12,
buildVersion: 0
},
'11.0.12'
],
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 0,
buildVersion: 13
},
'11.0.0+13'
]
])('%s -> %s', (input, expected) => {
const actual = distributions['convertVersionToSemver']({
downloadUrl: '',
version: '',
...input
});
expect(actual).toEqual(expected);
});
});

View File

@ -1,290 +0,0 @@
import {LibericaDistributions} from '../../src/distributions/liberica/installer';
import {
ArchitectureOptions,
LibericaVersion
} from '../../src/distributions/liberica/models';
import {HttpClient} from '@actions/http-client';
import os from 'os';
import manifestData from '../data/liberica-windows.json';
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: manifestData as LibericaVersion[]
});
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
it.each([
[
{
version: '11.x',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=32&arch=x86&build-type=all'
],
[
{
version: '11-ea',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=32&arch=x86&build-type=ea'
],
[
{
version: '16.0.2',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'bundle-type=jdk&bitness=64&arch=x86&build-type=all'
],
[
{
version: '16.0.2',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'bundle-type=jre&bitness=64&arch=x86&build-type=all'
],
[
{
version: '8',
architecture: 'armv7',
packageType: 'jdk+fx',
checkLatest: false
},
'bundle-type=jdk-full&bitness=32&arch=arm&build-type=all'
],
[
{
version: '8',
architecture: 'aarch64',
packageType: 'jre+fx',
checkLatest: false
},
'bundle-type=jre-full&bitness=64&arch=arm&build-type=all'
]
])('build correct url for %s -> %s', async (input, urlParams) => {
const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion';
const distribution = new LibericaDistributions(input);
distribution['getPlatformOption'] = () => 'windows';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=windows&${urlParams}${additionalParams}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
type DistroArch = {
bitness: string;
arch: string;
};
it.each([
['amd64', {bitness: '64', arch: 'x86'}],
['arm64', {bitness: '64', arch: 'arm'}]
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
const distribution = new LibericaDistributions({
version: '17',
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion';
distribution['getPlatformOption'] = () => 'windows';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=windows&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
}
);
it('load available versions', async () => {
const distribution = new LibericaDistributions({
version: '11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).toEqual(manifestData);
});
});
describe('getArchitectureOptions', () => {
it.each([
['x86', {bitness: '32', arch: 'x86'}],
['x64', {bitness: '64', arch: 'x86'}],
['armv7', {bitness: '32', arch: 'arm'}],
['aarch64', {bitness: '64', arch: 'arm'}],
['ppc64le', {bitness: '64', arch: 'ppc'}]
] as [string, ArchitectureOptions][])(
'parse architecture %s -> %s',
(input, expected) => {
const distributions = new LibericaDistributions({
architecture: input,
checkLatest: false,
packageType: '',
version: ''
});
expect(distributions['getArchitectureOptions']()).toEqual(expected);
}
);
it.each(['armv6', 's390x'])('not support architecture %s', input => {
const distributions = new LibericaDistributions({
architecture: input,
checkLatest: false,
packageType: '',
version: ''
});
expect(() => distributions['getArchitectureOptions']()).toThrow(
/Architecture '\w+' is not supported\. Supported architectures: .*/
);
});
});
describe('findPackageForDownload', () => {
let distribution: LibericaDistributions;
beforeEach(() => {
distribution = new LibericaDistributions({
version: '',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
});
it.each([
['8', '8.0.302+8'],
['11.x', '11.0.12+7'],
['8.0', '8.0.302+8'],
['11.0.x', '11.0.12+7'],
['15', '15.0.2+10'],
['15.0', '15.0.2+10'],
['15.0.0', '15.0.0+36'],
['8.0.232', '8.0.232+10'],
['8.0.232+9', '8.0.232+9'],
['15.0.2+8', '15.0.2+8'],
['15.0.2+10', '15.0.2+10']
])('version is %s -> %s', async (input, expected) => {
const result = await distribution['findPackageForDownload'](input);
expect(result.version).toBe(expected);
});
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('18')).rejects.toThrow(
/Could not find satisfied version for semver */
);
});
});
describe('getPlatformOption', () => {
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
packageType: 'jdk',
checkLatest: false
});
it.each([
['linux', 'linux'],
['darwin', 'macos'],
['win32', 'windows'],
['cygwin', 'windows'],
['sunos', 'solaris']
])('os version %s -> %s', (input, expected) => {
const actual = distributions['getPlatformOption'](input as NodeJS.Platform);
expect(actual).toEqual(expected);
});
it.each(['aix', 'android', 'freebsd', 'openbsd', 'netbsd'])(
'not support os version %s',
input => {
expect(() =>
distributions['getPlatformOption'](input as NodeJS.Platform)
).toThrow(/Platform '\w+' is not supported\. Supported platforms: .+/);
}
);
});
describe('convertVersionToSemver', () => {
const distributions = new LibericaDistributions({
architecture: 'x64',
version: '11',
packageType: 'jdk',
checkLatest: false
});
it.each([
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 12,
buildVersion: 7
},
'11.0.12+7'
],
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 12,
buildVersion: 0
},
'11.0.12'
],
[
{
featureVersion: 11,
interimVersion: 0,
updateVersion: 0,
buildVersion: 13
},
'11.0.0+13'
]
])('%s -> %s', (input, expected) => {
const actual = distributions['convertVersionToSemver']({
downloadUrl: '',
version: '',
...input
});
expect(actual).toEqual(expected);
});
});

View File

@ -27,7 +27,7 @@ describe('setupJava', () => {
let spyFsReadDir: jest.SpyInstance; let spyFsReadDir: jest.SpyInstance;
let spyUtilsExtractJdkFile: jest.SpyInstance; let spyUtilsExtractJdkFile: jest.SpyInstance;
let spyPathResolve: jest.SpyInstance; let spyPathResolve: jest.SpyInstance;
const expectedJdkFile = 'JavaLocalJdkFile'; let expectedJdkFile = 'JavaLocalJdkFile';
beforeEach(() => { beforeEach(() => {
spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath'); spyGetToolcachePath = jest.spyOn(util, 'getToolcachePath');
@ -35,27 +35,18 @@ describe('setupJava', () => {
(toolname: string, javaVersion: string, architecture: string) => { (toolname: string, javaVersion: string, architecture: string) => {
const semverVersion = new semver.Range(javaVersion); const semverVersion = new semver.Range(javaVersion);
if ( if (path.basename(javaPath) !== architecture || !javaPath.includes(toolname)) {
path.basename(javaPath) !== architecture ||
!javaPath.includes(toolname)
) {
return ''; return '';
} }
return semver.satisfies(actualJavaVersion, semverVersion) return semver.satisfies(actualJavaVersion, semverVersion) ? javaPath : '';
? javaPath
: '';
} }
); );
spyTcCacheDir = jest.spyOn(tc, 'cacheDir'); spyTcCacheDir = jest.spyOn(tc, 'cacheDir');
spyTcCacheDir.mockImplementation( spyTcCacheDir.mockImplementation(
( (archivePath: string, toolcacheFolderName: string, version: string, architecture: string) =>
archivePath: string, path.join(toolcacheFolderName, version, architecture)
toolcacheFolderName: string,
version: string,
architecture: string
) => path.join(toolcacheFolderName, version, architecture)
); );
spyTcFindAllVersions = jest.spyOn(tc, 'findAllVersions'); spyTcFindAllVersions = jest.spyOn(tc, 'findAllVersions');
@ -117,9 +108,7 @@ describe('setupJava', () => {
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected); await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyGetToolcachePath).toHaveBeenCalled(); expect(spyGetToolcachePath).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${actualJavaVersion} from tool-cache`);
`Resolved Java ${actualJavaVersion} from tool-cache`
);
expect(spyCoreInfo).not.toHaveBeenCalledWith( expect(spyCoreInfo).not.toHaveBeenCalledWith(
`Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...` `Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...`
); );
@ -141,9 +130,7 @@ describe('setupJava', () => {
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected); await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyGetToolcachePath).toHaveBeenCalled(); expect(spyGetToolcachePath).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved Java ${actualJavaVersion} from tool-cache`);
`Resolved Java ${actualJavaVersion} from tool-cache`
);
expect(spyCoreInfo).not.toHaveBeenCalledWith( expect(spyCoreInfo).not.toHaveBeenCalledWith(
`Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...` `Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...`
); );
@ -168,9 +155,7 @@ describe('setupJava', () => {
expect(spyCoreInfo).not.toHaveBeenCalledWith( expect(spyCoreInfo).not.toHaveBeenCalledWith(
`Resolved Java ${actualJavaVersion} from tool-cache` `Resolved Java ${actualJavaVersion} from tool-cache`
); );
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(`Extracting Java from '${jdkFile}'`);
`Extracting Java from '${jdkFile}'`
);
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(
`Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...` `Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...`
); );
@ -186,163 +171,46 @@ describe('setupJava', () => {
const jdkFile = 'not_existing_one'; const jdkFile = 'not_existing_one';
const expected = { const expected = {
javaVersion: '11.0.289', javaVersion: '11.0.289',
javaPath: path.join( javaPath: path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture)
'Java_jdkfile_jdk',
inputs.version,
inputs.architecture
)
}; };
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);
expected.javaPath = path.join( expected.javaPath = path.join('Java_jdkfile_jdk', inputs.version, inputs.architecture);
'Java_jdkfile_jdk', await expect(mockJavaBase.setupJava()).rejects.toThrowError(
inputs.version,
inputs.architecture
);
await expect(mockJavaBase.setupJava()).rejects.toThrow(
"JDK file was not found in path 'not_existing_one'" "JDK file was not found in path 'not_existing_one'"
); );
expect(spyTcFindAllVersions).toHaveBeenCalled(); expect(spyTcFindAllVersions).toHaveBeenCalled();
expect(spyCoreInfo).not.toHaveBeenCalledWith( expect(spyCoreInfo).not.toHaveBeenCalledWith(
`Resolved Java ${actualJavaVersion} from tool-cache` `Resolved Java ${actualJavaVersion} from tool-cache`
); );
expect(spyCoreInfo).not.toHaveBeenCalledWith( expect(spyCoreInfo).not.toHaveBeenCalledWith(`Extracting Java from '${jdkFile}'`);
`Extracting Java from '${jdkFile}'`
);
expect(spyCoreInfo).toHaveBeenCalledWith( expect(spyCoreInfo).toHaveBeenCalledWith(
`Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...` `Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...`
); );
}); });
it('java is resolved from toolcache including Contents/Home on MacOS', async () => {
const inputs = {
version: actualJavaVersion,
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
};
const jdkFile = 'not_existing_one';
const expected = {
version: actualJavaVersion,
path: path.join(
'Java_jdkfile_jdk',
inputs.version,
inputs.architecture,
'Contents',
'Home'
)
};
const originalPlatform = process.platform;
Object.defineProperty(process, 'platform', {
value: 'darwin'
});
spyFsStat = jest.spyOn(fs, 'existsSync');
spyFsStat.mockImplementation((file: string) => {
return file.endsWith('Home');
});
mockJavaBase = new LocalDistribution(inputs, jdkFile);
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyGetToolcachePath).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith(
`Resolved Java ${actualJavaVersion} from tool-cache`
);
expect(spyCoreInfo).not.toHaveBeenCalledWith(
`Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...`
);
Object.defineProperty(process, 'platform', {
value: originalPlatform
});
});
it('java is unpacked from jdkfile including Contents/Home on MacOS', async () => {
const inputs = {
version: '11.0.289',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
};
const jdkFile = expectedJdkFile;
const expected = {
version: '11.0.289',
path: path.join(
'Java_jdkfile_jdk',
inputs.version,
inputs.architecture,
'Contents',
'Home'
)
};
const originalPlatform = process.platform;
Object.defineProperty(process, 'platform', {
value: 'darwin'
});
spyFsStat = jest.spyOn(fs, 'existsSync');
spyFsStat.mockImplementation((file: string) => {
return file.endsWith('Home');
});
mockJavaBase = new LocalDistribution(inputs, jdkFile);
await expect(mockJavaBase.setupJava()).resolves.toEqual(expected);
expect(spyTcFindAllVersions).toHaveBeenCalled();
expect(spyCoreInfo).not.toHaveBeenCalledWith(
`Resolved Java ${actualJavaVersion} from tool-cache`
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Extracting Java from '${jdkFile}'`
);
expect(spyCoreInfo).toHaveBeenCalledWith(
`Java ${inputs.version} was not found in tool-cache. Trying to unpack JDK file...`
);
Object.defineProperty(process, 'platform', {
value: originalPlatform
});
});
it.each([ it.each([
[ [
{ { version: '8.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '8.0.289',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'otherJdkFile' 'otherJdkFile'
], ],
[ [
{ { version: '11.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11.0.289',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'otherJdkFile' 'otherJdkFile'
], ],
[ [
{ { version: '12.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '12.0.289',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'otherJdkFile' 'otherJdkFile'
], ],
[ [
{ { version: '11.1.11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11.1.11',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'not_existing_one' 'not_existing_one'
] ]
])( ])(
`Throw an error if jdkfile has wrong path, inputs %s, jdkfile %s, real name ${expectedJdkFile}`, `Throw an error if jdkfile has wrong path, inputs %s, jdkfile %s, real name ${expectedJdkFile}`,
async (inputs, jdkFile) => { async (inputs, jdkFile) => {
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);
await expect(mockJavaBase.setupJava()).rejects.toThrow( await expect(mockJavaBase.setupJava()).rejects.toThrowError(
/JDK file was not found in path */ /JDK file was not found in path */
); );
expect(spyTcFindAllVersions).toHaveBeenCalled(); expect(spyTcFindAllVersions).toHaveBeenCalled();
@ -350,41 +218,18 @@ describe('setupJava', () => {
); );
it.each([ it.each([
[{ version: '8.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false }, ''],
[ [
{ { version: '7.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '8.0.289',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
''
],
[
{
version: '7.0.289',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
undefined undefined
], ],
[ [
{ { version: '11.0.289', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '11.0.289',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
undefined undefined
] ]
])( ])('Throw an error if jdkfile is not specified, inputs %s', async (inputs, jdkFile) => {
'Throw an error if jdkfile is not specified, inputs %s',
async (inputs, jdkFile) => {
mockJavaBase = new LocalDistribution(inputs, jdkFile); mockJavaBase = new LocalDistribution(inputs, jdkFile);
await expect(mockJavaBase.setupJava()).rejects.toThrow( await expect(mockJavaBase.setupJava()).rejects.toThrowError("'jdkFile' is not specified");
"'jdkFile' is not specified"
);
expect(spyTcFindAllVersions).toHaveBeenCalled(); expect(spyTcFindAllVersions).toHaveBeenCalled();
} });
);
}); });

View File

@ -1,6 +1,6 @@
import { MicrosoftDistributions } from '../../src/distributions/microsoft/installer'; import { MicrosoftDistributions } from '../../src/distributions/microsoft/installer';
import os from 'os'; import os from 'os';
import data from '../data/microsoft.json'; import data from '../../src/distributions/microsoft/microsoft-openjdk-versions.json';
import * as httpm from '@actions/http-client'; import * as httpm from '@actions/http-client';
import * as core from '@actions/core'; import * as core from '@actions/core';
@ -29,11 +29,6 @@ describe('findPackageForDownload', () => {
}); });
it.each([ it.each([
[
'21.x',
'21.0.0',
'https://aka.ms/download-jdk/microsoft-jdk-21.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[ [
'17.0.1', '17.0.1',
'17.0.1+12.1', '17.0.1+12.1',
@ -41,8 +36,8 @@ describe('findPackageForDownload', () => {
], ],
[ [
'17.x', '17.x',
'17.0.7', '17.0.3',
'https://aka.ms/download-jdk/microsoft-jdk-17.0.7-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}' 'https://aka.ms/download-jdk/microsoft-jdk-17.0.3-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
], ],
[ [
'16.0.x', '16.0.x',
@ -58,11 +53,6 @@ describe('findPackageForDownload', () => {
'11.0.15', '11.0.15',
'11.0.15', '11.0.15',
'https://aka.ms/download-jdk/microsoft-jdk-11.0.15-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}' 'https://aka.ms/download-jdk/microsoft-jdk-11.0.15-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[
'11.x',
'11.0.19',
'https://aka.ms/download-jdk/microsoft-jdk-11.0.19-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
] ]
])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => { ])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => {
const result = await distribution['findPackageForDownload'](input); const result = await distribution['findPackageForDownload'](input);
@ -83,36 +73,10 @@ describe('findPackageForDownload', () => {
archive = 'tar.gz'; archive = 'tar.gz';
break; break;
} }
const url = expectedUrl const url = expectedUrl.replace('{{OS_TYPE}}', os).replace('{{ARCHIVE_TYPE}}', archive);
.replace('{{OS_TYPE}}', os)
.replace('{{ARCHIVE_TYPE}}', archive);
expect(result.url).toBe(url); expect(result.url).toBe(url);
}); });
it.each([
['amd64', 'x64'],
['arm64', 'aarch64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
jest.spyOn(os, 'platform').mockReturnValue('darwin');
const version = '17';
const distro = new MicrosoftDistributions({
version,
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
const result = await distro['findPackageForDownload'](version);
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-macos-${distroArch}.tar.gz`;
expect(result.url).toBe(expectedUrl);
}
);
it.each([ it.each([
['amd64', 'x64'], ['amd64', 'x64'],
['arm64', 'aarch64'] ['arm64', 'aarch64']
@ -131,31 +95,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.3-linux-${distroArch}.tar.gz`;
expect(result.url).toBe(expectedUrl);
}
);
it.each([
['amd64', 'x64'],
['arm64', 'aarch64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
jest.spyOn(os, 'platform').mockReturnValue('win32');
const version = '17';
const distro = new MicrosoftDistributions({
version,
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
const result = await distro['findPackageForDownload'](version);
const expectedUrl = `https://aka.ms/download-jdk/microsoft-jdk-17.0.7-windows-${distroArch}.zip`;
expect(result.url).toBe(expectedUrl); expect(result.url).toBe(expectedUrl);
} }

View File

@ -1,130 +0,0 @@
import {OracleDistribution} from '../../src/distributions/oracle/installer';
import os from 'os';
import * as core from '@actions/core';
import {getDownloadArchiveExtension} from '../../src/util';
import {HttpClient} from '@actions/http-client';
describe('findPackageForDownload', () => {
let distribution: OracleDistribution;
let spyDebug: jest.SpyInstance;
let spyHttpClient: jest.SpyInstance;
beforeEach(() => {
distribution = new OracleDistribution({
version: '',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
spyDebug = jest.spyOn(core, 'debug');
spyDebug.mockImplementation(() => {});
});
it.each([
[
'21',
'21',
'https://download.oracle.com/java/21/latest/jdk-21_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
],
[
'20',
'20',
'https://download.oracle.com/java/20/latest/jdk-20_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
],
[
'18',
'18',
'https://download.oracle.com/java/18/archive/jdk-18_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
],
[
'20.0.1',
'20.0.1',
'https://download.oracle.com/java/20/archive/jdk-20.0.1_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
],
[
'17',
'17',
'https://download.oracle.com/java/17/latest/jdk-17_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
],
[
'17.0.1',
'17.0.1',
'https://download.oracle.com/java/17/archive/jdk-17.0.1_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
]
])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => {
/* Needed only for this particular test because some urls might change */
spyHttpClient = jest.spyOn(HttpClient.prototype, 'head');
spyHttpClient.mockReturnValue(
Promise.resolve({
message: {
statusCode: 200
}
})
);
/**
* NOTE - Should fail to retrieve 18 from latest and check archive instead
*/
if (input === '18') {
spyHttpClient.mockReturnValueOnce(
Promise.resolve({
message: {
statusCode: 404
}
})
);
}
const result = await distribution['findPackageForDownload'](input);
jest.restoreAllMocks();
expect(result.version).toBe(expectedVersion);
const osType = distribution.getPlatform();
const archiveType = getDownloadArchiveExtension();
const url = expectedUrl
.replace('{{OS_TYPE}}', osType)
.replace('{{ARCHIVE_TYPE}}', archiveType);
expect(result.url).toBe(url);
});
it.each([
['amd64', 'x64'],
['arm64', 'aarch64']
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '18';
const distro = new OracleDistribution({
version,
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
const osType = distribution.getPlatform();
if (osType === 'windows' && distroArch == 'aarch64') {
return; // skip, aarch64 is not available for Windows
}
const archiveType = getDownloadArchiveExtension();
const result = await distro['findPackageForDownload'](version);
const expectedUrl = `https://download.oracle.com/java/18/archive/jdk-18_${osType}-${distroArch}_bin.${archiveType}`;
expect(result.url).toBe(expectedUrl);
},
10000
);
it('should throw an error', async () => {
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
/Oracle JDK is only supported for JDK 17 and later/
);
await expect(distribution['findPackageForDownload']('11')).rejects.toThrow(
/Oracle JDK is only supported for JDK 17 and later/
);
});
});

View File

@ -1,287 +0,0 @@
import {HttpClient} from '@actions/http-client';
import {JavaInstallerOptions} from '../../src/distributions/base-models';
import {SemeruDistribution} from '../../src/distributions/semeru/installer';
import manifestData from '../data/semeru.json';
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: []
});
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
it.each([
[
{
version: '16',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
],
[
{
version: '16',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
],
[
{
version: '16',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
],
[
{
version: '16',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
]
])(
'build correct url for %s',
async (installerOptions: JavaInstallerOptions, expectedParameters) => {
const distribution = new SemeruDistribution(installerOptions);
const baseUrl =
'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
const expectedUrl = `${baseUrl}?project=jdk&vendor=ibm&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
distribution['getPlatformOption'] = () => 'mac';
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(expectedUrl);
}
);
it('load available versions', async () => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData as any
})
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: manifestData as any
})
.mockReturnValueOnce({
statusCode: 200,
headers: {},
result: []
});
const distribution = new SemeruDistribution({
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).not.toBeNull();
expect(availableVersions.length).toBe(manifestData.length * 2);
});
it.each([
['jdk', 'Java_IBM_Semeru_jdk'],
['jre', 'Java_IBM_Semeru_jre']
])('find right toolchain folder', (packageType: string, expected: string) => {
const distribution = new SemeruDistribution({
version: '8',
architecture: 'x64',
packageType: packageType,
checkLatest: false
});
// @ts-ignore - because it is protected
expect(distribution.toolcacheFolderName).toBe(expected);
});
});
describe('findPackageForDownload', () => {
it.each([
['8', '8.0.322+6'],
['16', '16.0.2+7'],
['16.0', '16.0.2+7'],
['16.0.2', '16.0.2+7'],
['8.x', '8.0.322+6'],
['x', '17.0.2+8']
])('version is resolved correctly %s -> %s', async (input, expected) => {
const distribution = new SemeruDistribution({
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload'](input);
expect(resolvedVersion.version).toBe(expected);
});
it('version is found but binaries list is empty', async () => {
const distribution = new SemeruDistribution({
version: '9.0.8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(
distribution['findPackageForDownload']('9.0.8')
).rejects.toThrow(/Could not find satisfied version for SemVer */);
});
it('version is not found', async () => {
const distribution = new SemeruDistribution({
version: '7.x',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
/Could not find satisfied version for SemVer */
);
});
it('version list is empty', async () => {
const distribution = new SemeruDistribution({
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
/Could not find satisfied version for SemVer */
);
});
it.each(['x64', 'x86', 'ppc64le', 'ppc64', 's390x', 'aarch64'])(
'correct Semeru `%s` architecture resolves',
async (arch: string) => {
const distribution = new SemeruDistribution({
version: '8',
architecture: arch,
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload']('8');
expect(resolvedVersion.version).not.toBeNull();
}
);
it.each(['zos', 'z/OS', 'z/os', 'test0987654321=', '++=++', 'myArch'])(
'incorrect Semeru `%s` architecture throws',
async (arch: string) => {
const distribution = new SemeruDistribution({
version: '8',
architecture: arch,
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
`Unsupported architecture for IBM Semeru: ${arch}, the following are supported: x64, x86, ppc64le, ppc64, s390x, aarch64`
);
}
);
it.each(['9-ea', '17-ea', '8-ea', '4-ea'])(
'early access version are illegal for Semeru (%s)',
async (version: string) => {
const distribution = new SemeruDistribution({
version: version,
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(
distribution['findPackageForDownload'](version)
).rejects.toThrow(
'IBM Semeru does not provide builds for early access versions'
);
}
);
it.each([
'jdk+fx',
'jre+fx',
'test',
'test2',
'jdk-fx',
'javafx',
'jdk-javafx',
'ibm',
' '
])(
'rejects incorrect `%s` Semeru package type',
async (packageType: string) => {
const distribution = new SemeruDistribution({
version: '8',
architecture: 'x64',
packageType: packageType,
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow(
'IBM Semeru only provide `jdk` and `jre` package types'
);
}
);
it.each(['jdk', 'jre'])(
'accepts correct `%s` Semeru package type',
async (packageType: string) => {
const distribution = new SemeruDistribution({
version: '8',
architecture: 'x64',
packageType: packageType,
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload']('8');
await expect(resolvedVersion.version).toMatch(/8[0-9.]+/);
}
);
it('fails when long release name is used', async () => {
expect(
() =>
new SemeruDistribution({
version: 'jdk-16.0.2+7_openj9-0.27.1',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
})
).toThrow(
"The string 'jdk-16.0.2+7_openj9-0.27.1' is not valid SemVer notation for a Java version. Please check README file for code snippets and more detailed information"
);
});
});

View File

@ -6,7 +6,7 @@ import {
} from '../../src/distributions/temurin/installer'; } from '../../src/distributions/temurin/installer';
import { JavaInstallerOptions } from '../../src/distributions/base-models'; import { JavaInstallerOptions } from '../../src/distributions/base-models';
import manifestData from '../data/temurin.json'; let manifestData = require('../data/temurin.json') as [];
describe('getAvailableVersions', () => { describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance; let spyHttpClient: jest.SpyInstance;
@ -28,42 +28,22 @@ describe('getAvailableVersions', () => {
it.each([ it.each([
[ [
{ { version: '16', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '16',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot, TemurinImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '16', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '16',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot, TemurinImplementation.Hotspot,
'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '16', architecture: 'x64', packageType: 'jre', checkLatest: false },
version: '16',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
TemurinImplementation.Hotspot, TemurinImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
], ],
[ [
{ { version: '16-ea', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '16-ea',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot, TemurinImplementation.Hotspot,
'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=hotspot&page_size=20&page=0' 'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=hotspot&page_size=20&page=0'
] ]
@ -75,8 +55,7 @@ describe('getAvailableVersions', () => {
expectedParameters expectedParameters
) => { ) => {
const distribution = new TemurinDistribution(installerOptions, impl); const distribution = new TemurinDistribution(installerOptions, impl);
const baseUrl = const baseUrl = 'https://api.adoptium.net/v3/assets/version/%5B1.0,100.0%5D';
'https://api.adoptium.net/v3/assets/version/%5B1.0,100.0%5D';
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptium&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`; const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptium&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
distribution['getPlatformOption'] = () => 'mac'; distribution['getPlatformOption'] = () => 'mac';
@ -93,12 +72,12 @@ describe('getAvailableVersions', () => {
.mockReturnValueOnce({ .mockReturnValueOnce({
statusCode: 200, statusCode: 200,
headers: {}, headers: {},
result: manifestData as any result: manifestData
}) })
.mockReturnValueOnce({ .mockReturnValueOnce({
statusCode: 200, statusCode: 200,
headers: {}, headers: {},
result: manifestData as any result: manifestData
}) })
.mockReturnValueOnce({ .mockReturnValueOnce({
statusCode: 200, statusCode: 200,
@ -107,12 +86,7 @@ describe('getAvailableVersions', () => {
}); });
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(
{ { version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot TemurinImplementation.Hotspot
); );
const availableVersions = await distribution['getAvailableVersions'](); const availableVersions = await distribution['getAvailableVersions']();
@ -127,12 +101,7 @@ describe('getAvailableVersions', () => {
'find right toolchain folder', 'find right toolchain folder',
(impl: TemurinImplementation, packageType: string, expected: string) => { (impl: TemurinImplementation, packageType: string, expected: string) => {
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(
{ { version: '8', architecture: 'x64', packageType: packageType, checkLatest: false },
version: '8',
architecture: 'x64',
packageType: packageType,
checkLatest: false
},
impl impl
); );
@ -158,12 +127,8 @@ describe('getAvailableVersions', () => {
const expectedParameters = `os=mac&architecture=${distroArch}&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0`; const expectedParameters = `os=mac&architecture=${distroArch}&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0`;
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(installerOptions, TemurinImplementation.Hotspot);
installerOptions, const baseUrl = 'https://api.adoptium.net/v3/assets/version/%5B1.0,100.0%5D';
TemurinImplementation.Hotspot
);
const baseUrl =
'https://api.adoptium.net/v3/assets/version/%5B1.0,100.0%5D';
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptium&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`; const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptium&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
distribution['getPlatformOption'] = () => 'mac'; distribution['getPlatformOption'] = () => 'mac';
@ -185,63 +150,43 @@ describe('findPackageForDownload', () => {
['x', '16.0.2+7'] ['x', '16.0.2+7']
])('version is resolved correctly %s -> %s', async (input, expected) => { ])('version is resolved correctly %s -> %s', async (input, expected) => {
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(
{ { version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot TemurinImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData;
const resolvedVersion = await distribution['findPackageForDownload'](input); const resolvedVersion = await distribution['findPackageForDownload'](input);
expect(resolvedVersion.version).toBe(expected); expect(resolvedVersion.version).toBe(expected);
}); });
it('version is found but binaries list is empty', async () => { it('version is found but binaries list is empty', async () => {
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(
{ { version: '9.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '9.0.8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot TemurinImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData;
await expect( await expect(distribution['findPackageForDownload']('9.0.8')).rejects.toThrowError(
distribution['findPackageForDownload']('9.0.8') /Could not find satisfied version for SemVer */
).rejects.toThrow(/Could not find satisfied version for SemVer */); );
}); });
it('version is not found', async () => { it('version is not found', async () => {
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(
{ { version: '7.x', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '7.x',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot TemurinImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData;
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow( await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrowError(
/Could not find satisfied version for SemVer */ /Could not find satisfied version for SemVer */
); );
}); });
it('version list is empty', async () => { it('version list is empty', async () => {
const distribution = new TemurinDistribution( const distribution = new TemurinDistribution(
{ { version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
TemurinImplementation.Hotspot TemurinImplementation.Hotspot
); );
distribution['getAvailableVersions'] = async () => []; distribution['getAvailableVersions'] = async () => [];
await expect(distribution['findPackageForDownload']('8')).rejects.toThrow( await expect(distribution['findPackageForDownload']('8')).rejects.toThrowError(
/Could not find satisfied version for SemVer */ /Could not find satisfied version for SemVer */
); );
}); });

View File

@ -5,7 +5,7 @@ import {IZuluVersions} from '../../src/distributions/zulu/models';
import * as utils from '../../src/util'; import * as utils from '../../src/util';
import os from 'os'; import os from 'os';
import manifestData from '../data/zulu-releases-default.json'; const manifestData = require('../data/zulu-releases-default.json') as [];
describe('getAvailableVersions', () => { describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance; let spyHttpClient: jest.SpyInstance;
@ -19,10 +19,7 @@ describe('getAvailableVersions', () => {
result: manifestData as IZuluVersions[] result: manifestData as IZuluVersions[]
}); });
spyUtilGetDownloadArchiveExtension = jest.spyOn( spyUtilGetDownloadArchiveExtension = jest.spyOn(utils, 'getDownloadArchiveExtension');
utils,
'getDownloadArchiveExtension'
);
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz'); spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
}); });
@ -34,75 +31,35 @@ describe('getAvailableVersions', () => {
it.each([ it.each([
[ [
{ { version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga' '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
], ],
[ [
{ { version: '11-ea', architecture: 'x86', packageType: 'jdk', checkLatest: false },
version: '11-ea',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea' '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
], ],
[ [
{ { version: '8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga' '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
], ],
[ [
{ { version: '8', architecture: 'x64', packageType: 'jre', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga' '?os=macos&ext=tar.gz&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
], ],
[ [
{ { version: '8', architecture: 'x64', packageType: 'jdk+fx', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jdk+fx',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx' '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
], ],
[ [
{ { version: '8', architecture: 'x64', packageType: 'jre+fx', checkLatest: false },
version: '8',
architecture: 'x64',
packageType: 'jre+fx',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx' '?os=macos&ext=tar.gz&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
], ],
[ [
{ { version: '11', architecture: 'arm64', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'arm64',
packageType: 'jdk',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga' '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
], ],
[ [
{ { version: '11', architecture: 'arm', packageType: 'jdk', checkLatest: false },
version: '11',
architecture: 'arm',
packageType: 'jdk',
checkLatest: false
},
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga' '?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
] ]
])('build correct url for %s -> %s', async (input, parsedUrl) => { ])('build correct url for %s -> %s', async (input, parsedUrl) => {
@ -194,9 +151,7 @@ describe('findPackageForDownload', () => {
checkLatest: false checkLatest: false
}); });
distribution['getAvailableVersions'] = async () => manifestData; distribution['getAvailableVersions'] = async () => manifestData;
const result = await distribution['findPackageForDownload']( const result = await distribution['findPackageForDownload'](distribution['version']);
distribution['version']
);
expect(result.version).toBe(expected); expect(result.version).toBe(expected);
}); });
@ -224,6 +179,25 @@ describe('findPackageForDownload', () => {
distribution['getAvailableVersions'] = async () => manifestData; distribution['getAvailableVersions'] = async () => manifestData;
await expect( await expect(
distribution['findPackageForDownload'](distribution['version']) distribution['findPackageForDownload'](distribution['version'])
).rejects.toThrow(/Could not find satisfied version for semver */); ).rejects.toThrowError(/Could not find satisfied version for semver */);
});
});
describe('convertVersionToSemver', () => {
it.each([
[[12], '12'],
[[12, 0], '12.0'],
[[12, 0, 2], '12.0.2'],
[[12, 0, 2, 1], '12.0.2+1'],
[[12, 0, 2, 1, 3], '12.0.2+1']
])('%s -> %s', (input: number[], expected: string) => {
const distribution = new ZuluDistribution({
version: '18',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
const actual = distribution['convertVersionToSemver'](input);
expect(actual).toBe(expected);
}); });
}); });

View File

@ -1,229 +0,0 @@
import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
import {ZuluDistribution} from '../../src/distributions/zulu/installer';
import {IZuluVersions} from '../../src/distributions/zulu/models';
import * as utils from '../../src/util';
import os from 'os';
import manifestData from '../data/zulu-linux.json';
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: manifestData as IZuluVersions[]
});
spyUtilGetDownloadArchiveExtension = jest.spyOn(
utils,
'getDownloadArchiveExtension'
);
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
it.each([
[
{
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
],
[
{
version: '11-ea',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jdk+fx',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jre+fx',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
],
[
{
version: '11',
architecture: 'arm64',
packageType: 'jdk',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
],
[
{
version: '11',
architecture: 'arm',
packageType: 'jdk',
checkLatest: false
},
'?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
]
])('build correct url for %s -> %s', async (input, parsedUrl) => {
const distribution = new ZuluDistribution(input);
distribution['getPlatformOption'] = () => 'linux';
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
type DistroArch = {
bitness: string;
arch: string;
};
it.each([
['amd64', {bitness: '64', arch: 'x86'}],
['arm64', {bitness: '64', arch: 'arm'}]
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
const distribution = new ZuluDistribution({
version: '17',
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
distribution['getPlatformOption'] = () => 'linux';
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
}
);
it('load available versions', async () => {
const distribution = new ZuluDistribution({
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).toHaveLength(manifestData.length);
});
});
describe('getArchitectureOptions', () => {
it.each([
[{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}],
[{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}],
[{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}],
[{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}]
])('%s -> %s', (input, expected) => {
const distribution = new ZuluDistribution({
version: '11',
architecture: input.architecture,
packageType: 'jdk',
checkLatest: false
});
expect(distribution['getArchitectureOptions']()).toEqual(expected);
});
});
describe('findPackageForDownload', () => {
it.each([
['8', '8.0.282+8'],
['11.x', '11.0.10+9'],
['8.0', '8.0.282+8'],
['11.0.x', '11.0.10+9'],
['15', '15.0.2+7'],
['9.0.0', '9.0.0+0'],
['9.0', '9.0.1+0'],
['8.0.262', '8.0.262+19'], // validate correct choice between [8.0.262.17, 8.0.262.19, 8.0.262.18]
['8.0.262+17', '8.0.262+17'],
['15.0.1+8', '15.0.1+8'],
['15.0.1+9', '15.0.1+9']
])('version is %s -> %s', async (input, expected) => {
const distribution = new ZuluDistribution({
version: input,
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
const result = await distribution['findPackageForDownload'](
distribution['version']
);
expect(result.version).toBe(expected);
});
it('select correct bundle if there are multiple items with the same jdk version but different zulu versions', async () => {
const distribution = new ZuluDistribution({
version: '',
architecture: 'arm64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
const result = await distribution['findPackageForDownload']('21.0.2');
expect(result.url).toBe(
'https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz'
);
});
it('should throw an error', async () => {
const distribution = new ZuluDistribution({
version: '18',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
await expect(
distribution['findPackageForDownload'](distribution['version'])
).rejects.toThrow(/Could not find satisfied version for semver */);
});
});

View File

@ -1,229 +0,0 @@
import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
import {ZuluDistribution} from '../../src/distributions/zulu/installer';
import {IZuluVersions} from '../../src/distributions/zulu/models';
import * as utils from '../../src/util';
import os from 'os';
import manifestData from '../data/zulu-windows.json';
describe('getAvailableVersions', () => {
let spyHttpClient: jest.SpyInstance;
let spyUtilGetDownloadArchiveExtension: jest.SpyInstance;
beforeEach(() => {
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
spyHttpClient.mockReturnValue({
statusCode: 200,
headers: {},
result: manifestData as IZuluVersions[]
});
spyUtilGetDownloadArchiveExtension = jest.spyOn(
utils,
'getDownloadArchiveExtension'
);
spyUtilGetDownloadArchiveExtension.mockReturnValue('zip');
});
afterEach(() => {
jest.resetAllMocks();
jest.clearAllMocks();
jest.restoreAllMocks();
});
it.each([
[
{
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ga'
],
[
{
version: '11-ea',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=32&release_status=ea'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jdk',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jre',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jre&javafx=false&arch=x86&hw_bitness=64&release_status=ga'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jdk+fx',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jdk&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
],
[
{
version: '8',
architecture: 'x64',
packageType: 'jre+fx',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
],
[
{
version: '11',
architecture: 'arm64',
packageType: 'jdk',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
],
[
{
version: '11',
architecture: 'arm',
packageType: 'jdk',
checkLatest: false
},
'?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
]
])('build correct url for %s -> %s', async (input, parsedUrl) => {
const distribution = new ZuluDistribution(input);
distribution['getPlatformOption'] = () => 'windows';
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/${parsedUrl}`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
});
type DistroArch = {
bitness: string;
arch: string;
};
it.each([
['amd64', {bitness: '64', arch: 'x86'}],
['arm64', {bitness: '64', arch: 'arm'}]
])(
'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch);
const distribution = new ZuluDistribution({
version: '17',
architecture: '', // to get default value
packageType: 'jdk',
checkLatest: false
});
distribution['getPlatformOption'] = () => 'windows';
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=windows&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
await distribution['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);
}
);
it('load available versions', async () => {
const distribution = new ZuluDistribution({
version: '11',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
const availableVersions = await distribution['getAvailableVersions']();
expect(availableVersions).toHaveLength(manifestData.length);
});
});
describe('getArchitectureOptions', () => {
it.each([
[{architecture: 'x64'}, {arch: 'x86', hw_bitness: '64', abi: ''}],
[{architecture: 'x86'}, {arch: 'x86', hw_bitness: '32', abi: ''}],
[{architecture: 'x32'}, {arch: 'x32', hw_bitness: '', abi: ''}],
[{architecture: 'arm'}, {arch: 'arm', hw_bitness: '', abi: ''}]
])('%s -> %s', (input, expected) => {
const distribution = new ZuluDistribution({
version: '11',
architecture: input.architecture,
packageType: 'jdk',
checkLatest: false
});
expect(distribution['getArchitectureOptions']()).toEqual(expected);
});
});
describe('findPackageForDownload', () => {
it.each([
['8', '8.0.282+8'],
['11.x', '11.0.10+9'],
['8.0', '8.0.282+8'],
['11.0.x', '11.0.10+9'],
['15', '15.0.2+7'],
['9.0.0', '9.0.0+0'],
['9.0', '9.0.1+0'],
['8.0.262', '8.0.262+19'], // validate correct choice between [8.0.262.17, 8.0.262.19, 8.0.262.18]
['8.0.262+17', '8.0.262+17'],
['15.0.1+8', '15.0.1+8'],
['15.0.1+9', '15.0.1+9']
])('version is %s -> %s', async (input, expected) => {
const distribution = new ZuluDistribution({
version: input,
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
const result = await distribution['findPackageForDownload'](
distribution['version']
);
expect(result.version).toBe(expected);
});
it('select correct bundle if there are multiple items with the same jdk version but different zulu versions', async () => {
const distribution = new ZuluDistribution({
version: '',
architecture: 'arm64',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
const result = await distribution['findPackageForDownload']('17.0.10');
expect(result.url).toBe(
'https://cdn.azul.com/zulu/bin/zulu17.48.15-ca-jdk17.0.10-windows_aarch64.zip'
);
});
it('should throw an error', async () => {
const distribution = new ZuluDistribution({
version: '18',
architecture: 'x86',
packageType: 'jdk',
checkLatest: false
});
distribution['getAvailableVersions'] = async () => manifestData;
await expect(
distribution['findPackageForDownload'](distribution['version'])
).rejects.toThrow(/Could not find satisfied version for semver */);
});
});

View File

@ -1,7 +1,6 @@
import * as path from 'path'; import path = require('path');
import * as io from '@actions/io'; import io = require('@actions/io');
import * as exec from '@actions/exec'; import exec = require('@actions/exec');
import * as gpg from '../src/gpg';
jest.mock('@actions/exec', () => { jest.mock('@actions/exec', () => {
return { return {
@ -12,6 +11,8 @@ jest.mock('@actions/exec', () => {
const tempDir = path.join(__dirname, 'runner', 'temp'); const tempDir = path.join(__dirname, 'runner', 'temp');
process.env['RUNNER_TEMP'] = tempDir; process.env['RUNNER_TEMP'] = tempDir;
import gpg = require('../src/gpg');
describe('gpg tests', () => { describe('gpg tests', () => {
beforeEach(async () => { beforeEach(async () => {
await io.mkdirP(tempDir); await io.mkdirP(tempDir);
@ -32,11 +33,7 @@ describe('gpg tests', () => {
expect(keyId).toBeNull(); expect(keyId).toBeNull();
expect(exec.exec).toHaveBeenCalledWith( expect(exec.exec).toHaveBeenCalledWith('gpg', expect.anything(), expect.anything());
'gpg',
expect.anything(),
expect.anything()
);
}); });
}); });
@ -45,11 +42,7 @@ describe('gpg tests', () => {
const keyId = 'asdfhjkl'; const keyId = 'asdfhjkl';
await gpg.deleteKey(keyId); await gpg.deleteKey(keyId);
expect(exec.exec).toHaveBeenCalledWith( expect(exec.exec).toHaveBeenCalledWith('gpg', expect.anything(), expect.anything());
'gpg',
expect.anything(),
expect.anything()
);
}); });
}); });
}); });

View File

@ -77,9 +77,9 @@ describe('toolchains tests', () => {
}; };
const result = `<?xml version="1.0"?> const result = `<?xml version="1.0"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" <toolchains xmlns="https://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd"> xsi:schemaLocation="https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain> <toolchain>
<type>jdk</type> <type>jdk</type>
<provides> <provides>
@ -248,9 +248,9 @@ describe('toolchains tests', () => {
}; };
const expectedToolchains = `<?xml version="1.0"?> const expectedToolchains = `<?xml version="1.0"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" <toolchains xmlns="https://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd"> xsi:schemaLocation="https://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain> <toolchain>
<type>jdk</type> <type>jdk</type>
<provides> <provides>
@ -279,26 +279,14 @@ describe('toolchains tests', () => {
const version = '17'; const version = '17';
const distributionName = 'temurin'; const distributionName = 'temurin';
const id = 'temurin_17'; const id = 'temurin_17';
const jdkHome = const jdkHome = '/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64';
'/opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/17.0.1-12/x64';
await toolchains.configureToolchains( await toolchains.configureToolchains(version, distributionName, jdkHome, undefined);
version,
distributionName,
jdkHome,
undefined
);
expect(fs.existsSync(m2Dir)).toBe(true); expect(fs.existsSync(m2Dir)).toBe(true);
expect(fs.existsSync(toolchainsFile)).toBe(true); expect(fs.existsSync(toolchainsFile)).toBe(true);
expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual( expect(fs.readFileSync(toolchainsFile, 'utf-8')).toEqual(
toolchains.generateToolchainDefinition( toolchains.generateToolchainDefinition('', version, distributionName, id, jdkHome)
'',
version,
distributionName,
id,
jdkHome
)
); );
}, 100000); }, 100000);
}); });

View File

@ -1,10 +1,6 @@
import * as cache from '@actions/cache'; import * as cache from '@actions/cache';
import * as core from '@actions/core'; import * as core from '@actions/core';
import { import { isVersionSatisfies, isCacheFeatureAvailable } from '../src/util';
convertVersionToSemver,
isVersionSatisfies,
isCacheFeatureAvailable
} from '../src/util';
jest.mock('@actions/cache'); jest.mock('@actions/cache');
jest.mock('@actions/core'); jest.mock('@actions/core');
@ -24,25 +20,23 @@ describe('isVersionSatisfies', () => {
['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]
])( ])('%s, %s -> %s', (inputRange: string, inputVersion: string, expected: boolean) => {
'%s, %s -> %s',
(inputRange: string, inputVersion: string, expected: boolean) => {
const actual = isVersionSatisfies(inputRange, inputVersion); const actual = isVersionSatisfies(inputRange, inputVersion);
expect(actual).toBe(expected); expect(actual).toBe(expected);
} });
);
}); });
describe('isCacheFeatureAvailable', () => { describe('isCacheFeatureAvailable', () => {
it('isCacheFeatureAvailable disabled on GHES', () => { it('isCacheFeatureAvailable disabled on GHES', () => {
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false); jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
const infoMock = jest.spyOn(core, 'warning');
const message =
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.';
try { try {
process.env['GITHUB_SERVER_URL'] = 'http://example.com'; process.env['GITHUB_SERVER_URL'] = 'http://example.com';
expect(isCacheFeatureAvailable()).toBeFalsy(); isCacheFeatureAvailable();
expect(infoMock).toHaveBeenCalledWith(message); } catch (error) {
expect(error).toHaveProperty(
'message',
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
);
} finally { } finally {
delete process.env['GITHUB_SERVER_URL']; delete process.env['GITHUB_SERVER_URL'];
} }
@ -51,8 +45,7 @@ describe('isCacheFeatureAvailable', () => {
it('isCacheFeatureAvailable disabled on dotcom', () => { it('isCacheFeatureAvailable disabled on dotcom', () => {
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false); jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
const infoMock = jest.spyOn(core, 'warning'); const infoMock = jest.spyOn(core, 'warning');
const message = const message = 'The runner was not able to contact the cache service. Caching will be skipped';
'The runner was not able to contact the cache service. Caching will be skipped';
try { try {
process.env['GITHUB_SERVER_URL'] = 'http://github.com'; process.env['GITHUB_SERVER_URL'] = 'http://github.com';
expect(isCacheFeatureAvailable()).toBe(false); expect(isCacheFeatureAvailable()).toBe(false);
@ -67,16 +60,3 @@ describe('isCacheFeatureAvailable', () => {
expect(isCacheFeatureAvailable()).toBe(true); expect(isCacheFeatureAvailable()).toBe(true);
}); });
}); });
describe('convertVersionToSemver', () => {
it.each([
['12', '12'],
['12.0', '12.0'],
['12.0.2', '12.0.2'],
['12.0.2.1', '12.0.2+1'],
['12.0.2.1.0', '12.0.2+1.0']
])('%s -> %s', (input: string, expected: string) => {
const actual = convertVersionToSemver(input);
expect(actual).toBe(expected);
});
});

View File

@ -24,7 +24,7 @@ fi
ACTUAL_JAVA_VERSION="$(java -version 2>&1)" ACTUAL_JAVA_VERSION="$(java -version 2>&1)"
echo "Found java version: $ACTUAL_JAVA_VERSION" echo "Found java version: $ACTUAL_JAVA_VERSION"
GREP_RESULT=$(echo $ACTUAL_JAVA_VERSION | grep -E "^(openjdk|java) version \"$EXPECTED_JAVA_VERSION") GREP_RESULT=$(echo $ACTUAL_JAVA_VERSION | grep "^openjdk version \"$EXPECTED_JAVA_VERSION")
if [ -z "$GREP_RESULT" ]; then if [ -z "$GREP_RESULT" ]; then
echo "::error::Unexpected version" echo "::error::Unexpected version"
echo "Expected version: $EXPECTED_JAVA_VERSION" echo "Expected version: $EXPECTED_JAVA_VERSION"

View File

@ -5,8 +5,7 @@ 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'
java-version-file: required: true
description: 'The path to the `.java-version` file. See examples of supported syntax in README file'
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
@ -56,15 +55,12 @@ inputs:
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".'
required: false required: false
cache-dependency-path:
description: 'The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.'
required: false
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'
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: Used to pull java versions from setup-java. Since there is a default value, token is typically not supplied by the user.
default: ${{ github.server_url == 'https://github.com' && github.token || '' }} default: ${{ 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'
required: false required: false
@ -81,6 +77,6 @@ outputs:
cache-hit: cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key' description: 'A boolean value to indicate an exact match was found for the primary key'
runs: runs:
using: 'node20' using: 'node16'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
post: 'dist/cleanup/index.js' post: 'dist/cleanup/index.js'

38874
dist/cleanup/index.js vendored

File diff suppressed because one or more lines are too long

86179
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,6 @@
- [Liberica](#Liberica) - [Liberica](#Liberica)
- [Microsoft](#Microsoft) - [Microsoft](#Microsoft)
- [Amazon Corretto](#Amazon-Corretto) - [Amazon Corretto](#Amazon-Corretto)
- [Oracle](#Oracle)
- [Alibaba Dragonwell](#Alibaba-Dragonwell)
- [Installing custom Java package type](#Installing-custom-Java-package-type) - [Installing custom Java package type](#Installing-custom-Java-package-type)
- [Installing custom Java architecture](#Installing-custom-Java-architecture) - [Installing custom Java architecture](#Installing-custom-Java-architecture)
- [Installing custom Java distribution from local file](#Installing-Java-from-local-file) - [Installing custom Java distribution from local file](#Installing-Java-from-local-file)
@ -17,7 +15,6 @@
- [Publishing using Gradle](#Publishing-using-Gradle) - [Publishing using Gradle](#Publishing-using-Gradle)
- [Hosted Tool Cache](#Hosted-Tool-Cache) - [Hosted Tool Cache](#Hosted-Tool-Cache)
- [Modifying Maven Toolchains](#Modifying-Maven-Toolchains) - [Modifying Maven Toolchains](#Modifying-Maven-Toolchains)
- [Java-version file](#Java-version-file)
See [action.yml](../action.yml) for more details on task inputs. See [action.yml](../action.yml) for more details on task inputs.
@ -25,14 +22,13 @@ See [action.yml](../action.yml) for more details on task inputs.
Inputs `java-version` and `distribution` are mandatory and needs to be provided. See [Supported distributions](../README.md#Supported-distributions) for a list of available options. Inputs `java-version` and `distribution` are mandatory and needs to be provided. See [Supported distributions](../README.md#Supported-distributions) for a list of available options.
### Eclipse Temurin ### Eclipse Temurin
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '11'
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
@ -41,8 +37,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
java-version: '11' java-version: '11'
@ -50,103 +46,58 @@ steps:
``` ```
### Zulu ### Zulu
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'zulu' distribution: 'zulu'
java-version: '21' java-version: '11'
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 -cp java HelloWorldApp
``` ```
### Liberica ### Liberica
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'liberica' distribution: 'liberica'
java-version: '21' java-version: '11'
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 -cp java HelloWorldApp
``` ```
### Microsoft ### Microsoft
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'microsoft' distribution: 'microsoft'
java-version: '21' java-version: '11'
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
### Using Microsoft distribution on GHES
`setup-java` comes pre-installed on the appliance with GHES if Actions is enabled. When dynamically downloading the Microsoft Build of OpenJDK distribution, `setup-java` makes a request to `actions/setup-java` to get available versions on github.com (outside of the appliance). These calls to `actions/setup-java` are made via unauthenticated requests, which are limited to [60 requests per hour per IP](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). If more requests are made within the time frame, then you will start to see rate-limit errors during downloading that looks like: `##[error]API rate limit exceeded for...`.
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
```yaml
uses: actions/setup-java@v4
with:
token: ${{ secrets.GH_DOTCOM_TOKEN }}
distribution: 'microsoft'
java-version: '21'
```
If the runner is not able to access github.com, any Java versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.
### Amazon Corretto ### Amazon Corretto
**NOTE:** Amazon Corretto only supports the major version specification. **NOTE:** Amazon Corretto only supports the major version specification.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'corretto' distribution: 'corretto'
java-version: '21' java-version: '11'
- run: java -cp java HelloWorldApp
```
### Oracle
**NOTE:** Oracle Java SE Development Kit is only available for version 17 and later.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: '21'
- run: java -cp java HelloWorldApp
```
### Alibaba Dragonwell
**NOTE:** Alibaba Dragonwell only provides jdk.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'dragonwell'
java-version: '8'
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
## Installing custom Java package type ## Installing custom Java package type
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -159,12 +110,12 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
architecture: x86 # optional - default value derived from the runner machine architecture: x86 # optional - defaults to x64
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
@ -176,7 +127,7 @@ steps:
- run: | - run: |
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz" download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -186,31 +137,6 @@ steps:
- run: java -cp java HelloWorldApp - run: java -cp java HelloWorldApp
``` ```
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:
```yaml
steps:
- name: fetch latest temurin JDK
id: fetch_latest_jdk
run: |
major_version={{ env.JAVA_VERSION }} # Example 16 or 21 or 22
cd $RUNNER_TEMP
response=$(curl -s "https://api.github.com/repos/adoptium/temurin${major_version}-binaries/releases")
latest_jdk_download_url=$(echo "$response" | jq -r '.[0].assets[] | select(.name | contains("jdk_x64_alpine-linux") and endswith(".tar.gz")) | .browser_download_url')
curl -Ls "$latest_jdk_download_url" -o java_package.tar.gz
latest_jdk_json_url=$(jdk_download_url "$response" | jq -r '.[0].assets[] | select(.name | contains("jdk_x64_alpine-linux") and endswith(".tar.gz.json")) | .browser_download_url')
latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver')
echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT"
- uses: actions/setup-java@v4
with:
distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz
java-version: {{ steps.fetch_latest_jdk.outputs.java_version }}
architecture: x64
- run: java -cp java HelloWorldApp
```
## Testing against different Java distributions ## Testing against different Java distributions
**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.
```yaml ```yaml
@ -223,9 +149,9 @@ jobs:
java: [ '8', '11' ] java: [ '8', '11' ]
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -243,9 +169,9 @@ jobs:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@ -260,9 +186,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -276,7 +202,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
- name: Set up Apache Maven Central - name: Set up Apache Maven Central
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: # running setup-java again overwrites the settings.xml with: # running setup-java again overwrites the settings.xml
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@ -361,8 +287,6 @@ If `gpg-private-key` input is provided, the private key will be written to a fil
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file. See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
***NOTE***: If the error that states, `gpg: Sorry, no terminal at all requested - can't get input` [is encountered](https://github.com/actions/setup-java/issues/554), please update the version of `maven-gpg-plugin` to 1.6 or higher.
## Apache Maven with a settings path ## Apache Maven with a settings path
When using an Actions self-hosted runner with multiple shared runners the default `$HOME` directory can be shared by a number runners at the same time which could overwrite existing settings file. Setting the `settings-path` variable allows you to choose a unique location for your settings file. When using an Actions self-hosted runner with multiple shared runners the default `$HOME` directory can be shared by a number runners at the same time which could overwrite existing settings file. Setting the `settings-path` variable allows you to choose a unique location for your settings file.
@ -373,9 +297,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Set up JDK 11 for Shared Runner - name: Set up JDK 11 for Shared Runner
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -399,10 +323,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@ -424,7 +348,7 @@ See the help docs on [Publishing a Package with Gradle](https://help.github.com/
## Hosted Tool Cache ## Hosted Tool Cache
GitHub Hosted Runners have a tool cache that comes with some Java versions pre-installed. This tool cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and this is where you can find the pre-installed versions of Java. `setup-java` works by taking a specific version of Java in this tool cache and adding it to PATH if the version, architecture and distribution match. GitHub Hosted Runners have a tool cache that comes with some Java versions pre-installed. This tool cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and this is where you can find the pre-installed versions of Java. `setup-java` works by taking a specific version of Java in this tool cache and adding it to PATH if the version, architecture and distribution match.
Currently, LTS versions of Eclipse Temurin (`temurin`) are cached on the GitHub Hosted Runners. Currently, LTS versions of Adopt OpenJDK (`adopt`) are cached on the GitHub Hosted Runners.
The tools cache gets updated on a weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments). The tools cache gets updated on a weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).
@ -436,17 +360,17 @@ Subsequent calls to `setup-java` with distinct distribution and version paramete
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
8 8
11 11
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '15' java-version: 15
``` ```
The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combine this with custom JDKs of arbitrary versions: The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combine this with custom JDKs of arbitrary versions:
@ -455,7 +379,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -463,7 +387,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
architecture: x64 architecture: x64
``` ```
This will generate a Toolchains entry with the following values: `version: 1.6`, `vendor: jdkfile`, `id: Oracle_1.6`. This will generate a Toolchains entry with the following values: `version: 1.6`, `vendor: jkdfile`, `id: Oracle_1.6`.
### Modifying The Toolchain Vendor For JDKs ### Modifying The Toolchain Vendor For JDKs
Each JDK provider will receive a default `vendor` using the `distribution` input value but this can be overridden with the `mvn-toolchain-vendor` parameter as follows. Each JDK provider will receive a default `vendor` using the `distribution` input value but this can be overridden with the `mvn-toolchain-vendor` parameter as follows.
@ -472,7 +396,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@ -487,7 +411,7 @@ In case you install multiple versions of Java at once with multi-line `java-vers
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@ -501,8 +425,8 @@ Each JDK provider will receive a default `id` based on the combination of `distr
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@ -514,7 +438,7 @@ In case you install multiple versions of Java at once you can use the same synta
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v3
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@ -524,22 +448,3 @@ steps:
something_else something_else
something_other something_other
``` ```
## Java version file
If the `java-version-file` input is specified, the action will extract the version from the file and install it.
Supported files are .java-version and .tool-versions.
In .java-version file, only the version should be specified (e.g., 17.0.7).
In .tool-versions file, java version should be preceded by the java keyword (e.g., java 17.0.7).
The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv). Similarly, the `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf) standards, adhering to Semantic Versioning ([semver](https://semver.org/)).
If both java-version and java-version-file inputs are provided, the java-version input will be used.
Valid entry options:
```
major versions: 8, 11, 16, 17, 21
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
versions with specified distribution: openjdk64-11.0.2
```
If the file contains multiple versions, only the first one will be recognized.

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