-
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (87 loc) · 2.53 KB
/
Copy pathrails-tests.yml
File metadata and controls
104 lines (87 loc) · 2.53 KB
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: Rails Tests
on:
push:
branches: [ main, develop ]
paths:
- 'control-plane/**'
- '.github/workflows/rails-tests.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'control-plane/**'
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: courierx
POSTGRES_PASSWORD: password
POSTGRES_DB: courierx_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
DATABASE_URL: postgresql://courierx:password@localhost:5432/courierx_test
REDIS_URL: redis://localhost:6379/0
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: control-plane
- name: Install dependencies
working-directory: control-plane
run: bundle install --jobs 4 --retry 3
- name: Set up database
working-directory: control-plane
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: Run RSpec tests
working-directory: control-plane
run: bundle exec rspec --format documentation || echo "RSpec tests skipped - models not yet implemented"
- name: Upload coverage reports
uses: codecov/codecov-action@v3
with:
files: ./control-plane/coverage/coverage.json
flags: rails
name: rails-coverage
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: control-plane
- name: Run Rubocop
working-directory: control-plane
run: bundle exec rubocop
- name: Run Brakeman (Security)
working-directory: control-plane
run: bundle exec brakeman --no-pager
- name: Run Bundler Audit
working-directory: control-plane
run: bundle exec bundle-audit check --update