概要
actionsにredisを追加してActiveJobのCIに対応する。
結論
docs.github.com ここに書いてありますね。
で、Rails用のactionsに置き換えると下記のような感じかなと。
name: Build
on:
push:
branches:
- master
- development
pull_request:
branches:
- master
- development
jobs:
run_test:
name: Run test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
REDIS_HOST: redis
REDIS_PORT: 6379
steps:
- uses: actions/checkout@v1
- name: Set up Ruby 2.6
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.6
- name: install bundler2
run: gem install bundler
- name: Install dependent libralies
run: sudo apt-get install libpq-dev graphviz
- name: Bundle install
run: bundle install --jobs 4 --retry 3
- name: Yarn install
run: yarn install --check-files
- name: Setup Database
run: |
cp config/database.yml.ci config/database.yml
bundle exec rake db:create
bundle exec rake db:schema:load
env:
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Run test
run: |
COVERAGE=true bundle exec rails test
COVERAGE=true bundle exec rails test:system
env:
LANG: ja_JP.UTF-8
RAILS_ENV: test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
- name: Upload
uses: actions/upload-artifact@v2
if: failure()
with:
name: my-uploads
path: tmp/screenshots/