forked from External/greenlight
Added rubocop and rspec check to Github actions (#2490)
This commit is contained in:
parent
91fbe99fda
commit
dbba634dfd
|
@ -3,6 +3,7 @@
|
||||||
.gitignore
|
.gitignore
|
||||||
README.md
|
README.md
|
||||||
SECURITY.md
|
SECURITY.md
|
||||||
|
.github
|
||||||
|
|
||||||
# Rails
|
# Rails
|
||||||
.env
|
.env
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
env:
|
||||||
|
RUBY_VERSION: 2.7.2
|
||||||
|
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: "master"
|
||||||
|
pull_request:
|
||||||
|
branches: "*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Rubocop + RSpec
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
# Health checks to wait until postgres is ready
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Install Ruby ${{ env.RUBY_VERSION }}
|
||||||
|
uses: actions/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: ${{ env.RUBY_VERSION }}
|
||||||
|
|
||||||
|
- name: Bundle cache
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: vendor/bundle
|
||||||
|
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-gems-
|
||||||
|
- name: Bundle install
|
||||||
|
run: |
|
||||||
|
bundle config path vendor/bundle
|
||||||
|
bundle install --jobs 4 --retry 3
|
||||||
|
- name: Setup database
|
||||||
|
run: |
|
||||||
|
bundler exec rails db:create RAILS_ENV=test
|
||||||
|
bundler exec rails db:migrate RAILS_ENV=test
|
||||||
|
- name: Run Rubocop
|
||||||
|
run: bundle exec rubocop --fail-level F
|
||||||
|
|
||||||
|
- name: Run RSpec
|
||||||
|
run: bundle exec rspec
|
|
@ -5,14 +5,6 @@ rvm:
|
||||||
- 2.5.1
|
- 2.5.1
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
- stage: test
|
|
||||||
name: rubocop
|
|
||||||
script: bundle exec rubocop
|
|
||||||
if: env(CD_TEST_IGNORE) IS NOT present
|
|
||||||
- stage: test
|
|
||||||
name: rspec
|
|
||||||
script: gem install bundler & bundle exec rspec
|
|
||||||
if: env(CD_TEST_IGNORE) IS NOT present
|
|
||||||
- stage: build
|
- stage: build
|
||||||
name: build docker image
|
name: build docker image
|
||||||
script: bash scripts/image_build.sh $TRAVIS_REPO_SLUG $TRAVIS_BRANCH
|
script: bash scripts/image_build.sh $TRAVIS_REPO_SLUG $TRAVIS_BRANCH
|
||||||
|
|
Loading…
Reference in New Issue