gocardless/statesman

View on GitHub
.github/workflows/tests.yml

Summary

Maintainability
Test Coverage
name: tests

on:
  push:
    branches:
      - "master"
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  rubocop:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - run: bundle exec rubocop --extra-details --display-style-guide --parallel --force-exclusion

  postgres:
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ["3.0", "3.1", "3.2", "3.3"]
        rails-version:
          - "6.1.7.6"
          - "7.0.8"
          - "7.1.1"
          - "main"
        postgres-version: ["12", "13", "14", "15", "16"]
        exclude:
          - ruby-version: "3.2"
            rails-version: "6.1.7.6"
          - ruby-version: "3.3"
            rails-version: "6.1.7.6"
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:${{ matrix.postgres-version }}
        env:
          POSTGRES_USER: postgres
          POSTGRES_DB: statesman_test
          POSTGRES_PASSWORD: statesman
        ports:
          - 5432:5432
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 10
    env:
      DATABASE_URL: postgres://postgres:statesman@localhost/statesman_test
      DATABASE_DEPENDENCY_PORT: "5432"
    steps:
      - uses: actions/checkout@v3
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: "${{ matrix.ruby-version }}"
      - name: Run specs
        run: |
          bundle exec rspec --profile --format progress --format RSpec::Github::Formatter

  mysql:
    strategy:
      fail-fast: false
      matrix:
        ruby-version: ["3.0", "3.1", "3.2", "3.3"]
        rails-version:
          - "6.1.7.6"
          - "7.0.8"
          - "7.1.1"
          - "main"
        mysql-version: ["8.0", "8.2"]
        exclude:
          - ruby-version: "3.2"
            rails-version: "6.1.7.6"
          - ruby-version: "3.3"
            rails-version: "6.1.7.6"
    runs-on: ubuntu-latest
    services:
      mysql:
        image: mysql:${{ matrix.mysql-version }}
        env:
          MYSQL_ROOT_PASSWORD: password
          MYSQL_USER: foobar
          MYSQL_PASSWORD: password
          MYSQL_DATABASE: statesman_test
        ports:
          - "3306:3306"
        options: >-
          --health-cmd "mysqladmin ping"
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    env:
      DATABASE_URL: mysql2://foobar:password@127.0.0.1/statesman_test
      DATABASE_DEPENDENCY_PORT: "3306"
    steps:
      - uses: actions/checkout@v3
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          ruby-version: "${{ matrix.ruby-version }}"
      - name: Run specs
        run: |
          bundle exec rspec --profile --format progress --format RSpec::Github::Formatter