tiny_tds 2.1.7-x64-mingw32 → 3.0.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +470 -0
  3. data/CHANGELOG.md +10 -0
  4. data/ISSUE_TEMPLATE.md +1 -1
  5. data/README.md +25 -45
  6. data/Rakefile +1 -5
  7. data/VERSION +1 -1
  8. data/docker-compose.yml +2 -2
  9. data/ext/tiny_tds/client.c +8 -15
  10. data/ext/tiny_tds/extconf.rb +1 -2
  11. data/ext/tiny_tds/extconsts.rb +4 -10
  12. data/ext/tiny_tds/result.c +27 -35
  13. data/ext/tiny_tds/tiny_tds_ext.c +4 -1
  14. data/lib/tiny_tds/2.7/tiny_tds.so +0 -0
  15. data/lib/tiny_tds/3.0/tiny_tds.so +0 -0
  16. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/bin/bsqldb.exe +0 -0
  17. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/bin/datacopy.exe +0 -0
  18. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/bin/defncopy.exe +0 -0
  19. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/bin/freebcp.exe +0 -0
  20. data/ports/x64-mingw32/freetds/1.4.23/bin/libct-4.dll +0 -0
  21. data/ports/x64-mingw32/freetds/1.4.23/bin/libsybdb-5.dll +0 -0
  22. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/bin/osql +84 -79
  23. data/ports/x64-mingw32/freetds/1.4.23/bin/tdspool.exe +0 -0
  24. data/ports/x64-mingw32/freetds/1.4.23/bin/tsql.exe +0 -0
  25. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/lib/libct.la +3 -3
  26. data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/lib/libsybdb.la +3 -3
  27. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/bin/iconv.exe +0 -0
  28. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/bin/libcharset-1.dll +0 -0
  29. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/bin/libiconv-2.dll +0 -0
  30. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/lib/libcharset.dll.a +0 -0
  31. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/lib/libcharset.la +3 -3
  32. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/lib/libiconv.dll.a +0 -0
  33. data/ports/x64-mingw32/libiconv/{1.15 → 1.17}/lib/libiconv.la +4 -4
  34. data/ports/x64-mingw32/openssl/{1.1.1s → 3.4.0}/bin/c_rehash +46 -45
  35. data/ports/x64-mingw32/openssl/3.4.0/bin/libcrypto-3-x64.dll +0 -0
  36. data/ports/x64-mingw32/openssl/3.4.0/bin/libssl-3-x64.dll +0 -0
  37. data/ports/x64-mingw32/openssl/3.4.0/bin/openssl.exe +0 -0
  38. data/tasks/ports/freetds.rb +1 -6
  39. data/tasks/ports.rake +2 -2
  40. data/test/bin/install-mssql.ps1 +22 -11
  41. data/test/client_test.rb +2 -5
  42. data/test/gem_test.rb +0 -1
  43. data/test/result_test.rb +99 -192
  44. data/test/schema_test.rb +366 -388
  45. data/test/test_helper.rb +6 -37
  46. data/tiny_tds.gemspec +3 -2
  47. metadata +46 -45
  48. data/.circleci/config.yml +0 -409
  49. data/lib/tiny_tds/2.4/tiny_tds.so +0 -0
  50. data/lib/tiny_tds/2.5/tiny_tds.so +0 -0
  51. data/lib/tiny_tds/2.6/tiny_tds.so +0 -0
  52. data/ports/x64-mingw32/freetds/1.1.24/bin/libct-4.dll +0 -0
  53. data/ports/x64-mingw32/freetds/1.1.24/bin/libsybdb-5.dll +0 -0
  54. data/ports/x64-mingw32/freetds/1.1.24/bin/tdspool.exe +0 -0
  55. data/ports/x64-mingw32/freetds/1.1.24/bin/tsql.exe +0 -0
  56. data/ports/x64-mingw32/libiconv/1.15/lib/charset.alias +0 -4
  57. data/ports/x64-mingw32/openssl/1.1.1s/bin/libcrypto-1_1-x64.dll +0 -0
  58. data/ports/x64-mingw32/openssl/1.1.1s/bin/libssl-1_1-x64.dll +0 -0
  59. data/ports/x64-mingw32/openssl/1.1.1s/bin/openssl.exe +0 -0
  60. data/ports/x64-mingw32/openssl/1.1.1s/lib/libcrypto.a +0 -0
  61. data/ports/x64-mingw32/openssl/1.1.1s/lib/libcrypto.dll.a +0 -0
  62. data/ports/x64-mingw32/openssl/1.1.1s/lib/libssl.a +0 -0
  63. data/ports/x64-mingw32/openssl/1.1.1s/lib/libssl.dll.a +0 -0
  64. data/test/schema/sqlserver_2000.sql +0 -140
  65. data/test/schema/sqlserver_2005.sql +0 -140
  66. data/test/schema/sqlserver_2014.sql +0 -140
  67. data/test/schema/sqlserver_2016.sql +0 -140
  68. data/test/schema/sybase_ase.sql +0 -138
  69. /data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/lib/libct.dll.a +0 -0
  70. /data/ports/x64-mingw32/freetds/{1.1.24 → 1.4.23}/lib/libsybdb.dll.a +0 -0
  71. /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
