activescaffold/active_scaffold

View on GitHub
.gitlab-ci.yml

Summary

Maintainability
Test Coverage
.deploy:
  before_script:
    - cat /etc/os-release
    - uname -a
    - ruby --version
    - gem --version
    - gem install bundler
    - bundle --version
    - apk add --no-cache --update build-base git
    - bundle config set --local clean 'true'
    - bundle config set --local deployment 'true'
    - bundle config set --local without 'default development lint production test performance'
    - bundle install --jobs=2
  image: ruby:3.0-alpine
  only:
    - master
  stage: deploy
  tags:
    - gitlab-org

.lint:
  before_script:
    - cat /etc/os-release
    - uname -a
    - ruby --version
    - gem --version
    - gem install bundler
    - bundle --version
    - apk add --no-cache --update build-base git
    - bundle config set --local clean 'true'
    - bundle config set --local deployment 'true'
    - bundle config set --local without 'default deployment development production test performance'
    - bundle install --jobs=2
  image: ruby:3.0-alpine
  stage: lint
  tags:
    - gitlab-org

.test_before_script: &test_before_script
  - cat /etc/os-release
  - uname -a
  - ruby --version
  - gem --version
  - gem install bundler -v 2.3.26 # bundler 2.3.26 for ruby 2.5 and jruby 9.2
  - bundle --version
  - bundle config set --local clean 'true'
  - bundle config set --local deployment 'true'
  - bundle config set --local without 'deployment development lint production performance'

.test_alpine_before_script: &test_alpine_before_script
  - apk add --no-cache --update build-base curl git sqlite-dev tzdata

.test_debian_before_script: &test_debian_before_script
  - apt-get update
  - apt-get install -y build-essential curl git libsqlite3-dev tzdata

.test:
  artifacts:
    expire_in: 1 day
    paths:
      - coverage
  before_script:
    - *test_before_script
    - *test_alpine_before_script
  script:
    - bundle install --jobs=2
    - bundle exec rake
  stage: test
  tags:
    - gitlab-org

.use_jruby_9_2:
  image: bitnami/jruby:9.2
  before_script:
    - *test_before_script
    - *test_debian_before_script

.use_mri_2_5:
  image: ruby:2.5-alpine

.use_mri_2_6:
  image: ruby:2.6-alpine

.use_mri_2_7:
  image: ruby:2.7-alpine

.use_mri_3_0:
  image: ruby:3.0-alpine

.use_mri_3_1:
  image: ruby:3.1-alpine

.use_rails_5_2:
  extends: .test
  variables:
    BUNDLE_GEMFILE: gemfiles/Gemfile.rails-5.2.x

.use_rails_6_0:
  extends: .test
  variables:
    BUNDLE_GEMFILE: gemfiles/Gemfile.rails-6.0.x

.use_rails_6_1:
  extends: .test
  variables:
    BUNDLE_GEMFILE: Gemfile

cache:
  paths:
    - vendor/bundle

lint:brakeman:
  extends: .lint
  artifacts:
    expire_in: 1 day
    paths:
      - brakeman
    when: always
  script:
    - bundle exec brakeman --exit-on-warn --output brakeman/index.html

lint:bundler:audit:
  extends: .lint
  script:
    - bundle exec bundle-audit check --update --verbose

lint:i18n:
  extends: .lint
  allow_failure: true
  script:
    - bundle exec i18n-tasks health

lint:rubocop:
  extends: .lint
  script:
    - bundle exec rubocop

pages:
  extends: .deploy
  artifacts:
    expire_in: 1 month
    paths:
      - public
  script:
    - DIR=public/$([ "$CI_COMMIT_REF_SLUG" = master ] || echo $CI_COMMIT_REF_SLUG)
    - mkdir -pv $DIR
    - mv -v brakeman $DIR
    - mv -v coverage $DIR
  except:
    - tags

stages:
  - lint
  - test
  - deploy

test:rails-5.2:jruby:9.2:
  extends:
    - .use_rails_5_2
    - .use_jruby_9_2

test:rails-5.2:mri:2.5:
  extends:
    - .use_mri_2_5
    - .use_rails_5_2

test:rails-5.2:mri:2.6:
  extends:
    - .use_mri_2_6
    - .use_rails_5_2

#test:rails-6.0:jruby:9.2:
#  extends:
#    - .use_rails_6_0
#    - .use_jruby_9_2

test:rails-6.0:mri:2.6:
  extends:
    - .use_mri_2_6
    - .use_rails_6_0
  variables:
    COVERAGE: 'true'
  before_script:
    - *test_before_script
    - *test_alpine_before_script
    - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
    - chmod +x ./cc-test-reporter
    - ./cc-test-reporter before-build
  after_script:
    - ./cc-test-reporter after-build -t simplecov


test:rails-6.0:mri:2.7:
  extends:
    - .use_mri_2_7
    - .use_rails_6_0

test:rails-6.0:mri:3.0:
  extends:
    - .use_mri_3_0
    - .use_rails_6_0

#test:rails-6.1:jruby:9.2:
#  extends:
#    - .use_rails_6_1
#    - .use_jruby_9_2

#test:rails-6.1:mri:2.5:
#  extends:
##    - .use_mri_2_5
#    - .use_rails_6_1

test:rails-6.1:mri:2.6:
  extends:
    - .use_mri_2_6
    - .use_rails_6_1

test:rails-6.1:mri:2.7:
  extends:
    - .use_mri_2_7
    - .use_rails_6_1

test:rails-6.1:mri:3.0:
  extends:
    - .use_mri_3_0
    - .use_rails_6_1

test:rails-6.1:mri:3.1:
  extends:
    - .use_mri_3_1
    - .use_rails_6_1

variables:
  JRUBY_OPTS: --debug
  LC_ALL: C.UTF-8
  RAILS_ENV: test