mirror of
https://github.com/julia-actions/setup-julia.git
synced 2026-02-12 02:56:54 +08:00
Fix Windows install script
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import * as installer from '../src/installer'
|
import * as installer from '../src/installer'
|
||||||
|
|
||||||
|
import * as semver from 'semver'
|
||||||
|
|
||||||
const testVersions = ['v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0']
|
const testVersions = ['v1.3.0-rc4', 'v1.3.0-rc3', 'v1.3.0-rc2', 'v1.0.5', 'v1.2.0', 'v1.3.0-rc1', 'v1.2.0-rc3', 'v1.3.0-alpha', 'v1.2.0-rc2', 'v1.2.0-rc1', 'v1.1.1', 'v1.0.4', 'v1.1.0', 'v1.1.0-rc2', 'v1.1.0-rc1', 'v1.0.3', 'v1.0.2', 'v1.0.1', 'v1.0.0']
|
||||||
|
|
||||||
describe('installer tests', () => {
|
describe('installer tests', () => {
|
||||||
@@ -28,4 +30,14 @@ describe('installer tests', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
describe('node-semver behaviour', () => {
|
||||||
|
describe('Windows installer change', () => {
|
||||||
|
it('Correctly understands >1.4.0', () => {
|
||||||
|
expect(semver.gtr('1.4.0-rc1', '1.3', {includePrerelease: true})).toBeTruthy()
|
||||||
|
expect(semver.gtr('1.4.0-DEV', '1.3', {includePrerelease: true})).toBeTruthy()
|
||||||
|
expect(semver.gtr('1.3.1', '1.3', {includePrerelease: true})).toBeFalsy()
|
||||||
|
expect(semver.gtr('1.3.2-rc1', '1.3', {includePrerelease: true})).toBeFalsy()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
8
lib/installer.js
generated
8
lib/installer.js
generated
@@ -119,7 +119,13 @@ function installJulia(version, arch) {
|
|||||||
return `${process.env.HOME}/julia`;
|
return `${process.env.HOME}/julia`;
|
||||||
case 'win32':
|
case 'win32':
|
||||||
const juliaInstallationPath = path.join('C:', 'Julia');
|
const juliaInstallationPath = path.join('C:', 'Julia');
|
||||||
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
if (version == 'nightly' || semver.gtr(version, '1.3', { includePrerelease: true })) {
|
||||||
|
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
|
||||||
|
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yield exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`]);
|
||||||
|
}
|
||||||
return juliaInstallationPath;
|
return juliaInstallationPath;
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
yield exec.exec('hdiutil', ['attach', juliaDownloadPath]);
|
||||||
|
|||||||
@@ -112,7 +112,12 @@ export async function installJulia(version: string, arch: string): Promise<strin
|
|||||||
return `${process.env.HOME}/julia`
|
return `${process.env.HOME}/julia`
|
||||||
case 'win32':
|
case 'win32':
|
||||||
const juliaInstallationPath = path.join('C:', 'Julia')
|
const juliaInstallationPath = path.join('C:', 'Julia')
|
||||||
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
if (version == 'nightly' || semver.gtr(version, '1.3', {includePrerelease: true})) {
|
||||||
|
// The installer changed in 1.4: https://github.com/JuliaLang/julia/blob/ef0c9108b12f3ae177c51037934351ffa703b0b5/NEWS.md#build-system-changes
|
||||||
|
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/SILENT /dir=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||||
|
} else {
|
||||||
|
await exec.exec('powershell', ['-Command', `Start-Process -FilePath ${juliaDownloadPath} -ArgumentList "/S /D=${juliaInstallationPath}" -NoNewWindow -Wait`])
|
||||||
|
}
|
||||||
return juliaInstallationPath
|
return juliaInstallationPath
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
await exec.exec('hdiutil', ['attach', juliaDownloadPath])
|
||||||
|
|||||||
Reference in New Issue
Block a user