Created
April 26, 2020 00:38
-
-
Save kouyaf77/f9b6c102590312e2d948f610a3c009a4 to your computer and use it in GitHub Desktop.
GitHub Actions Rspec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rspec | |
on: pull_request | |
jobs: | |
rspec: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
container: | |
image: ruby:2.7.3 | |
env: | |
RAILS_ENV: test | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v1 | |
with: | |
path: vendor/bundle | |
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-gems- | |
- name: Install dependent libralies | |
run: | | |
curl -sL https://deb.nodesource.com/setup_12.x | bash - | |
apt install -y nodejs | |
- name: bundle install | |
run: | | |
gem install bundler | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Setup Database | |
run: | | |
cp config/database.github-actions.yml config/database.yml | |
bundle exec rake db:create | |
bundle exec rake db:schema:load | |
- name: Run RSpec | |
run: bundle exec rspec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment