tiny_tds 2.1.7 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +470 -0
- data/CHANGELOG.md +10 -0
- data/ISSUE_TEMPLATE.md +1 -1
- data/README.md +25 -45
- data/Rakefile +1 -5
- data/VERSION +1 -1
- data/docker-compose.yml +2 -2
- data/ext/tiny_tds/client.c +8 -15
- data/ext/tiny_tds/extconf.rb +1 -2
- data/ext/tiny_tds/extconsts.rb +4 -10
- data/ext/tiny_tds/result.c +27 -35
- data/ext/tiny_tds/tiny_tds_ext.c +4 -1
- data/tasks/ports/freetds.rb +1 -6
- data/tasks/ports.rake +2 -2
- data/test/bin/install-mssql.ps1 +22 -11
- data/test/client_test.rb +2 -5
- data/test/gem_test.rb +0 -1
- data/test/result_test.rb +99 -192
- data/test/schema_test.rb +366 -388
- data/test/test_helper.rb +6 -37
- data/tiny_tds.gemspec +3 -2
- metadata +23 -14
- data/.circleci/config.yml +0 -409
- data/test/schema/sqlserver_2000.sql +0 -140
- data/test/schema/sqlserver_2005.sql +0 -140
- data/test/schema/sqlserver_2014.sql +0 -140
- data/test/schema/sqlserver_2016.sql +0 -140
- data/test/schema/sybase_ase.sql +0 -138
- /data/test/schema/{sqlserver_2008.sql → sqlserver_2017.sql} +0 -0
data/test/test_helper.rb
CHANGED
@@ -4,7 +4,10 @@ require 'tiny_tds'
|
|
4
4
|
require 'minitest/autorun'
|
5
5
|
require 'toxiproxy'
|
6
6
|
|
7
|
-
|
7
|
+
require "minitest/reporters"
|
8
|
+
Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new, Minitest::Reporters::JUnitReporter.new]
|
9
|
+
|
10
|
+
TINYTDS_SCHEMAS = ['sqlserver_2017', 'sqlserver_azure'].freeze
|
8
11
|
|
9
12
|
module TinyTds
|
10
13
|
class TestCase < MiniTest::Spec
|
@@ -12,7 +15,7 @@ module TinyTds
|
|
12
15
|
class << self
|
13
16
|
|
14
17
|
def current_schema
|
15
|
-
ENV['TINYTDS_SCHEMA'] || '
|
18
|
+
ENV['TINYTDS_SCHEMA'] || 'sqlserver_2017'
|
16
19
|
end
|
17
20
|
|
18
21
|
TINYTDS_SCHEMAS.each do |schema|
|
@@ -20,11 +23,6 @@ module TinyTds
|
|
20
23
|
schema == self.current_schema
|
21
24
|
end
|
22
25
|
end
|
23
|
-
|
24
|
-
def sqlserver?
|
25
|
-
current_schema =~ /sqlserver/
|
26
|
-
end
|
27
|
-
|
28
26
|
end
|
29
27
|
|
30
28
|
after { close_client }
|
@@ -41,20 +39,13 @@ module TinyTds
|
|
41
39
|
self.class.current_schema
|
42
40
|
end
|
43
41
|
|
44
|
-
def sqlserver?
|
45
|
-
self.class.sqlserver?
|
46
|
-
end
|
47
|
-
|
48
42
|
def close_client(client=@client)
|
49
43
|
client.close if defined?(client) && client.is_a?(TinyTds::Client)
|
50
44
|
end
|
51
45
|
|
52
46
|
def new_connection(options={})
|
53
47
|
client = TinyTds::Client.new(connection_options(options))
|
54
|
-
if
|
55
|
-
client.execute("SET ANSINULL ON").do
|
56
|
-
return client
|
57
|
-
elsif sqlserver_azure?
|
48
|
+
if sqlserver_azure?
|
58
49
|
client.execute('SET ANSI_NULLS ON').do
|
59
50
|
client.execute('SET CURSOR_CLOSE_ON_COMMIT OFF').do
|
60
51
|
client.execute('SET ANSI_NULL_DFLT_ON ON').do
|
@@ -161,28 +152,6 @@ module TinyTds
|
|
161
152
|
end
|
162
153
|
|
163
154
|
def drop_sql
|
164
|
-
sybase_ase? ? drop_sql_sybase : drop_sql_microsoft
|
165
|
-
end
|
166
|
-
|
167
|
-
def drop_sql_sybase
|
168
|
-
%|IF EXISTS(
|
169
|
-
SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'datatypes'
|
170
|
-
) DROP TABLE datatypes
|
171
|
-
IF EXISTS(
|
172
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestReturnCodes'
|
173
|
-
) DROP PROCEDURE tinytds_TestReturnCodes
|
174
|
-
IF EXISTS(
|
175
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestPrintWithError'
|
176
|
-
) DROP PROCEDURE tinytds_TestPrintWithError
|
177
|
-
IF EXISTS(
|
178
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestPrintWithError'
|
179
|
-
) DROP PROCEDURE tinytds_TestPrintWithError
|
180
|
-
IF EXISTS(
|
181
|
-
SELECT 1 FROM sysobjects WHERE type = 'P' AND name = 'tinytds_TestSeveralPrints'
|
182
|
-
) DROP PROCEDURE tinytds_TestSeveralPrints|
|
183
|
-
end
|
184
|
-
|
185
|
-
def drop_sql_microsoft
|
186
155
|
%|IF EXISTS (
|
187
156
|
SELECT TABLE_NAME
|
188
157
|
FROM INFORMATION_SCHEMA.TABLES
|
data/tiny_tds.gemspec
CHANGED
@@ -18,14 +18,15 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.rdoc_options = ['--charset=UTF-8']
|
19
19
|
s.extensions = ['ext/tiny_tds/extconf.rb']
|
20
20
|
s.license = 'MIT'
|
21
|
-
s.required_ruby_version = '>= 2.
|
21
|
+
s.required_ruby_version = '>= 2.7.0'
|
22
22
|
s.metadata['msys2_mingw_dependencies'] = 'freetds'
|
23
|
+
s.add_dependency 'bigdecimal', '~> 3'
|
23
24
|
s.add_development_dependency 'mini_portile2', '~> 2.5.0'
|
24
25
|
s.add_development_dependency 'rake', '~> 13.0.0'
|
25
26
|
s.add_development_dependency 'rake-compiler', '~> 1.2'
|
26
27
|
s.add_development_dependency 'rake-compiler-dock', '~> 1.4.0'
|
27
28
|
s.add_development_dependency 'minitest', '~> 5.14.0'
|
28
|
-
s.add_development_dependency 'minitest-
|
29
|
+
s.add_development_dependency 'minitest-reporters', '~> 1.6.1'
|
29
30
|
s.add_development_dependency 'connection_pool', '~> 2.2.0'
|
30
31
|
s.add_development_dependency 'toxiproxy', '~> 2.0.0'
|
31
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_tds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
@@ -10,8 +10,22 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-
|
13
|
+
date: 2024-12-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bigdecimal
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '3'
|
15
29
|
- !ruby/object:Gem::Dependency
|
16
30
|
name: mini_portile2
|
17
31
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,19 +97,19 @@ dependencies:
|
|
83
97
|
- !ruby/object:Gem::Version
|
84
98
|
version: 5.14.0
|
85
99
|
- !ruby/object:Gem::Dependency
|
86
|
-
name: minitest-
|
100
|
+
name: minitest-reporters
|
87
101
|
requirement: !ruby/object:Gem::Requirement
|
88
102
|
requirements:
|
89
103
|
- - "~>"
|
90
104
|
- !ruby/object:Gem::Version
|
91
|
-
version:
|
105
|
+
version: 1.6.1
|
92
106
|
type: :development
|
93
107
|
prerelease: false
|
94
108
|
version_requirements: !ruby/object:Gem::Requirement
|
95
109
|
requirements:
|
96
110
|
- - "~>"
|
97
111
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
112
|
+
version: 1.6.1
|
99
113
|
- !ruby/object:Gem::Dependency
|
100
114
|
name: connection_pool
|
101
115
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,9 +150,9 @@ extensions:
|
|
136
150
|
- ext/tiny_tds/extconf.rb
|
137
151
|
extra_rdoc_files: []
|
138
152
|
files:
|
139
|
-
- ".circleci/config.yml"
|
140
153
|
- ".codeclimate.yml"
|
141
154
|
- ".gitattributes"
|
155
|
+
- ".github/workflows/ci.yml"
|
142
156
|
- ".gitignore"
|
143
157
|
- ".rubocop.yml"
|
144
158
|
- CHANGELOG.md
|
@@ -194,13 +208,8 @@ files:
|
|
194
208
|
- test/gem_test.rb
|
195
209
|
- test/result_test.rb
|
196
210
|
- test/schema/1px.gif
|
197
|
-
- test/schema/
|
198
|
-
- test/schema/sqlserver_2005.sql
|
199
|
-
- test/schema/sqlserver_2008.sql
|
200
|
-
- test/schema/sqlserver_2014.sql
|
201
|
-
- test/schema/sqlserver_2016.sql
|
211
|
+
- test/schema/sqlserver_2017.sql
|
202
212
|
- test/schema/sqlserver_azure.sql
|
203
|
-
- test/schema/sybase_ase.sql
|
204
213
|
- test/schema_test.rb
|
205
214
|
- test/sql/db-create.sql
|
206
215
|
- test/sql/db-login.sql
|
@@ -221,14 +230,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
221
230
|
requirements:
|
222
231
|
- - ">="
|
223
232
|
- !ruby/object:Gem::Version
|
224
|
-
version: 2.
|
233
|
+
version: 2.7.0
|
225
234
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
235
|
requirements:
|
227
236
|
- - ">="
|
228
237
|
- !ruby/object:Gem::Version
|
229
238
|
version: '0'
|
230
239
|
requirements: []
|
231
|
-
rubygems_version: 3.
|
240
|
+
rubygems_version: 3.1.6
|
232
241
|
signing_key:
|
233
242
|
specification_version: 4
|
234
243
|
summary: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
|
data/.circleci/config.yml
DELETED
@@ -1,409 +0,0 @@
|
|
1
|
-
version: 2.1
|
2
|
-
|
3
|
-
orbs:
|
4
|
-
win: circleci/windows@4.1
|
5
|
-
ruby: circleci/ruby@2.0.0
|
6
|
-
|
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 (-join("RubyInstaller-" , "<< 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
|
-
|
55
|
-
jobs:
|
56
|
-
test_linux:
|
57
|
-
parameters:
|
58
|
-
ruby_version:
|
59
|
-
description: 'version tag for the cimg/ruby container'
|
60
|
-
type: string
|
61
|
-
|
62
|
-
machine:
|
63
|
-
image: ubuntu-2004:current
|
64
|
-
|
65
|
-
# be sure to update the ./setup_cimgruby_dev.sh if changes are made to steps below
|
66
|
-
steps:
|
67
|
-
- checkout
|
68
|
-
|
69
|
-
- run:
|
70
|
-
name: start docker-compose build environment
|
71
|
-
command: |
|
72
|
-
sudo ./test/bin/setup_volume_permissions.sh
|
73
|
-
docker-compose up -d
|
74
|
-
echo "Waiting for containers to start..."
|
75
|
-
sleep 10
|
76
|
-
environment:
|
77
|
-
RUBY_VERSION: << parameters.ruby_version >>
|
78
|
-
|
79
|
-
- run:
|
80
|
-
name: install sql prereqs
|
81
|
-
command: |
|
82
|
-
docker exec cimg_ruby bash -c 'sudo -E ./test/bin/install-mssqltools.sh'
|
83
|
-
|
84
|
-
- run:
|
85
|
-
name: setup tiny_tds test database
|
86
|
-
command: |
|
87
|
-
docker exec cimg_ruby bash -c './test/bin/setup_tinytds_db.sh'
|
88
|
-
|
89
|
-
- run:
|
90
|
-
name: bundle install gems
|
91
|
-
command: |
|
92
|
-
docker exec cimg_ruby bash -c 'bundle install'
|
93
|
-
|
94
|
-
- run:
|
95
|
-
name: Write used versions into file
|
96
|
-
command: |
|
97
|
-
docker exec cimg_ruby bash -c 'bundle exec rake ports:version_file'
|
98
|
-
|
99
|
-
- restore_cache:
|
100
|
-
name: restore ports cache
|
101
|
-
keys:
|
102
|
-
- ports-<< parameters.ruby_version >>-{{ arch }}-{{ checksum ".ports_versions" }}
|
103
|
-
- ports-<< parameters.ruby_version >>-{{ arch }}-
|
104
|
-
|
105
|
-
- run:
|
106
|
-
name: compile ports
|
107
|
-
command: |
|
108
|
-
docker exec cimg_ruby bash -c 'bundle exec rake ports'
|
109
|
-
|
110
|
-
- run:
|
111
|
-
name: build gem
|
112
|
-
command: |
|
113
|
-
docker exec cimg_ruby bash -c 'bundle exec rake build'
|
114
|
-
|
115
|
-
- run:
|
116
|
-
name: Fix permissions on ports directory
|
117
|
-
command: |
|
118
|
-
docker exec cimg_ruby bash -c 'sudo chown -R $(id -u):$(id -g) ports'
|
119
|
-
|
120
|
-
- run:
|
121
|
-
name: test gem
|
122
|
-
command: |
|
123
|
-
docker exec cimg_ruby bash -c 'bundle exec rake test'
|
124
|
-
|
125
|
-
- save_cache:
|
126
|
-
name: save ports cache
|
127
|
-
paths:
|
128
|
-
- ./ports
|
129
|
-
key: ports-<< parameters.ruby_version >>-{{ arch }}-{{ arch }}-{{ checksum ".ports_versions" }}
|
130
|
-
|
131
|
-
- store_test_results:
|
132
|
-
path: test/reports
|
133
|
-
|
134
|
-
test_windows:
|
135
|
-
parameters:
|
136
|
-
ruby_version:
|
137
|
-
description: 'version tag for rubydev environment'
|
138
|
-
type: string
|
139
|
-
|
140
|
-
executor:
|
141
|
-
name: win/server-2022
|
142
|
-
shell: powershell.exe
|
143
|
-
|
144
|
-
environment:
|
145
|
-
RAKEOPT: '-rdevkit'
|
146
|
-
TESTOPTS: '-v'
|
147
|
-
MAKE: 'make V=1 -j2'
|
148
|
-
|
149
|
-
steps:
|
150
|
-
- install-ruby-windows:
|
151
|
-
ruby_version: << parameters.ruby_version >>
|
152
|
-
|
153
|
-
- checkout
|
154
|
-
|
155
|
-
- restore_cache:
|
156
|
-
name: restore gem cache
|
157
|
-
keys:
|
158
|
-
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
|
159
|
-
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-
|
160
|
-
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-
|
161
|
-
|
162
|
-
- run:
|
163
|
-
name: bundle install gems
|
164
|
-
command: |
|
165
|
-
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
|
166
|
-
bundle install --path vendor/bundle
|
167
|
-
|
168
|
-
- save_cache:
|
169
|
-
name: save gem cache
|
170
|
-
paths:
|
171
|
-
- ./vendor/bundle
|
172
|
-
key: v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
|
173
|
-
|
174
|
-
- attach_workspace:
|
175
|
-
at: artifacts
|
176
|
-
|
177
|
-
- run:
|
178
|
-
name: install native gem and restore cross-compiled code from gem
|
179
|
-
command: |
|
180
|
-
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
|
181
|
-
$rubyArchitecture = (ruby -e 'puts RUBY_PLATFORM').Trim()
|
182
|
-
$gemVersion = (Get-Content VERSION).Trim()
|
183
|
-
|
184
|
-
gem install --local --install-dir=./tmp "artifacts/gems/tiny_tds-$gemVersion-$rubyArchitecture.gem"
|
185
|
-
|
186
|
-
# Restore precompiled code
|
187
|
-
$source = (Resolve-Path ".\tmp\gems\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
|
188
|
-
$destination = (Resolve-Path ".\lib\tiny_tds").Path
|
189
|
-
Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
|
190
|
-
|
191
|
-
# Restore ports
|
192
|
-
Copy-Item -Path ".\tmp\gems\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
|
193
|
-
|
194
|
-
- restore_cache:
|
195
|
-
name: restore mssql installation file
|
196
|
-
key: downloads-{{ checksum "test/bin/install-mssql.ps1" }}
|
197
|
-
|
198
|
-
- run:
|
199
|
-
name: setup mssql
|
200
|
-
command: |
|
201
|
-
.\test\bin\install-mssql.ps1
|
202
|
-
|
203
|
-
- save_cache:
|
204
|
-
name: save downloads cache
|
205
|
-
paths:
|
206
|
-
- C:\Downloads
|
207
|
-
key: downloads-{{ checksum "test/bin/install-mssql.ps1" }}
|
208
|
-
|
209
|
-
- run:
|
210
|
-
name: install toxiproxy-server
|
211
|
-
command: |
|
212
|
-
choco install toxiproxy-server --version=2.5.0 -y
|
213
|
-
Start-Process toxiproxy-server
|
214
|
-
|
215
|
-
- run:
|
216
|
-
name: test gem
|
217
|
-
command: |
|
218
|
-
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
|
219
|
-
bundle exec rake test
|
220
|
-
environment:
|
221
|
-
TOXIPROXY_HOST: "localhost"
|
222
|
-
|
223
|
-
- store_test_results:
|
224
|
-
path: test/reports
|
225
|
-
|
226
|
-
- run:
|
227
|
-
name: Rename gem to a consistent name to store artifact
|
228
|
-
command: |
|
229
|
-
$Env:PATH = "C:\\Ruby<< parameters.ruby_version >>-x64\\bin;$Env:PATH"
|
230
|
-
$rubyArchitecture = (ruby -e 'puts RUBY_PLATFORM').Trim()
|
231
|
-
$gemVersion = (Get-Content VERSION).Trim()
|
232
|
-
|
233
|
-
New-Item -Path . -Name "tested_artifact" -ItemType "directory"
|
234
|
-
Move-Item "artifacts/gems/tiny_tds-$gemVersion-$rubyArchitecture.gem" "tested_artifact"
|
235
|
-
|
236
|
-
- store_artifacts:
|
237
|
-
path: tested_artifact
|
238
|
-
|
239
|
-
cross_compile_gem:
|
240
|
-
parameters:
|
241
|
-
platform:
|
242
|
-
description: "Platform to compile the gem resources"
|
243
|
-
type: string
|
244
|
-
|
245
|
-
docker:
|
246
|
-
- image: "ghcr.io/rake-compiler/rake-compiler-dock-image:1.4.0-mri-<< parameters.platform >>"
|
247
|
-
|
248
|
-
steps:
|
249
|
-
- checkout
|
250
|
-
|
251
|
-
- run:
|
252
|
-
name: bundle install gems
|
253
|
-
command: |
|
254
|
-
bundle install
|
255
|
-
|
256
|
-
- run:
|
257
|
-
name: Write used versions for ports into file
|
258
|
-
command: |
|
259
|
-
rake ports:version_file[<< parameters.platform >>]
|
260
|
-
|
261
|
-
- restore_cache:
|
262
|
-
name: restore ports cache
|
263
|
-
keys:
|
264
|
-
- ports-win-{{ arch }}-{{ checksum ".ports_versions" }}
|
265
|
-
- ports-win-{{ arch }}-
|
266
|
-
|
267
|
-
- run:
|
268
|
-
name: Build gem
|
269
|
-
command: |
|
270
|
-
rake gem:for_platform[<< parameters.platform >>]
|
271
|
-
|
272
|
-
- run:
|
273
|
-
name: Move gems into separate directory before caching
|
274
|
-
command: |
|
275
|
-
mkdir -p artifacts-<< parameters.platform >>/gems
|
276
|
-
mv pkg/*.gem artifacts-<< parameters.platform >>/gems
|
277
|
-
|
278
|
-
- run:
|
279
|
-
name: Remove non-native gem to avoid conflict in workspace
|
280
|
-
command: |
|
281
|
-
gemVersion=$(cat VERSION | tr -d "[:space:]")
|
282
|
-
rm -rf artifacts-<< parameters.platform >>/gems/tiny_tds-$gemVersion.gem
|
283
|
-
|
284
|
-
- store_artifacts:
|
285
|
-
path: artifacts-<< parameters.platform >>/gems
|
286
|
-
|
287
|
-
- save_cache:
|
288
|
-
name: save ports cache
|
289
|
-
paths:
|
290
|
-
- ./ports
|
291
|
-
key: ports-win-{{ arch }}-{{ checksum ".ports_versions" }}
|
292
|
-
|
293
|
-
- persist_to_workspace:
|
294
|
-
name: save gems into workspace
|
295
|
-
root: artifacts-<< parameters.platform >>
|
296
|
-
paths:
|
297
|
-
- gems
|
298
|
-
|
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 >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
|
337
|
-
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-
|
338
|
-
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-
|
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 >>-{{ arch }}-{{ .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
|
-
|
372
|
-
workflows:
|
373
|
-
test_supported_ruby_versions:
|
374
|
-
jobs:
|
375
|
-
- cross_compile_gem:
|
376
|
-
matrix:
|
377
|
-
parameters:
|
378
|
-
platform:
|
379
|
-
- "x86-mingw32"
|
380
|
-
- "x64-mingw32"
|
381
|
-
- "x64-mingw-ucrt"
|
382
|
-
- test_windows:
|
383
|
-
requires:
|
384
|
-
- cross_compile_gem
|
385
|
-
matrix: &ruby_versions
|
386
|
-
parameters:
|
387
|
-
ruby_version:
|
388
|
-
- '2.4'
|
389
|
-
- '2.5'
|
390
|
-
- '2.6'
|
391
|
-
- '2.7'
|
392
|
-
- '3.0'
|
393
|
-
- '3.1'
|
394
|
-
- '3.2'
|
395
|
-
- '3.3'
|
396
|
-
- test_linux:
|
397
|
-
matrix: *ruby_versions
|
398
|
-
|
399
|
-
- install_windows:
|
400
|
-
matrix:
|
401
|
-
parameters:
|
402
|
-
ruby_version:
|
403
|
-
- '2.5'
|
404
|
-
- '2.6'
|
405
|
-
- '2.7'
|
406
|
-
- '3.0'
|
407
|
-
- '3.1'
|
408
|
-
- '3.2'
|
409
|
-
- '3.3'
|