Skip to content

Support Rails 8.0

Support Rails 8.0 #58

Workflow file for this run

name: checks
on:
pull_request:
paths-ignore:
- .gitignore
- CHANGELOG.md
- CONTRIBUTING.md
- README.md
push:
paths-ignore:
- .gitignore
- CHANGELOG.md
- CONTRIBUTING.md
- README.md
jobs:
linter:
name: Run StandardRB linter
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/activerecord_8.0.gemfile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run StandardRB
id: offenses
run: |
echo "LINTER_OFFENSES<<EOF" >> $GITHUB_OUTPUT
echo "$(${{ matrix.env }} bundle exec standardrb)" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Print offenses
if: steps.offenses.outputs.LINTER_OFFENSES
run: |
echo '${{ steps.offenses.outputs.LINTER_OFFENSES }}'
- name: Fail if StandardRB offenses found
if: steps.offenses.outputs.LINTER_OFFENSES
uses: actions/github-script@v7
with:
script: "core.setFailed('StandardRB linter offenses found. Please inspect the details \
of the previous step in the job for more info.')"
tests:
name: Run tests (ruby ${{ matrix.ruby }}, rails ${{ matrix.rails }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- ruby: '3.3'
rails: '8.0'
- ruby: '3.3'
rails: '7.2'
- ruby: '3.3'
rails: '7.1'
- ruby: '3.3'
rails: '7.0'
- ruby: '3.2'
rails: '8.0'
- ruby: '3.2'
rails: '7.2'
- ruby: '3.2'
rails: '7.1'
- ruby: '3.2'
rails: '7.0'
- ruby: '3.1'
rails: '7.2'
- ruby: '3.1'
rails: '7.1'
- ruby: '3.1'
rails: '7.0'
- ruby: '3.1'
rails: '6.1'
- ruby: '3.0'
rails: '7.1'
- ruby: '3.0'
rails: '7.0'
- ruby: '3.0'
rails: '6.1'
- ruby: '2.7'
rails: '7.1'
- ruby: '2.7'
rails: '7.0'
- ruby: '2.7'
rails: '6.1'
- ruby: '2.7'
rails: '6.0'
- ruby: '2.6'
rails: '6.1'
- ruby: '2.6'
rails: '6.0'
- ruby: '2.5'
rails: '6.1'
- ruby: '2.5'
rails: '6.0'
- ruby: 'jruby'
rails: '7.0'
- ruby: 'jruby'
rails: '6.1'
- ruby: 'truffleruby'
rails: '8.0'
- ruby: 'truffleruby'
rails: '7.2'
- ruby: 'truffleruby'
rails: '7.1'
- ruby: 'truffleruby'
rails: '7.0'
- ruby: 'truffleruby'
rails: '6.1'
- ruby: 'truffleruby'
rails: '6.0'
env:
BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.rails }}.gemfile
SKIPPED_ADAPTERS: ${{ matrix.skipped_adapters }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup MySQL and PostgreSQL via Docker Compose
run: docker compose up -d --wait
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests
run: bundle exec rake spec
- name: Upload code coverage results as artifacts
uses: actions/upload-artifact@v4
with:
name: coverage-ruby-${{ matrix.ruby }}-rails-${{ matrix.rails }}
include-hidden-files: true
path: coverage/.resultset.json
coverage:
name: Calculate test coverage
needs: tests
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: gemfiles/activerecord_8.0.gemfile
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: coverage-resultsets
- name: Display structure of downloaded files
run: ls -Rla
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Collate coverage reports
run: ${{ matrix.env }} bundle exec rake ci:coverage:collate
- name: Upload total code coverage result as an artifact
uses: actions/upload-artifact@v4
with:
name: coverage-total
include-hidden-files: true
path: coverage/.last_run.json
- name: Fetch total coverage values from simplecov files
id: coverage
run: |
echo "COVERAGE_LINE=$(cat coverage/.last_run.json | jq '.result.line')" >> $GITHUB_OUTPUT
echo "COVERAGE_BRANCH=$(cat coverage/.last_run.json | jq '.result.branch')" >> $GITHUB_OUTPUT
- name: Print total coverage
run: |
echo "Total line test coverage: ${{ steps.coverage.outputs.COVERAGE_LINE }}%"
echo "Total branch test coverage: ${{ steps.coverage.outputs.COVERAGE_BRANCH }}%"
- name: Fail if coverage is less than 100%
if: steps.coverage.outputs.COVERAGE_LINE != 100 || steps.coverage.outputs.COVERAGE_BRANCH != 100
uses: actions/github-script@v7
with:
script: "core.setFailed('Please make sure test coverage is 100%. \
Currently: ${{ steps.coverage.outputs.COVERAGE_LINE }}% (line), \
${{ steps.coverage.outputs.COVERAGE_BRANCH }}% (branch).')"