mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 06:08:07 +00:00
Add Julia 1.3.1
This commit is contained in:
50
images/linux/scripts/installers/julia.sh
Normal file
50
images/linux/scripts/installers/julia.sh
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
## File: julia.sh
|
||||
## Desc: Installs Julia, and adds Julia to the path
|
||||
################################################################################
|
||||
|
||||
# Source the helpers for use with the script
|
||||
source $HELPER_SCRIPTS/document.sh
|
||||
|
||||
# This function installs Julia using the specified arguments:
|
||||
# $1=MajorVersion (1.3)
|
||||
# $2=MajorAndMinorVersion (1.3.1)
|
||||
# $3=IsDefaultVersion (true or false)
|
||||
|
||||
function InstallJulia () {
|
||||
curl -sL "https://julialang-s3.julialang.org/bin/linux/x64/$1/julia-$2-linux-x86_64.tar.gz" -o "julia-$2-linux-x86_64.tar.gz"
|
||||
mkdir -p "/usr/local/julia$1"
|
||||
tar -C "/usr/local/julia$1" -xzf "julia-$2-linux-x86_64.tar.gz" --strip-components=1 julia
|
||||
rm "julia-$2-linux-x86_64.tar.gz"
|
||||
|
||||
# If this version of Julia is to be the default version,
|
||||
# symlink it into the path
|
||||
if [ "$3" = true ]; then
|
||||
ln -s "/usr/local/julia$1/bin/julia" /usr/bin/julia
|
||||
fi
|
||||
|
||||
# Run tests to determine that the software installed as expected
|
||||
echo "Testing to make sure that script performed as expected, and basic scenarios work"
|
||||
|
||||
# If this version of Julia is to be the default version,
|
||||
# check that it has been added to PATH
|
||||
if [ "$3" = true ]; then
|
||||
if ! command -v julia; then
|
||||
echo "Julia was not installed or found on PATH"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Verify output of julia --version
|
||||
if [ ! "$(/usr/local/julia"$1"/bin/julia --version)" = "julia version $2" ]; then
|
||||
echo "Julia was not installed correctly"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Document what was added to the image
|
||||
echo "Lastly, documenting what we added to the metadata file"
|
||||
DocumentInstalledItem "Julia ($(julia --version))"
|
||||
}
|
||||
|
||||
InstallJulia 1.3 1.3.1 true
|
||||
62
images/win/scripts/Installers/Install-Julia.ps1
Normal file
62
images/win/scripts/Installers/Install-Julia.ps1
Normal file
@@ -0,0 +1,62 @@
|
||||
################################################################################
|
||||
## File: Install-Julia.ps1
|
||||
## Desc: Install Julia
|
||||
################################################################################
|
||||
|
||||
Import-Module -Name ImageHelpers -Force
|
||||
function Install-JuliaVersion
|
||||
{
|
||||
Param
|
||||
(
|
||||
[String]$juliaVersion,
|
||||
[Switch]$addToDefaultPath
|
||||
)
|
||||
|
||||
# Split versions.
|
||||
$juliaMajorVersion = $juliaVersion.split(".")[0] + "." + $juliaVersion.split(".")[1]
|
||||
|
||||
# Download the Julia installer.
|
||||
Write-Host "Downloading Julia $juliaVersion..."
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
Invoke-WebRequest -UseBasicParsing -Uri "https://julialang-s3.julialang.org/bin/winnt/x64/$juliaMajorVersion/julia-$juliaVersion-win64.exe" -OutFile "julia-$juliaVersion-win64.exe"
|
||||
|
||||
# Install Julia.
|
||||
# The installer will change in Julia 1.4. For future-proofing, a version check is run.
|
||||
if ( $juliaMajorVersion -ge "1.4")
|
||||
{
|
||||
Start-Process -FilePath "julia-$juliaVersion-win64.exe" -ArgumentList "/SILENT /dir=C:\Julia" -NoNewWindow -Wait
|
||||
}
|
||||
else
|
||||
{
|
||||
Start-Process -FilePath "julia-$juliaVersion-win64.exe" -ArgumentList "/S /D=C:\Julia" -NoNewWindow -Wait
|
||||
}
|
||||
|
||||
# Delete unnecessary files to conserve space.
|
||||
Write-Host "Deleting downloaded installer..."
|
||||
Remove-Item "julia-$juliaVersion-win64.exe"
|
||||
|
||||
# Make this the default version of Julia?
|
||||
if ($addToDefaultPath)
|
||||
{
|
||||
Write-Host "Adding Julia $juliaVersion to the path..."
|
||||
# Add the Julia binaries to the path.
|
||||
Add-MachinePathItem "C:\Julia\Julia-$juliaVersion\bin" | Out-Null
|
||||
}
|
||||
|
||||
# Done
|
||||
Write-Host "Done installing Julia $juliaVersion."
|
||||
return "C:\Julia\Julia-$juliaVersion"
|
||||
}
|
||||
|
||||
# Install Julia
|
||||
$juliaVersionsToInstall = $env:JULIA_VERSIONS.split(",")
|
||||
|
||||
foreach($julia in $juliaVersionsToInstall) {
|
||||
Write-Host "Installing Julia ${julia}"
|
||||
if($julia -eq $env:JULIA_DEFAULT) {
|
||||
$installDirectory = Install-JuliaVersion -juliaVersion $julia -addToDefaultPath
|
||||
} else {
|
||||
$installDirectory = Install-JuliaVersion -juliaVersion $julia
|
||||
}
|
||||
setx $envName "$installDirectory" /M
|
||||
}
|
||||
49
images/win/scripts/Installers/Validate-Julia.ps1
Normal file
49
images/win/scripts/Installers/Validate-Julia.ps1
Normal file
@@ -0,0 +1,49 @@
|
||||
################################################################################
|
||||
## File: Validate-Julia.ps1
|
||||
## Desc: Validate Julia
|
||||
################################################################################
|
||||
|
||||
# Verify that julia.exe is on the path
|
||||
if(Get-Command -Name 'julia')
|
||||
{
|
||||
Write-Host "$(julia --version) is on the path."
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Julia is not on the path."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Add details of available versions in Markdown
|
||||
$tmplMark = @"
|
||||
#### {0}
|
||||
|
||||
_Environment:_
|
||||
* {1}: root directory of the Julia {0} installation
|
||||
|
||||
"@
|
||||
|
||||
$tmplMarkRoot = @"
|
||||
#### {0}
|
||||
|
||||
_Environment:_
|
||||
* PATH: contains the location of julia.exe version {0}
|
||||
* {1}: root directory of the Julia {0} installation
|
||||
"@
|
||||
|
||||
$SoftwareName = "Julia (x64)"
|
||||
$Description = New-Object System.Text.StringBuilder
|
||||
$juliaVersionsToInstall = $env:JULIA_VERSIONS.split(",")
|
||||
|
||||
foreach($julia in $juliaVersionsToInstall) {
|
||||
$juliaVersion = Get-JuliaVersion
|
||||
if ($juliaVersion -eq $julia) {
|
||||
if($julia -eq $env:JULIA_DEFAULT) {
|
||||
$null = $Description.AppendLine(($tmplMarkRoot -f $juliaVersion))
|
||||
} else {
|
||||
$null = $Description.AppendLine(($tmplMark -f $juliaVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description.ToString()
|
||||
Reference in New Issue
Block a user