-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (85 loc) · 2.4 KB
/
main.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
97
98
99
100
101
102
103
104
name: Backend CI + Lint
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test:
name: Rspec Test & Code Coverage
runs-on: ubuntu-latest
needs: lint
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install dependencies
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Install system dependencies
run: |
sudo apt-get -y update
- name: Install PostgreSQL client
run: |
sudo apt-get -yqq install libpq-dev
- name: Install vips image variant
run: |
sudo apt-get install libvips
- name: Database setup
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/inicro_testing
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY_TEST }}
RAILS_ENV: test
run: |
bundle exec rails db:test:prepare db:migrate
- name: RSpec tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/inicro_testing
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY_TEST }}
RAILS_ENV: test
run: |
bundle exec rspec
- name: Create code coverage report
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage/
lint:
name: Linting and Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install dependencies
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Security audit dependencies
run: bundle exec bundler-audit --update
- name: Security audit application code
run: bundle exec brakeman -q -w2
- name: Lint via RuboCop
run: bundle exec rubocop --parallel -A