-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (46 loc) · 1.27 KB
/
ci.yml
File metadata and controls
48 lines (46 loc) · 1.27 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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: BookLibrary
POSTGRES_PASSWORD: ${{ secrets.BOOKLIBRARY_DATABASE_PASSWORD }}
POSTGRES_DB: BookLibrary_test
ports:
- 5432/tcp
# Needed because the Postgres container does not provide a healthcheck.
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.4
bundler-cache: true
env:
MAKE: make --jobs 4
- name: 'Setup database for tests.'
env:
PGHOST: localhost
PGPORT: ${{ job.services.postgres.ports[5432] }}
PGUSER: BookLibrary
PGPASSWORD: ${{ secrets.BOOKLIBRARY_DATABASE_PASSWORD }}
RAILS_ENV: test
run: bundle exec rake db:migrate
- name: 'Run tests.'
env:
PGHOST: localhost
PGPORT: ${{ job.services.postgres.ports[5432] }}
PGUSER: BookLibrary
PGPASSWORD: ${{ secrets.BOOKLIBRARY_DATABASE_PASSWORD }}
RAILS_ENV: test
run: bundle exec rspec