-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 2.17 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
name: CI
on: [ push ]
env:
CI: true
RAILS_ENV: test
jobs:
test:
name: Lint, Security, Unit and System Tests
runs-on: ubuntu-latest
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/ci
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_DB: ci
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
-
name: Checkout Source Code
uses: actions/checkout@v4
with:
fetch-depth: '1'
-
name: Install ruby 3.2.2
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
-
name: "Lint / Rubocop / Ruby code"
run: |
gem install rubocop
gem install rubocop-performance
gem install rubocop-rake
gem install rubocop-rspec
gem install rubocop-gitlab-security
gem install rubocop-rails
gem install rubocop-capybara
gem install rubocop-factory_bot
rubocop --parallel
-
name: Install dependencies
run: bin/bundle install --jobs 4 --retry 3
-
name: "Lint / Views"
run: bin/erblint --lint-all
-
name: "Security / Brakeman"
run: |
gem install brakeman
brakeman --exit-on-warn --no-progress --color --output /dev/stdout
-
name: "Security / bundle-audit / Common Vulnerabilities and Exposures check"
run: |
gem install bundle-audit
bundle-audit check --update -v
-
name: "Test / Unit Tests (controllers, models, helpers, mailers, jobs, lib, requests)"
run: bin/bundle exec rspec spec --exclude-pattern "spec/system/**/*_spec.rb"
- name: "Prepare System Tests"
run: |
bin/rails db:environment:set RAILS_ENV=test
bin/rails db:drop db:create db:schema:load
bin/rails db:migrate
bin/rails assets:precompile
-
name: "Test / System Tests"
run: bin/bundle exec rspec spec/system