44 win : circleci/windows@4.1
55 ruby : circleci/ruby@2.0.0
66
7+ commands :
8+ install-ruby-windows :
9+ description : " Install Ruby on Windows"
10+ parameters :
11+ ruby_version :
12+ description : ' version tag for the cimg/ruby container'
13+ type : string
14+ steps :
15+ - run :
16+ name : remove pre-installed ruby
17+ command : |
18+ Get-ChildItem -path 'C:\tools\' -filter Ruby* | Remove-Item -Force -Recurse
19+
20+ - run :
21+ name : download and install ruby devkit
22+ command : |
23+ $ProgressPreference='SilentlyContinue'
24+
25+ $uri = 'https://api.github.com/repos/oneclick/rubyinstaller2/tags?per_page=200'
26+ $releases = ((Invoke-WebRequest $uri) | ConvertFrom-Json).name | select-string -Pattern '<< parameters.ruby_version >>'
27+ $target_release = (($releases | Sort-Object -Descending)[0] | Out-String).Trim()
28+ $target_version = $target_release.Substring($target_release.Length - 7)
29+ $download_uri = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-$target_version/rubyinstaller-devkit-$target_version-x64.exe"
30+ echo "Ruby Target Version Found: $target_version"
31+
32+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
33+ Invoke-WebRequest -UseBasicParsing -uri $download_uri -OutFile C:\ruby-setup.exe
34+
35+ echo "Download finished, starting installation of $target_version"
36+ C:\ruby-setup.exe /VERYSILENT /NORESTART /ALLUSERS /DIR=C:/Ruby<< parameters.ruby_version >>-x64
37+
38+ - run :
39+ name : ruby diagnostics
40+ command : |
41+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
42+ echo "Perl Version:"
43+ perl --version
44+ echo "Ruby Version:"
45+ ruby --version
46+ echo "Gem Version:"
47+ gem --version
48+
49+ - run :
50+ name : install bundler
51+ command : |
52+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
53+ gem install bundler -v 2.3.26
54+
755jobs :
856 test_linux :
957 parameters :
@@ -99,45 +147,8 @@ jobs:
99147 MAKE : ' make V=1 -j2'
100148
101149 steps :
102- - run :
103- name : remove pre-installed ruby
104- command : |
105- Get-ChildItem -path 'C:\tools\' -filter Ruby* | Remove-Item -Force -Recurse
106-
107- - run :
108- name : download and install ruby devkit
109- command : |
110- $ProgressPreference='SilentlyContinue'
111-
112- $uri = 'https://api.github.com/repos/oneclick/rubyinstaller2/tags?per_page=200'
113- $releases = ((Invoke-WebRequest $uri) | ConvertFrom-Json).name | select-string -Pattern '<< parameters.ruby_version >>'
114- $target_release = (($releases | Sort-Object -Descending)[0] | Out-String).Trim()
115- $target_version = $target_release.Substring($target_release.Length - 7)
116- $download_uri = "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-$target_version/rubyinstaller-devkit-$target_version-x64.exe"
117- echo "Ruby Target Version Found: $target_version"
118-
119- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
120- Invoke-WebRequest -UseBasicParsing -uri $download_uri -OutFile C:\ruby-setup.exe
121-
122- echo "Download finished, starting installation of $target_version"
123- C:\ruby-setup.exe /VERYSILENT /NORESTART /ALLUSERS /DIR=C:/Ruby<< parameters.ruby_version >>-x64
124-
125- - run :
126- name : ruby diagnostics
127- command : |
128- $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
129- echo "Perl Version:"
130- perl --version
131- echo "Ruby Version:"
132- ruby --version
133- echo "Gem Version:"
134- gem --version
135-
136- - run :
137- name : install bundler
138- command : |
139- $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
140- gem install bundler -v 2.3.26
150+ - install-ruby-windows :
151+ ruby_version : << parameters.ruby_version >>
141152
142153 - checkout
143154
@@ -285,6 +296,79 @@ jobs:
285296 paths :
286297 - gems
287298
299+ install_windows :
300+ parameters :
301+ ruby_version :
302+ description : ' version tag for rubydev environment'
303+ type : string
304+
305+ executor :
306+ name : win/server-2022
307+ shell : powershell.exe
308+
309+ environment :
310+ RAKEOPT : ' -rdevkit'
311+ TESTOPTS : ' -v'
312+ MAKE : ' make V=1 -j2'
313+
314+ steps :
315+ - install-ruby-windows :
316+ ruby_version : << parameters.ruby_version >>
317+
318+ - run :
319+ name : Ensure msys2 installation is complete
320+ command : |
321+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
322+
323+ # on older Ruby version, the msys version shipped with RubyInstaller is quite old
324+ # and RubyInstaller will be unable to install anything because of outdated keys
325+ # With this those commands, we force to get a new set of keys
326+ # see https://www.msys2.org/docs/updating/#potential-issues
327+ ridk exec pacman-key --init
328+ ridk exec pacman-key --refresh-keys
329+ ridk install 1 2 3
330+
331+ - checkout
332+
333+ - restore_cache :
334+ name : restore gem cache
335+ keys :
336+ - v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
337+ - v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-
338+ - v1-bundle-<< parameters.ruby_version >>-
339+
340+ - run :
341+ name : bundle install gems
342+ command : |
343+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
344+ bundle install --path vendor/bundle
345+
346+ - save_cache :
347+ name : save gem cache
348+ paths :
349+ - ./vendor/bundle
350+ key : v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
351+
352+ - run :
353+ name : build gem
354+ command : |
355+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
356+ gem build tiny_tds.gemspec
357+
358+ - run :
359+ name : Install gem
360+ command : |
361+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
362+ $gemVersion = (Get-Content VERSION).Trim()
363+ gem install --local "tiny_tds-$gemVersion.gem"
364+
365+ - run :
366+ name : Check if gem loads correctly
367+ command : |
368+ $Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
369+ ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
370+ exit $LASTEXITCODE
371+
288372workflows :
289373 test_supported_ruby_versions :
290374 jobs :
@@ -310,3 +394,14 @@ workflows:
310394 - ' 3.2'
311395 - test_linux :
312396 matrix : *ruby_versions
397+
398+ - install_windows :
399+ matrix :
400+ parameters :
401+ ruby_version :
402+ - ' 2.5'
403+ - ' 2.6'
404+ - ' 2.7'
405+ - ' 3.0'
406+ - ' 3.1'
407+ - ' 3.2'
0 commit comments