Compare commits

...

15 Commits

Author SHA1 Message Date
Fabio Niephaus
6acd592e3e Bump version to 1.0.11. 2023-04-11 09:11:01 +02:00
Fabio Niephaus
cf001e2d43 Update dependencies. 2023-04-11 09:09:07 +02:00
Fabio Niephaus
90a2c32c8b Default to ${{ github.token }}. 2023-04-11 08:39:53 +02:00
Fabio Niephaus
4297237826 Drop deprecated ubuntu-18.04. 2023-04-10 13:53:31 +02:00
Fabio Niephaus
c85a448ca4 Adjust for JDK 20 dev builds. 2023-04-10 13:42:02 +02:00
Fabio Niephaus
c8fdb59e88 Adjust for new dev build naming scheme. 2023-04-10 12:48:07 +02:00
Fabio Niephaus
40947ba8ce Add test for automatic NI setup on Windows.
Context: https://github.com/oracle/graal/pull/5881
2023-02-13 10:57:38 +01:00
Fabio Niephaus
4356481765 Bump version to 1.0.10. 2023-02-13 10:32:00 +01:00
Fabio Niephaus
8b27096bbf Update JDK11 upgrade notice. 2023-02-13 10:31:17 +01:00
Fabio Niephaus
93d8fee7fa Skip Windows environment setup for dev builds. 2023-02-13 10:24:09 +01:00
Fabio Niephaus
76d605752b Test gu component removal. 2023-02-13 10:24:09 +01:00
Fabio Niephaus
b53bc17dd7 Allow java-version: 'dev' if version: 'dev'.
Fixes #30
2023-01-24 13:15:29 +01:00
Fabio Niephaus
d01f5f519f Allow users to set %VSINSTALLDIR%
and update `KNOWN_VISUAL_STUDIO_INSTALLATIONS`.

Fixes #29
2022-12-23 09:44:36 +01:00
Fabio Niephaus
4aba115fa5 Improve error message when url not found. 2022-12-16 18:43:51 +01:00
Fabio Niephaus
7c84ab1ba7 Let getLatestRelease() always query github.com.
This should allow GitHub Enterprise users to use this action.

Resolves #26, resolves #27.
2022-12-13 09:12:43 +01:00
16 changed files with 17568 additions and 24719 deletions

View File

