.test-template: &test
  cache:
    paths:
      - vendor/ruby
  before_script:
    - gem install bundler --no-document
    - bundle config set --local path 'vendor/bundle'
    - bundle config set --local without 'development'
    - bundle install -j $(nproc)
    - ruby -v                                   # Print out ruby version for debugging
  script:
    - bundle exec rake compile
    - bundle exec rake test

default:
  image: "ruby:${RUBY_VERSION}"

rspec:
  parallel:
    matrix:
      - RUBY_VERSION: ["2.6", "2.7", "3.0"]
  <<: *test

truffleruby:
  image: "flavorjones/truffleruby:buster"
  allow_failure: true
  <<: *test

.test-template: &test
  cache:
    paths:
      - vendor/ruby
  before_script:
    - gem install bundler --no-document
    - bundle config set --local path 'vendor/bundle'
    - bundle config set --local without 'development'
    - bundle install -j $(nproc)
    - ruby -v                                   # Print out ruby version for debugging
  script:
    - bundle exec rake compile
    - bundle exec rake test

default:
  image: "ruby:${RUBY_VERSION}"

rspec:
  parallel:
    matrix:
      - RUBY_VERSION: ["2.6", "2.7", "3.0"]
  <<: *test

truffleruby:
  image: "flavorjones/truffleruby:buster"
  allow_failure: true
  <<: *test

gems:
  services:
    - docker:${DOCKER_VERSION}-dind
  variables:
    DOCKER_VERSION: "20.10.1"
    DOCKER_DRIVER: overlay2
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
    RUBY_VERSION: "2.7"
  stage: test
  when: manual
  <<: *test
  script:
    - apt update && apt-get install -y docker.io
    - bundle exec rake gem:native
  artifacts:
    paths:
      - pkg/*.gem

Add GitLab manual CI step for building native gems
ci: Add GitLab manual CI step for building native gems

This is done in preparation for
https://github.com/kwilczynski/ruby-magic/pull/33.
