diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..696f4882 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,158 @@ +version: 2.1 + +orbs: + win: circleci/windows@2.2.0 + +jobs: + test_linux: + parameters: + ruby_version: + description: "version tag for the veracross/circleci-ruby-freetds container" + type: string + + docker: + - image: veracross/circleci-ruby-freetds:latest + - image: metaskills/mssql-server-linux-tinytds:2017-GA + + working_directory: ~/repo + + steps: + - checkout + + - restore_cache: + name: restore gem cache + keys: + - v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }} + - v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}- + - v1-bundle-<< parameters.ruby_version >>- + + - run: + name: install dependencies + command: | + bundle check --path ./vendor/bundle || bundle install --jobs=3 --retry=3 --path vendor/bundle + bundle clean + + - save_cache: + name: save gem cache + paths: + - ./vendor/bundle + key: v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }} + + - run: + name: build gem + command: | + bundle exec rake build + + - run: + # imported from setup.sh, although we should do better... + name: wait for database + command: | + sleep 10 + + - run: + name: run tests + command: | + TINYTDS_UNIT_HOST=localhost bundle exec rake test + + test_windows: + parameters: + ruby_version: + description: "version tag for the veracross/circleci-ruby-freetds container" + type: string + + executor: + name: win/default + shell: powershell.exe + + steps: + # - run: + # name: diagnostics + # command: | + # systeminfo + # pwd + # where perl + # perl --version + # ruby --version + # gem --version + + - run: + name: install msys2 + command: | + choco install msys2 + + - run: + name: ridk install + command: | + ridk install 2 3 + + # - run: + # name: diagnostics- perl modules + # command: | + # cpan -l + + # - run: + # name: install Pod::Usage + # command: | + # cpanm Pod::Usage + + - checkout + + - restore_cache: + name: restore gem cache + keys: + - v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }} + - v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}- + - v1-bundle-<< parameters.ruby_version >>- + + - run: + name: install dependencies + command: | + bundle install --jobs=3 --retry=3 --path ./vendor/bundle + bundle clean + + - save_cache: + name: save gem cache + paths: + - ./vendor/bundle + key: v1-bundle-<< parameters.ruby_version >>-{{ .Branch }}-{{ checksum "tiny_tds.gemspec" }} + + - run: + name: install ports + no_output_timeout: 60m + command: | + ridk enable + bundle exec rake ports + + - run: + name: build gem + command: | + bundle exec rake build + + - run: + # imported from setup.sh, although we should do better... + name: wait for database + command: | + sleep 10 + + - run: + name: run tests + command: | + TINYTDS_UNIT_HOST=localhost bundle exec rake test + +workflows: + test_supported_ruby_versions: + jobs: + # - test_linux: + # matrix: + # parameters: + # ruby_version: + # - '2.5.3' + # - '2.7' + + + - test_windows: + matrix: + parameters: + ruby_version: + # - '2.5.3' + - '2.7'