2019-10-17 02:57:45 +00:00
|
|
|
#!/usr/bin/env powershell
|
|
|
|
|
|
|
|
#Requires -Version 5
|
2019-11-12 20:47:40 +00:00
|
|
|
$ErrorActionPreference = 'Stop'
|
2019-10-17 02:57:45 +00:00
|
|
|
$env:HAB_ORIGIN = 'ci'
|
2019-10-21 21:46:04 +00:00
|
|
|
$env:CHEF_LICENSE = 'accept-no-persist'
|
2019-10-21 23:16:37 +00:00
|
|
|
$env:HAB_LICENSE = 'accept-no-persist'
|
2019-10-17 02:57:45 +00:00
|
|
|
$Plan = 'inspec'
|
|
|
|
|
|
|
|
Write-Host "--- system details"
|
|
|
|
$Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
|
|
|
|
Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
|
|
|
|
|
|
|
|
Write-Host "--- Installing the version of Habitat required"
|
2019-11-06 22:20:27 +00:00
|
|
|
$hab_version = (hab --version)
|
|
|
|
$hab_minor_version = $hab_version.split('.')[1]
|
|
|
|
if ( -not $? -Or $hab_minor_version -lt 85 ) {
|
2019-11-06 22:31:47 +00:00
|
|
|
Install-Habitat --version 0.85.0.20190916
|
2019-11-06 22:20:27 +00:00
|
|
|
} else {
|
|
|
|
Write-Host ":habicat: I think I have the version I need to build."
|
|
|
|
}
|
|
|
|
|
2019-10-17 02:57:45 +00:00
|
|
|
|
|
|
|
Write-Host "--- Generating fake origin key"
|
|
|
|
hab origin key generate $env:HAB_ORIGIN
|
|
|
|
|
|
|
|
Write-Host "--- Building $Plan"
|
|
|
|
$project_root = "$(git rev-parse --show-toplevel)"
|
|
|
|
Set-Location $project_root
|
|
|
|
|
2019-11-06 22:20:27 +00:00
|
|
|
$env:DO_CHECK=$true; hab pkg build .
|
2019-10-17 02:57:45 +00:00
|
|
|
|
2019-10-22 19:23:31 +00:00
|
|
|
. $project_root/results/last_build.ps1
|
2019-10-17 02:57:45 +00:00
|
|
|
|
2019-10-22 23:17:06 +00:00
|
|
|
Write-Host "--- Installing $pkg_ident/$pkg_artifact"
|
2019-11-06 22:20:27 +00:00
|
|
|
hab pkg install -b $project_root/results/$pkg_artifact
|
2019-11-12 20:47:40 +00:00
|
|
|
|
|
|
|
Write-Host "--- Downloading Ruby + DevKit"
|
|
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
(New-Object System.Net.WebClient).DownloadFile('https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-devkit-2.6.5-1-x64.exe', 'c:\\rubyinstaller-devkit-2.6.5-1-x64.exe')
|
|
|
|
|
|
|
|
Write-Host "--- Installing Ruby + DevKit"
|
|
|
|
Start-Process c:\rubyinstaller-devkit-2.6.5-1-x64.exe -ArgumentList '/verysilent /dir=C:\\ruby26' -Wait
|
|
|
|
|
|
|
|
Write-Host "--- Cleaning up installation"
|
|
|
|
Remove-Item c:\rubyinstaller-devkit-2.6.5-1-x64.exe -Force
|
|
|
|
|
|
|
|
$Env:Path += ";C:\ruby26\bin;C:\hab\bin"
|
2019-10-17 02:57:45 +00:00
|
|
|
|
|
|
|
Write-Host "+++ Testing $Plan"
|
2019-11-06 22:31:47 +00:00
|
|
|
|
2019-10-17 02:57:45 +00:00
|
|
|
Push-Location $project_root/test/artifact
|
|
|
|
rake
|
2019-12-18 20:12:05 +00:00
|
|
|
If ($lastexitcode -ne 0) { Exit $lastexitcode }
|