Compare commits

...

9 Commits

Author SHA1 Message Date
George Adams
1e13d80bb1
Merge 5398d30241 into 8df1039502 2024-10-21 11:46:45 -07:00
John Wesley Walker III
8df1039502
Refine isGhes logic (#697) 2024-10-21 19:57:52 +02:00
mahabaleshwars
870c199c48
Update workflows for GraalVM and Version Enhancements (#699)
* workflow update graalvm version

* updated workflow for publish action version update
2024-10-21 11:43:20 -05:00
George Adams
5398d30241
Update .github/workflows/e2e-versions.yml
Co-authored-by: christian <153755613+skateball@users.noreply.github.com>
2024-09-16 20:32:41 +01:00
George Adams
ff1f7f380c
rework test 2024-08-16 10:30:36 +01:00
George Adams
d67365e824
rework test 2024-08-16 10:23:50 +01:00
George Adams
a3755773a1
add dist 2024-08-16 10:20:34 +01:00
George Adams
0685457b96
attempt to add e2e test for Alpine 2024-08-16 10:19:46 +01:00
George Adams
12cfe0fd55
temurin: add support for Alpine Linux 2024-08-16 10:17:18 +01:00
7 changed files with 95 additions and 6 deletions

View File

@ -51,7 +51,7 @@ jobs:
version: 21 version: 21
- distribution: graalvm - distribution: graalvm
os: macos-latest os: macos-latest
version: 17 version: 17.0.12
- distribution: graalvm - distribution: graalvm
os: windows-latest os: windows-latest
version: 21 version: 21
@ -74,6 +74,32 @@ 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-alpine-linux:
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - alpine-linux - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
container:
image: alpine:latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
distribution: ['temurin', 'sapmachine']
version: ['21', '17']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install bash
run: apk add --no-cache bash
- name: setup-java
uses: ./
id: setup-java
with:
java-version: ${{ matrix.version }}
distribution: ${{ matrix.distribution }}
- name: Verify Java
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
shell: bash
setup-java-major-minor-versions: setup-java-major-minor-versions:
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }} name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
needs: setup-java-major-versions needs: setup-java-major-versions

View File

@ -23,7 +23,7 @@ jobs:
steps: steps:
- name: Update the ${{ env.TAG_NAME }} tag - name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag id: update-major-tag
uses: actions/publish-action@v0.2.2 uses: actions/publish-action@v0.3.0
with: with:
source-tag: ${{ env.TAG_NAME }} source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }} slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -3,7 +3,8 @@ import * as core from '@actions/core';
import { import {
convertVersionToSemver, convertVersionToSemver,
isVersionSatisfies, isVersionSatisfies,
isCacheFeatureAvailable isCacheFeatureAvailable,
isGhes
} from '../src/util'; } from '../src/util';
jest.mock('@actions/cache'); jest.mock('@actions/cache');
@ -80,3 +81,41 @@ describe('convertVersionToSemver', () => {
expect(actual).toBe(expected); expect(actual).toBe(expected);
}); });
}); });
describe('isGhes', () => {
const pristineEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...pristineEnv};
});
afterAll(() => {
process.env = pristineEnv;
});
it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => {
delete process.env['GITHUB_SERVER_URL'];
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost';
expect(isGhes()).toBeFalsy();
});
it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com';
expect(isGhes()).toBeTruthy();
});
});

View File

@ -88552,7 +88552,11 @@ function isJobStatusSuccess() {
exports.isJobStatusSuccess = isJobStatusSuccess; exports.isJobStatusSuccess = isJobStatusSuccess;
function isGhes() { function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
} }
exports.isGhes = isGhes; exports.isGhes = isGhes;
function isCacheFeatureAvailable() { function isCacheFeatureAvailable() {

11
dist/setup/index.js vendored
View File

@ -125634,6 +125634,11 @@ class TemurinDistribution extends base_installer_1.JavaBase {
return 'mac'; return 'mac';
case 'win32': case 'win32':
return 'windows'; return 'windows';
case 'linux':
if (fs_1.default.existsSync('/etc/alpine-release')) {
return 'alpine-linux';
}
return 'linux';
default: default:
return process.platform; return process.platform;
} }
@ -126328,7 +126333,11 @@ function isJobStatusSuccess() {
exports.isJobStatusSuccess = isJobStatusSuccess; exports.isJobStatusSuccess = isJobStatusSuccess;
function isGhes() { function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
} }
exports.isGhes = isGhes; exports.isGhes = isGhes;
function isCacheFeatureAvailable() { function isCacheFeatureAvailable() {

View File

@ -176,6 +176,11 @@ export class TemurinDistribution extends JavaBase {
return 'mac'; return 'mac';
case 'win32': case 'win32':
return 'windows'; return 'windows';
case 'linux':
if (fs.existsSync('/etc/alpine-release')) {
return 'alpine-linux';
}
return 'linux';
default: default:
return process.platform; return process.platform;
} }

View File

@ -92,7 +92,13 @@ export function isGhes(): boolean {
const ghUrl = new URL( const ghUrl = new URL(
process.env['GITHUB_SERVER_URL'] || 'https://github.com' process.env['GITHUB_SERVER_URL'] || 'https://github.com'
); );
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
} }
export function isCacheFeatureAvailable(): boolean { export function isCacheFeatureAvailable(): boolean {