Compare commits
43 Commits
releases/v
...
v3.4.0
Author | SHA1 | Date | |
---|---|---|---|
16cca5479d | |||
7b469c48c4 | |||
2506d21b74 | |||
187f735c38 | |||
48576e577e | |||
fa01820a3b | |||
62808131e1 | |||
ddbbc2fff5 | |||
4fba831118 | |||
11556068a2 | |||
ec303d3bdf | |||
1c449b9ad2 | |||
3e3d8c490f | |||
72dec17e4f | |||
e8f1c8b5ca | |||
05b9e395e1 | |||
860f600565 | |||
bae3140877 | |||
dd80852400 | |||
4fe61d24fe | |||
055250a105 | |||
0ed94a5678 | |||
9519cf1382 | |||
02c73de3fe | |||
fd3f6750a0 | |||
1aa8bf7608 | |||
9c8c90e08c | |||
cd35109007 | |||
d2e3f417a9 | |||
0aa6f2a84f | |||
dc1a9f2791 | |||
e886040dc2 | |||
efbea1411b | |||
c41070eda4 | |||
f69f00b5e5 | |||
2e1dfa1fb4 | |||
a12e082d83 | |||
04d53533c2 | |||
d8da887cad | |||
6df0b04fb5 | |||
a1ad2000b3 | |||
faa22ddfbc | |||
a388b3faf4 |
9
.github/workflows/build.yml
vendored
Executable file → Normal file
9
.github/workflows/build.yml
vendored
Executable file → Normal file
@ -19,11 +19,12 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Node.JS 12
|
- name: Setup Node.JS 16
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 16.x
|
||||||
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- run: npm run format-check
|
- run: npm run format-check
|
||||||
|
11
.github/workflows/check-dist.yml
vendored
11
.github/workflows/check-dist.yml
vendored
@ -21,12 +21,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 12.x
|
- name: Set Node.js 16.x
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: 16.x
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -44,7 +45,7 @@ jobs:
|
|||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v3
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
104
.github/workflows/e2e-cache.yml
vendored
104
.github/workflows/e2e-cache.yml
vendored
@ -23,7 +23,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Run setup-java with the cache for gradle
|
- name: Run setup-java with the cache for gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -49,7 +49,7 @@ jobs:
|
|||||||
needs: gradle-save
|
needs: gradle-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Run setup-java with the cache for gradle
|
- name: Run setup-java with the cache for gradle
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -72,7 +72,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Run setup-java with the cache for maven
|
- name: Run setup-java with the cache for maven
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -96,7 +96,7 @@ jobs:
|
|||||||
needs: maven-save
|
needs: maven-save
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Run setup-java with the cache for maven
|
- name: Run setup-java with the cache for maven
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -111,3 +111,99 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
ls ~/.m2/repository
|
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
|
||||||
|
6
.github/workflows/e2e-local-file.yml
vendored
6
.github/workflows/e2e-local-file.yml
vendored
@ -20,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Download Adopt OpenJDK file
|
- name: Download Adopt OpenJDK file
|
||||||
run: |
|
run: |
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
@ -57,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Download Zulu OpenJDK file
|
- name: Download Zulu OpenJDK file
|
||||||
run: |
|
run: |
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
@ -94,7 +94,7 @@ jobs:
|
|||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Download Eclipse Temurin file
|
- name: Download Eclipse Temurin file
|
||||||
run: |
|
run: |
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
|
8
.github/workflows/e2e-publishing.yml
vendored
8
.github/workflows/e2e-publishing.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
|||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -59,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Create fake settings.xml
|
- name: Create fake settings.xml
|
||||||
run: |
|
run: |
|
||||||
$xmlDirectory = Join-Path $HOME ".m2"
|
$xmlDirectory = Join-Path $HOME ".m2"
|
||||||
@ -95,7 +95,7 @@ jobs:
|
|||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Create fake settings.xml
|
- name: Create fake settings.xml
|
||||||
run: |
|
run: |
|
||||||
$xmlDirectory = Join-Path $HOME ".m2"
|
$xmlDirectory = Join-Path $HOME ".m2"
|
||||||
@ -132,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
28
.github/workflows/e2e-versions.yml
vendored
28
.github/workflows/e2e-versions.yml
vendored
@ -20,14 +20,14 @@ 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', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft' ] # internally 'adopt-hotspot' is the same as 'adopt'
|
distribution: ['temurin', 'adopt', 'adopt-openj9', 'zulu', 'liberica', 'microsoft', 'corretto' ] # internally 'adopt-hotspot' is the same as 'adopt'
|
||||||
version: ['8', '11', '16']
|
version: ['8', '11', '16']
|
||||||
exclude:
|
exclude:
|
||||||
- distribution: microsoft
|
- distribution: microsoft
|
||||||
version: 8
|
version: 8
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -53,7 +53,7 @@ jobs:
|
|||||||
- '16.0.2+7'
|
- '16.0.2+7'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -75,7 +75,7 @@ jobs:
|
|||||||
distribution: ['temurin', 'zulu', 'liberica']
|
distribution: ['temurin', 'zulu', 'liberica']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -98,7 +98,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -120,7 +120,7 @@ jobs:
|
|||||||
version: ['17-ea']
|
version: ['17-ea']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -141,7 +141,7 @@ jobs:
|
|||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
distribution: ['temurin', 'zulu', 'liberica']
|
distribution: ['temurin', 'zulu', 'liberica']
|
||||||
java-package: ['jre']
|
java-package: ['jre']
|
||||||
version: ['16.0']
|
version: ['17.0']
|
||||||
include:
|
include:
|
||||||
- distribution: 'zulu'
|
- distribution: 'zulu'
|
||||||
java-package: jre+fx
|
java-package: jre+fx
|
||||||
@ -159,13 +159,13 @@ jobs:
|
|||||||
java-package: jre+fx
|
java-package: jre+fx
|
||||||
version: '11'
|
version: '11'
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
exclude:
|
- distribution: 'corretto'
|
||||||
# Eclipse Temurin currently doesn't publish JREs, only JDKs
|
java-package: jre
|
||||||
- distribution: 'temurin'
|
version: '8'
|
||||||
java-package: 'jre'
|
os: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
@ -187,11 +187,11 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# x86 is not supported on macOS
|
# x86 is not supported on macOS
|
||||||
os: [windows-latest, ubuntu-latest]
|
os: [windows-latest, ubuntu-latest]
|
||||||
distribution: ['liberica', 'zulu']
|
distribution: ['liberica', 'zulu', 'corretto']
|
||||||
version: ['11']
|
version: ['11']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: setup-java
|
- name: setup-java
|
||||||
uses: ./
|
uses: ./
|
||||||
id: setup-java
|
id: setup-java
|
||||||
|
4
.github/workflows/licensed.yml
vendored
4
.github/workflows/licensed.yml
vendored
@ -14,12 +14,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Check licenses
|
name: Check licenses
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Install licensed
|
- name: Install licensed
|
||||||
run: |
|
run: |
|
||||||
cd $RUNNER_TEMP
|
cd $RUNNER_TEMP
|
||||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
|
||||||
sudo tar -xzf licensed.tar.gz
|
sudo tar -xzf licensed.tar.gz
|
||||||
sudo mv licensed /usr/local/bin/licensed
|
sudo mv licensed /usr/local/bin/licensed
|
||||||
- run: licensed status
|
- run: licensed status
|
||||||
|
BIN
.licenses/npm/@actions/cache.dep.yml
generated
BIN
.licenses/npm/@actions/cache.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-asynciterator-polyfill.dep.yml
generated
BIN
.licenses/npm/@azure/core-asynciterator-polyfill.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-http.dep.yml
generated
BIN
.licenses/npm/@azure/core-http.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-lro.dep.yml
generated
BIN
.licenses/npm/@azure/core-lro.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/core-paging.dep.yml
generated
BIN
.licenses/npm/@azure/core-paging.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/ms-rest-js.dep.yml
generated
BIN
.licenses/npm/@azure/ms-rest-js.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@azure/storage-blob.dep.yml
generated
BIN
.licenses/npm/@azure/storage-blob.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@opentelemetry/api.dep.yml
generated
BIN
.licenses/npm/@opentelemetry/api.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@types/node-fetch.dep.yml
generated
BIN
.licenses/npm/@types/node-fetch.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/node-fetch.dep.yml
generated
BIN
.licenses/npm/node-fetch.dep.yml
generated
Binary file not shown.
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
# 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
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
### NCC
|
### 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/`.
|
In order to avoid uploading `node_modules` to the repository, we use [vercel/ncc](https://github.com/vercel/ncc) to create multiple `index.js` files that gets saved under `dist/`.
|
||||||
There are two main files that get created
|
There are two main files that get created
|
||||||
- `dist/setup/index.js`
|
- `dist/setup/index.js`
|
||||||
- Core `setup-java` logic that downloads and installs an appropriate version of Java
|
- Core `setup-java` logic that downloads and installs an appropriate version of Java
|
||||||
|
51
README.md
51
README.md
@ -25,8 +25,8 @@ Inputs `java-version` and `distribution` are mandatory. See [Supported distribut
|
|||||||
**Eclipse Temurin**
|
**Eclipse Temurin**
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin' # See 'Supported distributions' for available options
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
||||||
java-version: '17'
|
java-version: '17'
|
||||||
@ -36,8 +36,8 @@ steps:
|
|||||||
**Zulu OpenJDK**
|
**Zulu OpenJDK**
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu' # See 'Supported distributions' for available options
|
distribution: 'zulu' # See 'Supported distributions' for available options
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -60,19 +60,29 @@ Currently, the following distributions are supported:
|
|||||||
| `adopt-openj9` | Adopt OpenJDK OpenJ9 | [Link](https://adoptopenjdk.net/) | [Link](https://adoptopenjdk.net/about.html) |
|
| `adopt-openj9` | Adopt OpenJDK 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/) |
|
| `liberica` | Liberica JDK | [Link](https://bell-sw.com/) | [Link](https://bell-sw.com/liberica_eula/) |
|
||||||
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
|
| `microsoft` | Microsoft Build of OpenJDK | [Link](https://www.microsoft.com/openjdk) | [Link](https://docs.microsoft.com/java/openjdk/faq)
|
||||||
|
| `corretto` | Amazon Corretto Build of OpenJDK | [Link](https://aws.amazon.com/corretto/) | [Link](https://aws.amazon.com/corretto/faqs/)
|
||||||
|
|
||||||
**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:** Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` to `temurin` to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
|
**NOTE:** Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from `adopt` to `temurin` to keep receiving software and security updates. See more details in the [Good-bye AdoptOpenJDK post](https://blog.adoptopenjdk.net/2021/08/goodbye-adoptopenjdk-hello-adoptium/).
|
||||||
|
|
||||||
|
**NOTE:** For Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness.
|
||||||
|
|
||||||
### Caching packages dependencies
|
### Caching packages dependencies
|
||||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle and maven. The cache input is optional, and caching is turned off by default.
|
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle, maven and sbt. The format of the used cache key is `setup-java-${{ platform }}-${{ packageManager }}-${{ fileHash }}`, where the hash is based on the following files:
|
||||||
|
- gradle: `**/*.gradle*`, `**/gradle-wrapper.properties`
|
||||||
|
- maven: `**/pom.xml`
|
||||||
|
- sbt: all sbt build definition files `**/*.sbt`, `**/project/build.properties`, `**/project/**.{scala,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
|
#### Caching gradle dependencies
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -83,8 +93,8 @@ steps:
|
|||||||
#### Caching maven dependencies
|
#### Caching maven dependencies
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -93,6 +103,19 @@ steps:
|
|||||||
run: mvn -B package --file pom.xml
|
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: '11'
|
||||||
|
cache: 'sbt'
|
||||||
|
- name: Build with SBT
|
||||||
|
run: sbt package
|
||||||
|
```
|
||||||
|
|
||||||
### 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.
|
||||||
|
|
||||||
@ -103,8 +126,8 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -122,9 +145,9 @@ jobs:
|
|||||||
java: [ '8', '11', '13', '15' ]
|
java: [ '8', '11', '13', '15' ]
|
||||||
name: Java ${{ matrix.Java }} sample
|
name: Java ${{ matrix.Java }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
@ -137,6 +160,8 @@ jobs:
|
|||||||
- [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)
|
- [Liberica](docs/advanced-usage.md#Liberica)
|
||||||
|
- [Microsoft](docs/advanced-usage.md#Microsoft)
|
||||||
|
- [Amazon Corretto](docs/advanced-usage.md#Amazon-Corretto)
|
||||||
- [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)
|
||||||
|
@ -118,6 +118,23 @@ describe('dependency cache', () => {
|
|||||||
expect(spyInfo).toBeCalledWith('gradle cache is not found');
|
expect(spyInfo).toBeCalledWith('gradle cache is not found');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('for sbt', () => {
|
||||||
|
it('throws error if no build.sbt found', async () => {
|
||||||
|
await expect(restore('sbt')).rejects.toThrowError(
|
||||||
|
`No file in ${projectRoot(
|
||||||
|
workspace
|
||||||
|
)} matched to [**/*.sbt,**/project/build.properties,**/project/**.{scala,sbt}], make sure you have checked out the target repository`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('downloads cache', async () => {
|
||||||
|
createFile(join(workspace, 'build.sbt'));
|
||||||
|
|
||||||
|
await restore('sbt');
|
||||||
|
expect(spyCacheRestore).toBeCalled();
|
||||||
|
expect(spyWarning).not.toBeCalled();
|
||||||
|
expect(spyInfo).toBeCalledWith('sbt cache is not found');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
describe('save', () => {
|
describe('save', () => {
|
||||||
let spyCacheSave: jest.SpyInstance<
|
let spyCacheSave: jest.SpyInstance<
|
||||||
@ -194,6 +211,30 @@ describe('dependency cache', () => {
|
|||||||
expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
|
expect(spyInfo).toBeCalledWith(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).toBeCalled();
|
||||||
|
expect(spyWarning).not.toBeCalled();
|
||||||
|
});
|
||||||
|
it('does not upload cache if no restore run before', async () => {
|
||||||
|
createFile(join(workspace, 'build.sbt'));
|
||||||
|
|
||||||
|
await save('sbt');
|
||||||
|
expect(spyCacheSave).not.toBeCalled();
|
||||||
|
expect(spyWarning).toBeCalledWith('Error retrieving key from state.');
|
||||||
|
});
|
||||||
|
it('uploads cache', async () => {
|
||||||
|
createFile(join(workspace, 'build.sbt'));
|
||||||
|
createStateForSuccessfulRestore();
|
||||||
|
|
||||||
|
await save('sbt');
|
||||||
|
expect(spyCacheSave).toBeCalled();
|
||||||
|
expect(spyWarning).not.toBeCalled();
|
||||||
|
expect(spyInfo).toBeCalledWith(expect.stringMatching(/^Cache saved with the key:.*/));
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
1
__tests__/cache/sbt/.gitignore
vendored
Normal file
1
__tests__/cache/sbt/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
target/
|
3
__tests__/cache/sbt/build.sbt
vendored
Normal file
3
__tests__/cache/sbt/build.sbt
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ThisBuild / scalaVersion := "2.12.15"
|
||||||
|
|
||||||
|
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
|
1
__tests__/cache/sbt/project/build.properties
vendored
Normal file
1
__tests__/cache/sbt/project/build.properties
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
sbt.version=1.6.2
|
1183
__tests__/data/corretto.json
Normal file
1183
__tests__/data/corretto.json
Normal file
File diff suppressed because it is too large
Load Diff
152
__tests__/distributors/corretto-installer.test.ts
Normal file
152
__tests__/distributors/corretto-installer.test.ts
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
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';
|
||||||
|
|
||||||
|
const manifestData = require('../data/corretto.json') as [];
|
||||||
|
|
||||||
|
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.toThrowError(
|
||||||
|
'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.toThrowError(
|
||||||
|
'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.toThrowError(
|
||||||
|
"Could not find satisfied version for SemVer '4'"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const mockPlatform = (distributon: CorrettoDistribution, platform: string) => {
|
||||||
|
distributon['getPlatformOption'] = () => platform;
|
||||||
|
const mockedExtension = platform === 'windows' ? 'zip' : 'tar.gz';
|
||||||
|
spyGetDownloadArchiveExtension.mockReturnValue(mockedExtension);
|
||||||
|
};
|
||||||
|
});
|
@ -14,10 +14,15 @@ describe('findPackageForDownload', () => {
|
|||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
[
|
[
|
||||||
'17.x',
|
'17.0.1',
|
||||||
'17.0.1',
|
'17.0.1',
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
'https://aka.ms/download-jdk/microsoft-jdk-17.0.1.12.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'17.x',
|
||||||
|
'17.0.3',
|
||||||
|
'https://aka.ms/download-jdk/microsoft-jdk-17.0.3-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'16.0.x',
|
'16.0.x',
|
||||||
'16.0.2',
|
'16.0.2',
|
||||||
@ -27,6 +32,11 @@ describe('findPackageForDownload', () => {
|
|||||||
'11.0.13',
|
'11.0.13',
|
||||||
'11.0.13',
|
'11.0.13',
|
||||||
'https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
'https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'11.0.15',
|
||||||
|
'11.0.15',
|
||||||
|
'https://aka.ms/download-jdk/microsoft-jdk-11.0.15-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
|
||||||
]
|
]
|
||||||
])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => {
|
])('version is %s -> %s', async (input, expectedVersion, expectedUrl) => {
|
||||||
const result = await distribution['findPackageForDownload'](input);
|
const result = await distribution['findPackageForDownload'](input);
|
||||||
|
@ -52,6 +52,14 @@ describe('getAvailableVersions', () => {
|
|||||||
[
|
[
|
||||||
{ version: '8', architecture: 'x64', packageType: 'jre+fx', checkLatest: false },
|
{ version: '8', architecture: 'x64', packageType: 'jre+fx', checkLatest: false },
|
||||||
'?os=macos&ext=tar.gz&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
|
'?os=macos&ext=tar.gz&bundle_type=jre&javafx=true&arch=x86&hw_bitness=64&release_status=ga&features=fx'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{ version: '11', architecture: 'arm64', packageType: 'jdk', checkLatest: false },
|
||||||
|
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=64&release_status=ga'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{ version: '11', architecture: 'arm', packageType: 'jdk', checkLatest: false },
|
||||||
|
'?os=macos&ext=tar.gz&bundle_type=jdk&javafx=false&arch=arm&hw_bitness=&release_status=ga'
|
||||||
]
|
]
|
||||||
])('build correct url for %s -> %s', async (input, parsedUrl) => {
|
])('build correct url for %s -> %s', async (input, parsedUrl) => {
|
||||||
const distribution = new ZuluDistribution(input);
|
const distribution = new ZuluDistribution(input);
|
||||||
@ -139,6 +147,7 @@ describe('findPackageForDownload', () => {
|
|||||||
packageType: 'jdk',
|
packageType: 'jdk',
|
||||||
checkLatest: false
|
checkLatest: false
|
||||||
});
|
});
|
||||||
|
distribution['getAvailableVersions'] = async () => manifestData;
|
||||||
await expect(
|
await expect(
|
||||||
distribution['findPackageForDownload'](distribution['version'])
|
distribution['findPackageForDownload'](distribution['version'])
|
||||||
).rejects.toThrowError(/Could not find satisfied version for semver */);
|
).rejects.toThrowError(/Could not find satisfied version for semver */);
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
import { isVersionSatisfies } from '../src/util';
|
import * as cache from '@actions/cache';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import { isVersionSatisfies, isCacheFeatureAvailable } from '../src/util';
|
||||||
|
|
||||||
|
jest.mock('@actions/cache');
|
||||||
|
jest.mock('@actions/core');
|
||||||
|
|
||||||
describe('isVersionSatisfies', () => {
|
describe('isVersionSatisfies', () => {
|
||||||
it.each([
|
it.each([
|
||||||
@ -20,3 +25,38 @@ describe('isVersionSatisfies', () => {
|
|||||||
expect(actual).toBe(expected);
|
expect(actual).toBe(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isCacheFeatureAvailable', () => {
|
||||||
|
it('isCacheFeatureAvailable disabled on GHES', () => {
|
||||||
|
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
||||||
|
try {
|
||||||
|
process.env['GITHUB_SERVER_URL'] = 'http://example.com';
|
||||||
|
isCacheFeatureAvailable();
|
||||||
|
} catch (error) {
|
||||||
|
expect(error).toHaveProperty(
|
||||||
|
'message',
|
||||||
|
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('isCacheFeatureAvailable disabled on dotcom', () => {
|
||||||
|
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => false);
|
||||||
|
const infoMock = jest.spyOn(core, 'warning');
|
||||||
|
const message = 'The runner was not able to contact the cache service. Caching will be skipped';
|
||||||
|
try {
|
||||||
|
process.env['GITHUB_SERVER_URL'] = 'http://github.com';
|
||||||
|
expect(isCacheFeatureAvailable()).toBe(false);
|
||||||
|
expect(infoMock).toHaveBeenCalledWith(message);
|
||||||
|
} finally {
|
||||||
|
delete process.env['GITHUB_SERVER_URL'];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('isCacheFeatureAvailable is enabled', () => {
|
||||||
|
jest.spyOn(cache, 'isFeatureAvailable').mockImplementation(() => true);
|
||||||
|
expect(isCacheFeatureAvailable()).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
@ -54,7 +54,7 @@ inputs:
|
|||||||
$GPG_PASSPHRASE.'
|
$GPG_PASSPHRASE.'
|
||||||
required: false
|
required: false
|
||||||
cache:
|
cache:
|
||||||
description: 'Name of the build platform to cache dependencies. It can be "maven" or "gradle".'
|
description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".'
|
||||||
required: false
|
required: false
|
||||||
job-status:
|
job-status:
|
||||||
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
||||||
@ -67,6 +67,6 @@ outputs:
|
|||||||
path:
|
path:
|
||||||
description: 'Path to where the java environment has been installed (same as $JAVA_HOME)'
|
description: 'Path to where the java environment has been installed (same as $JAVA_HOME)'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node16'
|
||||||
main: 'dist/setup/index.js'
|
main: 'dist/setup/index.js'
|
||||||
post: 'dist/cleanup/index.js'
|
post: 'dist/cleanup/index.js'
|
||||||
|
62693
dist/cleanup/index.js
vendored
62693
dist/cleanup/index.js
vendored
File diff suppressed because one or more lines are too long
183704
dist/setup/index.js
vendored
183704
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
@ -3,6 +3,9 @@
|
|||||||
- [Eclipse Temurin](#Eclipse-Temurin)
|
- [Eclipse Temurin](#Eclipse-Temurin)
|
||||||
- [Adopt](#Adopt)
|
- [Adopt](#Adopt)
|
||||||
- [Zulu](#Zulu)
|
- [Zulu](#Zulu)
|
||||||
|
- [Liberica](#Liberica)
|
||||||
|
- [Microsoft](#Microsoft)
|
||||||
|
- [Amazon Corretto](#Amazon-Corretto)
|
||||||
- [Installing custom Java package type](#Installing-custom-Java-package-type)
|
- [Installing custom Java package type](#Installing-custom-Java-package-type)
|
||||||
- [Installing custom Java architecture](#Installing-custom-Java-architecture)
|
- [Installing custom Java architecture](#Installing-custom-Java-architecture)
|
||||||
- [Installing custom Java distribution from local file](#Installing-Java-from-local-file)
|
- [Installing custom Java distribution from local file](#Installing-Java-from-local-file)
|
||||||
@ -20,8 +23,8 @@ Inputs `java-version` and `distribution` are mandatory and needs to be provided.
|
|||||||
### Eclipse Temurin
|
### Eclipse Temurin
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -33,8 +36,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'adopt-hotspot'
|
distribution: 'adopt-hotspot'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -44,8 +47,8 @@ steps:
|
|||||||
### Zulu
|
### Zulu
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'zulu'
|
distribution: 'zulu'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -56,8 +59,8 @@ steps:
|
|||||||
### Liberica
|
### Liberica
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'liberica'
|
distribution: 'liberica'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -68,19 +71,32 @@ steps:
|
|||||||
### Microsoft
|
### Microsoft
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'microsoft'
|
distribution: 'microsoft'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Amazon Corretto
|
||||||
|
**NOTE:** Amazon Corretto only supports the major version specification.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: 'corretto'
|
||||||
|
java-version: '11'
|
||||||
|
- run: java -cp java HelloWorldApp
|
||||||
|
```
|
||||||
|
|
||||||
## Installing custom Java package type
|
## Installing custom Java package type
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -93,8 +109,8 @@ steps:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -110,7 +126,7 @@ steps:
|
|||||||
- run: |
|
- run: |
|
||||||
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
|
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
|
||||||
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
|
||||||
- uses: actions/setup-java@v2
|
- uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'jdkfile'
|
distribution: 'jdkfile'
|
||||||
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
jdkFile: ${{ runner.temp }}/java_package.tar.gz
|
||||||
@ -132,9 +148,9 @@ jobs:
|
|||||||
java: [ '8', '11' ]
|
java: [ '8', '11' ]
|
||||||
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
|
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: ${{ matrix.distribution }}
|
distribution: ${{ matrix.distribution }}
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
@ -152,9 +168,9 @@ jobs:
|
|||||||
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
|
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
|
||||||
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
|
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup java
|
- name: Setup java
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
@ -169,9 +185,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -185,7 +201,7 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
|
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
|
||||||
|
|
||||||
- name: Set up Apache Maven Central
|
- name: Set up Apache Maven Central
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with: # running setup-java again overwrites the settings.xml
|
with: # running setup-java again overwrites the settings.xml
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -280,9 +296,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up JDK 11 for Shared Runner
|
- name: Set up JDK 11 for Shared Runner
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
@ -306,10 +322,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up JDK 11
|
- name: Set up JDK 11
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: '<distribution>'
|
distribution: '<distribution>'
|
||||||
java-version: '11'
|
java-version: '11'
|
||||||
|
6757
package-lock.json
generated
6757
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-java",
|
"name": "setup-java",
|
||||||
"version": "2.0.0",
|
"version": "3.1.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup java action",
|
"description": "setup java action",
|
||||||
"main": "dist/setup/index.js",
|
"main": "dist/setup/index.js",
|
||||||
@ -24,7 +24,7 @@
|
|||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^1.0.8",
|
"@actions/cache": "^2.0.2",
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/glob": "^0.2.0",
|
"@actions/glob": "^0.2.0",
|
||||||
@ -36,19 +36,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
"@types/node": "^12.19.13",
|
"@types/node": "^16.11.25",
|
||||||
"@types/semver": "^7.3.4",
|
"@types/semver": "^7.3.4",
|
||||||
"@zeit/ncc": "^0.20.5",
|
|
||||||
"jest": "^27.2.5",
|
"jest": "^27.2.5",
|
||||||
"jest-circus": "^27.2.5",
|
"jest-circus": "^27.2.5",
|
||||||
|
"@vercel/ncc": "^0.33.4",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^1.19.1",
|
||||||
"ts-jest": "^27.0.5",
|
"ts-jest": "^27.0.5",
|
||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
|
||||||
"husky": {
|
|
||||||
"skipCI": true,
|
|
||||||
"hooks": {
|
|
||||||
"pre-commit": "npm run build && npm run format"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
src/cache.ts
23
src/cache.ts
@ -13,7 +13,7 @@ const CACHE_MATCHED_KEY = 'cache-matched-key';
|
|||||||
const CACHE_KEY_PREFIX = 'setup-java';
|
const CACHE_KEY_PREFIX = 'setup-java';
|
||||||
|
|
||||||
interface PackageManager {
|
interface PackageManager {
|
||||||
id: 'maven' | 'gradle';
|
id: 'maven' | 'gradle' | 'sbt';
|
||||||
/**
|
/**
|
||||||
* Paths of the file that specify the files to cache.
|
* Paths of the file that specify the files to cache.
|
||||||
*/
|
*/
|
||||||
@ -32,9 +32,28 @@ const supportedPackageManager: PackageManager[] = [
|
|||||||
path: [join(os.homedir(), '.gradle', 'caches'), join(os.homedir(), '.gradle', 'wrapper')],
|
path: [join(os.homedir(), '.gradle', 'caches'), join(os.homedir(), '.gradle', 'wrapper')],
|
||||||
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle
|
// https://github.com/actions/cache/blob/0638051e9af2c23d10bb70fa9beffcad6cff9ce3/examples.md#java---gradle
|
||||||
pattern: ['**/*.gradle*', '**/gradle-wrapper.properties']
|
pattern: ['**/*.gradle*', '**/gradle-wrapper.properties']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'sbt',
|
||||||
|
path: [
|
||||||
|
join(os.homedir(), '.ivy2', 'cache'),
|
||||||
|
join(os.homedir(), '.sbt'),
|
||||||
|
getCoursierCachePath(),
|
||||||
|
// Some files should not be cached to avoid resolution problems.
|
||||||
|
// In particular the resolution of snapshots (ideological gap between maven/ivy).
|
||||||
|
'!' + join(os.homedir(), '.sbt', '*.lock'),
|
||||||
|
'!' + join(os.homedir(), '**', 'ivydata-*.properties')
|
||||||
|
],
|
||||||
|
pattern: ['**/*.sbt', '**/project/build.properties', '**/project/**.{scala,sbt}']
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function getCoursierCachePath(): string {
|
||||||
|
if (os.type() === 'Linux') return join(os.homedir(), '.cache', 'coursier');
|
||||||
|
if (os.type() === 'Darwin') return join(os.homedir(), 'Library', 'Caches', 'Coursier');
|
||||||
|
return join(os.homedir(), 'AppData', 'Local', 'Coursier', 'Cache');
|
||||||
|
}
|
||||||
|
|
||||||
function findPackageManager(id: string): PackageManager {
|
function findPackageManager(id: string): PackageManager {
|
||||||
const packageManager = supportedPackageManager.find(packageManager => packageManager.id === id);
|
const packageManager = supportedPackageManager.find(packageManager => packageManager.id === id);
|
||||||
if (packageManager === undefined) {
|
if (packageManager === undefined) {
|
||||||
@ -77,8 +96,10 @@ export async function restore(id: string) {
|
|||||||
]);
|
]);
|
||||||
if (matchedKey) {
|
if (matchedKey) {
|
||||||
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
core.saveState(CACHE_MATCHED_KEY, matchedKey);
|
||||||
|
core.setOutput('cache-hit', matchedKey === primaryKey);
|
||||||
core.info(`Cache restored from key: ${matchedKey}`);
|
core.info(`Cache restored from key: ${matchedKey}`);
|
||||||
} else {
|
} else {
|
||||||
|
core.setOutput('cache-hit', false);
|
||||||
core.info(`${packageManager.id} cache is not found`);
|
core.info(`${packageManager.id} cache is not found`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
|||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as httpm from '@actions/http-client';
|
import * as httpm from '@actions/http-client';
|
||||||
import { getToolcachePath, getVersionFromToolcachePath, isVersionSatisfies } from '../util';
|
import { getToolcachePath, isVersionSatisfies } from '../util';
|
||||||
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from './base-models';
|
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from './base-models';
|
||||||
import { MACOS_JAVA_CONTENT_POSTFIX } from '../constants';
|
import { MACOS_JAVA_CONTENT_POSTFIX } from '../constants';
|
||||||
|
|
||||||
|
155
src/distributions/corretto/installer.ts
Normal file
155
src/distributions/corretto/installer.ts
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as tc from '@actions/tool-cache';
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { extractJdkFile, getDownloadArchiveExtension } from '../../util';
|
||||||
|
import { JavaBase } from '../base-installer';
|
||||||
|
import { JavaDownloadRelease, JavaInstallerOptions, JavaInstallerResults } from '../base-models';
|
||||||
|
import { ICorrettoAllAvailableVersions, ICorettoAvailableVersions } from './models';
|
||||||
|
|
||||||
|
export class CorrettoDistribution extends JavaBase {
|
||||||
|
constructor(installerOptions: JavaInstallerOptions) {
|
||||||
|
super('Corretto', installerOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async downloadTool(javaRelease: JavaDownloadRelease): Promise<JavaInstallerResults> {
|
||||||
|
core.info(
|
||||||
|
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
|
||||||
|
);
|
||||||
|
const javaArchivePath = await tc.downloadTool(javaRelease.url);
|
||||||
|
|
||||||
|
core.info(`Extracting Java archive...`);
|
||||||
|
|
||||||
|
const extractedJavaPath = await extractJdkFile(javaArchivePath, getDownloadArchiveExtension());
|
||||||
|
|
||||||
|
const archiveName = fs.readdirSync(extractedJavaPath)[0];
|
||||||
|
const archivePath = path.join(extractedJavaPath, archiveName);
|
||||||
|
const version = this.getToolcacheVersionName(javaRelease.version);
|
||||||
|
|
||||||
|
const javaPath = await tc.cacheDir(
|
||||||
|
archivePath,
|
||||||
|
this.toolcacheFolderName,
|
||||||
|
version,
|
||||||
|
this.architecture
|
||||||
|
);
|
||||||
|
|
||||||
|
return { version: javaRelease.version, path: javaPath };
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async findPackageForDownload(version: string): Promise<JavaDownloadRelease> {
|
||||||
|
if (!this.stable) {
|
||||||
|
throw new Error('Early access versions are not supported');
|
||||||
|
}
|
||||||
|
if (version.includes('.')) {
|
||||||
|
throw new Error('Only major versions are supported');
|
||||||
|
}
|
||||||
|
const availableVersions = await this.getAvailableVersions();
|
||||||
|
const matchingVersions = availableVersions
|
||||||
|
.filter(item => item.version == version)
|
||||||
|
.map(item => {
|
||||||
|
return {
|
||||||
|
version: item.correttoVersion,
|
||||||
|
url: item.downloadLink
|
||||||
|
} as JavaDownloadRelease;
|
||||||
|
});
|
||||||
|
|
||||||
|
const resolvedVersion = matchingVersions.length > 0 ? matchingVersions[0] : null;
|
||||||
|
if (!resolvedVersion) {
|
||||||
|
const availableOptions = availableVersions.map(item => item.version).join(', ');
|
||||||
|
const availableOptionsMessage = availableOptions
|
||||||
|
? `\nAvailable versions: ${availableOptions}`
|
||||||
|
: '';
|
||||||
|
throw new Error(
|
||||||
|
`Could not find satisfied version for SemVer '${version}'. ${availableOptionsMessage}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return resolvedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getAvailableVersions(): Promise<ICorettoAvailableVersions[]> {
|
||||||
|
const platform = this.getPlatformOption();
|
||||||
|
const arch = this.architecture;
|
||||||
|
const imageType = this.packageType;
|
||||||
|
|
||||||
|
console.time('coretto-retrieve-available-versions');
|
||||||
|
|
||||||
|
const availableVersionsUrl =
|
||||||
|
'https://corretto.github.io/corretto-downloads/latest_links/indexmap_with_checksum.json';
|
||||||
|
const fetchCurrentVersions = await this.http.getJson<ICorrettoAllAvailableVersions>(
|
||||||
|
availableVersionsUrl
|
||||||
|
);
|
||||||
|
const fetchedCurrentVersions = fetchCurrentVersions.result;
|
||||||
|
if (!fetchedCurrentVersions) {
|
||||||
|
throw Error(`Could not fetch latest corretto versions from ${availableVersionsUrl}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const eligbleVersions = fetchedCurrentVersions?.[platform]?.[arch]?.[imageType];
|
||||||
|
const availableVersions = this.getAvailableVersionsForPlatform(eligbleVersions);
|
||||||
|
|
||||||
|
if (core.isDebug()) {
|
||||||
|
this.printAvailableVersions(availableVersions);
|
||||||
|
}
|
||||||
|
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getAvailableVersionsForPlatform(
|
||||||
|
eligbleVersions: ICorrettoAllAvailableVersions['os']['arch']['imageType'] | undefined
|
||||||
|
): ICorettoAvailableVersions[] {
|
||||||
|
const availableVersions: ICorettoAvailableVersions[] = [];
|
||||||
|
|
||||||
|
for (const version in eligbleVersions) {
|
||||||
|
const availableVersion = eligbleVersions[version];
|
||||||
|
for (const fileType in availableVersion) {
|
||||||
|
const skipNonExtractableBinaries = fileType != getDownloadArchiveExtension();
|
||||||
|
if (skipNonExtractableBinaries) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const availableVersionDetails = availableVersion[fileType];
|
||||||
|
const correttoVersion = this.getCorettoVersion(availableVersionDetails.resource);
|
||||||
|
|
||||||
|
availableVersions.push({
|
||||||
|
checksum: availableVersionDetails.checksum,
|
||||||
|
checksum_sha256: availableVersionDetails.checksum_sha256,
|
||||||
|
fileType,
|
||||||
|
resource: availableVersionDetails.resource,
|
||||||
|
downloadLink: `https://corretto.aws${availableVersionDetails.resource}`,
|
||||||
|
version: version,
|
||||||
|
correttoVersion
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return availableVersions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private printAvailableVersions(availableVersions: ICorettoAvailableVersions[]) {
|
||||||
|
core.startGroup('Print information about available versions');
|
||||||
|
console.timeEnd('coretto-retrieve-available-versions');
|
||||||
|
console.log(`Available versions: [${availableVersions.length}]`);
|
||||||
|
console.log(
|
||||||
|
availableVersions.map(item => `${item.version}: ${item.correttoVersion}`).join(', ')
|
||||||
|
);
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
private getPlatformOption(): string {
|
||||||
|
// Coretto has its own platform names so we need to map them
|
||||||
|
switch (process.platform) {
|
||||||
|
case 'darwin':
|
||||||
|
return 'macos';
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
default:
|
||||||
|
return process.platform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getCorettoVersion(resource: string): string {
|
||||||
|
const regex = /(\d+.+)\//;
|
||||||
|
const match = regex.exec(resource);
|
||||||
|
if (match === null) {
|
||||||
|
throw Error(`Could not parse corretto version from ${resource}`);
|
||||||
|
}
|
||||||
|
return match[1];
|
||||||
|
}
|
||||||
|
}
|
25
src/distributions/corretto/models.ts
Normal file
25
src/distributions/corretto/models.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
export interface ICorrettoAllAvailableVersions {
|
||||||
|
[os: string]: {
|
||||||
|
[arch: string]: {
|
||||||
|
[distributionType: string]: {
|
||||||
|
[version: string]: {
|
||||||
|
[fileType: string]: {
|
||||||
|
checksum: string;
|
||||||
|
checksum_sha256: string;
|
||||||
|
resource: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICorettoAvailableVersions {
|
||||||
|
version: string;
|
||||||
|
fileType: string;
|
||||||
|
checksum: string;
|
||||||
|
checksum_sha256: string;
|
||||||
|
resource: string;
|
||||||
|
downloadLink: string;
|
||||||
|
correttoVersion: string;
|
||||||
|
}
|
@ -6,6 +6,7 @@ import { AdoptDistribution, AdoptImplementation } from './adopt/installer';
|
|||||||
import { TemurinDistribution, TemurinImplementation } from './temurin/installer';
|
import { TemurinDistribution, TemurinImplementation } from './temurin/installer';
|
||||||
import { LibericaDistributions } from './liberica/installer';
|
import { LibericaDistributions } from './liberica/installer';
|
||||||
import { MicrosoftDistributions } from './microsoft/installer';
|
import { MicrosoftDistributions } from './microsoft/installer';
|
||||||
|
import { CorrettoDistribution } from './corretto/installer';
|
||||||
|
|
||||||
enum JavaDistribution {
|
enum JavaDistribution {
|
||||||
Adopt = 'adopt',
|
Adopt = 'adopt',
|
||||||
@ -15,7 +16,8 @@ enum JavaDistribution {
|
|||||||
Zulu = 'zulu',
|
Zulu = 'zulu',
|
||||||
Liberica = 'liberica',
|
Liberica = 'liberica',
|
||||||
JdkFile = 'jdkfile',
|
JdkFile = 'jdkfile',
|
||||||
Microsoft = 'microsoft'
|
Microsoft = 'microsoft',
|
||||||
|
Corretto = 'corretto'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getJavaDistribution(
|
export function getJavaDistribution(
|
||||||
@ -39,6 +41,8 @@ export function getJavaDistribution(
|
|||||||
return new LibericaDistributions(installerOptions);
|
return new LibericaDistributions(installerOptions);
|
||||||
case JavaDistribution.Microsoft:
|
case JavaDistribution.Microsoft:
|
||||||
return new MicrosoftDistributions(installerOptions);
|
return new MicrosoftDistributions(installerOptions);
|
||||||
|
case JavaDistribution.Corretto:
|
||||||
|
return new CorrettoDistribution(installerOptions);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -80,11 +80,17 @@ export class MicrosoftDistributions extends JavaBase {
|
|||||||
// TODO get these dynamically!
|
// TODO get these dynamically!
|
||||||
// We will need Microsoft to add an endpoint where we can query for versions.
|
// We will need Microsoft to add an endpoint where we can query for versions.
|
||||||
const jdkVersions = [
|
const jdkVersions = [
|
||||||
|
{
|
||||||
|
version: [17, 0, 3]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
version: [17, 0, 1, 12, 1]
|
version: [17, 0, 1, 12, 1]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
version: [16, 0, 2, 7, 1]
|
version: [16, 0, 2, 7, 1]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
version: [11, 0, 15]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -133,6 +133,8 @@ export class ZuluDistribution extends JavaBase {
|
|||||||
return { arch: 'x86', hw_bitness: '64', abi: '' };
|
return { arch: 'x86', hw_bitness: '64', abi: '' };
|
||||||
} else if (this.architecture == 'x86') {
|
} else if (this.architecture == 'x86') {
|
||||||
return { arch: 'x86', hw_bitness: '32', abi: '' };
|
return { arch: 'x86', hw_bitness: '32', abi: '' };
|
||||||
|
} else if (this.architecture == 'arm64') {
|
||||||
|
return { arch: 'arm', hw_bitness: '64', abi: '' };
|
||||||
} else {
|
} else {
|
||||||
return { arch: this.architecture, hw_bitness: '', abi: '' };
|
return { arch: this.architecture, hw_bitness: '', abi: '' };
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as auth from './auth';
|
import * as auth from './auth';
|
||||||
import { getBooleanInput } from './util';
|
import { getBooleanInput, isCacheFeatureAvailable } from './util';
|
||||||
import * as constants from './constants';
|
import * as constants from './constants';
|
||||||
import { restore } from './cache';
|
import { restore } from './cache';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
@ -42,7 +42,7 @@ async function run() {
|
|||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||||
|
|
||||||
await auth.configureAuthentication();
|
await auth.configureAuthentication();
|
||||||
if (cache) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
await restore(cache);
|
await restore(cache);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
22
src/util.ts
22
src/util.ts
@ -2,6 +2,7 @@ import os from 'os';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
import * as cache from '@actions/cache';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
@ -77,3 +78,24 @@ export function isJobStatusSuccess() {
|
|||||||
|
|
||||||
return jobStatus === 'success';
|
return jobStatus === 'success';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isGhes(): boolean {
|
||||||
|
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
|
||||||
|
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isCacheFeatureAvailable(): boolean {
|
||||||
|
if (!cache.isFeatureAvailable()) {
|
||||||
|
if (isGhes()) {
|
||||||
|
throw new Error(
|
||||||
|
'Caching is only supported on GHES version >= 3.5. If you are on a version >= 3.5, please check with your GHES admin if the Actions cache service is enabled or not.'
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
core.warning('The runner was not able to contact the cache service. Caching will be skipped');
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user