@@ -25,23 +25,32 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: [latest, dev]
java-version: ['17', '19']
version: ['latest', 'dev']
java-version: ['19', '20']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
exclude:
- version: 'latest'
java-version: '20'
- version: 'dev'
java-version: '19'
include:
- version: '22.2.0' # for update notifications
java-version: '17'
components: 'native-image'
os: ubuntu-18.04
- version: '22.3.0'
os: ubuntu-20.04
- version: '22.3.1'
java-version: '11' # for JDK11 notification
components: 'native-image'
os: macos-11
- version: '22.3.0'
- version: '22.3.1'
java-version: '17'
components: 'native-image'
os: windows-2022
- version: 'dev'
java-version: 'dev'
components: 'native-image'
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
@@ -63,6 +72,7 @@ jobs:
java --version
java --version | grep "GraalVM CE" || exit 34
native-image --version
gu list
if: runner.os != 'Windows'
- name: Check Windows environment
run: |
@@ -70,6 +80,7 @@ jobs:
echo "JAVA_HOME: $env:JAVA_HOME"
java --version
native-image --version
gu.cmd remove native-image
if: runner.os == 'Windows'
test-ee:
name: EE ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
@@ -77,10 +88,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
version: ['22.3.0', 'latest']
java-version: ['11', '17', '19']
version: ['latest']
java-version: ['19']
components: ['native-image']
os: [macos-latest, windows-latest, ubuntu-latest]
include:
- version: '22.3.0'
java-version: '11'
components: 'native-image'
os: ubuntu-latest
- version: '22.3.0'
java-version: '17'
components: 'native-image'
os: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
@@ -99,6 +119,7 @@ jobs:
java --version
java --version | grep "GraalVM EE" || exit 23
native-image --version
gu list
if: runner.os != 'Windows'
- name: Check Windows environment
run: |
@@ -106,6 +127,7 @@ jobs:
echo "JAVA_HOME: $env:JAVA_HOME"
java --version
native-image --version
gu.cmd remove native-image
if: runner.os == 'Windows'
test-mandrel:
name: ${{ matrix.version }} + JDK${{ matrix.java-version }} on ${{ matrix.os }}
@@ -138,7 +160,7 @@ jobs:
java --version
native-image --version
if: runner.os == 'Windows'
test-native-image-msvc:
test-native-image-windows:
name: native-image on windows-latest
runs-on: windows-latest
permissions:
@@ -149,7 +171,30 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'latest'
version: 'dev'
java-version: 'dev'
components: 'native-image'
native-image-job-reports: 'true'
native-image-pr-reports: 'true'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build HelloWorld executable with GraalVM Native Image on Windows
run: |
echo 'public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }' > HelloWorld.java
javac HelloWorld.java
native-image HelloWorld
./helloworld
test-native-image-windows-msvc:
name: native-image on windows-2019
runs-on: windows-2019
permissions:
contents: read
pull-requests: write # for `native-image-pr-reports` option
steps:
- uses: actions/checkout@v3
- name: Run setup-graalvm action
uses: ./
with:
version: '22.3.1'
java-version: '17'
components: 'native-image'
native-image-job-reports: 'true'
@@ -172,8 +217,8 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'latest'
java-version: '19'
version: 'dev'
java-version: 'dev'
components: 'native-image'
native-image-musl: 'true'
native-image-job-reports: 'true'
@@ -196,7 +241,7 @@ jobs:
- name: Run setup-graalvm action
uses: ./
with:
version: 'dev'
version: 'latest'
java-version: '17'
components: 'espresso,llvm-toolchain,native-image,nodejs,python,R,ruby,wasm'
set-java-home: 'false'
@@ -240,3 +285,5 @@ jobs:
bundle exec rake compile
bundle exec rake test
popd > /dev/null
- name: Remove components
run: gu remove espresso llvm-toolchain nodejs python R ruby wasm

View File

