Skip to content

Commit e8c29f8

Browse files
authored
Merge pull request #320 from joyofrails/chore/test-in-ci
Make it possible to run CI without project secrets
2 parents 9aac995 + b86e3ea commit e8c29f8

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

.github/workflows/verify.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ jobs:
5555
test:
5656
name: Tests
5757
runs-on: ubuntu-latest
58-
env:
59-
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_TEST_KEY }}
6058

6159
steps:
6260
- name: Checkout code
@@ -159,8 +157,6 @@ jobs:
159157
npm-test:
160158
name: Tests - JavaScript
161159
runs-on: ubuntu-latest
162-
env:
163-
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_TEST_KEY }}
164160

165161
steps:
166162
- name: Checkout code
@@ -196,7 +192,6 @@ jobs:
196192
assets:
197193
name: Assets
198194
runs-on: ubuntu-latest
199-
200195
steps:
201196
- name: Checkout code
202197
uses: actions/checkout@v4
@@ -226,8 +221,6 @@ jobs:
226221
227222
- name: Make sure assets compile
228223
run: |
229-
RAILS_MASTER_KEY=${{ secrets.RAILS_MASTER_PRODUCTION_KEY }} \
230-
RAILS_ENV=production \
231224
bin/rails assets:precompile
232225
233226
- uses: actions/upload-artifact@v4
@@ -240,7 +233,7 @@ jobs:
240233
name: Boot
241234
runs-on: ubuntu-latest
242235
env:
243-
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_PRODUCTION_KEY }}
236+
RAILS_MASTER_PRODUCTION_KEY: ${{ secrets.RAILS_MASTER_PRODUCTION_KEY }}
244237
steps:
245238
- name: Checkout code
246239
uses: actions/checkout@v4
@@ -268,11 +261,24 @@ jobs:
268261
run: |
269262
bin/sqlpkg install
270263
271-
- name: Start Rails server in the background
264+
- name: Start Rails server in the background (test)
265+
run: |
266+
bundle exec puma -b tcp://127.0.0.1:3001 -e test &
267+
268+
- name: Start Rails server in the background (production)
269+
if: ${{ env.RAILS_MASTER_PRODUCTION_KEY != '' }}
272270
run: |
273-
RAILS_FORCE_SSL=false bundle exec puma -b tcp://127.0.0.1:3001 -e production &
274-
sleep 10
271+
RAILS_MASTER_KEY=$RAILS_MASTER_PRODUCTION_KEY \
272+
RAILS_FORCE_SSL=false bundle exec puma -b tcp://127.0.0.1:3002 -e production &
273+
274+
- name: Wait for the servers to start
275+
run: sleep 10
275276

276-
- name: Make sure the server is running
277+
- name: Make sure the server is running (test)
277278
run: |
278279
bin/up http://127.0.0.1:3001/up
280+
281+
- name: Make sure the server is running (production)
282+
if: ${{ env.RAILS_MASTER_PRODUCTION_KEY != '' }}
283+
run: |
284+
bin/up http://127.0.0.1:3002/up

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
# Ignore master key for decrypting credentials and more.
3939
/config/master.key
4040

41-
/config/credentials/test.key
4241
/config/credentials/production.key
4342
/config/credentials/development.key
4443
/config/credentials/development.yml.enc

config/credentials/test.key

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bb161741ddb450ac2ea8af439cb27fb3

0 commit comments

Comments
 (0)