.github/workflows/pr-build.yml
name: pr-build
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches: [main]
schedule:
# NOTE: runs on every first day of a month
- cron: '0 0 1 * *'
jobs:
pr-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
# @see https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
# NOTE: check the versions that Ruby supports at https://www.ruby-lang.org/en/downloads/branches/
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
# NOTE: check the versions that Rails supports at https://guides.rubyonrails.org/maintenance_policy.html
rails: ['7.0', '6.1', '6.0', '5.2']
exclude:
- ruby: '2.6'
rails: '7.0'
- ruby: '2.5'
rails: '7.0'
- ruby: '3.1'
rails: '6.0'
- ruby: '3.1'
rails: '5.2'
- ruby: '3.0'
rails: '5.2'
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.rails-${{ matrix.rails }}
RAILS_ENV: test
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Rubocop Check
run: bundle exec rubocop
- name: Minitest
run: |
if [ "$GITHUB_REF_NAME" = "main" ]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
if [ "$GITHUB_REF_NAME" = "main" ]; then chmod +x ./cc-test-reporter; fi
if [ "$GITHUB_REF_NAME" = "main" ]; then ./cc-test-reporter before-build; fi
bundle exec rake --trace test
if [ "$GITHUB_REF_NAME" = "main" ]; then ./cc-test-reporter after-build -r ${{ env.CC_TEST_REPORTER_ID }}; fi