@@ -13,17 +13,22 @@ jobs:
13
13
platform :
14
14
- " x64-mingw32"
15
15
- " x64-mingw-ucrt"
16
- name : cross-compile-windows
16
+ - " x86_64-linux-gnu"
17
+ - " x86_64-linux-musl"
18
+ - " aarch64-linux-gnu"
19
+ - " aarch64-linux-musl"
20
+
21
+ name : cross-compile
17
22
runs-on : ubuntu-22.04
18
- container :
19
- image : " ghcr.io/rake-compiler/rake-compiler-dock-image:1.7.0-mri-${{ matrix.platform }}"
20
23
steps :
21
24
- uses : actions/checkout@v4
22
25
23
- - run : git config --global --add safe.directory /__w/tiny_tds/tiny_tds # shrug
26
+ - name : Set up Ruby
27
+ uses : ruby/setup-ruby@v1
28
+ with :
29
+ ruby-version : " 2.7"
24
30
25
- - name : Install gems
26
- shell : bash
31
+ - name : " Install dependencies"
27
32
run : bundle install
28
33
29
34
- name : Write used versions into file
@@ -34,14 +39,14 @@ jobs:
34
39
uses : actions/cache@v4
35
40
with :
36
41
path : ports
37
- key : cross-compiled-v3 -${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
42
+ key : cross-compiled-v1 -${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
38
43
restore-keys : |
39
- cross-compiled-v3 -${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
40
- cross-compiled-v3 -${{ matrix.platform }}-
44
+ cross-compiled-v1 -${{ matrix.platform }}-${{ hashFiles('**/.ports_versions') }}
45
+ cross-compiled-v1 -${{ matrix.platform }}-
41
46
42
47
- name : Build gem
43
48
shell : bash
44
- run : bundle exec rake gem:for_platform[ ${{ matrix.platform }}]
49
+ run : bundle exec rake gem:native: ${{ matrix.platform }}
45
50
46
51
- uses : actions/upload-artifact@v4
47
52
with :
89
94
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
90
95
exit $LASTEXITCODE
91
96
97
+ - name : Test if tsql wrapper works
98
+ shell : pwsh
99
+ run : |
100
+ tsql-ttds -C
101
+ exit $LASTEXITCODE
102
+
103
+ - name : Test if defncopy wrapper works
104
+ shell : pwsh
105
+ run : |
106
+ defncopy-ttds -v
107
+ exit $LASTEXITCODE
108
+
92
109
test-windows-mingw :
93
110
needs :
94
111
- cross-compile
@@ -123,21 +140,9 @@ jobs:
123
140
124
141
- name : Install native gem and restore cross-compiled code from it
125
142
shell : pwsh
126
- run : |
127
- $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
128
- $gemVersion = (Get-Content VERSION).Trim()
129
- $gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
130
-
131
- Write-Host "Looking to unpack $gemToUnpack"
132
- gem unpack --target ./tmp "$gemToUnpack"
133
-
134
- # Restore precompiled code
135
- $source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
136
- $destination = (Resolve-Path ".\lib\tiny_tds").Path
137
- Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
138
-
139
- # Restore ports
140
- Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
143
+ run : " & ./test/bin/restore-from-native-gem.ps1"
144
+ env :
145
+ RUBY_ARCHITECTURE : " x64-mingw32"
141
146
142
147
- name : Setup MSSQL
143
148
uses : rails-sqlserver/setup-mssql@v1
@@ -214,6 +219,18 @@ jobs:
214
219
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
215
220
exit $LASTEXITCODE
216
221
222
+ - name : Test if tsql wrapper works
223
+ shell : pwsh
224
+ run : |
225
+ tsql-ttds -C
226
+ exit $LASTEXITCODE
227
+
228
+ - name : Test if defncopy wrapper works
229
+ shell : pwsh
230
+ run : |
231
+ defncopy-ttds -v
232
+ exit $LASTEXITCODE
233
+
217
234
test-windows-ucrt :
218
235
needs :
219
236
- cross-compile
@@ -250,21 +267,9 @@ jobs:
250
267
251
268
- name : Install native gem and restore cross-compiled code from it
252
269
shell : pwsh
253
- run : |
254
- $rubyArchitecture = (ruby -e "puts RbConfig::CONFIG['arch']").Trim()
255
- $gemVersion = (Get-Content VERSION).Trim()
256
- $gemToUnpack = "./tiny_tds-$gemVersion-$rubyArchitecture.gem"
257
-
258
- Write-Host "Looking to unpack $gemToUnpack"
259
- gem unpack --target ./tmp "$gemToUnpack"
260
-
261
- # Restore precompiled code
262
- $source = (Resolve-Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\lib\tiny_tds").Path
263
- $destination = (Resolve-Path ".\lib\tiny_tds").Path
264
- Get-ChildItem $source -Recurse -Exclude "*.rb" | Copy-Item -Destination {Join-Path $destination $_.FullName.Substring($source.length)}
265
-
266
- # Restore ports
267
- Copy-Item -Path ".\tmp\tiny_tds-$gemVersion-$rubyArchitecture\ports" -Destination "." -Recurse
270
+ run : " & ./test/bin/restore-from-native-gem.ps1"
271
+ env :
272
+ RUBY_ARCHITECTURE : " x64-mingw-ucrt"
268
273
269
274
- name : Setup MSSQL
270
275
uses : rails-sqlserver/setup-mssql@v1
@@ -336,44 +341,94 @@ jobs:
336
341
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
337
342
exit $LASTEXITCODE
338
343
339
- compile-native-ports :
344
+ - name : Test if tsql wrapper works
345
+ shell : pwsh
346
+ run : |
347
+ tsql-ttds -C
348
+ exit $LASTEXITCODE
349
+
350
+ - name : Test if defncopy wrapper works
351
+ shell : pwsh
352
+ run : |
353
+ defncopy-ttds -v
354
+ exit $LASTEXITCODE
355
+
356
+ install-linux :
357
+ needs :
358
+ - cross-compile
359
+ strategy :
360
+ fail-fast : false
361
+ matrix :
362
+ platform :
363
+ - " x86_64-linux-gnu"
364
+ - " x86_64-linux-musl"
365
+ - " aarch64-linux-gnu"
366
+ - " aarch64-linux-musl"
367
+
368
+ ruby-version :
369
+ - " 2.7"
370
+ - " 3.0"
371
+ - " 3.1"
372
+ - " 3.2"
373
+ - " 3.3"
374
+ - " 3.4"
375
+
376
+ include :
377
+ - platform : x86_64-linux-musl
378
+ docker_tag : " -alpine"
379
+ bootstrap : " apk add -U build-base &&" # required to compile bigdecimal on Ruby 2.7
380
+
381
+ - platform : aarch64-linux-gnu
382
+ docker_platform : " --platform=linux/arm64"
383
+
384
+ - platform : aarch64-linux-musl
385
+ docker_platform : " --platform=linux/arm64"
386
+ docker_tag : " -alpine"
387
+ bootstrap : " apk add -U build-base &&"
388
+
389
+ name : install-linux
340
390
runs-on : ubuntu-22.04
341
- name : cross-compile-linux
342
391
steps :
343
392
- uses : actions/checkout@v4
344
393
345
- - uses : ruby/setup-ruby@v1
346
- with :
347
- ruby-version : 3.4
348
- bundler-cache : true
349
-
350
- - name : Write used versions into file
351
- run : bundle exec rake ports:version_file
352
-
353
- - name : Cache ports
354
- uses : actions/cache@v4
394
+ - name : Download precompiled gem
395
+ uses : actions/download-artifact@v4
355
396
with :
356
- path : ports
357
- key : native-v3-${{ hashFiles('**/.ports_versions') }}
358
- restore-keys : |
359
- native-v3-${{ hashFiles('* */.ports_versions') }}
360
- native-v3-
361
-
362
- - name : Build required libraries
363
- run : |
364
- bundle exec rake ports
397
+ name : gem-${{ matrix.platform }}
398
+ path : precompiled/gems
399
+
400
+ - name : Setup QEMU for docker
401
+ uses : docker/setup-qemu-action@v3
402
+ if : ${{ matrix.docker_platform }} != ''
403
+
404
+ - run : |
405
+ docker run --rm -v $PWD/precompiled:/precompiled -w /precompiled \
406
+ ${{ matrix.docker_platform }} ruby:${{ matrix.ruby-version }}${{ matrix.docker_tag }} \
407
+ sh -c "
408
+ gem update --system 3.3.22 &&
409
+ ${{ matrix.bootstrap }}
410
+ gem install --no-document ./gems/tiny_tds-$(cat VERSION)-${{ matrix.platform }}.gem &&
411
+ ruby -e \"require 'tiny_tds'; puts TinyTds::Gem.root_path\" &&
412
+ tsql-ttds -C &&
413
+ defncopy-ttds -v
414
+ "
365
415
366
416
test-linux :
367
417
needs :
368
- - compile-native-ports
418
+ - cross-compile
369
419
name : test-linux
370
420
strategy :
371
421
fail-fast : false
372
422
matrix :
423
+ force-encryption :
424
+ - false
425
+ - true
426
+
373
427
mssql-version :
374
428
- 2017
375
429
- 2019
376
430
- 2022
431
+
377
432
ruby-version :
378
433
- " 2.7"
379
434
- " 3.0"
@@ -391,27 +446,24 @@ jobs:
391
446
ruby-version : ${{ matrix.ruby-version }}
392
447
bundler-cache : true
393
448
394
- - name : Write used versions into file
395
- run : |
396
- bundle exec rake ports:version_file
397
-
398
- - name : Cache ports
399
- uses : actions/cache@v4
449
+ - name : Download precompiled gem
450
+ uses : actions/download-artifact@v4
400
451
with :
401
- path : ports
402
- key : native-v3-${{ hashFiles('**/.ports_versions') }}
403
- fail-on-cache-miss : true
452
+ name : gem-x86_64-linux-gnu
404
453
405
- - name : Build gem
406
- run : |
407
- bundle exec rake build
454
+ - name : Install native gem and restore cross-compiled code from it
455
+ shell : pwsh
456
+ run : " & ./test/bin/restore-from-native-gem.ps1"
457
+ env :
458
+ RUBY_ARCHITECTURE : " x86_64-linux-gnu"
408
459
409
460
- name : Setup MSSQL
410
461
uses : rails-sqlserver/setup-mssql@v1
411
462
with :
412
463
components : sqlcmd,sqlengine
413
464
version : ${{ matrix.mssql-version }}
414
465
sa-password : " c0MplicatedP@ssword"
466
+ force-encryption : ${{ matrix.force-encryption }}
415
467
416
468
- name : Setup MSSQL database
417
469
run : |
@@ -435,6 +487,52 @@ jobs:
435
487
paths : " test/reports/TEST-*.xml"
436
488
if : always()
437
489
490
+ install-linux-native :
491
+ strategy :
492
+ fail-fast : false
493
+ matrix :
494
+ ruby-version :
495
+ - " 2.7"
496
+ - " 3.0"
497
+ - " 3.1"
498
+ - " 3.2"
499
+ - " 3.3"
500
+ - " 3.4"
501
+
502
+ name : install-linux-native
503
+ runs-on : ubuntu-22.04
504
+ steps :
505
+ - uses : actions/checkout@v4
506
+
507
+ - uses : ruby/setup-ruby@v1
508
+ with :
509
+ ruby-version : ${{ matrix.ruby-version }}
510
+ bundler-cache : true
511
+
512
+ - name : Install FreeTDS
513
+ shell : bash
514
+ run : ./test/bin/install-freetds.sh
515
+
516
+ - name : Build gem
517
+ shell : bash
518
+ run : gem build tiny_tds.gemspec
519
+
520
+ - name : Install gem
521
+ shell : bash
522
+ run : gem install "tiny_tds-$(cat VERSION).gem"
523
+
524
+ - name : Test if TinyTDS loads
525
+ shell : bash
526
+ run : ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
527
+
528
+ - name : Test if tsql wrapper works
529
+ shell : bash
530
+ run : tsql-ttds -C
531
+
532
+ - name : Test if defncopy wrapper works
533
+ shell : bash
534
+ run : defncopy-ttds -v
535
+
438
536
install_macos :
439
537
strategy :
440
538
fail-fast : false
0 commit comments