AlexWayfer/gem_generator

View on GitHub
.cirrus.yaml

Summary

Maintainability
Test Coverage
bundle_cache: &bundle_cache
  bundle_cache:
    folder: /usr/local/bundle
    fingerprint_script:
      - echo $CIRRUS_OS
      - ruby -v
      - cat Gemfile
      - cat *.gemspec
  install_script:
    - gem install bundler
    - bundle update

env:
  ## To suppress flood of warnings:
  ## https://github.com/cirruslabs/cirrus-ci-docs/issues/814
  ## https://github.com/rubygems/rubygems/issues/4466#issuecomment-818688569
  ## Global for:
  ## 1. different tasks (rubocop, test, etc.);
  ## 2. avoiding overriding `env` in specific cases like macOS.
  TMPDIR: $CIRRUS_WORKING_DIR

remark_task:
  container:
    image: node

  node_modules_cache:
    folder: node_modules
    fingerprint_script:
      - echo $CIRRUS_OS
      - node -v
      - cat package.json

  install_script: npm install

  lint_script: npm run remark

  only_if: ($CIRRUS_BRANCH == 'main') ||
    changesInclude(
      '.cirrus.yaml', 'package.json', '.remarkrc.yaml', '**.md'
    )

bundle-audit_task:
  container:
    image: ruby

  <<: *bundle_cache

  audit_script: bundle exec bundle-audit check --update

  only_if: ($CIRRUS_BRANCH == 'main') ||
    changesInclude(
      '.cirrus.yaml', '.gitignore', 'Gemfile', '*.gemspec'
    )

rubocop_task:
  container:
    image: ruby

  <<: *bundle_cache

  lint_script: bundle exec rubocop

  always:
    rubocop_artifacts:
      path: rubocop.json
      type: text/json
      format: rubocop

  only_if: ($CIRRUS_BRANCH == 'main') ||
    changesInclude(
      '.cirrus.yaml', '.gitignore', 'Gemfile', '.rubocop.yml', '*.gemspec', '**.rb', '**.ru'
    )

rspec_task:
  container:
    matrix:
      - image: ruby:3.0
      - image: ruby:3.1
      - image: ruby:3.2
      - image: ruby:3.3

  <<: *bundle_cache

  test_script: bundle exec rspec

  codecov_uploader_cache:
    folder: codecov
    fingerprint_script:
      - curl --no-progress-meter https://uploader.codecov.io/latest/linux/codecov.SHA256SUM
    populate_script:
      - mkdir -p codecov
      - curl https://uploader.codecov.io/latest/linux/codecov -o codecov/uploader
      - chmod +x codecov/uploader

  codecov_script: codecov/uploader

  only_if: ($CIRRUS_BRANCH == 'main') ||
    changesInclude(
      '.cirrus.yaml', '.gitignore', 'Gemfile', '.rspec', '*.gemspec', 'lib/**', 'spec/**'
    )