This repository has been archived by the owner on Dec 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
85 lines (70 loc) · 1.94 KB
/
ci.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
name: CI
on: [push]
jobs:
linters:
name: Linters
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Lint ruby files
run: bundle exec rubocop
- name: Lint html.erb files
run: bundle exec erblint --lint-all
brakeman:
name: Brakeman
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
- name: Install brakeman
run: gem install brakeman
- name: Scan code
run: brakeman -A -z -q
test:
name: Test
needs:
- linters
- brakeman
runs-on: ubuntu-20.04
env:
DATABASE_URL: postgres://postgres:example@localhost:5432/nindika_test
services:
postgres:
image: postgres:latest
ports: ['5432:5432']
env:
POSTGRES_DB: nindika_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@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install postgres client
run: sudo apt-get install libpq-dev
- name: Setup Node
uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version-file: '.node-version'
- name: Install Yarn packages
run: yarn install --check-files --pure-lockfile
- name: Compile Assets
run: |
bin/rails css:build
bin/rails javascript:build
- name: Create database structure
run: RAILS_ENV=test bundle exec rails db:reset
- name: Run tests
run: bundle exec rspec spec --format progress