---
stages:
  - syntax
  - unit
  - acceptance
  - release

cache:
  paths:
    - vendor/bundle

before_script:
  - bundle -v
  - rm Gemfile.lock || true
  - gem update --system $RUBYGEMS_VERSION
  - gem --version
  - bundle -v
  - bundle install --without system_tests --path vendor/bundle --jobs $(nproc)

syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5:
  stage: syntax
  image: ruby:2.4.4
  script:
    - bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
  variables:
    PUPPET_GEM_VERSION: '~> 5.5'

parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
  stage: unit
  image: ruby:2.4.4
  script:
    - bundle exec rake parallel_spec
  variables:
    PUPPET_GEM_VERSION: '~> 5.5'

acceptance with puppet5 ubuntu1604:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet5'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'ubuntu1604-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet5 debian8:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet5'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'debian8-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet5 debian9:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet5'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'debian9-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet5 centos7:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet5'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'centos7-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet6 ubuntu1604:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet6'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'ubuntu1604-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet6 debian8:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet6'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'debian8-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet6 debian9:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet6'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'debian9-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

acceptance with puppet6 centos7:
  stage: acceptance
  variables:
    RBENV_VERSION: '2.5.1'
    PUPPET_INSTALL_TYPE: 'agent'
    BEAKER_IS_PE: 'no'
    BEAKER_PUPPET_COLLECTION: 'puppet6'
    BEAKER_debug: 'true'
    BEAKER_setfile: 'centos7-64'
    BEAKER_HYPERVISOR: 'docker'
  script:
    - bundle exec rake beaker
  tags:
    - puppet-tests

module release:
  stage: release
  variables:
    RBENV_VERSION: '2.5.1'
  script: 
    - pdk build
  tags:
    - puppet-tests
  only:
    - tags
  except:
    - branches
  artifacts:
    paths:
      - pkg/
    expire_in: 6 weeks

