-
-
Notifications
You must be signed in to change notification settings - Fork 203
188 lines (177 loc) · 5.43 KB
/
test.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 5
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
steps:
- name: Checkout code
uses: actions/checkout@v4
# Dependencies
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
# Lint
- name: Run linter
run: bin/lint --nofix
development_environment:
name: Development Environment
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PGHOST: localhost
PGUSER: good_job
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
DISABLE_SPRING: 1
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: good_job
POSTGRES_DB: good_job_test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports: [ "5432:5432" ]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v4
# Dependencies
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
# Validate Development Environment
- name: bin/setup
run: bin/rails db:test:prepare
- name: bin/rspec
run: bin/rspec --require ./spec/support/pre_documentation_formatter.rb --format PreDocumentationFormatter
# Archive
- name: Archive system spec screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots-devenv
path: |
demo/tmp/screenshots
demo/tmp/capybara
- name: Archive Rails logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: rails_logs-devenv
path: demo/log
test:
name: Test - ${{ matrix.gemfile }} - Ruby ${{ matrix.ruby }} - PG ${{ matrix.pg }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
ruby: ["3.0", 3.1, 3.2, 3.3]
gemfile: [rails_6.1, rails_7.0, rails_7.1, rails_7.2, rails_8.0, rails_head]
pg: [17]
include:
- ruby: 3.3
gemfile: rails_7.2
pg: 10
exclude:
# Rails 7.2 is >= 3.1
- ruby: "3.0"
gemfile: rails_7.2
# Rails 8.0 is >= 3.2
- ruby: "3.0"
gemfile: rails_8.0
- ruby: 3.1
gemfile: rails_8.0
# Rails head is >= 3.2
- ruby: "3.0"
gemfile: rails_head
- ruby: 3.1
gemfile: rails_head
env:
PGHOST: localhost
PGUSER: good_job
RAILS_ENV: test
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: vendor/bundle
BUNDLE_WITHOUT: debug:lint:demo:production
RAILS_LOG_TO_STDOUT: false
services:
postgres:
image: postgres:${{ matrix.pg }}
env:
POSTGRES_USER: good_job
POSTGRES_DB: good_job_test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: browser-actions/setup-chrome@latest
- run: chrome --version
- name: Checkout code
uses: actions/checkout@v4
- name: Update .ruby-version with matrix value
run: echo "${{ matrix.ruby }}" >| .ruby-version
# Dependencies
- name: Set up Ruby and bundle install
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
- name: Print Lockfile
run: cat ${{ env.BUNDLE_GEMFILE }}.lock
# Test
- name: Set up test database
run: bundle exec demo/bin/rails db:test:prepare
- name: Run Unit tests
run: |
bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb, spec/generators/**/*_spec.rb" \
--require ./spec/support/pre_documentation_formatter.rb \
--format PreDocumentationFormatter
- name: Run System tests
run: |
bundle exec rspec --require ./spec/support/pre_documentation_formatter.rb \
--format PreDocumentationFormatter \
spec/system
- name: Run Generators tests
run: |
bundle exec rspec --require ./spec/support/pre_documentation_formatter.rb \
--format PreDocumentationFormatter \
spec/generators
# Archive
- name: Archive system spec screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots-${{ matrix.gemfile }}-${{ matrix.ruby }}-${{ matrix.pg }}
path: |
demo/tmp/screenshots
demo/tmp/capybara
- name: Archive Rails logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: rails_logs-${{ matrix.gemfile }}-${{ matrix.ruby }}-${{ matrix.pg }}
path: demo/log