Skip to content

Commit bb696e2

Browse files
committed
Test installation on ARM Mac
1 parent 089694f commit bb696e2

File tree

1 file changed

+91
-14
lines changed

1 file changed

+91
-14
lines changed

.circleci/config.yml

Lines changed: 91 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ jobs:
9999
- restore_cache:
100100
name: restore ports cache
101101
keys:
102-
- ports-<< parameters.ruby_version >>-{{ checksum ".ports_versions" }}
103-
- ports-<< parameters.ruby_version >>-
102+
- ports-<< parameters.ruby_version >>-{{ arch }}-{{ checksum ".ports_versions" }}
103+
- ports-<< parameters.ruby_version >>-{{ arch }}-
104104

105105
- run:
106106
name: compile ports
@@ -126,7 +126,7 @@ jobs:
126126
name: save ports cache
127127
paths:
128128
- ./ports
129-
key: ports-<< parameters.ruby_version >>-{{ checksum ".ports_versions" }}
129+
key: ports-<< parameters.ruby_version >>-{{ arch }}-{{ arch }}-{{ checksum ".ports_versions" }}
130130

131131
- store_test_results:
132132
path: test/reports
@@ -155,9 +155,9 @@ jobs:
155155
- restore_cache:
156156
name: restore gem cache
157157
keys:
158-
- v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
159-
- v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-
160-
- v1-bundle-<< parameters.ruby_version >>-
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 }}-
161161

162162
- run:
163163
name: bundle install gems
@@ -169,7 +169,7 @@ jobs:
169169
name: save gem cache
170170
paths:
171171
- ./vendor/bundle
172-
key: v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
172+
key: v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
173173

174174
- attach_workspace:
175175
at: artifacts
@@ -261,8 +261,8 @@ jobs:
261261
- restore_cache:
262262
name: restore ports cache
263263
keys:
264-
- ports-win-{{ checksum ".ports_versions" }}
265-
- ports-win-
264+
- ports-win-{{ arch }}-{{ checksum ".ports_versions" }}
265+
- ports-win-{{ arch }}-
266266

267267
- run:
268268
name: Build gem
@@ -288,7 +288,7 @@ jobs:
288288
name: save ports cache
289289
paths:
290290
- ./ports
291-
key: ports-win-{{ checksum ".ports_versions" }}
291+
key: ports-win-{{ arch }}-{{ checksum ".ports_versions" }}
292292

293293
- persist_to_workspace:
294294
name: save gems into workspace
@@ -333,9 +333,9 @@ jobs:
333333
- restore_cache:
334334
name: restore gem cache
335335
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 >>-
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 }}-
339339

340340
- run:
341341
name: bundle install gems
@@ -347,7 +347,7 @@ jobs:
347347
name: save gem cache
348348
paths:
349349
- ./vendor/bundle
350-
key: v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
350+
key: v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
351351

352352
- run:
353353
name: build gem
@@ -369,6 +369,72 @@ jobs:
369369
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
370370
exit $LASTEXITCODE
371371
372+
install_mac_silicon:
373+
parameters:
374+
ruby_version:
375+
description: "version tag for rubydev environment"
376+
type: string
377+
378+
# the XCode version on Mac OS also determines the Mac OS version you get
379+
# so for 15.0, we get 13.5.1
380+
macos:
381+
xcode: "15.0.0"
382+
resource_class: macos.m1.medium.gen1
383+
384+
steps:
385+
- run:
386+
name: Install rbenv and freetds from Homebrew
387+
command: |
388+
brew install freetds rbenv
389+
390+
- run:
391+
name: Install Ruby
392+
command: |
393+
latest_version=$(rbenv install --list-all | grep "<< parameters.ruby_version >>" | grep -v - | tail -1)
394+
rbenv install --skip-existing $latest_version
395+
rbenv global $latest_version
396+
397+
- run:
398+
name: Install bundler
399+
command: |
400+
gem install bundler -v 2.3.26
401+
402+
- checkout
403+
404+
- restore_cache:
405+
name: restore gem cache
406+
keys:
407+
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
408+
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-
409+
- v1-bundle-<< parameters.ruby_version >>-{{ arch }}-
410+
411+
- run:
412+
name: bundle install gems
413+
command: |
414+
bundle install --path vendor/bundle
415+
416+
- save_cache:
417+
name: save gem cache
418+
paths:
419+
- ./vendor/bundle
420+
key: v1-bundle-<< parameters.ruby_version >>-{{ arch }}-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }}
421+
422+
- run:
423+
name: build gem
424+
command: |
425+
gem build tiny_tds.gemspec
426+
427+
- run:
428+
name: Install gem
429+
command: |
430+
gemVersion=$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' < VERSION)
431+
gem install --local "tiny_tds-$gemVersion.gem"
432+
433+
- run:
434+
name: Check if gem loads correctly
435+
command: |
436+
ruby -e "require 'tiny_tds'; puts TinyTds::Gem.root_path"
437+
372438
workflows:
373439
test_supported_ruby_versions:
374440
jobs:
@@ -405,3 +471,14 @@ workflows:
405471
- '3.0'
406472
- '3.1'
407473
- '3.2'
474+
475+
- install_mac_silicon:
476+
matrix:
477+
parameters:
478+
# Ruby 2.4 and Ruby 2.5 do not build on Silicon anymore
479+
ruby_version:
480+
- '2.6'
481+
- '2.7'
482+
- '3.0'
483+
- '3.1'
484+
- '3.2'

0 commit comments

Comments
 (0)