-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (62 loc) · 1.81 KB
/
workflow.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
env:
RUBY_VERSION: 3.0.2
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
DATABASE_USER: postgres
DATABASE_PASSWORD: password
name: Rails tests
on: [push, pull_request]
jobs:
rspec-test:
name: RSpec
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
ports:
- 5432:5432
env:
POSTGRES_USER: ${{ env.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ env.POSTGRES_PASSWORD }}
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
- name: Install postgres client
run: sudo apt-get install libpq-dev
- name: Install dependencies
run: |
gem install bundler
bundler install
- name: Create database
run: |
bundler exec rails db:create RAILS_ENV=test
bundler exec rails db:migrate RAILS_ENV=test
- uses: borales/[email protected]
with:
cmd: install
- name: Run tests
run: bundler exec rspec .
- name: Run brakeman
run: brakeman -o brakeman.txt
- name: Run rubocop
run: bundler exec rubocop --force-exclusion vendor/*/** --out rubocop.txt
- name: Upload coverage results
uses: actions/upload-artifact@master
if: always()
with:
name: coverage-report
path: coverage
- name: Upload rubocop report
uses: actions/upload-artifact@master
if: always()
with:
name: rubocop-report.txt
path: rubocop.txt
- name: Upload brakeman report
uses: actions/upload-artifact@master
if: always()
with:
name: brakeman-report.txt
path: brakeman.txt