-
-
Notifications
You must be signed in to change notification settings - Fork 9
68 lines (55 loc) · 1.54 KB
/
ci.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: CI
on: [push, pull_request]
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
env:
ENVKEY: ${{ secrets.ENVKEY }}
RAILS_ENV: test
POSTGRES_DB: rubydocs_test
POSTGRES_HOST: localhost
POSTGRES_PASSWORD: password
POSTGRES_USER: rubydocs
services:
postgres:
image: postgres:11
ports:
- 5432:5432
# TODO: Unfortunately this service doesn't inherit the env vars from the job. Is there a way to fix this?
env:
POSTGRES_DB: rubydocs_test
POSTGRES_HOST: localhost
POSTGRES_PASSWORD: password
POSTGRES_USER: rubydocs
redis:
image: redis
options: --entrypoint redis-server
ports:
- 6379:6379
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true
- name: Load env vars
uses: rojopolis/envkey-action@master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Cache gems
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install gems
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Set up database
run: |
cp config/database.yml.ci config/database.yml
bundle exec rake db:setup
- name: Run tests
run: bin/rspec