@@ -102,9 +102,11 @@ jobs:
102
102
103
103
<%- end -%>
104
104
steps:
105
+ <%- unless ci_packages.empty? -%>
105
106
- name: Install packages
106
107
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y <%= ci_packages.join(" ") %>
107
108
109
+ <%- end -%>
108
110
- name: Checkout code
109
111
uses: actions/checkout@v4
110
112
@@ -132,12 +134,81 @@ jobs:
132
134
<%- end -%>
133
135
# RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
134
136
# REDIS_URL: redis://localhost:6379/0
135
- <%- if options[:api] || options[:skip_system_test] -%>
136
137
run: bin/rails db:test:prepare test
137
- <%- else -%>
138
+ <%- unless options[:api] || options[:skip_system_test] -%>
139
+
140
+ system-test:
141
+ runs-on: ubuntu-latest
142
+
143
+ <%- if options[:database] == "sqlite3" -%>
144
+ # services:
145
+ # redis:
146
+ # image: valkey/valkey:8
147
+ # ports:
148
+ # - 6379:6379
149
+ # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
150
+ <%- else -%>
151
+ services:
152
+ <%- if options[:database] == "mysql" || options[:database] == "trilogy" -%>
153
+ mysql:
154
+ image: mysql
155
+ env:
156
+ MYSQL_ALLOW_EMPTY_PASSWORD: true
157
+ ports:
158
+ - 3306:3306
159
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
160
+ <%- elsif options[:database] == "postgresql" -%>
161
+ postgres:
162
+ image: postgres
163
+ env:
164
+ POSTGRES_USER: postgres
165
+ POSTGRES_PASSWORD: postgres
166
+ ports:
167
+ - 5432:5432
168
+ options: --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3
169
+ <%- end -%>
170
+
171
+ # redis:
172
+ # image: valkey/valkey:8
173
+ # ports:
174
+ # - 6379:6379
175
+ # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
176
+
177
+ <%- end -%>
178
+ steps:
179
+ <%- unless ci_packages.empty? -%>
180
+ - name: Install packages
181
+ run: sudo apt-get update && sudo apt-get install --no-install-recommends -y <%= ci_packages.join(" ") %>
182
+
183
+ <%- end -%>
184
+ - name: Checkout code
185
+ uses: actions/checkout@v4
186
+
187
+ - name: Set up Ruby
188
+ uses: ruby/setup-ruby@v1
189
+ with:
190
+ ruby-version: .ruby-version
191
+ bundler-cache: true
192
+ <%- if using_bun? -%>
193
+
194
+ - uses: oven-sh/setup-bun@v1
195
+ with:
196
+ bun-version: <%= dockerfile_bun_version %>
197
+ <%- end -%>
198
+
199
+ - name: Run System Tests
200
+ env:
201
+ RAILS_ENV: test
202
+ <%- if options[:database] == "mysql" -%>
203
+ DATABASE_URL: mysql2://127.0.0.1:3306
204
+ <%- elsif options[:database] == "trilogy" -%>
205
+ DATABASE_URL: trilogy://127.0.0.1:3306
206
+ <%- elsif options[:database] == "postgresql" -%>
207
+ DATABASE_URL: postgres://postgres:postgres@localhost:5432
208
+ <%- end -%>
209
+ # RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }}
210
+ # REDIS_URL: redis://localhost:6379/0
138
211
run: bin/rails db:test:prepare test test:system
139
- <%- end -%>
140
- <%- unless options[:api] || options[:skip_system_test] -%>
141
212
142
213
- name: Keep screenshots from failed system tests
143
214
uses: actions/upload-artifact@v4
@@ -146,5 +217,5 @@ jobs:
146
217
name: screenshots
147
218
path: ${{ github.workspace }}/tmp/screenshots
148
219
if-no-files-found: ignore
149
- <%- end -%>
150
- <% end -%>
220
+ <%- end -%>
221
+ <%- end -%>
0 commit comments