-
Notifications
You must be signed in to change notification settings - Fork 1.2k
68 lines (66 loc) · 1.71 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
name: Test
on:
pull_request:
push:
jobs:
lint:
name: AutoCorrect Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: huacnlee.autocorrect
uses: huacnlee/autocorrect-action@main
assets_compile:
name: Assets Compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.0
bundler-cache: true
- name: Install dependencies
run: |
yarn
- name: Assets Precompile
run: bundle exec rails assets:precompile RAILS_PRECOMPILE=1 RAILS_ENV=production SECRET_KEY_BASE=fake_secure_for_compile
test:
name: CI Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: homeland-test
POSTGRES_USER: "admin"
POSTGRES_PASSWORD: "123456"
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
RAILS_ENV: test
REDIS_URL: redis://localhost:6379/1
DATABASE_URL: postgres://admin:123456@localhost:5432/homeland-test
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.0
bundler-cache: true
- name: Before tests
run: bundle exec rails db:migrate
- name: Run tests
run: bundle exec rails test