@@ -116,9 +116,9 @@ jobs:
|-----------------|:--------:|-------------|
| `version`<br>*(required)* | n/a | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases]<br>`latest` for [latest stable release][stable],<br>`dev` for [latest dev build][dev-build],<br>`mandrel-X.Y.Z` (e.g., `mandrel-21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],<br>`mandrel-latest` for [latest Mandrel stable release][mandrel-stable]. |
| `gds-token` | `''` | Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#basic-graalvm-enterprise-edition-template)). |
| `java-version`<br>*(required)* | n/a | `'17'` or `'19'` for a specific Java version.<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
| `java-version`<br>*(required)* | n/a | `'17'` or `'19'` for a specific Java version, `'dev'` for the highest Java version available (requires `version: 'dev'`).<br>(`'8'`, `'11'`, `'16'` are supported for older GraalVM releases.) |
| `components` | `''` | Comma-spearated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. |
| `github-token` | `''` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues. |
| `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps to reduce rate limiting issues. |
| `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. Overrides any previous action or command that sets `$JAVA_HOME`. |
| `cache` | `''` | Name of the build platform to cache dependencies. It can be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. |
| `check-for-updates` | `'true'` | [Annotate jobs][gha-annotations] with update notifications, for example, when a new GraalVM release is available. |

61
__tests__/graalvm.test.ts Normal file
View File

@@ -0,0 +1,61 @@
import * as path from 'path'
import * as graalvm from '../src/graalvm'
import {expect, test} from '@jest/globals'
import {getLatestRelease} from '../src/utils'
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
import {GRAALVM_RELEASES_REPO} from '../src/constants'
process.env['RUNNER_TOOL_CACHE'] = path.join(__dirname, 'TOOL_CACHE')
process.env['RUNNER_TEMP'] = path.join(__dirname, 'TEMP')
test('request invalid version/javaVersion', async () => {
for (var combination of [
['22.3.0', '7'],
['22.3', '17'],
['22.3', '7']
]) {
let error = new Error('unexpected')
try {
await graalvm.setUpGraalVMRelease('', combination[0], combination[1])
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Erro: ${err}`)
}
error = err
}
expect(error).not.toBeUndefined()
expect(error.message).toContain('Failed to download')
expect(error.message).toContain('Are you sure version')
}
})
test('find version/javaVersion', async () => {
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestVersion = findGraalVMVersion(latestRelease)
expect(latestVersion).not.toBe('')
const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion)
expect(latestJavaVersion).not.toBe('')
let error = new Error('unexpected')
try {
const invalidRelease = {...latestRelease, tag_name: 'invalid'}
findGraalVMVersion(invalidRelease)
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Erro: ${err}`)
}
error = err
}
expect(error.message).toContain('Could not find latest GraalVM release:')
try {
findHighestJavaVersion(latestRelease, 'invalid')
} catch (err) {
if (!(err instanceof Error)) {
fail(`Unexpected non-Erro: ${err}`)
}
error = err
}
expect(error.message).toContain('Could not find highest Java version.')
})

View File

@@ -20,8 +20,8 @@ inputs:
default: ''
github-token:
required: false
description: 'Set it to secrets.GITHUB_TOKEN to increase rate limits when accessing the GitHub API.'
default: ''
description: 'Set it to secrets.GITHUB_TOKEN to increase rate limits when accessing the GitHub API. Defaults to github.token.'
default: ${{ github.token }}
set-java-home:
required: false
description: 'Set $JAVA_HOME to the GraalVM installation. Default: true.'

17409
dist/cleanup/index.js generated vendored

File diff suppressed because one or more lines are too long

17649
dist/main/index.js generated vendored

File diff suppressed because one or more lines are too long

6877
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "setup-graalvm",
"version": "1.0.9",
"version": "1.0.11",
"private": true,
"description": "GitHub Action for GraalVM",
"main": "lib/main.js",
@@ -11,7 +11,8 @@
"lint": "eslint src/**/*.ts",
"package": "ncc build -o dist/main src/main.ts && ncc build -o dist/cleanup src/cleanup.ts",
"test": "jest",
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
"all-but-test": "npm run build && npm run format && npm run lint && npm run package",
"all": "npm run all-but-test && npm test"
},
"repository": {
"type": "git",
@@ -41,7 +42,7 @@
},
"devDependencies": {
"@types/jest": "^27.5.2",
"@types/node": "^17.0.6",
"@types/node": "^18.15.11",
"@types/semver": "^7.3.13",
"@types/uuid": "^8.3.4",
"@typescript-eslint/parser": "^5.8.1",
@@ -49,10 +50,10 @@
"eslint": "^8.6.0",
"eslint-plugin-github": "^4.3.5",
"eslint-plugin-jest": "^25.3.4",
"jest": "^27.4.5",
"jest": "^29.5.0",
"js-yaml": "^4.1.0",
"prettier": "2.5.1",
"ts-jest": "^27.1.2",
"typescript": "^4.2.3"
"ts-jest": "^29.1.0",
"typescript": "^5.0.4"
}
}

View File

@@ -21,6 +21,7 @@ export const GRAALVM_ARCH = determineGraalVMArchitecture()
export const GRAALVM_FILE_EXTENSION = IS_WINDOWS ? '.zip' : '.tar.gz'
export const GRAALVM_GH_USER = 'graalvm'
export const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform
export const GRAALVM_RELEASES_REPO = 'graalvm-ce-builds'
export const JDK_HOME_SUFFIX = IS_MACOS ? '/Contents/Home' : ''
export const MANDREL_NAMESPACE = 'mandrel-'

View File

@@ -167,6 +167,10 @@ export async function save(id: string): Promise<void> {
await cache.saveCache(packageManager.path, primaryKey)
core.info(`Cache saved with the key: ${primaryKey}`)
} catch (error) {
if (!(error instanceof Error)) {
core.info(`Not an Error: ${error}`)
throw error
}
if (error.name === cache.ReserveCacheError.name) {
core.info(error.message)
} else {

View File

@@ -1,19 +1,22 @@
import * as core from '@actions/core'
import {toSemVer} from '../utils'
import {getLatestRelease, toSemVer} from '../utils'
import {lt, major, minor, valid} from 'semver'
import {getLatestReleaseVersion} from '../graalvm'
import {findGraalVMVersion} from '../graalvm'
import {GRAALVM_RELEASES_REPO} from '../constants'
export async function checkForUpdates(
graalVMVersion: string,
javaVersion: string
): Promise<void> {
if (graalVMVersion === '22.3.0' && javaVersion === '11') {
if (graalVMVersion.startsWith('22.3.') && javaVersion === '11') {
core.notice(
'Please consider upgrading your project to Java 17+. The GraalVM 22.3.0 release is the last to support JDK11: https://github.com/oracle/graal/issues/5063'
'Please consider upgrading your project to Java 17+. GraalVM 22.3.X releases are the last to support JDK11: https://github.com/oracle/graal/issues/5063'
)
return
}
const latestGraalVMVersion = await getLatestReleaseVersion()
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestGraalVMVersion = findGraalVMVersion(latestRelease)
const selectedVersion = toSemVer(graalVMVersion)
const latestVersion = toSemVer(latestGraalVMVersion)
if (

View File

@@ -32,7 +32,7 @@ export async function downloadGraalVMEE(
version: string,
javaVersion: string
): Promise<string> {
const userAgent = `GraalVMGitHubAction/1.0.9 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
const userAgent = `GraalVMGitHubAction/1.0.11 (arch:${c.GRAALVM_ARCH}; os:${c.GRAALVM_PLATFORM}; java:${javaVersion})`
const baseArtifact = await fetchArtifact(
userAgent,
'isBase:True',

View File

@@ -7,10 +7,8 @@ import {
import {downloadGraalVMEE} from './gds'
import {downloadTool} from '@actions/tool-cache'
const GRAALVM_CE_DL_BASE =
'https://github.com/graalvm/graalvm-ce-builds/releases/download'
const GRAALVM_CE_DL_BASE = `https://github.com/graalvm/${c.GRAALVM_RELEASES_REPO}/releases/download`
const GRAALVM_REPO_DEV_BUILDS = 'graalvm-ce-dev-builds'
const GRAALVM_REPO_RELEASES = 'graalvm-ce-builds'
const GRAALVM_TAG_PREFIX = 'vm-'
export async function setUpGraalVMLatest(
@@ -20,17 +18,17 @@ export async function setUpGraalVMLatest(
if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion)
}
const latestReleaseVersion = await getLatestReleaseVersion()
return setUpGraalVMRelease(gdsToken, latestReleaseVersion, javaVersion)
const latestRelease = await getLatestRelease(c.GRAALVM_RELEASES_REPO)
const version = findGraalVMVersion(latestRelease)
return setUpGraalVMRelease(gdsToken, version, javaVersion)
}
export async function getLatestReleaseVersion(): Promise<string> {
const latestRelease = await getLatestRelease(GRAALVM_REPO_RELEASES)
const tag_name = latestRelease.tag_name
if (tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
return tag_name.substring(GRAALVM_TAG_PREFIX.length, tag_name.length)
export function findGraalVMVersion(release: c.LatestReleaseResponse['data']) {
const tag_name = release.tag_name
if (!tag_name.startsWith(GRAALVM_TAG_PREFIX)) {
throw new Error(`Could not find latest GraalVM release: ${tag_name}`)
}
throw new Error(`Could not find latest GraalVM release: ${tag_name}`)
return tag_name.substring(GRAALVM_TAG_PREFIX.length, tag_name.length)
}
export async function setUpGraalVMDevBuild(
@@ -41,20 +39,14 @@ export async function setUpGraalVMDevBuild(
throw new Error('Downloading GraalVM EE dev builds is not supported')
}
const latestDevBuild = await getLatestRelease(GRAALVM_REPO_DEV_BUILDS)
const graalVMIdentifier = determineGraalVMIdentifier(
false,
'dev',
javaVersion
)
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
for (const asset of latestDevBuild.assets) {
if (asset.name === expectedFileName) {
return downloadAndExtractJDK(asset.browser_download_url)
}
let resolvedJavaVersion
if (javaVersion == c.VERSION_DEV) {
resolvedJavaVersion = findHighestJavaVersion(latestDevBuild, c.VERSION_DEV)
} else {
resolvedJavaVersion = javaVersion
}
throw new Error(
`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.`
)
const downloadUrl = findDownloadUrl(latestDevBuild, resolvedJavaVersion)
return downloadAndExtractJDK(downloadUrl)
}
export async function setUpGraalVMRelease(
@@ -63,34 +55,110 @@ export async function setUpGraalVMRelease(
javaVersion: string
): Promise<string> {
const isEE = gdsToken.length > 0
const graalVMIdentifier = determineGraalVMIdentifier(
isEE,
version,
javaVersion
)
const toolName = determineToolName(isEE, javaVersion)
const toolName = determineToolName(isEE, version, javaVersion)
let downloader: () => Promise<string>
if (isEE) {
downloader = async () => downloadGraalVMEE(gdsToken, version, javaVersion)
} else {
const downloadUrl = `${GRAALVM_CE_DL_BASE}/${GRAALVM_TAG_PREFIX}${version}/${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
downloader = async () => downloadTool(downloadUrl)
downloader = async () => downloadGraalVMCE(version, javaVersion)
}
return downloadExtractAndCacheJDK(downloader, toolName, version)
}
export function findHighestJavaVersion(
release: c.LatestReleaseResponse['data'],
version: string
): string {
const graalVMIdentifierPattern = determineGraalVMIdentifier(
false,
version,
'(\\d+)'
)
const expectedFileNameRegExp = new RegExp(
`^${graalVMIdentifierPattern}${c.GRAALVM_FILE_EXTENSION.replace(
/\./g,
'\\.'
)}$`
)
let highestJavaVersion = 0
for (const asset of release.assets) {
const matches = asset.name.match(expectedFileNameRegExp)
if (matches) {
const javaVersion = +matches[1]
if (javaVersion > highestJavaVersion) {
highestJavaVersion = javaVersion
}
}
}
if (highestJavaVersion > 0) {
return String(highestJavaVersion)
} else {
throw new Error(
'Could not find highest Java version. Please file an issue at: https://github.com/graalvm/setup-graalvm/issues.'
)
}
}
function findDownloadUrl(
release: c.LatestReleaseResponse['data'],
javaVersion: string
): string {
const graalVMIdentifier = determineGraalVMIdentifier(
false,
c.VERSION_DEV,
javaVersion
)
const expectedFileName = `${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
for (const asset of release.assets) {
if (asset.name === expectedFileName) {
return asset.browser_download_url
}
}
throw new Error(
`Could not find GraalVM dev build for Java ${javaVersion}. It may no longer be available, so please consider upgrading the Java version. If you think this is a mistake, please file an issue at: https://github.com/graalvm/setup-graalvm/issues.`
)
}
function determineGraalVMIdentifier(
isEE: boolean,
version: string,
javaVersion: string
): string {
return `graalvm-${isEE ? 'ee' : 'ce'}-java${javaVersion}-${
c.GRAALVM_PLATFORM
}-${c.GRAALVM_ARCH}-${version}`
return `${determineToolName(isEE, version, javaVersion)}-${
c.GRAALVM_ARCH
}-${version}`
}
function determineToolName(isEE: boolean, javaVersion: string): string {
return `graalvm-${isEE ? 'ee' : 'ce'}-java${javaVersion}-${
c.GRAALVM_PLATFORM
}`
function determineToolName(
isEE: boolean,
version: string,
javaVersion: string
): string {
const infix = isEE ? 'ee' : version === c.VERSION_DEV ? 'community' : 'ce'
return `graalvm-${infix}-java${javaVersion}-${c.GRAALVM_PLATFORM}`
}
async function downloadGraalVMCE(
version: string,
javaVersion: string
): Promise<string> {
const graalVMIdentifier = determineGraalVMIdentifier(
false,
version,
javaVersion
)
const downloadUrl = `${GRAALVM_CE_DL_BASE}/${GRAALVM_TAG_PREFIX}${version}/${graalVMIdentifier}${c.GRAALVM_FILE_EXTENSION}`
try {
return await downloadTool(downloadUrl)
} catch (error) {
if (error instanceof Error && error.message.includes('404')) {
// Not Found
throw new Error(
`Failed to download ${graalVMIdentifier}. Are you sure version: '${version}' and java-version: '${javaVersion}' are correct?`
)
}
throw new Error(
`Failed to download ${graalVMIdentifier} (error: ${error}).`
)
}
}

View File

@@ -27,7 +27,7 @@ async function run(): Promise<void> {
const enableNativeImageMusl = core.getInput(c.INPUT_NI_MUSL) === 'true'
if (c.IS_WINDOWS) {
setUpWindowsEnvironment()
setUpWindowsEnvironment(graalvmVersion)
}
await setUpDependencies(components)
if (enableNativeImageMusl) {

View File

@@ -1,18 +1,25 @@
import * as core from '@actions/core'
import {execSync} from 'child_process'
import {existsSync} from 'fs'
import {VERSION_DEV} from './constants'
// Keep in sync with https://github.com/actions/virtual-environments
const KNOWN_VISUAL_STUDIO_INSTALLATIONS = [
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise', // 'windows-2016'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise', // 'windows-2019' and 'windows-latest'
'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise' // 'windows-2022'
'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise', // 'windows-2022' and 'windows-latest'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise', // 'windows-2019'
'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise' // 'windows-2016' (deprecated and removed)
]
const VCVARSALL_SUBPATH = '\\VC\\Auxiliary\\Build\\vcvarsall.bat'
if (process.env['VSINSTALLDIR']) {
// if VSINSTALLDIR is set, make it the first known installation
KNOWN_VISUAL_STUDIO_INSTALLATIONS.unshift(
process.env['VSINSTALLDIR'].replace(/\\$/, '')
)
}
const VCVARSALL_SUBPATH = 'VC\\Auxiliary\\Build\\vcvarsall.bat'
function findVcvarsallPath(): string {
for (const installation of KNOWN_VISUAL_STUDIO_INSTALLATIONS) {
const candidate = `${installation}${VCVARSALL_SUBPATH}`
const candidate = `${installation}\\${VCVARSALL_SUBPATH}`
if (existsSync(candidate)) {
return candidate
}
@@ -20,7 +27,11 @@ function findVcvarsallPath(): string {
throw new Error('Failed to find vcvarsall.bat')
}
export function setUpWindowsEnvironment(): void {
export function setUpWindowsEnvironment(graalVMVersion: string): void {
if (graalVMVersion === VERSION_DEV) {
return // no longer required in dev builds
}
core.startGroup('Updating Windows environment...')
const vcvarsallPath = findVcvarsallPath()

View File

@@ -9,9 +9,9 @@ import {Octokit} from '@octokit/core'
import {createHash} from 'crypto'
import {join} from 'path'
// Set up Octokit in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'
const GitHub = Octokit.defaults({
// Set up Octokit for github.com only and in the same way as @actions/github (see https://git.io/Jy9YP)
const baseUrl = 'https://api.github.com'
const GitHubDotCom = Octokit.defaults({
baseUrl,
request: {
agent: new httpClient.HttpClient().getAgent(baseUrl)
@@ -38,7 +38,7 @@ export async function getLatestRelease(
): Promise<c.LatestReleaseResponse['data']> {
const githubToken = getGitHubToken()
const options = githubToken.length > 0 ? {auth: githubToken} : {}
const octokit = new GitHub(options)
const octokit = new GitHubDotCom(options)
return (
await octokit.request('GET /repos/{owner}/{repo}/releases/latest', {
owner: c.GRAALVM_GH_USER,