Skip to content

Migrate from Travis CI to GitHub Actions with multi-Ruby version supp… #3

Migrate from Travis CI to GitHub Actions with multi-Ruby version supp…

Migrate from Travis CI to GitHub Actions with multi-Ruby version supp… #3

Workflow file for this run

name: CI
on:
push:
branches: [ master, main ]
pull_request:
branches: [ master, main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- '2.4'
- '2.5'
- '2.6'
- '2.7'
- '3.0'
- '3.1'
- '3.2'
- '3.3'
include:
- ruby: 'head'
continue-on-error: true
- ruby: 'jruby-9.4'
continue-on-error: true
- ruby: '2.2'
continue-on-error: true
- ruby: '2.3'
continue-on-error: true
continue-on-error: ${{ matrix.continue-on-error || false }}
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: 111
POSTGRES_DB: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: 111
MYSQL_DATABASE: leafy_test
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
COVERAGE: 1
CC_TEST_REPORTER_ID: 5c94ea74238649cee4b51abbe647de62a3d63971eaeca9aa58c82b62d9a0e6a8
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Setup Code Climate Test Reporter (for Ruby 3.3 only)
if: matrix.ruby == '3.3'
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: Run tests
run: bundle exec rspec
- name: Upload coverage to Code Climate (for Ruby 3.3 only)
if: matrix.ruby == '3.3' && success()
run: ./cc-test-reporter after-build --exit-code $?