Skip to content

Commit b53500d

Browse files
maxim-lobanovgdamskonradpabjandmitry-shibanov
authored
Merge "v2-preview" branch into "main" (#150)
* actions/setup-java@v2 - Support different distributions (#132) * Implement support for custom vendors in setup-java * minor improvements * minor refactoring * Add unit tests and e2e tests * Update documentation for setup-java@v2 release * minor improvements * regenerate dist * fix comments * resolve comments * resolve comments * fix tests * Update README.md Co-authored-by: George Adams <[email protected]> * Apply suggestions from code review Co-authored-by: Konrad Pabjan <[email protected]> * fix minor nitpicks * handle 4th digit * pull latest main * Update README.md * rename adoptium to adopt * rename adoptium to adopt * rename adoptium to adopt * Update README.md * make java-version and distribution required for action * update readme * fix tests * fix e2e tests Co-authored-by: George Adams <[email protected]> Co-authored-by: Konrad Pabjan <[email protected]> * Add "overwrite-settings" input parameter (#136) * add overwrite-settings parameter * fix e2e tests * print debug * fix e2e tests * add comment * remove comment * Add "Contents/Home" postfix on macOS if provider creates it (#139) * Update e2e-versions.yml * Update e2e-versions.yml * implement fix * Update e2e-versions.yml * Update installer.ts * fix filter logic * Update e2e-versions.yml * remove extra logic * Update e2e-versions.yml * Add check-latest flag (#141) * add changes for check-latest * run prerelease script * resolving comments * fixing tests * fix spelling * improve core.info messages * run format * run prerelease * change version to fix test * resolve comment for check-latest * Update README.md * added hosted tool cache section * Apply suggestions from code review Co-authored-by: Maxim Lobanov <[email protected]> Co-authored-by: Konrad Pabjan <[email protected]> * Avoid "+" sign in Java path in v2-preview (#145) * try to handle _ versions * more logs * more debug * test 1 * more fixes * fix typo * Update e2e-versions.yml * add unit-tests * remove debug info from tests * debug pre-cached versions * change e2e tests to ubuntu-latest * update npm licenses Co-authored-by: George Adams <[email protected]> Co-authored-by: Konrad Pabjan <[email protected]> Co-authored-by: Dmitry Shibanov <[email protected]>
1 parent ebb424f commit b53500d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+47113
-28375
lines changed

.github/workflows/build.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build Action
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- releases/*
8+
- v2-preview
9+
paths-ignore:
10+
- '**.md'
11+
pull_request:
12+
paths-ignore:
13+
- '**.md'
14+
15+
jobs:
16+
build:
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Setup Node.JS 12
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: 12.x
28+
- run: npm ci
29+
- run: npm run build
30+
- run: npm run format-check
31+
- run: npm test
32+
- name: Verify no unstaged changes
33+
if: runner.os != 'windows'
34+
run: bash __tests__/verify-no-unstaged-changes.sh

.github/workflows/e2e-local-file.yml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Validate local file
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- releases/*
7+
- v2-preview
8+
paths-ignore:
9+
- '**.md'
10+
pull_request:
11+
paths-ignore:
12+
- '**.md'
13+
14+
jobs:
15+
setup-java-local-file-adopt:
16+
name: Validate installation from local file Adopt
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [macos-latest, windows-latest, ubuntu-latest]
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- name: Download Adopt OpenJDK file
26+
run: |
27+
if ($IsLinux) {
28+
$downloadUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
29+
$localFilename = "java_package.tar.gz"
30+
} elseif ($IsMacOS) {
31+
$downloadUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_mac_hotspot_11.0.10_9.tar.gz"
32+
$localFilename = "java_package.tar.gz"
33+
} elseif ($IsWindows) {
34+
$downloadUrl = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_windows_hotspot_11.0.10_9.zip"
35+
$localFilename = "java_package.zip"
36+
}
37+
echo "LocalFilename=$localFilename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
38+
(New-Object System.Net.WebClient).DownloadFile($downloadUrl, "$env:RUNNER_TEMP/$localFilename")
39+
shell: pwsh
40+
- name: setup-java
41+
uses: ./
42+
id: setup-java
43+
with:
44+
distribution: 'jdkfile'
45+
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
46+
java-version: '11.0.0-ea'
47+
architecture: x64
48+
- name: Verify Java version
49+
run: bash __tests__/verify-java.sh "11.0.10" "${{ steps.setup-java.outputs.path }}"
50+
shell: bash
51+
52+
setup-java-local-file-zulu:
53+
name: Validate installation from local file Zulu
54+
runs-on: ${{ matrix.os }}
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
os: [macos-latest, windows-latest, ubuntu-latest]
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v2
62+
- name: Download Zulu OpenJDK file
63+
run: |
64+
if ($IsLinux) {
65+
$downloadUrl = "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz"
66+
$localFilename = "java_package.tar.gz"
67+
} elseif ($IsMacOS) {
68+
$downloadUrl = "https://cdn.azul.com/zulu/bin/zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz"
69+
$localFilename = "java_package.tar.gz"
70+
} elseif ($IsWindows) {
71+
$downloadUrl = "https://cdn.azul.com/zulu/bin/zulu11.45.27-ca-jdk11.0.10-win_x64.zip"
72+
$localFilename = "java_package.zip"
73+
}
74+
echo "LocalFilename=$localFilename" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
75+
(New-Object System.Net.WebClient).DownloadFile($downloadUrl, "$env:RUNNER_TEMP/$localFilename")
76+
shell: pwsh
77+
- name: setup-java
78+
uses: ./
79+
id: setup-java
80+
with:
81+
distribution: 'jdkfile'
82+
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
83+
java-version: '11.0.0-ea'
84+
architecture: x64
85+
- name: Verify Java version
86+
run: bash __tests__/verify-java.sh "11.0" "${{ steps.setup-java.outputs.path }}"
87+
shell: bash

.github/workflows/e2e-publishing.yml

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Validate publishing functionality
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- releases/*
7+
- v2-preview
8+
paths-ignore:
9+
- '**.md'
10+
pull_request:
11+
paths-ignore:
12+
- '**.md'
13+
14+
defaults:
15+
run:
16+
shell: pwsh
17+
18+
jobs:
19+
setup-java-publishing:
20+
name: Validate settings.xml
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [macos-latest, windows-latest, ubuntu-latest]
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
- name: setup-java
30+
uses: ./
31+
id: setup-java
32+
with:
33+
distribution: 'adopt'
34+
java-version: '11'
35+
server-id: maven
36+
server-username: MAVEN_USERNAME
37+
server-password: MAVEN_CENTRAL_TOKEN
38+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
39+
- name: Validate settings.xml
40+
run: |
41+
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
42+
Get-Content $xmlPath | ForEach-Object { Write-Host $_ }
43+
44+
[xml]$xml = Get-Content $xmlPath
45+
$servers = $xml.settings.servers.server
46+
if (($servers[0].id -ne 'maven') -or ($servers[0].username -ne '${env.MAVEN_USERNAME}') -or ($servers[0].password -ne '${env.MAVEN_CENTRAL_TOKEN}')) {
47+
throw "Generated XML file is incorrect"
48+
}
49+
50+
if (($servers[1].id -ne 'gpg.passphrase') -or ($servers[1].passphrase -ne '${env.MAVEN_GPG_PASSPHRASE}')) {
51+
throw "Generated XML file is incorrect"
52+
}
53+
54+
test-publishing-overwrite:
55+
name: settings.xml is overwritten if flag is true
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
fail-fast: false
59+
matrix:
60+
os: [macos-latest, windows-latest, ubuntu-latest]
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v2
64+
- name: Create fake settings.xml
65+
run: |
66+
$xmlDirectory = Join-Path $HOME ".m2"
67+
$xmlPath = Join-Path $xmlDirectory "settings.xml"
68+
New-Item -Path $xmlDirectory -ItemType Directory
69+
Set-Content -Path $xmlPath -Value "Fake_XML"
70+
- name: setup-java
71+
uses: ./
72+
id: setup-java
73+
with:
74+
distribution: 'adopt'
75+
java-version: '11'
76+
server-id: maven
77+
server-username: MAVEN_USERNAME
78+
server-password: MAVEN_CENTRAL_TOKEN
79+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
80+
- name: Validate settings.xml is overwritten
81+
run: |
82+
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
83+
Get-Content $xmlPath | ForEach-Object { Write-Host $_ }
84+
85+
$content = Get-Content $xmlPath -Raw
86+
if ($content -notlike '*maven*') {
87+
throw "settings.xml file is not overwritten"
88+
}
89+
90+
test-publishing-skip-overwrite:
91+
name: settings.xml is not overwritten if flag is false
92+
runs-on: ${{ matrix.os }}
93+
strategy:
94+
fail-fast: false
95+
matrix:
96+
os: [macos-latest, windows-latest, ubuntu-latest]
97+
steps:
98+
- name: Checkout
99+
uses: actions/checkout@v2
100+
- name: Create fake settings.xml
101+
run: |
102+
$xmlDirectory = Join-Path $HOME ".m2"
103+
$xmlPath = Join-Path $xmlDirectory "settings.xml"
104+
New-Item -Path $xmlDirectory -ItemType Directory
105+
Set-Content -Path $xmlPath -Value "Fake_XML"
106+
- name: setup-java
107+
uses: ./
108+
id: setup-java
109+
with:
110+
distribution: 'adopt'
111+
java-version: '11'
112+
server-id: maven
113+
server-username: MAVEN_USERNAME
114+
server-password: MAVEN_CENTRAL_TOKEN
115+
overwrite-settings: false
116+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
117+
- name: Validate that settings.xml is not overwritten
118+
run: |
119+
$xmlPath = Join-Path $HOME ".m2" "settings.xml"
120+
$content = Get-Content -Path $xmlPath -Raw
121+
Write-Host $content
122+
123+
if ($content -notlike "*Fake_XML*") {
124+
throw "settings.xml file was overwritten but it should not be"
125+
}
126+
127+
test-publishing-custom-location:
128+
name: settings.xml in custom location
129+
runs-on: ${{ matrix.os }}
130+
strategy:
131+
fail-fast: false
132+
matrix:
133+
os: [macos-latest, windows-latest, ubuntu-latest]
134+
steps:
135+
- name: Checkout
136+
uses: actions/checkout@v2
137+
- name: setup-java
138+
uses: ./
139+
id: setup-java
140+
with:
141+
distribution: 'adopt'
142+
java-version: '11'
143+
server-id: maven
144+
server-username: MAVEN_USERNAME
145+
server-password: MAVEN_CENTRAL_TOKEN
146+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
147+
settings-path: ${{ runner.temp }}
148+
- name: Validate settings.xml location
149+
run: |
150+
$path = Join-Path $env:RUNNER_TEMP "settings.xml"
151+
if (-not (Test-Path $path)) {
152+
throw "settings.xml file is not found in expected location"
153+
}

0 commit comments

Comments
 (0)