Compare commits
1 Commits
main
...
rename-v2-
Author | SHA1 | Date |
---|---|---|
Maxim Lobanov | 6191f55d32 |
|
@ -1,6 +0,0 @@
|
||||||
# Ignore list
|
|
||||||
/*
|
|
||||||
|
|
||||||
# Do not ignore these folders:
|
|
||||||
!__tests__/
|
|
||||||
!src/
|
|
51
.eslintrc.js
51
.eslintrc.js
|
@ -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,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
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
* @actions/setup-actions-team
|
* @actions/actions-service
|
||||||
|
* @actions/virtual-environments-owners
|
||||||
|
|
|
@ -1,17 +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
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
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@v2
|
||||||
|
- name: Setup Node.JS 12
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: npm run format-check
|
||||||
|
- run: npm test
|
||||||
|
- name: Verify no unstaged changes
|
||||||
|
if: runner.os != 'windows'
|
||||||
|
run: bash __tests__/verify-no-unstaged-changes.sh
|
|
@ -1,17 +0,0 @@
|
||||||
name: Check dist/
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
call-check-dist:
|
|
||||||
name: Check dist/
|
|
||||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
|
|
@ -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
|
|
|
@ -1,209 +0,0 @@
|
||||||
name: Validate cache
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- releases/*
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
gradle-save:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Run setup-java with the cache for gradle
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '11'
|
|
||||||
cache: 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/gradle
|
|
||||||
if [ ! -d ~/.gradle/caches ]; then
|
|
||||||
echo "::error::The ~/.gradle/caches directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
gradle-restore:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
needs: gradle-save
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Run setup-java with the cache for gradle
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '11'
|
|
||||||
cache: 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/
|
|
||||||
maven-save:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Run setup-java with the cache for maven
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '11'
|
|
||||||
cache: maven
|
|
||||||
- name: Create files to cache
|
|
||||||
run: |
|
|
||||||
mvn verify -f __tests__/cache/maven/pom.xml
|
|
||||||
if [ ! -d ~/.m2/repository ]; then
|
|
||||||
echo "::error::The ~/.m2/repository directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
maven-restore:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
needs: maven-save
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Run setup-java with the cache for maven
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '11'
|
|
||||||
cache: maven
|
|
||||||
- name: Confirm that ~/.m2/repository directory has been made
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/.m2/repository ]; then
|
|
||||||
echo "::error::The ~/.m2/repository directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ls ~/.m2/repository
|
|
||||||
sbt-save:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
working-directory: __tests__/cache/sbt
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Run setup-java with the cache for sbt
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '11'
|
|
||||||
cache: sbt
|
|
||||||
- name: Create files to cache
|
|
||||||
run: sbt update
|
|
||||||
|
|
||||||
- name: Check files to cache on macos-latest
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/Library/Caches/Coursier ]; then
|
|
||||||
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Check files to cache on windows-latest
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/AppData/Local/Coursier/Cache ]; then
|
|
||||||
echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Check files to cache on ubuntu-latest
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/.cache/coursier ]; then
|
|
||||||
echo "::error::The ~/.cache/coursier directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
sbt-restore:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
working-directory: __tests__/cache/sbt
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
needs: sbt-save
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Run setup-java with the cache for sbt
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'adopt'
|
|
||||||
java-version: '11'
|
|
||||||
cache: sbt
|
|
||||||
|
|
||||||
- name: Confirm that ~/Library/Caches/Coursier directory has been made
|
|
||||||
if: matrix.os == 'macos-latest'
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/Library/Caches/Coursier ]; then
|
|
||||||
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ls ~/Library/Caches/Coursier
|
|
||||||
|
|
||||||
- name: Confirm that ~/AppData/Local/Coursier/Cache directory has been made
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/AppData/Local/Coursier/Cache ]; then
|
|
||||||
echo "::error::The ~/AppData/Local/Coursier/Cache directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ls ~/AppData/Local/Coursier/Cache
|
|
||||||
|
|
||||||
- name: Confirm that ~/.cache/coursier directory has been made
|
|
||||||
if: matrix.os == 'ubuntu-latest'
|
|
||||||
run: |
|
|
||||||
if [ ! -d ~/.cache/coursier ]; then
|
|
||||||
echo "::error::The ~/.cache/coursier directory does not exist unexpectedly"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ls ~/.cache/coursier
|
|
|
@ -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@v3
|
uses: actions/checkout@v2
|
||||||
- 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@v3
|
uses: actions/checkout@v2
|
||||||
- name: Download Zulu OpenJDK file
|
- name: Download Zulu OpenJDK file
|
||||||
run: |
|
run: |
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
|
@ -85,40 +84,3 @@ jobs:
|
||||||
- name: Verify Java version
|
- name: Verify Java version
|
||||||
run: bash __tests__/verify-java.sh "11.0" "${{ steps.setup-java.outputs.path }}"
|
run: bash __tests__/verify-java.sh "11.0" "${{ steps.setup-java.outputs.path }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
setup-java-local-file-temurin:
|
|
||||||
name: Validate installation from local file Eclipse Temurin
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Download Eclipse Temurin file
|
|
||||||
run: |
|
|
||||||
if ($IsLinux) {
|
|
||||||
$downloadUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_x64_linux_hotspot_11.0.12_7.tar.gz"
|
|
||||||
$localFilename = "java_package.tar.gz"
|
|
||||||
} elseif ($IsMacOS) {
|
|
||||||
$downloadUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_x64_mac_hotspot_11.0.12_7.tar.gz"
|
|
||||||
$localFilename = "java_package.tar.gz"
|
|
||||||
} elseif ($IsWindows) {
|
|
||||||
$downloadUrl = "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.12%2B7/OpenJDK11U-jdk_x64_windows_hotspot_11.0.12_7.zip"
|
|
||||||
$localFilename = "java_package.zip"
|
|
||||||
}
|
|
||||||
echo "LocalFilename=$localFilename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
||||||
(New-Object System.Net.WebClient).DownloadFile($downloadUrl, "$env:RUNNER_TEMP/$localFilename")
|
|
||||||
shell: pwsh
|
|
||||||
- name: setup-java
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: 'jdkfile'
|
|
||||||
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
|
|
||||||
java-version: '11.0.0-ea'
|
|
||||||
architecture: x64
|
|
||||||
- name: Verify Java version
|
|
||||||
run: bash __tests__/verify-java.sh "11.0.12" "${{ steps.setup-java.outputs.path }}"
|
|
||||||
shell: bash
|
|
||||||
|
|
|
@ -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@v3
|
uses: actions/checkout@v2
|
||||||
- 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@v3
|
uses: actions/checkout@v2
|
||||||
- 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@v3
|
uses: actions/checkout@v2
|
||||||
- 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@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
name: Validate Java e2e
|
name: Validate Java e2e
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
@ -10,9 +9,7 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
schedule:
|
|
||||||
- cron: '0 */12 * * *'
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
jobs:
|
||||||
setup-java-major-versions:
|
setup-java-major-versions:
|
||||||
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
||||||
|
@ -21,37 +18,11 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: [
|
distribution: ['adopt', 'zulu']
|
||||||
'temurin',
|
version: ['8', '11', '15']
|
||||||
'adopt',
|
|
||||||
'adopt-openj9',
|
|
||||||
'zulu',
|
|
||||||
'liberica',
|
|
||||||
'microsoft',
|
|
||||||
'semeru',
|
|
||||||
'corretto',
|
|
||||||
'dragonwell'
|
|
||||||
] # internally 'adopt-hotspot' is the same as 'adopt'
|
|
||||||
version: ['8', '11', '17']
|
|
||||||
exclude:
|
|
||||||
- distribution: microsoft
|
|
||||||
version: 8
|
|
||||||
- distribution: dragonwell
|
|
||||||
os: macos-latest
|
|
||||||
include:
|
|
||||||
- distribution: oracle
|
|
||||||
os: macos-latest
|
|
||||||
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@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
@ -70,24 +41,24 @@ 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']
|
distribution: ['adopt', 'zulu']
|
||||||
version:
|
version:
|
||||||
- '11.0'
|
- '11.0'
|
||||||
- '8.0.302'
|
- '8.0.282'
|
||||||
- '17.0.7+7'
|
- '11.0.2+7'
|
||||||
include:
|
include:
|
||||||
- distribution: oracle
|
- distribution: 'adopt'
|
||||||
|
version: '12.0.2+10.1'
|
||||||
|
os: macos-latest
|
||||||
|
- distribution: 'adopt'
|
||||||
|
version: '12.0.2+10.1'
|
||||||
|
os: windows-latest
|
||||||
|
- distribution: 'adopt'
|
||||||
|
version: '12.0.2+10.1'
|
||||||
os: ubuntu-latest
|
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@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
@ -106,13 +77,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: ['adopt', 'zulu']
|
||||||
exclude:
|
|
||||||
- distribution: dragonwell
|
|
||||||
os: macos-latest
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
@ -124,46 +92,6 @@ jobs:
|
||||||
run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
|
run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
setup-java-multiple-jdks:
|
|
||||||
name: ${{ matrix.distribution }} ${{ matrix.version }} - multiple jdks - ${{ matrix.os }}
|
|
||||||
needs: setup-java-major-versions
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
distribution: ['temurin', 'zulu', 'liberica', 'dragonwell']
|
|
||||||
exclude:
|
|
||||||
- distribution: dragonwell
|
|
||||||
os: macos-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: setup-java
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: ${{ matrix.distribution }}
|
|
||||||
java-version: |
|
|
||||||
11
|
|
||||||
17
|
|
||||||
- name: Verify Java env variables
|
|
||||||
run: |
|
|
||||||
$versionsArr = "11","17"
|
|
||||||
foreach ($version in $versionsArr)
|
|
||||||
{
|
|
||||||
$envName = "JAVA_HOME_${version}_${env:RUNNER_ARCH}"
|
|
||||||
$JavaVersionPath = [Environment]::GetEnvironmentVariable($envName)
|
|
||||||
if (-not (Test-Path "$JavaVersionPath")) {
|
|
||||||
Write-Host "$envName is not found"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
shell: pwsh
|
|
||||||
- name: Verify Java
|
|
||||||
run: bash __tests__/verify-java.sh "17" "${{ steps.setup-java.outputs.path }}"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
setup-java-ea-versions-zulu:
|
setup-java-ea-versions-zulu:
|
||||||
name: zulu ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
name: zulu ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
||||||
needs: setup-java-major-minor-versions
|
needs: setup-java-major-minor-versions
|
||||||
|
@ -175,7 +103,7 @@ jobs:
|
||||||
version: ['17-ea', '15.0.0-ea.14']
|
version: ['17-ea', '15.0.0-ea.14']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
@ -186,24 +114,24 @@ 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-ea-versions-temurin:
|
setup-java-ea-versions-adopt:
|
||||||
name: temurin ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
name: adopt ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
||||||
needs: setup-java-major-minor-versions
|
needs: setup-java-major-minor-versions
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
version: ['17-ea']
|
version: ['17-ea', '15.0.0-ea.14.1.202003160455']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.version }}
|
java-version: ${{ matrix.version }}
|
||||||
distribution: temurin
|
distribution: adopt
|
||||||
- name: Verify Java
|
- name: Verify Java
|
||||||
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
@ -216,9 +144,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', 'semeru']
|
distribution: ['adopt', 'zulu']
|
||||||
java-package: ['jre']
|
java-package: ['jre']
|
||||||
version: ['17.0']
|
version:
|
||||||
|
- '15.0'
|
||||||
include:
|
include:
|
||||||
- distribution: 'zulu'
|
- distribution: 'zulu'
|
||||||
java-package: jre+fx
|
java-package: jre+fx
|
||||||
|
@ -228,21 +157,9 @@ jobs:
|
||||||
java-package: jdk+fx
|
java-package: jdk+fx
|
||||||
version: '8.0.242'
|
version: '8.0.242'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- distribution: 'liberica'
|
|
||||||
java-package: jdk+fx
|
|
||||||
version: '8'
|
|
||||||
os: ubuntu-latest
|
|
||||||
- distribution: 'liberica'
|
|
||||||
java-package: jre+fx
|
|
||||||
version: '11'
|
|
||||||
os: ubuntu-latest
|
|
||||||
- distribution: 'corretto'
|
|
||||||
java-package: jre
|
|
||||||
version: '8'
|
|
||||||
os: windows-latest
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
@ -254,125 +171,27 @@ 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
|
||||||
|
|
||||||
# Only Liberica and Zulu provide x86
|
setup-java-custom-architecture:
|
||||||
setup-java-x86:
|
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x86) - ${{ matrix.os }}
|
||||||
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-${{ matrix.architecture }}) - ${{ matrix.os }}
|
|
||||||
needs: setup-java-major-minor-versions
|
needs: setup-java-major-minor-versions
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
# x86 is not supported on macOS
|
# Only Zulu provides x86 arch for now and only for windows / ubuntu
|
||||||
os: [windows-latest, ubuntu-latest]
|
os: [windows-latest, ubuntu-latest]
|
||||||
distribution: ['liberica', 'zulu', 'corretto']
|
distribution: ['zulu']
|
||||||
version: ['11']
|
version: ['11']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v2
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.distribution }}
|
distribution: ${{ matrix.distribution }}
|
||||||
java-version: ${{ matrix.version }}
|
java-version: ${{ matrix.version }}
|
||||||
architecture: 'x86'
|
architecture: x86
|
||||||
- name: Verify Java
|
- name: Verify Java
|
||||||
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
setup-java-version-both-version-inputs-presents:
|
|
||||||
name: ${{ matrix.distribution }} version (should be from input) - ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
distribution: ['temurin', 'microsoft', 'corretto']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Create .java-version file
|
|
||||||
shell: bash
|
|
||||||
run: echo "8" > .java-version
|
|
||||||
- name: setup-java
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: ${{ matrix.distribution }}
|
|
||||||
java-version: 11
|
|
||||||
java-version-file: '.java-version'
|
|
||||||
- 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']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Create .java-version file
|
|
||||||
shell: bash
|
|
||||||
run: echo "11" > .java-version
|
|
||||||
- name: setup-java
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: ${{ matrix.distribution }}
|
|
||||||
java-version-file: '.java-version'
|
|
||||||
- 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']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Create .java-version file
|
|
||||||
shell: bash
|
|
||||||
run: echo "11.0.2" > .java-version
|
|
||||||
- name: setup-java
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: ${{ matrix.distribution }}
|
|
||||||
java-version-file: '.java-version'
|
|
||||||
- name: Verify Java
|
|
||||||
run: bash __tests__/verify-java.sh "11.0.2" "${{ steps.setup-java.outputs.path }}"
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
setup-java-version-from-file-major-minor-patch-with-dist:
|
|
||||||
name: ${{ matrix.distribution }} version from file 'openjdk64-11.0.2' - ${{ matrix.os }}
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
distribution: ['adopt', 'zulu', 'liberica']
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Create .java-version file
|
|
||||||
shell: bash
|
|
||||||
run: echo "openjdk64-11.0.2" > .java-version
|
|
||||||
- name: setup-java
|
|
||||||
uses: ./
|
|
||||||
id: setup-java
|
|
||||||
with:
|
|
||||||
distribution: ${{ matrix.distribution }}
|
|
||||||
java-version-file: '.java-version'
|
|
||||||
- name: Verify Java
|
|
||||||
run: bash __tests__/verify-java.sh "11.0.2" "${{ steps.setup-java.outputs.path }}"
|
|
||||||
shell: bash
|
|
||||||
|
|
|
@ -1,15 +1,20 @@
|
||||||
name: Licensed
|
name: Licensed
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push: {branches: main}
|
||||||
branches:
|
pull_request: {branches: main}
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
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@v2
|
||||||
|
- run: npm ci
|
||||||
|
- name: Install licensed
|
||||||
|
run: |
|
||||||
|
cd $RUNNER_TEMP
|
||||||
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
|
||||||
|
sudo tar -xzf licensed.tar.gz
|
||||||
|
sudo mv licensed /usr/local/bin/licensed
|
||||||
|
- run: licensed status
|
|
@ -1,29 +0,0 @@
|
||||||
name: Release new action version
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [released]
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
TAG_NAME:
|
|
||||||
description: 'Tag name that the major tag will point to'
|
|
||||||
required: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
update_tag:
|
|
||||||
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
|
|
||||||
environment:
|
|
||||||
name: releaseNewActionVersion
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Update the ${{ env.TAG_NAME }} tag
|
|
||||||
id: update-major-tag
|
|
||||||
uses: actions/publish-action@v0.2.2
|
|
||||||
with:
|
|
||||||
source-tag: ${{ env.TAG_NAME }}
|
|
||||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
|
|
@ -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
|
|
|
@ -94,6 +94,3 @@ typings/
|
||||||
# DynamoDB Local files
|
# DynamoDB Local files
|
||||||
.dynamodb/
|
.dynamodb/
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
# IntelliJ / WebStorm
|
|
||||||
/.idea/
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ sources:
|
||||||
|
|
||||||
allowed:
|
allowed:
|
||||||
- apache-2.0
|
- apache-2.0
|
||||||
- 0bsd
|
|
||||||
- bsd-2-clause
|
- bsd-2-clause
|
||||||
- bsd-3-clause
|
- bsd-3-clause
|
||||||
- isc
|
- isc
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,7 +0,0 @@
|
||||||
# Ignore list
|
|
||||||
/*
|
|
||||||
|
|
||||||
# Do not ignore these folders:
|
|
||||||
!__tests__/
|
|
||||||
!.github/
|
|
||||||
!src/
|
|
|
@ -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'
|
|
||||||
};
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"printWidth": 100,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"bracketSpacing": true,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"parser": "typescript"
|
||||||
|
}
|
|
@ -1,76 +0,0 @@
|
||||||
# Contributor Covenant Code of Conduct
|
|
||||||
|
|
||||||
## Our Pledge
|
|
||||||
|
|
||||||
In the interest of fostering an open and welcoming environment, we as
|
|
||||||
contributors and maintainers pledge to make participation in our project and
|
|
||||||
our community a harassment-free experience for everyone, regardless of age, body
|
|
||||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
||||||
level of experience, education, socio-economic status, nationality, personal
|
|
||||||
appearance, race, religion, or sexual identity and orientation.
|
|
||||||
|
|
||||||
## Our Standards
|
|
||||||
|
|
||||||
Examples of behavior that contributes to creating a positive environment
|
|
||||||
include:
|
|
||||||
|
|
||||||
* Using welcoming and inclusive language
|
|
||||||
* Being respectful of differing viewpoints and experiences
|
|
||||||
* Gracefully accepting constructive criticism
|
|
||||||
* Focusing on what is best for the community
|
|
||||||
* Showing empathy towards other community members
|
|
||||||
|
|
||||||
Examples of unacceptable behavior by participants include:
|
|
||||||
|
|
||||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
||||||
advances
|
|
||||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
||||||
* Public or private harassment
|
|
||||||
* Publishing others' private information, such as a physical or electronic
|
|
||||||
address, without explicit permission
|
|
||||||
* Other conduct which could reasonably be considered inappropriate in a
|
|
||||||
professional setting
|
|
||||||
|
|
||||||
## Our Responsibilities
|
|
||||||
|
|
||||||
Project maintainers are responsible for clarifying the standards of acceptable
|
|
||||||
behavior and are expected to take appropriate and fair corrective action in
|
|
||||||
response to any instances of unacceptable behavior.
|
|
||||||
|
|
||||||
Project maintainers have the right and responsibility to remove, edit, or
|
|
||||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
||||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
||||||
permanently any contributor for other behaviors that they deem inappropriate,
|
|
||||||
threatening, offensive, or harmful.
|
|
||||||
|
|
||||||
## Scope
|
|
||||||
|
|
||||||
This Code of Conduct applies within all project spaces, and it also applies when
|
|
||||||
an individual is representing the project or its community in public spaces.
|
|
||||||
Examples of representing a project or community include using an official
|
|
||||||
project e-mail address, posting via an official social media account, or acting
|
|
||||||
as an appointed representative at an online or offline event. Representation of
|
|
||||||
a project may be further defined and clarified by project maintainers.
|
|
||||||
|
|
||||||
## Enforcement
|
|
||||||
|
|
||||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
||||||
reported by contacting the project team at opensource+actions/setup-java@github.com. All
|
|
||||||
complaints will be reviewed and investigated and will result in a response that
|
|
||||||
is deemed necessary and appropriate to the circumstances. The project team is
|
|
||||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
||||||
Further details of specific enforcement policies may be posted separately.
|
|
||||||
|
|
||||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
||||||
faith may face temporary or permanent repercussions as determined by other
|
|
||||||
members of the project's leadership.
|
|
||||||
|
|
||||||
## Attribution
|
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
||||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
||||||
|
|
||||||
[homepage]: https://www.contributor-covenant.org
|
|
||||||
|
|
||||||
For answers to common questions about this code of conduct, see
|
|
||||||
https://www.contributor-covenant.org/faq
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
# Contributors
|
||||||
|
|
||||||
|
### Checkin
|
||||||
|
|
||||||
|
- Do checkin source (src)
|
||||||
|
- Do checkin a single index.js file after running `ncc`
|
||||||
|
- Do not checking node_modules
|
||||||
|
|
||||||
|
### NCC
|
||||||
|
|
||||||
|
In order to avoid uploading `node_modules` to the repository, we use [zeit/ncc](https://github.com/zeit/ncc) to create multiple `index.js` files that gets saved under `dist/`.
|
||||||
|
There are two main files that get created
|
||||||
|
- `dist/setup/index.js`
|
||||||
|
- Core `setup-java` logic that downloads and installs an appropriate version of Java
|
||||||
|
- Handling creating a `settings.xml` file to make it easier to publish packages
|
||||||
|
- `dist/cleanup/index/js`
|
||||||
|
- Extra cleanup script that is used to remove GPG keys (needed for certain self-hosted runner scenarios)
|
||||||
|
|
||||||
|
If you're developing locally, after doing `npm install`, you can use the following commands
|
||||||
|
```yaml
|
||||||
|
npm run build # runs tsc along with ncc
|
||||||
|
npm run format # runs prettier --write
|
||||||
|
npm run format-check # runs prettier --check
|
||||||
|
npm run test # runs jest
|
||||||
|
npm run release # add all the necessary ncc files under dist/* to the git staging area
|
||||||
|
```
|
||||||
|
|
||||||
|
Any files generated using `tsc` will be added to `lib/*`, however those files also are not uploaded to the repository and are excluded using `.gitignore`.
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Tests are included under `_tests_/*` and can be run using `npm run-script test`.
|
||||||
|
|
||||||
|
We ask that you include a link to a successful run that utilizes the changes you are working on. For example, if your changes are in the branch `newAwesomeFeature`, then show an example run that uses `setup-python@newAwesomeFeature` or `my-fork@newAwesomeFeature`. This will help speed up testing and help us confirm that there are no breaking changes or bugs.
|
||||||
|
|
||||||
|
### Licensed
|
||||||
|
|
||||||
|
This repository uses a tool called [Licensed](https://github.com/github/licensed) to verify third party dependencies. You may need to locally install licensed and run `licensed cache` to update the dependency cache if you install or update a production dependency. If licensed cache is unable to determine the dependency, you may need to modify the cache file yourself to put the correct license. You should still verify the dependency, licensed is a tool to help, but is not a substitute for human review of dependencies.
|
231
README.md
231
README.md
|
@ -1,184 +1,63 @@
|
||||||
# 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)
|
<p align="left">
|
||||||
[![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)
|
<a href="https://github.com/actions/setup-java"><img alt="GitHub Actions status" src="https://github.com/actions/setup-java/workflows/Main%20workflow/badge.svg"></a>
|
||||||
[![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)
|
</p>
|
||||||
|
|
||||||
The `setup-java` action provides the following functionality for GitHub Actions runners:
|
This 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 Gradle.
|
|
||||||
- Caching dependencies managed by sbt.
|
|
||||||
- [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.
|
|
||||||
|
|
||||||
## V2 vs V1
|
## V2 vs V1
|
||||||
|
- V2 supports custom distributions and provides support for Zulu OpenJDK and Adopt OpenJDK out of the box. V1 supports only 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 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
|
||||||
|
Inputs `java-version` and `distribution` are mandatory. See [Supported distributions](../README.md#Supported-distributions) section for a list of available options.
|
||||||
|
|
||||||
- `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.
|
### Basic
|
||||||
|
**Adopt OpenJDK**
|
||||||
- `java-version-file`: The path to the `.java-version` file. See more details in [about `.java-version` file](docs/advanced-usage.md#Java-version-file).
|
|
||||||
|
|
||||||
- `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`.
|
|
||||||
|
|
||||||
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
|
|
||||||
|
|
||||||
- `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM.
|
|
||||||
|
|
||||||
- `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".
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
- `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-username`: Environment variable name for the username for authentication to the Apache Maven repository. Default is GITHUB_ACTOR.
|
|
||||||
|
|
||||||
- `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.
|
|
||||||
|
|
||||||
- `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.
|
|
||||||
|
|
||||||
- `mvn-toolchain-id`: Name of Maven Toolchain ID if the default name of `${distribution}_${java-version}` is not wanted.
|
|
||||||
|
|
||||||
- `mvn-toolchain-vendor`: Name of Maven Toolchain Vendor if the default name of `${distribution}` is not wanted.
|
|
||||||
|
|
||||||
### Basic Configuration
|
|
||||||
|
|
||||||
#### Eclipse Temurin
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'adopt' # See 'Supported distributions' for available options
|
||||||
java-version: '17'
|
java-version: '11'
|
||||||
- run: java HelloWorldApp.java
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Azul Zulu OpenJDK
|
**Zulu OpenJDK**
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
java-version: '17'
|
java-version: '11'
|
||||||
- run: java HelloWorldApp.java
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 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`
|
- major versions: `8`, `11`, `15`
|
||||||
- more specific versions: `17.0`, `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
|
- more specific versions: `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
|
||||||
- early access (EA) versions: `15-ea`, `15.0.0-ea`, `15.0.0-ea.2`, `15.0.0+2-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:
|
||||||
| Keyword | Distribution | Official site | License
|
| Keyword | Distribution | Official site | License |
|
||||||
|-|-|-|-|
|
|-|-|-|-|
|
||||||
| `temurin` | Eclipse Temurin | [Link](https://adoptium.net/) | [Link](https://adoptium.net/about.html)
|
| `zulu` | Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
||||||
| `zulu` | Azul Zulu OpenJDK | [Link](https://www.azul.com/downloads/zulu-community/?package=jdk) | [Link](https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/) |
|
| `adopt` | Adopt OpenJDK | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html)
|
||||||
| `adopt` or `adopt-hotspot` | AdoptOpenJDK Hotspot | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
|
||||||
| `adopt-openj9` | AdoptOpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
|
||||||
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
|
|
||||||
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
|
|
||||||
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
|
|
||||||
| `semeru` | IBM Semeru Runtime Open Edition | [Link](https://developer.ibm.com/languages/java/semeru-runtimes/downloads/) | [Link](https://openjdk.java.net/legal/gplv2+ce.html) |
|
|
||||||
| `oracle` | Oracle JDK | [Link](https://www.oracle.com/java/technologies/downloads/) | [Link](https://java.com/freeuselicense)
|
|
||||||
| `dragonwell` | Alibaba Dragonwell JDK | [Link](https://dragonwell-jdk.io/) | [Link](https://www.aliyun.com/product/dragonwell/)
|
|
||||||
|
|
||||||
**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:** For Azul Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
|
|
||||||
|
|
||||||
### 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:
|
|
||||||
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`, `buildSrc/**/Versions.kt`, `buildSrc/**/Dependencies.kt`, `gradle/*.versions.toml`, and `**/versions.properties`
|
|
||||||
- maven: `**/pom.xml`
|
|
||||||
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.scala`, `**/project/**.sbt`
|
|
||||||
|
|
||||||
The 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 cache input is optional, and caching is turned off by default.
|
|
||||||
|
|
||||||
#### Caching gradle dependencies
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '17'
|
|
||||||
cache: 'gradle'
|
|
||||||
- run: ./gradlew build --no-daemon
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Caching maven dependencies
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '17'
|
|
||||||
cache: 'maven'
|
|
||||||
- name: Build with Maven
|
|
||||||
run: mvn -B package --file pom.xml
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Caching sbt dependencies
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '17'
|
|
||||||
cache: 'sbt'
|
|
||||||
- name: Build with SBT
|
|
||||||
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@v3
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '17'
|
|
||||||
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.
|
||||||
|
|
||||||
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
|
If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions.
|
||||||
|
@ -188,13 +67,13 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v3
|
- uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'adopt'
|
||||||
java-version: '17'
|
java-version: '11'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: java HelloWorldApp.java
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
### Testing against different Java versions
|
### Testing against different Java versions
|
||||||
|
@ -204,47 +83,22 @@ jobs:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java: [ '8', '11', '17' ]
|
java: [ '8', '11', '13', '15' ]
|
||||||
name: Java ${{ matrix.Java }} sample
|
name: Java ${{ matrix.Java }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v2
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
- run: java HelloWorldApp.java
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install multiple JDKs
|
### Advanced
|
||||||
|
|
||||||
All versions are added to the PATH. The last version will be used and available globally. Other Java versions can be accessed through env variables with such specification as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/setup-java@v3
|
|
||||||
with:
|
|
||||||
distribution: '<distribution>'
|
|
||||||
java-version: |
|
|
||||||
8
|
|
||||||
11
|
|
||||||
15
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using Maven Toolchains
|
|
||||||
In the example above multiple JDKs are installed for the same job. The result after the last JDK is installed is a Maven Toolchains declaration containing references to all three JDKs. The values for `id`, `version`, and `vendor` of the individual Toolchain entries are the given input values for `distribution` and `java-version` (`vendor` being the combination of `${distribution}_${java-version}`) by default.
|
|
||||||
|
|
||||||
### Advanced Configuration
|
|
||||||
|
|
||||||
- [Selecting a Java distribution](docs/advanced-usage.md#Selecting-a-Java-distribution)
|
- [Selecting a Java distribution](docs/advanced-usage.md#Selecting-a-Java-distribution)
|
||||||
- [Eclipse Temurin](docs/advanced-usage.md#Eclipse-Temurin)
|
|
||||||
- [Adopt](docs/advanced-usage.md#Adopt)
|
- [Adopt](docs/advanced-usage.md#Adopt)
|
||||||
- [Zulu](docs/advanced-usage.md#Zulu)
|
- [Zulu](docs/advanced-usage.md#Zulu)
|
||||||
- [Liberica](docs/advanced-usage.md#Liberica)
|
|
||||||
- [Microsoft](docs/advanced-usage.md#Microsoft)
|
|
||||||
- [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto)
|
|
||||||
- [Oracle](docs/advanced-usage.md#Oracle)
|
|
||||||
- [Alibaba Dragonwell](docs/advanced-usage.md#Alibaba-Dragonwell)
|
|
||||||
- [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)
|
||||||
|
@ -253,11 +107,10 @@ In the example above multiple JDKs are installed for the same job. The result af
|
||||||
- [Publishing using Apache Maven](docs/advanced-usage.md#Publishing-using-Apache-Maven)
|
- [Publishing using Apache Maven](docs/advanced-usage.md#Publishing-using-Apache-Maven)
|
||||||
- [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)
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE).
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,20 @@
|
||||||
import * as io from '@actions/io';
|
import io = require('@actions/io');
|
||||||
import * as core from '@actions/core';
|
import fs = require('fs');
|
||||||
import * as fs from 'fs';
|
import path = require('path');
|
||||||
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';
|
||||||
import {M2_DIR, MVN_SETTINGS_FILE} from '../src/constants';
|
|
||||||
|
|
||||||
const m2Dir = path.join(__dirname, M2_DIR);
|
const m2Dir = path.join(__dirname, auth.M2_DIR);
|
||||||
const settingsFile = path.join(m2Dir, MVN_SETTINGS_FILE);
|
const settingsFile = path.join(m2Dir, auth.SETTINGS_FILE);
|
||||||
|
|
||||||
describe('auth tests', () => {
|
describe('auth tests', () => {
|
||||||
let spyOSHomedir: jest.SpyInstance;
|
let spyOSHomedir: jest.SpyInstance;
|
||||||
let spyInfo: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await io.rmRF(m2Dir);
|
await io.rmRF(m2Dir);
|
||||||
spyOSHomedir = jest.spyOn(os, 'homedir');
|
spyOSHomedir = jest.spyOn(os, 'homedir');
|
||||||
spyOSHomedir.mockReturnValue(__dirname);
|
spyOSHomedir.mockReturnValue(__dirname);
|
||||||
spyInfo = jest.spyOn(core, 'info');
|
|
||||||
spyInfo.mockImplementation(() => null);
|
|
||||||
}, 300000);
|
}, 300000);
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
|
@ -39,16 +34,10 @@ describe('auth tests', () => {
|
||||||
const password = 'TOLKIEN';
|
const password = 'TOLKIEN';
|
||||||
|
|
||||||
const altHome = path.join(__dirname, 'runner', 'settings');
|
const altHome = path.join(__dirname, 'runner', 'settings');
|
||||||
const altSettingsFile = path.join(altHome, MVN_SETTINGS_FILE);
|
const altSettingsFile = path.join(altHome, auth.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 +56,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 +69,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);
|
||||||
|
@ -109,24 +83,16 @@ describe('auth tests', () => {
|
||||||
const username = 'USERNAME';
|
const username = 'USERNAME';
|
||||||
const password = 'PASSWORD';
|
const password = 'PASSWORD';
|
||||||
|
|
||||||
fs.mkdirSync(m2Dir, {recursive: true});
|
fs.mkdirSync(m2Dir, { recursive: true });
|
||||||
fs.writeFileSync(settingsFile, 'FAKE FILE');
|
fs.writeFileSync(settingsFile, 'FAKE FILE');
|
||||||
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 () => {
|
||||||
|
@ -134,18 +100,12 @@ describe('auth tests', () => {
|
||||||
const username = 'USERNAME';
|
const username = 'USERNAME';
|
||||||
const password = 'PASSWORD';
|
const password = 'PASSWORD';
|
||||||
|
|
||||||
fs.mkdirSync(m2Dir, {recursive: true});
|
fs.mkdirSync(m2Dir, { recursive: true });
|
||||||
fs.writeFileSync(settingsFile, 'FAKE FILE');
|
fs.writeFileSync(settingsFile, 'FAKE FILE');
|
||||||
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 +154,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
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,409 +0,0 @@
|
||||||
import {mkdtempSync} from 'fs';
|
|
||||||
import {tmpdir} from 'os';
|
|
||||||
import {join} from 'path';
|
|
||||||
import {restore, save} from '../src/cache';
|
|
||||||
import * as fs from 'fs';
|
|
||||||
import * as os from 'os';
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
import * as cache from '@actions/cache';
|
|
||||||
|
|
||||||
describe('dependency cache', () => {
|
|
||||||
const ORIGINAL_RUNNER_OS = process.env['RUNNER_OS'];
|
|
||||||
const ORIGINAL_GITHUB_WORKSPACE = process.env['GITHUB_WORKSPACE'];
|
|
||||||
const ORIGINAL_CWD = process.cwd();
|
|
||||||
let workspace: string;
|
|
||||||
let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>;
|
|
||||||
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
|
||||||
let spyDebug: jest.SpyInstance<void, Parameters<typeof core.debug>>;
|
|
||||||
let spySaveState: jest.SpyInstance<void, Parameters<typeof core.saveState>>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
workspace = mkdtempSync(join(tmpdir(), 'setup-java-cache-'));
|
|
||||||
switch (os.platform()) {
|
|
||||||
case 'darwin':
|
|
||||||
process.env['RUNNER_OS'] = 'macOS';
|
|
||||||
break;
|
|
||||||
case 'win32':
|
|
||||||
process.env['RUNNER_OS'] = 'Windows';
|
|
||||||
break;
|
|
||||||
case 'linux':
|
|
||||||
process.env['RUNNER_OS'] = 'Linux';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error(`unknown platform: ${os.platform()}`);
|
|
||||||
}
|
|
||||||
process.chdir(workspace);
|
|
||||||
// This hack is necessary because @actions/glob ignores files not in the GITHUB_WORKSPACE
|
|
||||||
// https://git.io/Jcxig
|
|
||||||
process.env['GITHUB_WORKSPACE'] = projectRoot(workspace);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyInfo = jest.spyOn(core, 'info');
|
|
||||||
spyInfo.mockImplementation(() => null);
|
|
||||||
|
|
||||||
spyWarning = jest.spyOn(core, 'warning');
|
|
||||||
spyWarning.mockImplementation(() => null);
|
|
||||||
|
|
||||||
spyDebug = jest.spyOn(core, 'debug');
|
|
||||||
spyDebug.mockImplementation(() => null);
|
|
||||||
|
|
||||||
spySaveState = jest.spyOn(core, 'saveState');
|
|
||||||
spySaveState.mockImplementation(() => null);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
process.chdir(ORIGINAL_CWD);
|
|
||||||
process.env['GITHUB_WORKSPACE'] = ORIGINAL_GITHUB_WORKSPACE;
|
|
||||||
process.env['RUNNER_OS'] = ORIGINAL_RUNNER_OS;
|
|
||||||
resetState();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('restore', () => {
|
|
||||||
let spyCacheRestore: jest.SpyInstance<
|
|
||||||
ReturnType<typeof cache.restoreCache>,
|
|
||||||
Parameters<typeof cache.restoreCache>
|
|
||||||
>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyCacheRestore = jest
|
|
||||||
.spyOn(cache, 'restoreCache')
|
|
||||||
.mockImplementation((paths: string[], primaryKey: string) =>
|
|
||||||
Promise.resolve(undefined)
|
|
||||||
);
|
|
||||||
spyWarning.mockImplementation(() => null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('throws error if unsupported package manager specified', () => {
|
|
||||||
return expect(restore('ant')).rejects.toThrow(
|
|
||||||
'unknown package manager specified: ant'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('for maven', () => {
|
|
||||||
it('throws error if no pom.xml found', async () => {
|
|
||||||
await expect(restore('maven')).rejects.toThrow(
|
|
||||||
`No file in ${projectRoot(
|
|
||||||
workspace
|
|
||||||
)} matched to [**/pom.xml], make sure you have checked out the target repository`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('downloads cache', async () => {
|
|
||||||
createFile(join(workspace, 'pom.xml'));
|
|
||||||
|
|
||||||
await restore('maven');
|
|
||||||
expect(spyCacheRestore).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith('maven cache is not found');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('for gradle', () => {
|
|
||||||
it('throws error if no build.gradle found', async () => {
|
|
||||||
await expect(restore('gradle')).rejects.toThrow(
|
|
||||||
`No file in ${projectRoot(
|
|
||||||
workspace
|
|
||||||
)} matched to [**/*.gradle*,**/gradle-wrapper.properties,buildSrc/**/Versions.kt,buildSrc/**/Dependencies.kt,gradle/*.versions.toml,**/versions.properties], make sure you have checked out the target repository`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('downloads cache based on build.gradle', async () => {
|
|
||||||
createFile(join(workspace, 'build.gradle'));
|
|
||||||
|
|
||||||
await restore('gradle');
|
|
||||||
expect(spyCacheRestore).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
|
|
||||||
});
|
|
||||||
it('downloads cache based on build.gradle.kts', async () => {
|
|
||||||
createFile(join(workspace, 'build.gradle.kts'));
|
|
||||||
|
|
||||||
await restore('gradle');
|
|
||||||
expect(spyCacheRestore).toHaveBeenCalled();
|
|
||||||
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(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
it('downloads cache based on buildSrc/Versions.kt', async () => {
|
|
||||||
createDirectory(join(workspace, 'buildSrc'));
|
|
||||||
createFile(join(workspace, 'buildSrc', 'Versions.kt'));
|
|
||||||
|
|
||||||
await restore('gradle');
|
|
||||||
expect(spyCacheRestore).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
|
|
||||||
});
|
|
||||||
describe('for sbt', () => {
|
|
||||||
it('throws error if no build.sbt found', async () => {
|
|
||||||
await expect(restore('sbt')).rejects.toThrow(
|
|
||||||
`No file in ${projectRoot(
|
|
||||||
workspace
|
|
||||||
)} matched to [**/*.sbt,**/project/build.properties,**/project/**.scala,**/project/**.sbt], make sure you have checked out the target repository`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('downloads cache', async () => {
|
|
||||||
createFile(join(workspace, 'build.sbt'));
|
|
||||||
|
|
||||||
await restore('sbt');
|
|
||||||
expect(spyCacheRestore).toHaveBeenCalled();
|
|
||||||
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(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith('gradle cache is not found');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('save', () => {
|
|
||||||
let spyCacheSave: jest.SpyInstance<
|
|
||||||
ReturnType<typeof cache.saveCache>,
|
|
||||||
Parameters<typeof cache.saveCache>
|
|
||||||
>;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyCacheSave = jest
|
|
||||||
.spyOn(cache, 'saveCache')
|
|
||||||
.mockImplementation((paths: string[], key: string) =>
|
|
||||||
Promise.resolve(0)
|
|
||||||
);
|
|
||||||
spyWarning.mockImplementation(() => null);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('throws error if unsupported package manager specified', () => {
|
|
||||||
return expect(save('ant')).rejects.toThrow(
|
|
||||||
'unknown package manager specified: ant'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('save with -1 cacheId , should not fail workflow', async () => {
|
|
||||||
spyCacheSave.mockImplementation(() => Promise.resolve(-1));
|
|
||||||
createStateForMissingBuildFile();
|
|
||||||
|
|
||||||
await save('maven');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('saves with error from toolkit, should fail workflow', async () => {
|
|
||||||
spyCacheSave.mockImplementation(() =>
|
|
||||||
Promise.reject(new cache.ValidationError('Validation failed'))
|
|
||||||
);
|
|
||||||
createStateForMissingBuildFile();
|
|
||||||
|
|
||||||
expect.assertions(1);
|
|
||||||
await expect(save('maven')).rejects.toEqual(
|
|
||||||
new cache.ValidationError('Validation failed')
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('for maven', () => {
|
|
||||||
it('uploads cache even if no pom.xml found', async () => {
|
|
||||||
createStateForMissingBuildFile();
|
|
||||||
await save('maven');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
it('does not upload cache if no restore run before', async () => {
|
|
||||||
createFile(join(workspace, 'pom.xml'));
|
|
||||||
|
|
||||||
await save('maven');
|
|
||||||
expect(spyCacheSave).not.toHaveBeenCalled();
|
|
||||||
expect(spyWarning).toHaveBeenCalledWith(
|
|
||||||
'Error retrieving key from state.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('uploads cache', async () => {
|
|
||||||
createFile(join(workspace, 'pom.xml'));
|
|
||||||
createStateForSuccessfulRestore();
|
|
||||||
|
|
||||||
await save('maven');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('for gradle', () => {
|
|
||||||
it('uploads cache even if no build.gradle found', async () => {
|
|
||||||
createStateForMissingBuildFile();
|
|
||||||
|
|
||||||
await save('gradle');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
it('does not upload cache if no restore run before', async () => {
|
|
||||||
createFile(join(workspace, 'build.gradle'));
|
|
||||||
|
|
||||||
await save('gradle');
|
|
||||||
expect(spyCacheSave).not.toHaveBeenCalled();
|
|
||||||
expect(spyWarning).toHaveBeenCalledWith(
|
|
||||||
'Error retrieving key from state.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('uploads cache based on build.gradle', async () => {
|
|
||||||
createFile(join(workspace, 'build.gradle'));
|
|
||||||
createStateForSuccessfulRestore();
|
|
||||||
|
|
||||||
await save('gradle');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('uploads cache based on build.gradle.kts', async () => {
|
|
||||||
createFile(join(workspace, 'build.gradle.kts'));
|
|
||||||
createStateForSuccessfulRestore();
|
|
||||||
|
|
||||||
await save('gradle');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('uploads cache based on buildSrc/Versions.kt', async () => {
|
|
||||||
createDirectory(join(workspace, 'buildSrc'));
|
|
||||||
createFile(join(workspace, 'buildSrc', 'Versions.kt'));
|
|
||||||
createStateForSuccessfulRestore();
|
|
||||||
|
|
||||||
await save('gradle');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
expect.stringMatching(/^Cache saved with the key:.*/)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe('for sbt', () => {
|
|
||||||
it('uploads cache even if no build.sbt found', async () => {
|
|
||||||
createStateForMissingBuildFile();
|
|
||||||
await save('sbt');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
it('does not upload cache if no restore run before', async () => {
|
|
||||||
createFile(join(workspace, 'build.sbt'));
|
|
||||||
|
|
||||||
await save('sbt');
|
|
||||||
expect(spyCacheSave).not.toHaveBeenCalled();
|
|
||||||
expect(spyWarning).toHaveBeenCalledWith(
|
|
||||||
'Error retrieving key from state.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('uploads cache', async () => {
|
|
||||||
createFile(join(workspace, 'build.sbt'));
|
|
||||||
createStateForSuccessfulRestore();
|
|
||||||
|
|
||||||
await save('sbt');
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
expect(spyInfo).toHaveBeenCalledWith(
|
|
||||||
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:.*/)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function resetState() {
|
|
||||||
jest.spyOn(core, 'getState').mockReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create states to emulate a restore process without build file.
|
|
||||||
*/
|
|
||||||
function createStateForMissingBuildFile() {
|
|
||||||
jest.spyOn(core, 'getState').mockImplementation(name => {
|
|
||||||
switch (name) {
|
|
||||||
case 'cache-primary-key':
|
|
||||||
return 'setup-java-cache-';
|
|
||||||
default:
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create states to emulate a successful restore process.
|
|
||||||
*/
|
|
||||||
function createStateForSuccessfulRestore() {
|
|
||||||
jest.spyOn(core, 'getState').mockImplementation(name => {
|
|
||||||
switch (name) {
|
|
||||||
case 'cache-primary-key':
|
|
||||||
return 'setup-java-cache-primary-key';
|
|
||||||
case 'cache-matched-key':
|
|
||||||
return 'setup-java-cache-matched-key';
|
|
||||||
default:
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function createFile(path: string) {
|
|
||||||
core.info(`created a file at ${path}`);
|
|
||||||
fs.writeFileSync(path, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
function createDirectory(path: string) {
|
|
||||||
core.info(`created a directory at ${path}`);
|
|
||||||
fs.mkdirSync(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
function projectRoot(workspace: string): string {
|
|
||||||
if (os.platform() === 'darwin') {
|
|
||||||
return `/private${workspace}`;
|
|
||||||
} else {
|
|
||||||
return workspace;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
|
|
@ -1,17 +0,0 @@
|
||||||
plugins {
|
|
||||||
id 'java'
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
dependencies {
|
|
||||||
implementation 'org.codehaus.groovy:groovy:1.8.6'
|
|
||||||
}
|
|
||||||
tasks.register('downloadDependencies') {
|
|
||||||
doLast {
|
|
||||||
def total = configurations.compileClasspath.inject (0) { sum, file ->
|
|
||||||
sum + file.length()
|
|
||||||
}
|
|
||||||
println total
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
target/
|
|
||||||
pom.xml.tag
|
|
||||||
pom.xml.releaseBackup
|
|
||||||
pom.xml.versionsBackup
|
|
||||||
pom.xml.next
|
|
||||||
release.properties
|
|
||||||
dependency-reduced-pom.xml
|
|
||||||
buildNumber.properties
|
|
||||||
.mvn/timing.properties
|
|
||||||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
|
||||||
.mvn/wrapper/maven-wrapper.jar
|
|
|
@ -1,16 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>io.github.actions</groupId>
|
|
||||||
<artifactId>setup-java-maven-example</artifactId>
|
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
|
||||||
<version>5.7.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1 +0,0 @@
|
||||||
target/
|
|
|
@ -1,3 +0,0 @@
|
||||||
ThisBuild / scalaVersion := "2.12.15"
|
|
||||||
|
|
||||||
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
|
|
|
@ -1 +0,0 @@
|
||||||
sbt.version=1.6.2
|
|
|
@ -1,75 +0,0 @@
|
||||||
import {run as cleanup} from '../src/cleanup-java';
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
import * as cache from '@actions/cache';
|
|
||||||
import * as util from '../src/util';
|
|
||||||
|
|
||||||
describe('cleanup', () => {
|
|
||||||
let spyWarning: jest.SpyInstance<void, Parameters<typeof core.warning>>;
|
|
||||||
let spyInfo: jest.SpyInstance<void, Parameters<typeof core.info>>;
|
|
||||||
let spyCacheSave: jest.SpyInstance<
|
|
||||||
ReturnType<typeof cache.saveCache>,
|
|
||||||
Parameters<typeof cache.saveCache>
|
|
||||||
>;
|
|
||||||
let spyJobStatusSuccess: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyWarning = jest.spyOn(core, 'warning');
|
|
||||||
spyWarning.mockImplementation(() => null);
|
|
||||||
spyInfo = jest.spyOn(core, 'info');
|
|
||||||
spyInfo.mockImplementation(() => null);
|
|
||||||
spyCacheSave = jest.spyOn(cache, 'saveCache');
|
|
||||||
spyJobStatusSuccess = jest.spyOn(util, 'isJobStatusSuccess');
|
|
||||||
spyJobStatusSuccess.mockReturnValue(true);
|
|
||||||
createStateForSuccessfulRestore();
|
|
||||||
});
|
|
||||||
afterEach(() => {
|
|
||||||
resetState();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not fail nor warn even when the save process throws a ReserveCacheError', async () => {
|
|
||||||
spyCacheSave.mockImplementation((paths: string[], key: string) =>
|
|
||||||
Promise.reject(
|
|
||||||
new cache.ReserveCacheError(
|
|
||||||
'Unable to reserve cache with key, another job may be creating this cache.'
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
|
|
||||||
return name === 'cache' ? 'gradle' : '';
|
|
||||||
});
|
|
||||||
await cleanup();
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
expect(spyWarning).not.toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('does not fail even though the save process throws error', async () => {
|
|
||||||
spyCacheSave.mockImplementation((paths: string[], key: string) =>
|
|
||||||
Promise.reject(new Error('Unexpected error'))
|
|
||||||
);
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation((name: string) => {
|
|
||||||
return name === 'cache' ? 'gradle' : '';
|
|
||||||
});
|
|
||||||
await cleanup();
|
|
||||||
expect(spyCacheSave).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function resetState() {
|
|
||||||
jest.spyOn(core, 'getState').mockReset();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create states to emulate a successful restore process.
|
|
||||||
*/
|
|
||||||
function createStateForSuccessfulRestore() {
|
|
||||||
jest.spyOn(core, 'getState').mockImplementation(name => {
|
|
||||||
switch (name) {
|
|
||||||
case 'cache-primary-key':
|
|
||||||
return 'setup-java-cache-primary-key';
|
|
||||||
case 'cache-matched-key':
|
|
||||||
return 'setup-java-cache-matched-key';
|
|
||||||
default:
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,434 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"buildVersion": 36,
|
|
||||||
"updateVersion": 0,
|
|
||||||
"patchVersion": 0,
|
|
||||||
"downloadUrl": "https://github.com/bell-sw/Liberica/releases/download/14+36/bellsoft-jdk14+36-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-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-macos-amd64.zip",
|
|
||||||
"interimVersion": 0,
|
|
||||||
"version": "8u232+9",
|
|
||||||
"featureVersion": 8
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,255 +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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"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
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,11 @@
|
||||||
import {HttpClient} from '@actions/http-client';
|
import { HttpClient } from '@actions/http-client';
|
||||||
import {IAdoptAvailableVersions} from '../../src/distributions/adopt/models';
|
|
||||||
import {
|
|
||||||
AdoptDistribution,
|
|
||||||
AdoptImplementation
|
|
||||||
} from '../../src/distributions/adopt/installer';
|
|
||||||
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|
||||||
|
|
||||||
import os from 'os';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import manifestData from '../data/adopt.json';
|
import { AdoptDistribution } from '../../src/distributions/adopt/installer';
|
||||||
|
import { JavaInstallerOptions } from '../../src/distributions/base-models';
|
||||||
|
|
||||||
|
let manifestData = require('../data/adopt.json') as [];
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
describe('getAvailableVersions', () => {
|
||||||
let spyHttpClient: jest.SpyInstance;
|
let spyHttpClient: jest.SpyInstance;
|
||||||
|
@ -30,96 +27,27 @@ describe('getAvailableVersions', () => {
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
{
|
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11',
|
'os=mac&architecture=x64&image_type=jdk&release_type=ga&page_size=20&page=0'
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.Hotspot,
|
|
||||||
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11',
|
'os=mac&architecture=x86&image_type=jdk&release_type=ga&page_size=20&page=0'
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.Hotspot,
|
|
||||||
'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11', architecture: 'x64', packageType: 'jre', checkLatest: false },
|
||||||
version: '11',
|
'os=mac&architecture=x64&image_type=jre&release_type=ga&page_size=20&page=0'
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jre',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.Hotspot,
|
|
||||||
'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=hotspot&page_size=20&page=0'
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11-ea', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11-ea',
|
'os=mac&architecture=x64&image_type=jdk&release_type=ea&page_size=20&page=0'
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.Hotspot,
|
|
||||||
'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=hotspot&page_size=20&page=0'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
version: '11',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.OpenJ9,
|
|
||||||
'os=mac&architecture=x64&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
version: '11',
|
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.OpenJ9,
|
|
||||||
'os=mac&architecture=x86&image_type=jdk&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
version: '11',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jre',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.OpenJ9,
|
|
||||||
'os=mac&architecture=x64&image_type=jre&release_type=ga&jvm_impl=openj9&page_size=20&page=0'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
version: '11-ea',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
AdoptImplementation.OpenJ9,
|
|
||||||
'os=mac&architecture=x64&image_type=jdk&release_type=ea&jvm_impl=openj9&page_size=20&page=0'
|
|
||||||
]
|
]
|
||||||
])(
|
])(
|
||||||
'build correct url for %s',
|
'build correct url for %s',
|
||||||
async (
|
async (installerOptions: JavaInstallerOptions, expectedParameters) => {
|
||||||
installerOptions: JavaInstallerOptions,
|
const distribution = new AdoptDistribution(installerOptions);
|
||||||
impl: AdoptImplementation,
|
const baseUrl = 'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
|
||||||
expectedParameters
|
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&jvm_impl=hotspot&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
|
||||||
) => {
|
|
||||||
const distribution = new AdoptDistribution(installerOptions, impl);
|
|
||||||
const baseUrl =
|
|
||||||
'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
|
|
||||||
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
|
|
||||||
distribution['getPlatformOption'] = () => 'mac';
|
distribution['getPlatformOption'] = () => 'mac';
|
||||||
|
|
||||||
await distribution['getAvailableVersions']();
|
await distribution['getAvailableVersions']();
|
||||||
|
@ -135,12 +63,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,
|
||||||
|
@ -148,75 +76,16 @@ describe('getAvailableVersions', () => {
|
||||||
result: []
|
result: []
|
||||||
});
|
});
|
||||||
|
|
||||||
const distribution = new AdoptDistribution(
|
const distribution = new AdoptDistribution({
|
||||||
{
|
|
||||||
version: '11',
|
version: '11',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
checkLatest: false
|
checkLatest: false
|
||||||
},
|
});
|
||||||
AdoptImplementation.Hotspot
|
|
||||||
);
|
|
||||||
const availableVersions = await distribution['getAvailableVersions']();
|
const availableVersions = await distribution['getAvailableVersions']();
|
||||||
expect(availableVersions).not.toBeNull();
|
expect(availableVersions).not.toBeNull();
|
||||||
expect(availableVersions.length).toBe(manifestData.length * 2);
|
expect(availableVersions.length).toBe(manifestData.length * 2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
|
||||||
[AdoptImplementation.Hotspot, 'jdk', 'Java_Adopt_jdk'],
|
|
||||||
[AdoptImplementation.Hotspot, 'jre', 'Java_Adopt_jre'],
|
|
||||||
[AdoptImplementation.OpenJ9, 'jdk', 'Java_Adopt-OpenJ9_jdk'],
|
|
||||||
[AdoptImplementation.OpenJ9, 'jre', 'Java_Adopt-OpenJ9_jre']
|
|
||||||
])(
|
|
||||||
'find right toolchain folder',
|
|
||||||
(impl: AdoptImplementation, packageType: string, expected: string) => {
|
|
||||||
const distribution = new AdoptDistribution(
|
|
||||||
{
|
|
||||||
version: '11',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: packageType,
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
impl
|
|
||||||
);
|
|
||||||
|
|
||||||
// @ts-ignore - because it is protected
|
|
||||||
expect(distribution.toolcacheFolderName).toBe(expected);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each([
|
|
||||||
['amd64', 'x64'],
|
|
||||||
['arm64', 'aarch64']
|
|
||||||
])(
|
|
||||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
|
||||||
async (osArch: string, distroArch: string) => {
|
|
||||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
|
||||||
|
|
||||||
const installerOptions: JavaInstallerOptions = {
|
|
||||||
version: '17',
|
|
||||||
architecture: '', // to get default value
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const expectedParameters = `os=mac&architecture=${distroArch}&image_type=jdk&release_type=ga&jvm_impl=hotspot&page_size=20&page=0`;
|
|
||||||
|
|
||||||
const distribution = new AdoptDistribution(
|
|
||||||
installerOptions,
|
|
||||||
AdoptImplementation.Hotspot
|
|
||||||
);
|
|
||||||
const baseUrl =
|
|
||||||
'https://api.adoptopenjdk.net/v3/assets/version/%5B1.0,100.0%5D';
|
|
||||||
const expectedUrl = `${baseUrl}?project=jdk&vendor=adoptopenjdk&heap_size=normal&sort_method=DEFAULT&sort_order=DESC&${expectedParameters}`;
|
|
||||||
distribution['getPlatformOption'] = () => 'mac';
|
|
||||||
|
|
||||||
await distribution['getAvailableVersions']();
|
|
||||||
|
|
||||||
expect(spyHttpClient.mock.calls).toHaveLength(1);
|
|
||||||
expect(spyHttpClient.mock.calls[0][0]).toBe(expectedUrl);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('findPackageForDownload', () => {
|
describe('findPackageForDownload', () => {
|
||||||
|
@ -233,64 +102,52 @@ describe('findPackageForDownload', () => {
|
||||||
['15.0.1+9', '15.0.1+9'],
|
['15.0.1+9', '15.0.1+9'],
|
||||||
['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',
|
version: '11',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
checkLatest: false
|
checkLatest: false
|
||||||
},
|
});
|
||||||
AdoptImplementation.Hotspot
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
);
|
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
|
||||||
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',
|
version: '11',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
checkLatest: false
|
checkLatest: false
|
||||||
},
|
});
|
||||||
AdoptImplementation.Hotspot
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
|
await expect(distribution['findPackageForDownload']('9.0.8')).rejects.toThrowError(
|
||||||
|
/Could not find satisfied version for SemVer */
|
||||||
);
|
);
|
||||||
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 () => {
|
it('version is not found', async () => {
|
||||||
const distribution = new AdoptDistribution(
|
const distribution = new AdoptDistribution({
|
||||||
{
|
|
||||||
version: '11',
|
version: '11',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
checkLatest: false
|
checkLatest: false
|
||||||
},
|
});
|
||||||
AdoptImplementation.Hotspot
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
);
|
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrowError(
|
||||||
distribution['getAvailableVersions'] = async () => manifestData as any;
|
|
||||||
await expect(distribution['findPackageForDownload']('7.x')).rejects.toThrow(
|
|
||||||
/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',
|
version: '11',
|
||||||
architecture: 'x64',
|
architecture: 'x64',
|
||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
checkLatest: false
|
checkLatest: false
|
||||||
},
|
});
|
||||||
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 */
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,37 +5,26 @@ import * as util from '../../src/util';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import {JavaBase} from '../../src/distributions/base-installer';
|
import { JavaBase } from '../../src/distributions/base-installer';
|
||||||
import {
|
import {
|
||||||
JavaDownloadRelease,
|
JavaDownloadRelease,
|
||||||
JavaInstallerOptions,
|
JavaInstallerOptions,
|
||||||
JavaInstallerResults
|
JavaInstallerResults
|
||||||
} from '../../src/distributions/base-models';
|
} from '../../src/distributions/base-models';
|
||||||
|
|
||||||
import os from 'os';
|
|
||||||
|
|
||||||
class EmptyJavaBase extends JavaBase {
|
class EmptyJavaBase extends JavaBase {
|
||||||
constructor(installerOptions: JavaInstallerOptions) {
|
constructor(installerOptions: JavaInstallerOptions) {
|
||||||
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 +58,44 @@ describe('findInToolcache', () => {
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
{
|
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11',
|
{ version: actualJavaVersion, path: javaPath }
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11.0',
|
{ version: actualJavaVersion, path: javaPath }
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11.0.8',
|
{ version: actualJavaVersion, path: javaPath }
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11', architecture: 'x64', packageType: 'jdk', checkLatest: true },
|
||||||
version: '11',
|
{ version: actualJavaVersion, path: javaPath }
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0', architecture: 'x64', packageType: 'jdk', checkLatest: true },
|
||||||
version: '11.0',
|
{ version: actualJavaVersion, path: javaPath }
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0.8', architecture: 'x64', packageType: 'jdk', checkLatest: true },
|
||||||
version: '11.0.8',
|
{ version: actualJavaVersion, path: javaPath }
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{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);
|
||||||
|
@ -181,22 +103,17 @@ describe('findInToolcache', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['11', {version: '11.0.3+2', versionInPath: '11.0.3-2'}],
|
['11', { version: '11.0.3+2', versionInPath: '11.0.3-2' }],
|
||||||
['11.0', {version: '11.0.3+2', versionInPath: '11.0.3-2'}],
|
['11.0', { version: '11.0.3+2', versionInPath: '11.0.3-2' }],
|
||||||
['11.0.1', {version: '11.0.1', versionInPath: '11.0.1'}],
|
['11.0.1', { version: '11.0.1', versionInPath: '11.0.1' }],
|
||||||
['11.0.3', {version: '11.0.3+2', versionInPath: '11.0.3-2'}],
|
['11.0.3', { version: '11.0.3+2', versionInPath: '11.0.3-2' }],
|
||||||
['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',
|
['11.2-ea', { version: '11.2.1', versionInPath: '11.2.1-ea' }],
|
||||||
{version: '11.3.3+5.2.1231421', versionInPath: '11.3.3-ea.5.2.1231421'}
|
['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) => {
|
||||||
['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'}]
|
|
||||||
])(
|
|
||||||
'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 +141,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 +166,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
|
|
||||||
: '';
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -286,8 +192,6 @@ describe('setupJava', () => {
|
||||||
|
|
||||||
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
spyCoreSetOutput = jest.spyOn(core, 'setOutput');
|
||||||
spyCoreSetOutput.mockImplementation(() => undefined);
|
spyCoreSetOutput.mockImplementation(() => undefined);
|
||||||
|
|
||||||
jest.spyOn(os, 'arch').mockReturnValue('x86');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
|
@ -298,46 +202,23 @@ describe('setupJava', () => {
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
{
|
{ version: '11', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11',
|
{ version: installedJavaVersion, path: javaPath }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
{version: installedJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11.0',
|
{ version: installedJavaVersion, path: javaPath }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
{version: installedJavaVersion, path: javaPath}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0.8', architecture: 'x86', packageType: 'jdk', checkLatest: false },
|
||||||
version: '11.0.8',
|
{ version: installedJavaVersion, path: javaPath }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
{version: installedJavaVersion, path: javaPath}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{version: '11', architecture: '', packageType: 'jdk', checkLatest: false},
|
|
||||||
{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 +227,16 @@ 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},
|
|
||||||
{
|
|
||||||
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);
|
||||||
|
@ -394,177 +244,82 @@ describe('setupJava', () => {
|
||||||
expect(spyGetToolcachePath).toHaveBeenCalled();
|
expect(spyGetToolcachePath).toHaveBeenCalled();
|
||||||
expect(spyCoreAddPath).toHaveBeenCalled();
|
expect(spyCoreAddPath).toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).toHaveBeenCalled();
|
expect(spyCoreExportVariable).toHaveBeenCalled();
|
||||||
expect(spyCoreExportVariable).toHaveBeenCalledWith(
|
|
||||||
`JAVA_HOME_${input.version}_${(
|
|
||||||
input.architecture || 'x86'
|
|
||||||
).toLocaleUpperCase()}`,
|
|
||||||
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',
|
{ version: '11.0.9', path: javaPathInstalled }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{version: '11.0.9', path: javaPathInstalled}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
version: '11.0.9',
|
|
||||||
architecture: '',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{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',
|
{ version: actualJavaVersion, path: javaPathInstalled }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPathInstalled}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0', architecture: 'x86', packageType: 'jdk', checkLatest: true },
|
||||||
version: '11.0',
|
{ version: actualJavaVersion, path: javaPathInstalled }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPathInstalled}
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{
|
{ version: '11.0.x', architecture: 'x86', packageType: 'jdk', checkLatest: true },
|
||||||
version: '11.0.x',
|
{ version: actualJavaVersion, path: javaPathInstalled }
|
||||||
architecture: 'x86',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: true
|
|
||||||
},
|
|
||||||
{version: actualJavaVersion, path: javaPathInstalled}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{version: '11', architecture: '', packageType: 'jdk', checkLatest: true},
|
|
||||||
{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', () => {
|
||||||
const DummyJavaBase = JavaBase as any;
|
const DummyJavaBase = JavaBase as any;
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
['11', {version: '11', stable: true}],
|
['11', { version: '11', stable: true }],
|
||||||
['11.0', {version: '11.0', stable: true}],
|
['11.0', { version: '11.0', stable: true }],
|
||||||
['11.0.10', {version: '11.0.10', stable: true}],
|
['11.0.10', { version: '11.0.10', stable: true }],
|
||||||
['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`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -574,14 +329,14 @@ describe('getToolcacheVersionName', () => {
|
||||||
const DummyJavaBase = JavaBase as any;
|
const DummyJavaBase = JavaBase as any;
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[{version: '11', stable: true}, '11'],
|
[{ version: '11', stable: true }, '11'],
|
||||||
[{version: '11.0.2', stable: true}, '11.0.2'],
|
[{ version: '11.0.2', stable: true }, '11.0.2'],
|
||||||
[{version: '11.0.2+4', stable: true}, '11.0.2-4'],
|
[{ version: '11.0.2+4', stable: true }, '11.0.2-4'],
|
||||||
[{version: '11.0.2+4.1.2563234', stable: true}, '11.0.2-4.1.2563234'],
|
[{ version: '11.0.2+4.1.2563234', stable: true }, '11.0.2-4.1.2563234'],
|
||||||
[{version: '11.0', stable: false}, '11.0-ea'],
|
[{ version: '11.0', stable: false }, '11.0-ea'],
|
||||||
[{version: '11.0.3', stable: false}, '11.0.3-ea'],
|
[{ version: '11.0.3', stable: false }, '11.0.3-ea'],
|
||||||
[{version: '11.0.3+4', stable: false}, '11.0.3-ea.4'],
|
[{ version: '11.0.3+4', stable: false }, '11.0.3-ea.4'],
|
||||||
[{version: '11.0.3+4.2.256', stable: false}, '11.0.3-ea.4.2.256']
|
[{ version: '11.0.3+4.2.256', stable: false }, '11.0.3-ea.4.2.256']
|
||||||
])('returns correct version name for %s', (input, expected) => {
|
])('returns correct version name for %s', (input, expected) => {
|
||||||
const inputVersion = input.stable ? '11' : '11-ea';
|
const inputVersion = input.stable ? '11' : '11-ea';
|
||||||
const mockJavaBase = new EmptyJavaBase({
|
const mockJavaBase = new EmptyJavaBase({
|
||||||
|
|
|
@ -1,243 +0,0 @@
|
||||||
import {HttpClient} from '@actions/http-client';
|
|
||||||
import {JavaInstallerOptions} from '../../src/distributions/base-models';
|
|
||||||
|
|
||||||
import {CorrettoDistribution} from '../../src/distributions/corretto/installer';
|
|
||||||
import * as util from '../../src/util';
|
|
||||||
import os from 'os';
|
|
||||||
import {isGeneratorFunction} from 'util/types';
|
|
||||||
|
|
||||||
import manifestData from '../data/corretto.json';
|
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
|
||||||
let spyHttpClient: jest.SpyInstance;
|
|
||||||
let spyGetDownloadArchiveExtension: jest.SpyInstance;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
|
||||||
spyHttpClient.mockReturnValue({
|
|
||||||
statusCode: 200,
|
|
||||||
headers: {},
|
|
||||||
result: manifestData
|
|
||||||
});
|
|
||||||
spyGetDownloadArchiveExtension = jest.spyOn(
|
|
||||||
util,
|
|
||||||
'getDownloadArchiveExtension'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
jest.resetAllMocks();
|
|
||||||
jest.clearAllMocks();
|
|
||||||
jest.restoreAllMocks();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getAvailableVersions', () => {
|
|
||||||
it('load available versions', async () => {
|
|
||||||
const distribution = new CorrettoDistribution({
|
|
||||||
version: '11',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
mockPlatform(distribution, 'linux');
|
|
||||||
|
|
||||||
const availableVersions = await distribution['getAvailableVersions']();
|
|
||||||
expect(availableVersions).not.toBeNull();
|
|
||||||
expect(availableVersions.length).toBe(6);
|
|
||||||
});
|
|
||||||
|
|
||||||
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
|
|
||||||
},
|
|
||||||
'windows',
|
|
||||||
6
|
|
||||||
],
|
|
||||||
[
|
|
||||||
{
|
|
||||||
version: '18',
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jre',
|
|
||||||
checkLatest: false
|
|
||||||
},
|
|
||||||
'windows',
|
|
||||||
1
|
|
||||||
]
|
|
||||||
])(
|
|
||||||
'fetch expected amount of available versions for %s',
|
|
||||||
async (
|
|
||||||
installerOptions: JavaInstallerOptions,
|
|
||||||
platform: string,
|
|
||||||
expectedAmountOfAvailableVersions
|
|
||||||
) => {
|
|
||||||
const distribution = new CorrettoDistribution(installerOptions);
|
|
||||||
mockPlatform(distribution, platform);
|
|
||||||
|
|
||||||
const availableVersions = await distribution['getAvailableVersions']();
|
|
||||||
expect(availableVersions).not.toBeNull();
|
|
||||||
expect(availableVersions.length).toBe(
|
|
||||||
expectedAmountOfAvailableVersions
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('findPackageForDownload', () => {
|
|
||||||
it.each([
|
|
||||||
[
|
|
||||||
'macos',
|
|
||||||
'https://corretto.aws/downloads/resources/18.0.0.37.1/amazon-corretto-18.0.0.37.1-macosx-x64.tar.gz'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'windows',
|
|
||||||
'https://corretto.aws/downloads/resources/18.0.0.37.1/amazon-corretto-18.0.0.37.1-windows-x64-jdk.zip'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'linux',
|
|
||||||
'https://corretto.aws/downloads/resources/18.0.0.37.1/amazon-corretto-18.0.0.37.1-linux-x64.tar.gz'
|
|
||||||
]
|
|
||||||
])('for os: %s', async (platform: string, expectedLink: string) => {
|
|
||||||
const version = '18';
|
|
||||||
const distribution = new CorrettoDistribution({
|
|
||||||
version,
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
mockPlatform(distribution, platform);
|
|
||||||
|
|
||||||
const availableVersion = await distribution['findPackageForDownload'](
|
|
||||||
version
|
|
||||||
);
|
|
||||||
expect(availableVersion).not.toBeNull();
|
|
||||||
expect(availableVersion.url).toBe(expectedLink);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('with unstable version expect to throw not supported error', async () => {
|
|
||||||
const version = '18.0.1-ea';
|
|
||||||
const distribution = new CorrettoDistribution({
|
|
||||||
version,
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
mockPlatform(distribution, 'linux');
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
distribution['findPackageForDownload'](version)
|
|
||||||
).rejects.toThrow('Early access versions are not supported');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('with non major version expect to throw not supported error', async () => {
|
|
||||||
const version = '18.0.1';
|
|
||||||
const distribution = new CorrettoDistribution({
|
|
||||||
version,
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
mockPlatform(distribution, 'linux');
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
distribution['findPackageForDownload'](version)
|
|
||||||
).rejects.toThrow('Only major versions are supported');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('with unfound version throw could not find error', async () => {
|
|
||||||
const version = '4';
|
|
||||||
const distribution = new CorrettoDistribution({
|
|
||||||
version,
|
|
||||||
architecture: 'x64',
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
});
|
|
||||||
mockPlatform(distribution, 'linux');
|
|
||||||
|
|
||||||
await expect(
|
|
||||||
distribution['findPackageForDownload'](version)
|
|
||||||
).rejects.toThrow("Could not find satisfied version for SemVer '4'");
|
|
||||||
});
|
|
||||||
|
|
||||||
it.each([
|
|
||||||
['arm64', 'aarch64'],
|
|
||||||
['amd64', 'x64']
|
|
||||||
])(
|
|
||||||
'defaults to os.arch(): %s mapped to distro arch: %s',
|
|
||||||
async (osArch: string, distroArch: string) => {
|
|
||||||
jest.spyOn(os, 'arch').mockReturnValue(osArch);
|
|
||||||
|
|
||||||
const version = '17';
|
|
||||||
const installerOptions: JavaInstallerOptions = {
|
|
||||||
version,
|
|
||||||
architecture: '', // to get default value
|
|
||||||
packageType: 'jdk',
|
|
||||||
checkLatest: false
|
|
||||||
};
|
|
||||||
|
|
||||||
const distribution = new CorrettoDistribution(installerOptions);
|
|
||||||
mockPlatform(distribution, 'macos');
|
|
||||||
|
|
||||||
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
|
|
||||||
|
|
||||||
const availableVersion = await distribution['findPackageForDownload'](
|
|
||||||
version
|
|
||||||
);
|
|
||||||
expect(availableVersion).not.toBeNull();
|
|
||||||
expect(availableVersion.url).toBe(expectedLink);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
const mockPlatform = (
|
|
||||||
distribution: CorrettoDistribution,
|
|
||||||
platform: string
|
|
||||||
) => {
|
|
||||||
distribution['getPlatformOption'] = () => platform;
|
|
||||||
const mockedExtension = platform === 'windows' ? 'zip' : 'tar.gz';
|
|
||||||
spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension);
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -1,226 +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', 24],
|
|
||||||
['8.6.6', 'x64', 'linux', 27],
|
|
||||||
['8', 'x86', 'anolis', 0],
|
|
||||||
['8', 'x86', 'windows', 0],
|
|
||||||
['8', 'x86', 'mac', 0],
|
|
||||||
['11', 'x64', 'linux', 27],
|
|
||||||
['11', 'aarch64', 'linux', 24],
|
|
||||||
['17', 'riscv', 'linux', 0],
|
|
||||||
['16.0.1', 'x64', 'linux', 27]
|
|
||||||
])(
|
|
||||||
'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/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'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'11',
|
|
||||||
'linux',
|
|
||||||
'aarch64',
|
|
||||||
'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_aarch64_linux.tar.gz'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'11',
|
|
||||||
'windows',
|
|
||||||
'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_windows.zip'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'11',
|
|
||||||
'alpine-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_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'
|
|
||||||
]
|
|
||||||
])(
|
|
||||||
'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');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -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.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'] = () => 'macos';
|
|
||||||
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&${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'] = () => 'macos';
|
|
||||||
|
|
||||||
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`;
|
|
||||||
|
|
||||||
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']('17')).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);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -7,7 +7,7 @@ import path from 'path';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as util from '../../src/util';
|
import * as util from '../../src/util';
|
||||||
|
|
||||||
import {LocalDistribution} from '../../src/distributions/local/installer';
|
import { LocalDistribution } from '../../src/distributions/local/installer';
|
||||||
|
|
||||||
describe('setupJava', () => {
|
describe('setupJava', () => {
|
||||||
const actualJavaVersion = '11.1.10';
|
const actualJavaVersion = '11.1.10';
|
||||||
|
@ -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');
|
||||||
|
@ -83,7 +74,7 @@ describe('setupJava', () => {
|
||||||
|
|
||||||
spyFsStat = jest.spyOn(fs, 'statSync');
|
spyFsStat = jest.spyOn(fs, 'statSync');
|
||||||
spyFsStat.mockImplementation((file: string) => {
|
spyFsStat.mockImplementation((file: string) => {
|
||||||
return {isFile: () => file === expectedJdkFile};
|
return { isFile: () => file === expectedJdkFile };
|
||||||
});
|
});
|
||||||
|
|
||||||
// Spy on util methods
|
// Spy on util methods
|
||||||
|
@ -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();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue