mirror of
https://github.com/actions/runner-images.git
synced 2025-12-28 12:48:21 +08:00
[Windows] Docker, .NET Core and NPM improvements (#3811)
* improve InitializeVM script * Update windows2019.json * remove configs * resolve comments * resolve comments; fix order * fix templates * move Node.js packages to toolset * dotnet warmup and merge docker scripts * Update Node.Tests.ps1 * Update Install-Docker.ps1 * fix node.js tests * fix npm package installation * Update Install-NodeLts.ps1 * fix tests * fix test
This commit is contained in:
@@ -12,4 +12,15 @@ Start-Service docker
|
||||
Write-Host "Install-Package Docker-Compose"
|
||||
Choco-Install -PackageName docker-compose
|
||||
|
||||
Invoke-PesterTests -TestFile "Docker" -TestName "Docker"
|
||||
$dockerImages = (Get-ToolsetContent).docker.images
|
||||
foreach ($dockerImage in $dockerImages) {
|
||||
Write-Host "Pulling docker image $dockerImage ..."
|
||||
docker pull $dockerImage
|
||||
|
||||
if (!$?) {
|
||||
Write-Host "Docker pull failed with a non-zero exit code"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile "Docker"
|
||||
@@ -12,16 +12,26 @@ Set-SystemVariable -SystemVariable DOTNET_MULTILEVEL_LOOKUP -Value "0"
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
||||
|
||||
$templates = @(
|
||||
'console',
|
||||
'mstest',
|
||||
'web',
|
||||
'mvc',
|
||||
'webapi'
|
||||
)
|
||||
function Invoke-Warmup (
|
||||
$SdkVersion
|
||||
) {
|
||||
# warm up dotnet for first time experience
|
||||
$projectTypes = @('console', 'mstest', 'web', 'mvc', 'webapi')
|
||||
$projectTypes | ForEach-Object {
|
||||
$template = $_
|
||||
$projectPath = Join-Path -Path C:\temp -ChildPath $template
|
||||
New-Item -Path $projectPath -Force -ItemType Directory
|
||||
Push-Location -Path $projectPath
|
||||
& $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion"
|
||||
& $env:ProgramFiles\dotnet\dotnet.exe new $template
|
||||
Pop-Location
|
||||
Remove-Item $projectPath -Force -Recurse
|
||||
}
|
||||
}
|
||||
|
||||
function InstallSDKVersion (
|
||||
$sdkVersion
|
||||
$SdkVersion,
|
||||
$Warmup
|
||||
)
|
||||
{
|
||||
if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion"))
|
||||
@@ -40,16 +50,8 @@ function InstallSDKVersion (
|
||||
$sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets"
|
||||
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
|
||||
|
||||
# warm up dotnet for first time experience
|
||||
$templates | ForEach-Object {
|
||||
$template = $_
|
||||
$projectPath = Join-Path -Path C:\temp -ChildPath $template
|
||||
New-Item -Path $projectPath -Force -ItemType Directory
|
||||
Push-Location -Path $projectPath
|
||||
& $env:ProgramFiles\dotnet\dotnet.exe new globaljson --sdk-version "$sdkVersion"
|
||||
& $env:ProgramFiles\dotnet\dotnet.exe new $template
|
||||
Pop-Location
|
||||
Remove-Item $projectPath -Force -Recurse
|
||||
if ($Warmup) {
|
||||
Invoke-Warmup -SdkVersion $SdkVersion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +59,9 @@ function InstallAllValidSdks()
|
||||
{
|
||||
# Consider all channels except preview/eol channels.
|
||||
# Sort the channels in ascending order
|
||||
$dotnetVersions = (Get-ToolsetContent).dotnet.versions
|
||||
$dotnetToolset = (Get-ToolsetContent).dotnet
|
||||
$dotnetVersions = $dotnetToolset.versions
|
||||
$warmup = $dotnetToolset.warmup
|
||||
|
||||
# Download installation script.
|
||||
$installationName = "dotnet-install.ps1"
|
||||
@@ -93,7 +97,7 @@ function InstallAllValidSdks()
|
||||
elseif (!$release.'sdk'.'version'.Contains('-'))
|
||||
{
|
||||
$sdkVersion = $release.'sdk'.'version'
|
||||
InstallSDKVersion -sdkVersion $sdkVersion
|
||||
InstallSDKVersion -SdkVersion $sdkVersion -Warmup $warmup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,9 @@ $env:npm_config_prefix = $PrefixPath
|
||||
npm config set cache $CachePath --global
|
||||
npm config set registry https://registry.npmjs.org/
|
||||
|
||||
npm install -g cordova
|
||||
npm install -g grunt-cli
|
||||
npm install -g gulp-cli
|
||||
npm install -g parcel-bundler
|
||||
npm install -g --save-dev webpack webpack-cli
|
||||
npm install -g yarn
|
||||
npm install -g lerna
|
||||
npm install -g node-sass
|
||||
npm install -g newman
|
||||
$globalNpmPackages = (Get-ToolsetContent).npm.global_packages
|
||||
$globalNpmPackages | ForEach-Object {
|
||||
npm install -g $_.name
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile "Node"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
################################################################################
|
||||
## File: Install-TypeScript.ps1
|
||||
## Desc: Install Latest TypeScript
|
||||
################################################################################
|
||||
|
||||
npm install -g typescript
|
||||
|
||||
Invoke-PesterTests -TestFile "Tools" -TestName "Typescript"
|
||||
@@ -1,24 +0,0 @@
|
||||
################################################################################
|
||||
## File: Update-DockerImages.ps1
|
||||
## Desc: Pull some standard docker images.
|
||||
## Must be run after docker is installed.
|
||||
################################################################################
|
||||
|
||||
function DockerPull {
|
||||
Param ([string]$image)
|
||||
|
||||
Write-Host Installing $image ...
|
||||
docker pull $image
|
||||
|
||||
if (!$?) {
|
||||
Write-Host "Docker pull failed with a non-zero exit code"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$dockerToolset = (Get-ToolsetContent).docker
|
||||
foreach($dockerImage in $dockerToolset.images) {
|
||||
DockerPull $dockerImage
|
||||
}
|
||||
|
||||
Invoke-PesterTests -TestFile "Docker" -TestName "DockerImages"
|
||||
Reference in New Issue
Block a user