Add github actions CI
This commit is contained in:
parent
46a839e7f7
commit
a03d812d19
3 changed files with 103 additions and 1 deletions
101
.github/workflows/ci.yml
vendored
Normal file
101
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
name: Continuous Integration
|
||||
on:
|
||||
push:
|
||||
branches: 'main'
|
||||
pull_request:
|
||||
branches: 'main'
|
||||
|
||||
jobs:
|
||||
linters:
|
||||
name: Linters
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Find yarn cache location
|
||||
id: yarn-cache
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: JS package cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install packages
|
||||
run: |
|
||||
yarn install --pure-lockfile
|
||||
|
||||
- name: Run linters
|
||||
run: |
|
||||
bundle exec rake lint
|
||||
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:12
|
||||
env:
|
||||
POSTGRES_USER: tps_test
|
||||
POSTGRES_DB: tps_test
|
||||
POSTGRES_PASSWORD: tps_test
|
||||
ports: ["5432:5432"]
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
pattern:
|
||||
- spec/controllers
|
||||
- spec/features
|
||||
- spec/helpers spec/lib spec/middlewares
|
||||
- spec/mailers spec/jobs spec/policies
|
||||
- spec/models
|
||||
- spec/serializers spec/services
|
||||
- spec/views
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Find yarn cache location
|
||||
id: yarn-cache
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
- name: JS package cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ${{ steps.yarn-cache.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
- name: Install packages
|
||||
run: |
|
||||
yarn install --pure-lockfile
|
||||
|
||||
- name: Setup test database
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
DATABASE_URL: "postgres://tps_test@localhost:5432/tps_test"
|
||||
run: |
|
||||
bundle exec rake db:create db:schema:load db:migrate
|
||||
|
||||
- name: Run tests
|
||||
run: bundle exec rspec ${{ matrix.pattern }}
|
|
@ -12,6 +12,7 @@ AllCops:
|
|||
- "db/migrate/20190730153555_recreate_structure.rb"
|
||||
- "bin/*"
|
||||
- "node_modules/**/*"
|
||||
- "vendor/**/*"
|
||||
|
||||
DS/Unscoped:
|
||||
Enabled: true
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
task :lint do
|
||||
sh "bundle exec rubocop"
|
||||
sh "bundle exec rubocop --parallel"
|
||||
sh "bundle exec haml-lint app/views/"
|
||||
sh "bundle exec scss-lint app/assets/stylesheets/"
|
||||
sh "bundle exec brakeman --no-pager"
|
||||
|
|
Loading…
Reference in a new issue