Skip to content

questionコントローラーにset_testを追加 #46

questionコントローラーにset_testを追加

questionコントローラーにset_testを追加 #46

Workflow file for this run

# テスト(rspec)、コードルール(rubocop, eslint, prettier)のチェックを行う
name: Continuous Integration
# 当 workflow の実行タイミング
# ブランチへの push 時
on:
push:
# 当 workflow が行う処理
jobs:
# 処理① rspec がオールグリーンであることをチェック
rspec:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rails
services:
mysql:
image: mysql:8.0.32
ports:
- 3306:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
bundler-cache: true
- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Bundler and gem install
run: |
gem install bundler
bundle install --jobs 4 --retry 3 --path vendor/bundle
- 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 rspec
run: bundle exec rspec
# 処理② rubocop のルール違反がないことをチェック
rubocop:
runs-on: ubuntu-latest
defaults:
run:
working-directory: rails
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.2
bundler-cache: true
- name: Bundler and gem install
run: |
gem install bundler
bundle install --jobs 4 --retry 3 --path vendor/bundle
- name: Run rubocop
run: bundle exec rubocop
# 処理③ eslint(& prettier) のルール違反がないことをチェック
eslint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: next
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install packages
run: npm install
- name: Run lint
run: npm run lint