Skip to content

Instantly share code, notes, and snippets.

@gabriel-samfira
Last active August 31, 2023 11:08
Show Gist options
  • Save gabriel-samfira/c80ccb1d79be737e5e61214181e48ad8 to your computer and use it in GitHub Desktop.
Save gabriel-samfira/c80ccb1d79be737e5e61214181e48ad8 to your computer and use it in GitHub Desktop.
Installs needed dependencies
# Prepare windows environment for building and running containerd tests
$PACKAGES= @{ mingw = "12.2.0"; git = ""; golang = ""; make = ""}
Write-Host "Downloading chocolatey package"
curl.exe -L "https://packages.chocolatey.org/chocolatey.0.10.15.nupkg" -o 'c:\choco.zip'
Expand-Archive "c:\choco.zip" -DestinationPath "c:\choco"
Write-Host "Installing choco"
& "c:\choco\tools\chocolateyInstall.ps1"
Write-Host "Set choco.exe path."
$env:PATH+=";C:\ProgramData\chocolatey\bin"
Write-Host "Install necessary packages"
foreach ($package in $PACKAGES.Keys) {
$command = "choco.exe install $package --yes"
$version = $PACKAGES[$package]
if (-Not [string]::IsNullOrEmpty($version)) {
$command += " --version $version"
}
Invoke-Expression $command
}
Write-Host "Set up environment."
$userGoBin = "$HOME\go\bin"
if (!(Test-Path $userGoBin)){
mkdir $userGoBin
}
$env:PATH+=";c:\Program Files\Git\bin;c:\Program Files\Go\bin;$userGoBin;c:\containerd\bin"
Write-Host $env:PATH
[Environment]::SetEnvironmentVariable("PATH", $env:PATH, 'User')
# Prepare Log dir
mkdir c:\Logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment