Skip to content

Instantly share code, notes, and snippets.

@takashi
Created December 4, 2019 07:37
Show Gist options
  • Save takashi/2d2c069448f29b12ac20e81241028e8d to your computer and use it in GitHub Desktop.
Save takashi/2d2c069448f29b12ac20e81241028e8d to your computer and use it in GitHub Desktop.
name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
env:
DB_HOST: mysql
DB_PASSWORD: password
RAILS_ENV: test
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
services:
mysql:
image: mysql:5.7
options: --health-cmd "mysqladmin ping -h localhost" --health-interval 20s --health-timeout 10s --health-retries 10
env:
MYSQL_ROOT_PASSWORD: password
container:
image: ruby:2.6.5
env:
DB_HOST: mysql
DB_PASSWORD: password
RAILS_ENV: test
RAILS_MASTER_KEY: $RAILS_MASTER_KEY
steps:
- uses: actions/checkout@v1
- uses: borales/[email protected]
with:
cmd: install
- uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Install bundler
run: gem install bundler --no-document
- name: Build
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Setup DB
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: Run tests
run: bundle exec rspec
- name: Run rubocop
run: bundle exec rubocop -c .rubocop.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment