diff --git a/.expeditor/prep_environment.ps1 b/.expeditor/prep_environment.ps1 new file mode 100644 index 0000000..0d16f8d --- /dev/null +++ b/.expeditor/prep_environment.ps1 @@ -0,0 +1,39 @@ +param (string $Ruby) + +Set-ExecutionPolicy Bypass +$ErrorActionPreference='Stop' +$ProgressPreference='SilentlyContinue' +$env:chocolateyVersion="1.4.0" + +Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + +Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 +choco feature enable -n=allowGlobalConfirmation +choco config set cacheLocation C:\chococache +choco upgrade chocolatey +choco install git +Remove-Item -Recurse -Force c:\chococache + +if($Ruby -eq "3.0") +{ + $env:RUBY_URL="https://github.com/oneclick/rubyinstaller3/releases/download/RubyInstaller-3.0.6-1/rubyinstaller-3.0.6-1-x64.exe" + $env:RUBY_FILE="rubyinstaller-3.0.6-1-x64.exe" + $env:RUBY_DIR="c:/ruby30" +} +if($Ruby -eq "3.1") +{ + $env:RUBY_URL="https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.4-1/rubyinstaller-3.1.4-1-x64.exe" + $env:RUBY_FILE="rubyinstaller-3.1.4-1-x64.exe" + $env:RUBY_DIR="c:/ruby31" +} + +# Install Ruby + Devkit +Write-Output 'Downloading Ruby + DevKit'; \ + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; \ + (New-Object System.Net.WebClient).DownloadFile("$env:RUBY_URL", "c:/$env:RUBY_FILE") + +Write-Output 'Installing Ruby + DevKit' +Start-Process "c:/$env:RUBY_FILE" -ArgumentList "/allusers /verysilent /dir=$env:RUBY_DIR" -Wait + +Write-Output 'Cleaning up installation' +Remove-Item "c:/$env:RUBY_FILE" -Force diff --git a/.expeditor/run_windows_tests.ps1 b/.expeditor/run_windows_tests.ps1 index f048b32..459c399 100644 --- a/.expeditor/run_windows_tests.ps1 +++ b/.expeditor/run_windows_tests.ps1 @@ -1,5 +1,44 @@ -# Stop script execution when a non-terminating error occurs -$ErrorActionPreference = "Stop" +param ([string] $Ruby) + +Set-ExecutionPolicy Bypass +$ErrorActionPreference='Stop' +$ProgressPreference='SilentlyContinue' +$env:chocolateyVersion="1.4.0" + +Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) + +Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 +choco feature enable -n=allowGlobalConfirmation +choco config set cacheLocation C:\chococache +# choco upgrade chocolatey +choco install git +Remove-Item -Recurse -Force c:\chococache + +if($Ruby -eq "3.0") +{ + $env:RUBY_URL="https://github.com/oneclick/rubyinstaller3/releases/download/RubyInstaller-3.0.6-1/rubyinstaller-3.0.6-1-x64.exe" + $env:RUBY_FILE="rubyinstaller-3.0.6-1-x64.exe" + $env:RUBY_DIR="c:/ruby30" +} +if($Ruby -eq "3.1") +{ + $env:RUBY_URL="https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.1.4-1/rubyinstaller-3.1.4-1-x64.exe" + $env:RUBY_FILE="rubyinstaller-3.1.4-1-x64.exe" + $env:RUBY_DIR="c:/ruby31" +} + +# Install Ruby + Devkit +Write-Output 'Downloading Ruby + DevKit'; +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; +(New-Object System.Net.WebClient).DownloadFile("$env:RUBY_URL", "c:/$env:RUBY_FILE") + +Write-Output 'Installing Ruby + DevKit' +Start-Process "c:/$env:RUBY_FILE" -ArgumentList "/allusers /verysilent /dir=$env:RUBY_DIR" -Wait + +Write-Output 'Cleaning up installation' +Remove-Item "c:/$env:RUBY_FILE" -Force + +$env:PATH += ";$env:RUBY_DIR/bin" # This will run ruby test on windows platform @@ -13,5 +52,5 @@ If ($lastexitcode -ne 0) { Exit $lastexitcode } Write-Output "--- Bundle Execute" -bundle exec rake -If ($lastexitcode -ne 0) { Exit $lastexitcode } \ No newline at end of file +bundle exec rake --trace +If ($lastexitcode -ne 0) { Exit $lastexitcode } diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 88c57b3..0ded098 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -11,22 +11,25 @@ steps: - label: run-specs-ruby-3.0-windows commands: - - .expeditor/run_windows_tests.ps1 + - Set-ExecutionPolicy Bypass; .expeditor/run_windows_tests.ps1 3.0 expeditor: executor: docker: host_os: windows shell: ["powershell", "-Command"] - image: rubydistros/windows-2019:3.0 + # image: rubydistros/windows-2019:3.0 + image: mcr.microsoft.com/windows:ltsc2019 + - label: run-specs-ruby-3.1-windows commands: - - .expeditor/run_windows_tests.ps1 + - Set-ExecutionPolicy Bypass; .expeditor/run_windows_tests.ps1 3.1 expeditor: executor: docker: host_os: windows shell: ["powershell", "-Command"] - image: rubydistros/windows-2019:3.1 \ No newline at end of file + # image: rubydistros/windows-2019:3.1 + image: mcr.microsoft.com/windows:ltsc2019 diff --git a/test/test_win32_service.rb b/test/test_win32_service.rb index 555212a..d516b53 100644 --- a/test/test_win32_service.rb +++ b/test/test_win32_service.rb @@ -13,13 +13,13 @@ class TC_Win32_Service < Test::Unit::TestCase def self.startup @@host = Socket.gethostname - @@service_name = "stisvc" + @@service_name = "StiSvc" @@elevated = Win32::Security.elevated_security? end def setup @display_name = "Windows Image Acquisition (WIA)" - @service_name = "stisvc" + @service_name = "StiSvc" @service_stat = nil @services = [] @elevated = Win32::Security.elevated_security?