---
.defaults: &defaults
  before_script:
    - apk add --update ragel build-base
    - if [ "$INSTALL_OPENJDK" == "true" ]; then apk add openjdk8; fi
    - gem install bundler --no-document
    - ruby --version
    - gem --version
    - bundle --version
    - bundle install --path vendor --retry=3
  script:
    - bundle exec rake
  cache:
    paths:
      - vendor/ruby

Ruby 2.3:
  image: "ruby:2.3-alpine"
  <<: *defaults

Ruby 2.4:
  image: "ruby:2.4-alpine"
  <<: *defaults

Ruby 2.5:
  image: "ruby:2.5-alpine"
  <<: *defaults

Ruby 2.6:
  image: "ruby:2.6-alpine"
  <<: *defaults

Ruby 2.7:
  image: "ruby:2.7-alpine"
  <<: *defaults

JRuby 9.1:
  image: "jruby:9.1-alpine"
  variables:
    INSTALL_OPENJDK: "true"
  <<: *defaults
