Rails+MySQLのCI(RSpec,Rubocop)
6876 ワード
Rails + MySQLでRSpecとRubocopのCIを行うGithubActionsです。
name: Run rspec, rubocop
on:
push:
pull_request:
jobs:
rspec:
runs-on: ubuntu-latest
timeout-minutes: 10
services:
mysql:
image: mysql:8.0
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
defaults:
run:
working-directory: backend
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: 3.0.2
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: .env
run: cp .env.sample .env
- name: Bundler and gem install
run: |
bundle install
- name: Database create and migrate
run: |
cp config/database.yml.ci config/database.yml
bundle exec rails db:create RAILS_ENV=test
bundle exec rails db:migrate RAILS_ENV=test
- name: Run rubocop-airbnb
run: bundle exec rubocop --require rubocop-airbnb
- name: Run rspec
run: bundle exec rspec spec --format documentation
Author And Source
この問題について(Rails+MySQLのCI(RSpec,Rubocop)), 我々は、より多くの情報をここで見つけました https://zenn.dev/bz0/articles/e290784d1043a5著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Collection and Share based on the CC protocol