mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 22:26:56 +00: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"
|
Write-Host "Install-Package Docker-Compose"
|
||||||
Choco-Install -PackageName 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"
|
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12"
|
||||||
|
|
||||||
$templates = @(
|
function Invoke-Warmup (
|
||||||
'console',
|
$SdkVersion
|
||||||
'mstest',
|
) {
|
||||||
'web',
|
# warm up dotnet for first time experience
|
||||||
'mvc',
|
$projectTypes = @('console', 'mstest', 'web', 'mvc', 'webapi')
|
||||||
'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 (
|
function InstallSDKVersion (
|
||||||
$sdkVersion
|
$SdkVersion,
|
||||||
|
$Warmup
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!(Test-Path -Path "C:\Program Files\dotnet\sdk\$sdkVersion"))
|
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"
|
$sdkTargetsPath = "C:\Program Files\dotnet\sdk\$sdkVersion\Sdks\Microsoft.NET.Sdk\targets"
|
||||||
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
|
Start-DownloadWithRetry -Url $sdkTargetsUrl -DownloadPath $sdkTargetsPath -Name $sdkTargetsName
|
||||||
|
|
||||||
# warm up dotnet for first time experience
|
if ($Warmup) {
|
||||||
$templates | ForEach-Object {
|
Invoke-Warmup -SdkVersion $SdkVersion
|
||||||
$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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +59,9 @@ function InstallAllValidSdks()
|
|||||||
{
|
{
|
||||||
# Consider all channels except preview/eol channels.
|
# Consider all channels except preview/eol channels.
|
||||||
# Sort the channels in ascending order
|
# Sort the channels in ascending order
|
||||||
$dotnetVersions = (Get-ToolsetContent).dotnet.versions
|
$dotnetToolset = (Get-ToolsetContent).dotnet
|
||||||
|
$dotnetVersions = $dotnetToolset.versions
|
||||||
|
$warmup = $dotnetToolset.warmup
|
||||||
|
|
||||||
# Download installation script.
|
# Download installation script.
|
||||||
$installationName = "dotnet-install.ps1"
|
$installationName = "dotnet-install.ps1"
|
||||||
@@ -93,7 +97,7 @@ function InstallAllValidSdks()
|
|||||||
elseif (!$release.'sdk'.'version'.Contains('-'))
|
elseif (!$release.'sdk'.'version'.Contains('-'))
|
||||||
{
|
{
|
||||||
$sdkVersion = $release.'sdk'.'version'
|
$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 cache $CachePath --global
|
||||||
npm config set registry https://registry.npmjs.org/
|
npm config set registry https://registry.npmjs.org/
|
||||||
|
|
||||||
npm install -g cordova
|
$globalNpmPackages = (Get-ToolsetContent).npm.global_packages
|
||||||
npm install -g grunt-cli
|
$globalNpmPackages | ForEach-Object {
|
||||||
npm install -g gulp-cli
|
npm install -g $_.name
|
||||||
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
|
|
||||||
|
|
||||||
Invoke-PesterTests -TestFile "Node"
|
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"
|
|
||||||
@@ -4,18 +4,16 @@ Describe "Node.JS" {
|
|||||||
@{ ToolName = "node" }
|
@{ ToolName = "node" }
|
||||||
@{ ToolName = "npm" }
|
@{ ToolName = "npm" }
|
||||||
) {
|
) {
|
||||||
"$ToolName --version" | Should -ReturnZeroExitCode
|
"$ToolName --version" | Should -ReturnZeroExitCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$globalNpmPackages = (Get-ToolsetContent).npm.global_packages
|
||||||
|
$globalNpmPackagesWithTests = $globalNpmPackages | Where-Object { $_.test } | ForEach-Object { @{ Name = $_.name; Test = $_.test } }
|
||||||
|
|
||||||
Context "Global NPM Packages" {
|
Context "Global NPM Packages" {
|
||||||
It "<ToolName> " -TestCases @(
|
It "<Name>" -TestCases $globalNpmPackagesWithTests {
|
||||||
@{ ToolName = "gulp" }
|
$Test | Should -ReturnZeroExitCode
|
||||||
@{ ToolName = "grunt" }
|
|
||||||
@{ ToolName = "yarn" }
|
|
||||||
@{ ToolName = "lerna" }
|
|
||||||
@{ ToolName = "newman" }
|
|
||||||
) {
|
|
||||||
"$ToolName --version" | Should -ReturnZeroExitCode
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,12 +139,6 @@ Describe "Stack" {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Describe "Typescript" {
|
|
||||||
It "tsc" {
|
|
||||||
"tsc --version" | Should -ReturnZeroExitCode
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Describe "Vcpkg" {
|
Describe "Vcpkg" {
|
||||||
It "vcpkg" {
|
It "vcpkg" {
|
||||||
"vcpkg version" | Should -ReturnZeroExitCode
|
"vcpkg version" | Should -ReturnZeroExitCode
|
||||||
|
|||||||
@@ -340,12 +340,28 @@
|
|||||||
"cmd": "yamllint --version"
|
"cmd": "yamllint --version"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"npm": {
|
||||||
|
"global_packages": [
|
||||||
|
{ "name": "yarn", "test": "yarn --version" },
|
||||||
|
{ "name": "newman", "test": "newman --version" },
|
||||||
|
{ "name": "lerna", "test": "lerna --version" },
|
||||||
|
{ "name": "typescript", "test": "tsc --version" },
|
||||||
|
{ "name": "cordova" },
|
||||||
|
{ "name": "grunt-cli", "test": "grunt --version" },
|
||||||
|
{ "name": "gulp-cli", "test": "gulp --version" },
|
||||||
|
{ "name": "parcel-bundler" },
|
||||||
|
{ "name": "webpack" },
|
||||||
|
{ "name": "webpack-cli" },
|
||||||
|
{ "name": "node-sass" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"dotnet": {
|
"dotnet": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.1",
|
"2.1",
|
||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
],
|
||||||
|
"warmup": true
|
||||||
},
|
},
|
||||||
"choco": {
|
"choco": {
|
||||||
"common_packages": [
|
"common_packages": [
|
||||||
|
|||||||
@@ -368,12 +368,28 @@
|
|||||||
"cmd": "yamllint --version"
|
"cmd": "yamllint --version"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"npm": {
|
||||||
|
"global_packages": [
|
||||||
|
{ "name": "yarn", "test": "yarn --version" },
|
||||||
|
{ "name": "newman", "test": "newman --version" },
|
||||||
|
{ "name": "lerna", "test": "lerna --version" },
|
||||||
|
{ "name": "typescript", "test": "tsc --version" },
|
||||||
|
{ "name": "cordova" },
|
||||||
|
{ "name": "grunt-cli", "test": "grunt --version" },
|
||||||
|
{ "name": "gulp-cli", "test": "gulp --version" },
|
||||||
|
{ "name": "parcel-bundler" },
|
||||||
|
{ "name": "webpack" },
|
||||||
|
{ "name": "webpack-cli" },
|
||||||
|
{ "name": "node-sass" }
|
||||||
|
]
|
||||||
|
},
|
||||||
"dotnet": {
|
"dotnet": {
|
||||||
"versions": [
|
"versions": [
|
||||||
"2.1",
|
"2.1",
|
||||||
"3.1",
|
"3.1",
|
||||||
"5.0"
|
"5.0"
|
||||||
]
|
],
|
||||||
|
"warmup": true
|
||||||
},
|
},
|
||||||
"choco": {
|
"choco": {
|
||||||
"common_packages": [
|
"common_packages": [
|
||||||
|
|||||||
@@ -172,7 +172,6 @@
|
|||||||
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}"
|
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"{{ template_dir }}/scripts/Installers/Update-DockerImages.ps1",
|
|
||||||
"{{ template_dir }}/scripts/Installers/Install-KubernetesTools.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-KubernetesTools.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-VS.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-VS.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-NET48.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-NET48.ps1",
|
||||||
@@ -304,7 +303,6 @@
|
|||||||
"type": "powershell",
|
"type": "powershell",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Mingw64.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Mingw64.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-TypeScript.ps1",
|
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Haskell.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Haskell.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Stack.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Stack.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1",
|
||||||
|
|||||||
@@ -180,7 +180,6 @@
|
|||||||
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}"
|
"TOOLSET_JSON_PATH={{user `toolset_json_path`}}"
|
||||||
],
|
],
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"{{ template_dir }}/scripts/Installers/Update-DockerImages.ps1",
|
|
||||||
"{{ template_dir }}/scripts/Installers/Install-KubernetesTools.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-KubernetesTools.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-VS.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-VS.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-NET48.ps1"
|
"{{ template_dir }}/scripts/Installers/Install-NET48.ps1"
|
||||||
@@ -287,7 +286,6 @@
|
|||||||
"{{ template_dir }}/scripts/Installers/Install-SQLPowerShellTools.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-SQLPowerShellTools.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-DotnetSDK.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Mingw64.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Mingw64.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-TypeScript.ps1",
|
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Haskell.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Haskell.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Stack.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Stack.ps1",
|
||||||
"{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1",
|
"{{ template_dir }}/scripts/Installers/Install-Miniconda.ps1",
|
||||||
|
|||||||
Reference in New Issue
Block a user