Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tp/infsus 137 #86

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .expeditor/prep_environment.ps1
Original file line number Diff line number Diff line change
@@ -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
47 changes: 43 additions & 4 deletions .expeditor/run_windows_tests.ps1
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -13,5 +52,5 @@ If ($lastexitcode -ne 0) { Exit $lastexitcode }

Write-Output "--- Bundle Execute"

bundle exec rake
If ($lastexitcode -ne 0) { Exit $lastexitcode }
bundle exec rake --trace
If ($lastexitcode -ne 0) { Exit $lastexitcode }
11 changes: 7 additions & 4 deletions .expeditor/verify.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
# image: rubydistros/windows-2019:3.1
image: mcr.microsoft.com/windows:ltsc2019
4 changes: 2 additions & 2 deletions test/test_win32_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down