- TINYTDS_SCHEMAS = ['sqlserver_2000', 'sqlserver_2005', 'sqlserver_2008', 'sqlserver_2014', 'sqlserver_azure', 'sybase_ase'].freeze
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'] || 'sqlserver_2014'
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 sybase_ase?
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.0.0'
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-ci', '~> 3.4.0'
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: 2.1.7
4
+ version: 3.0.0
5
5
  platform: x64-mingw32
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-01-08 00:00:00.000000000 Z
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-ci
100
+ name: minitest-reporters
87
101
  requirement: !ruby/object:Gem::Requirement
88
102
  requirements:
89
103
  - - "~>"
90
104
  - !ruby/object:Gem::Version
91
- version: 3.4.0
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: 3.4.0
112
+ version: 1.6.1
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: connection_pool
101
115
  requirement: !ruby/object:Gem::Requirement
@@ -135,9 +149,9 @@ executables:
135
149
  extensions: []
136
150
  extra_rdoc_files: []
137
151
  files:
138
- - ".circleci/config.yml"
139
152
  - ".codeclimate.yml"
140
153
  - ".gitattributes"
154
+ - ".github/workflows/ci.yml"
141
155
  - ".gitignore"
142
156
  - ".rubocop.yml"
143
157
  - CHANGELOG.md
@@ -161,9 +175,6 @@ files:
161
175
  - ext/tiny_tds/tiny_tds_ext.c
162
176
  - ext/tiny_tds/tiny_tds_ext.h
163
177
  - lib/tiny_tds.rb
164
- - lib/tiny_tds/2.4/tiny_tds.so
165
- - lib/tiny_tds/2.5/tiny_tds.so
166
- - lib/tiny_tds/2.6/tiny_tds.so
167
178
  - lib/tiny_tds/2.7/tiny_tds.so
168
179
  - lib/tiny_tds/3.0/tiny_tds.so
169
180
  - lib/tiny_tds/bin.rb
@@ -175,35 +186,30 @@ files:
175
186
  - patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff
176
187
  - patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff
177
188
  - patches/libiconv/1.14/1-avoid-gets-error.patch
