Colex/gdpr_admin

View on GitHub
.github/workflows/build.yml

Summary

Maintainability
Test Coverage
name: Build
on:
  - push
  - pull_request

jobs:
  lint:
    name: Static checks
    runs-on: 'ubuntu-latest'
    steps:
      - uses: actions/checkout@v3
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: "3.1"
      - name: Install dependencies
        run: bundle install
      - name: Run linting
        run: bundle exec rubocop

  build:
    name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
    strategy:
      fail-fast: false
      matrix:
        ruby:
          - "3.2"
          - "3.1"
          - "3.0"
          - "2.7"
        rails:
          - "6.1"
          - "7.0"
          - main
        exclude:
          - ruby: "3.1"
            rails: "6.0"
          - ruby: "3.2"
            rails: "6.0"
    runs-on: 'ubuntu-latest'
    env:
      RUBYOPT: "--disable-error_highlight"
    steps:
      - uses: actions/checkout@v2
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby }}
      - name: Install ruby dependencies
        run: bundle install
      - name: Setup database
        run: rails db:create db:migrate
      - name: Run test
        run: bundle exec rspec

  coverage:
    environment: main
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: 3.1
    - name: Setup Code Climate test-reporter
      run: |
        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
    - name: Build and test with RSpec
      run: |
        bundle install --jobs 4 --retry 3
        bundle exec rspec
    - name: Publish code coverage
      run: |
        export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}"
        ./cc-test-reporter after-build -r ${{secrets.CC_TEST_REPORTER_ID}}