Dynamoid/dynamoid

View on GitHub
.github/workflows/ci.yml

Summary

Maintainability
Test Coverage
name: CI

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  # Allow manually triggering the workflow.
  workflow_dispatch:

# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
  # The concurrency group contains the workflow name and the branch name.
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  tests:
    runs-on: ubuntu-latest

    env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
      BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile

    # Do not bother building commits with [ci skip] or [skip ci] in the commit message
    if: "!contains(github.event.commits[0].message, '[ci skip]') && !contains(github.event.commits[0].message, '[skip ci]')"

    strategy:
      fail-fast: false

      matrix:
        gemfile:
          - rails_4_2
          - rails_5_0
          - rails_5_1
          - rails_5_2
          - rails_6_0
          - rails_6_1
          - rails_7_0
          - rails_7_1
        rubygems:
          - default
        bundler:
          - default
        ruby:
          - "2.3"
          - "2.4"
          - "2.5"
          - "2.6"
          - jruby
          - "2.7"
          - "3.0"
          - "3.1"
          - "3.2"
          - "3.3"
        exclude:

          # Rails 7.1 requires Ruby 2.7 and above
          - gemfile: rails_7_1
            ruby: "2.3"
          - gemfile: rails_7_1
            ruby: "2.4"
          - gemfile: rails_7_1
            ruby: "2.5"
          - gemfile: rails_7_1
            ruby: "2.6"

          # Rails 7.0 requires Ruby 2.7 and above
          - gemfile: rails_7_0
            ruby: "2.3"
          - gemfile: rails_7_0
            ruby: "2.4"
          - gemfile: rails_7_0
            ruby: "2.5"
          - gemfile: rails_7_0
            ruby: "2.6"

          # Rails 6.1 requires Ruby 2.5 and above.
          - gemfile: rails_6_1
            ruby: "2.3"
          - gemfile: rails_6_1
            ruby: "2.4"

          # Rails 6.0 requires Ruby 2.5 and above.
          - gemfile: rails_6_0
            ruby: "2.3"
          - gemfile: rails_6_0
            ruby: "2.4"

          # Rails supports Ruby 3.0 since 6.0 only. So skip all the other Rails versions.
          - ruby: "3.0"
            gemfile: rails_4_2
          - ruby: "3.0"
            gemfile: rails_5_0
          - ruby: "3.0"
            gemfile: rails_5_1
          - ruby: "3.0"
            gemfile: rails_5_2
          - ruby: "3.1"
            gemfile: rails_4_2
          - ruby: "3.1"
            gemfile: rails_5_0
          - ruby: "3.1"
            gemfile: rails_5_1
          - ruby: "3.1"
            gemfile: rails_5_2
          - ruby: "3.2"
            gemfile: rails_4_2
          - ruby: "3.2"
            gemfile: rails_5_0
          - ruby: "3.2"
            gemfile: rails_5_1
          - ruby: "3.2"
            gemfile: rails_5_2
          - ruby: "3.3"
            gemfile: rails_4_2
          - ruby: "3.3"
            gemfile: rails_5_0
          - ruby: "3.3"
            gemfile: rails_5_1
          - ruby: "3.3"
            gemfile: rails_5_2

          - ruby: "jruby"
            gemfile: rails_4_2
          - ruby: "jruby"
            gemfile: rails_5_0
          - ruby: "jruby"
            gemfile: rails_5_1
          - ruby: "jruby"
            gemfile: rails_5_2

        include:
          - ruby: "jruby-9.3.9.0"
            gemfile: rails_4_2
          - ruby: "jruby-9.3.9.0"
            gemfile: rails_5_0
          - ruby: "jruby-9.3.9.0"
            gemfile: rails_5_1
          - ruby: "jruby-9.3.9.0"
            gemfile: rails_5_2

    name: ${{ matrix.gemfile }}, Ruby ${{ matrix.ruby }}

    steps:
    - uses: actions/checkout@v3

    - name: Setup Ruby & Bundle
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        rubygems: ${{ matrix.rubygems }}
        bundler: ${{ matrix.bundler }}
        bundler-cache: true

    - name: Start dynamodb-local
      run: |
        docker compose up -d

    - name: Run RSpec tests
      run: |
        bundle exec rspec

    - name: Stop dynamodb-local
      run: |
        docker compose down