178
- - ports/x64-mingw32/freetds/1.1.24/bin/bsqldb.exe
179
- - ports/x64-mingw32/freetds/1.1.24/bin/datacopy.exe
180
- - ports/x64-mingw32/freetds/1.1.24/bin/defncopy.exe
181
- - ports/x64-mingw32/freetds/1.1.24/bin/freebcp.exe
182
- - ports/x64-mingw32/freetds/1.1.24/bin/libct-4.dll
183
- - ports/x64-mingw32/freetds/1.1.24/bin/libsybdb-5.dll
184
- - ports/x64-mingw32/freetds/1.1.24/bin/osql
185
- - ports/x64-mingw32/freetds/1.1.24/bin/tdspool.exe
186
- - ports/x64-mingw32/freetds/1.1.24/bin/tsql.exe
187
- - ports/x64-mingw32/freetds/1.1.24/lib/libct.dll.a
188
- - ports/x64-mingw32/freetds/1.1.24/lib/libct.la
189
- - ports/x64-mingw32/freetds/1.1.24/lib/libsybdb.dll.a
190
- - ports/x64-mingw32/freetds/1.1.24/lib/libsybdb.la
191
- - ports/x64-mingw32/libiconv/1.15/bin/iconv.exe
192
- - ports/x64-mingw32/libiconv/1.15/bin/libcharset-1.dll
193
- - ports/x64-mingw32/libiconv/1.15/bin/libiconv-2.dll
194
- - ports/x64-mingw32/libiconv/1.15/lib/charset.alias
195
- - ports/x64-mingw32/libiconv/1.15/lib/libcharset.dll.a
196
- - ports/x64-mingw32/libiconv/1.15/lib/libcharset.la
197
- - ports/x64-mingw32/libiconv/1.15/lib/libiconv.dll.a
198
- - ports/x64-mingw32/libiconv/1.15/lib/libiconv.la
199
- - ports/x64-mingw32/openssl/1.1.1s/bin/c_rehash
200
- - ports/x64-mingw32/openssl/1.1.1s/bin/libcrypto-1_1-x64.dll
201
- - ports/x64-mingw32/openssl/1.1.1s/bin/libssl-1_1-x64.dll
202
- - ports/x64-mingw32/openssl/1.1.1s/bin/openssl.exe
203
- - ports/x64-mingw32/openssl/1.1.1s/lib/libcrypto.a
204
- - ports/x64-mingw32/openssl/1.1.1s/lib/libcrypto.dll.a
205
- - ports/x64-mingw32/openssl/1.1.1s/lib/libssl.a
206
- - ports/x64-mingw32/openssl/1.1.1s/lib/libssl.dll.a
189
+ - ports/x64-mingw32/freetds/1.4.23/bin/bsqldb.exe
190
+ - ports/x64-mingw32/freetds/1.4.23/bin/datacopy.exe
191
+ - ports/x64-mingw32/freetds/1.4.23/bin/defncopy.exe
192
+ - ports/x64-mingw32/freetds/1.4.23/bin/freebcp.exe
193
+ - ports/x64-mingw32/freetds/1.4.23/bin/libct-4.dll
194
+ - ports/x64-mingw32/freetds/1.4.23/bin/libsybdb-5.dll
195
+ - ports/x64-mingw32/freetds/1.4.23/bin/osql
196
+ - ports/x64-mingw32/freetds/1.4.23/bin/tdspool.exe
197
+ - ports/x64-mingw32/freetds/1.4.23/bin/tsql.exe
198
+ - ports/x64-mingw32/freetds/1.4.23/lib/libct.dll.a
199
+ - ports/x64-mingw32/freetds/1.4.23/lib/libct.la
200
+ - ports/x64-mingw32/freetds/1.4.23/lib/libsybdb.dll.a
201
+ - ports/x64-mingw32/freetds/1.4.23/lib/libsybdb.la
202
+ - ports/x64-mingw32/libiconv/1.17/bin/iconv.exe
203
+ - ports/x64-mingw32/libiconv/1.17/bin/libcharset-1.dll
204
+ - ports/x64-mingw32/libiconv/1.17/bin/libiconv-2.dll
205
+ - ports/x64-mingw32/libiconv/1.17/lib/libcharset.dll.a
206
+ - ports/x64-mingw32/libiconv/1.17/lib/libcharset.la
207
+ - ports/x64-mingw32/libiconv/1.17/lib/libiconv.dll.a
208
+ - ports/x64-mingw32/libiconv/1.17/lib/libiconv.la
209
+ - ports/x64-mingw32/openssl/3.4.0/bin/c_rehash
210
+ - ports/x64-mingw32/openssl/3.4.0/bin/libcrypto-3-x64.dll
211
+ - ports/x64-mingw32/openssl/3.4.0/bin/libssl-3-x64.dll
212
+ - ports/x64-mingw32/openssl/3.4.0/bin/openssl.exe
207
213
  - setup_cimgruby_dev.sh
208
214
  - start_dev.sh
209
215
  - tasks/native_gem.rake
@@ -227,13 +233,8 @@ files:
227
233
  - test/gem_test.rb
228
234
  - test/result_test.rb
229
235
  - test/schema/1px.gif
230
- - test/schema/sqlserver_2000.sql
231
- - test/schema/sqlserver_2005.sql
232
- - test/schema/sqlserver_2008.sql
233
- - test/schema/sqlserver_2014.sql
234
- - test/schema/sqlserver_2016.sql
236
+ - test/schema/sqlserver_2017.sql
235
237
  - test/schema/sqlserver_azure.sql
236
- - test/schema/sybase_ase.sql
237
238
  - test/schema_test.rb
238
239
  - test/sql/db-create.sql
239
240
  - test/sql/db-login.sql
@@ -253,7 +254,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
253
254
  requirements:
254
255
  - - ">="
255
256
  - !ruby/object:Gem::Version
256
- version: '2.4'
257
+ version: '2.7'
257
258
  - - "<"
258
259
  - !ruby/object:Gem::Version
259
260
  version: 3.1.dev
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'
Binary file
Binary file
Binary file