-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (72 loc) · 2.07 KB
/
workflow.yml
File metadata and controls
82 lines (72 loc) · 2.07 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
name: Tests
on:
pull_request:
branches:
- '*'
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14
env:
POSTGRES_DB: rails_github_actions_test
POSTGRES_USER: rails_github_actions
POSTGRES_PASSWORD: password
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Setup Ruby 3.4.5
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.4.5
- name: Setup Node 24
uses: actions/setup-node@v4
with:
node-version: 24.9.x
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev build-essential libcurl4-openssl-dev
gem install bundler
bundle install --jobs 4 --retry 3
yarn install --pure-lockfile
- name: Setup test database
env:
RAILS_ENV: test
PGHOST: localhost
POSTGRES_DB: rails_github_actions_test
POSTGRES_USER: rails_github_actions
POSTGRES_PASSWORD: password
run: |
cp config/database.ci.yml config/database.yml
bin/rails db:create db:migrate
- name: Precompile assets
env:
RAILS_ENV: test
PGHOST: localhost
POSTGRES_DB: rails_github_actions_test
POSTGRES_USER: rails_github_actions
POSTGRES_PASSWORD: password
PGPORT: ${{ job.services.postgres.ports[5432] }}
run: |
bin/rails assets:precompile
- name: Run tests
env:
PGHOST: localhost
POSTGRES_DB: rails_github_actions_test
POSTGRES_USER: rails_github_actions
POSTGRES_PASSWORD: password
PGPORT: ${{ job.services.postgres.ports[5432] }}
RAILS_ENV: test
JWT_KEY: some_key_for_testing
run: |
bundle exec rspec