image: public.ecr.aws/docker/library/ruby

stages:
  - test
  - publish

before_script:
  - "echo ':ssl_verify_mode: 0' >> ~/.gemrc"
  - bundle config ssl_verify_mode 0
  - bundle install --path=/tmp/bundler --jobs=8 --quiet

rubocop:
  stage: test
  image: public.ecr.aws/docker/library/ruby:2.7
  script:
    - bundle exec rubocop

rspec_latest:
  stage: test
  script:
    - bundle exec rspec

rspec_2.6:
  stage: test
  image: public.ecr.aws/docker/library/ruby:2.6
  script:
    - bundle exec rspec

rspec_2.5:
  stage: test
  image: public.ecr.aws/docker/library/ruby:2.5
  script:
    - bundle exec rspec

rspec_2.2:
  stage: test
  image: ruby:2.2
  script:
    - bundle exec rspec

publish_gem:
  stage: publish
  script:
    - gem build access_token_agent.gemspec
    - gem push $(find `pwd` -name "access_token_agent-*.gem")
  only:
    - main