Skip to content

Commit bdcbdcc

Browse files
committed
update CI Ruby setup
1 parent 2a6e8c3 commit bdcbdcc

File tree

1 file changed

+35
-24
lines changed

1 file changed

+35
-24
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -136,38 +136,49 @@ jobs:
136136
- name: Build Ruby Butler
137137
run: cargo build --release
138138

139-
- name: Install Ruby (for testing Ruby environment detection)
140-
uses: ruby/setup-ruby@v1
141-
with:
142-
ruby-version: '3.4.5'
143-
bundler-cache: false
144-
145-
- name: Setup Ruby Butler test installation directory
139+
- name: Setup Ruby Butler test installation from RubyInstaller
146140
run: |
147-
# Create the Ruby Butler expected directory structure
148-
$RubyInstallDir = "$env:USERPROFILE\.rubies\ruby-3.4.5"
149-
New-Item -ItemType Directory -Path "$RubyInstallDir\bin" -Force
150-
New-Item -ItemType Directory -Path "$RubyInstallDir\lib\ruby\gems\3.4.0" -Force
141+
# Download RubyInstaller 3.4.5
142+
$DownloadUrl = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-3.4.5-1/rubyinstaller-3.4.5-1-x64.7z"
143+
$ArchivePath = "$env:TEMP\rubyinstaller-3.4.5-1-x64.7z"
144+
$ExtractPath = "$env:TEMP\ruby-extract"
151145
152-
# Find Ruby installation paths
153-
$RubyPath = (Get-Command ruby).Source
154-
$GemPath = (Get-Command gem).Source
155-
$BundlerPath = (Get-Command bundle).Source
146+
Write-Host "Downloading Ruby installer from $DownloadUrl"
147+
Invoke-WebRequest -Uri $DownloadUrl -OutFile $ArchivePath
156148
157-
# Copy Ruby executables to the test structure
158-
Copy-Item $RubyPath "$RubyInstallDir\bin\"
159-
Copy-Item $GemPath "$RubyInstallDir\bin\"
160-
Copy-Item $BundlerPath "$RubyInstallDir\bin\"
149+
# Extract using 7z (available on GitHub Actions Windows runners)
150+
Write-Host "Extracting Ruby installer..."
151+
& 7z x $ArchivePath -o"$ExtractPath"
161152
162-
# Also copy any .bat or .cmd files that might exist
163-
$RubyDir = Split-Path $RubyPath -Parent
164-
Get-ChildItem "$RubyDir\*.bat", "$RubyDir\*.cmd" -ErrorAction SilentlyContinue | ForEach-Object {
165-
Copy-Item $_.FullName "$RubyInstallDir\bin\"
153+
# Find the extracted Ruby directory (should be rubyinstaller-3.4.5-1-x64)
154+
$ExtractedRubyDir = Get-ChildItem "$ExtractPath" -Directory | Where-Object { $_.Name -like "*rubyinstaller*" } | Select-Object -First 1
155+
156+
if (-not $ExtractedRubyDir) {
157+
throw "Could not find extracted Ruby directory in $ExtractPath"
166158
}
167159
160+
# Create the Ruby Butler expected directory structure
161+
$RubyInstallDir = "$env:USERPROFILE\.rubies\ruby-3.4.5"
162+
New-Item -ItemType Directory -Path (Split-Path $RubyInstallDir -Parent) -Force
163+
164+
# Copy the entire Ruby installation to the Butler expected location
165+
Write-Host "Copying Ruby installation from $($ExtractedRubyDir.FullName) to $RubyInstallDir"
166+
Copy-Item $ExtractedRubyDir.FullName $RubyInstallDir -Recurse -Force
167+
168168
# Verify the setup
169169
Write-Host "Ruby Butler test installation created:"
170-
Get-ChildItem "$RubyInstallDir\bin" | Format-Table Name, Length
170+
Get-ChildItem "$RubyInstallDir\bin" | Select-Object Name, Length | Format-Table
171+
172+
# Test that key executables exist
173+
$KeyExecutables = @("ruby.exe", "gem.cmd", "bundle.bat", "irb.bat")
174+
foreach ($Exe in $KeyExecutables) {
175+
$ExePath = "$RubyInstallDir\bin\$Exe"
176+
if (Test-Path $ExePath) {
177+
Write-Host "✓ Found $Exe"
178+
} else {
179+
Write-Warning "✗ Missing $Exe"
180+
}
181+
}
171182
shell: pwsh
172183

173184
- name: Run Pester tests

0 commit comments

Comments
 (0)