Skip to content

Commit

Permalink
add support for multiple jdks
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-shibanov committed Aug 16, 2022
1 parent 8048bbe commit b6bae37
Show file tree
Hide file tree
Showing 10 changed files with 3,177 additions and 421 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/e2e-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,43 @@ jobs:
run: bash __tests__/verify-java.sh "11" "${{ steps.setup-java.outputs.path }}"
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']
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
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:
name: zulu ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
needs: setup-java-major-minor-versions
Expand Down
2 changes: 1 addition & 1 deletion .licenses/npm/@actions/core.dep.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,10 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: '<distribution>'
java-version: 8
- run: echo "JAVA_8=$JAVA_HOME" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: '<distribution>'
java-version: 11
- run: echo "JAVA_11=$JAVA_HOME" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: '<distribution>'
java-version: 15
- run: echo "JAVA_15=$JAVA_HOME" >> $GITHUB_ENV
java-version: |
8
11
15
```

### Advanced
Expand Down
4 changes: 4 additions & 0 deletions __tests__/distributors/base-installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ describe('setupJava', () => {
expect(spyGetToolcachePath).toHaveBeenCalled();
expect(spyCoreAddPath).toHaveBeenCalled();
expect(spyCoreExportVariable).toHaveBeenCalled();
expect(spyCoreExportVariable).toHaveBeenCalledWith(
`JAVA_HOME_${input.version}_${input.architecture.toLocaleUpperCase()}`,
expected.path
);
expect(spyCoreSetOutput).toHaveBeenCalled();
expect(spyCoreInfo).toHaveBeenCalledWith('Trying to resolve the latest version from remote');
expect(spyCoreInfo).toHaveBeenCalledWith(`Resolved latest version as ${expected.version}`);
Expand Down
Loading

0 comments on commit b6bae37

Please sign in to comment.