-
Notifications
You must be signed in to change notification settings - Fork 39
96 lines (79 loc) · 2.54 KB
/
catarse-ci-backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Catarse CI (back-end)
on: push
defaults:
run:
working-directory: ./services/catarse
jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: ./services/catarse
- name: Analyze code
run: bundle exec rubocop
brakeman:
name: Brakeman
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: ./services/catarse
- name: Install brakeman
run: gem install brakeman
- name: Scan code
run: brakeman -A -z -q
rspec:
name: RSpec
runs-on: ubuntu-20.04
needs: ['rubocop', 'brakeman']
env:
DATABASE_URL: postgres://postgres:example@localhost:5432/catarse_test
services:
postgres:
image: postgres:11.5
ports: ['5432:5432']
env:
POSTGRES_DB: catarse_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: example
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
# ruby-version: 3.0.0 # detects from .ruby-version or .tool-versions
# bundler: 2.2.8 # detects from BUNDLED_WITH from Gemfile.lock
bundler-cache: true # runs bundle install and caches gem automatically
working-directory: ./services/catarse # path to detect .ruby-version, .tool-versions, Gemfile and Gemfile.lock
- name: Install postgres client dependencies
run: sudo apt-get install libpq-dev
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 14.16.0
- name: Yarn package cache
uses: actions/cache@v2
with:
path: ./services/catarse/catarse.js/node_modules
key: ${{ runner.os }}-yarn-v2-${{ hashFiles('./services/catarse/catarse.js/yarn.lock') }}
- name: Install Yarn packages
run: |
yarn policies set-version
yarn install --pure-lockfile
- name: Create database
run: |
RAILS_ENV=test bundle exec rails db:create
RAILS_ENV=test bundle exec rails db:migrate
- name: Run tests
run: bundle exec rspec spec --format progress