-
Notifications
You must be signed in to change notification settings - Fork 13
76 lines (74 loc) · 1.95 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
69
70
71
72
73
74
75
76
name: Tests
on:
push:
inputs:
app_name:
required: true
type: string
default: partner-metrics
use_node:
type: boolean
required: false
default: false
secrets:
secret_key_base:
required: true
bundle_token:
required: true
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
env:
POSTGRES_USER: postgres
POSTGRES_DB: ${{ inputs.app_name }}-test
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports: ['6379:6379']
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v3
- name: Set up Node
if: ${{ inputs.use_node == true }}
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
- name: Set up Ruby
uses: ruby/setup-ruby@v1
env:
BUNDLE_GITHUB__COM: x-access-token:${{ secrets.bundle_token }}
with:
bundler-cache: true
- name: Copy .env sample
run: |
cp .env.example .env
- name: Setup test database
env:
RAILS_ENV: test
SECRET_KEY_BASE: ${{ secrets.secret_key_base }}
run: |
bin/rake db:create
bin/rake db:schema:load
bin/rake db:migrate
- name: Run tests
env:
REDIS_URL: redis://localhost:6379/0
SECRET_KEY_BASE: ${{ secrets.secret_key_base }}
run: |
bin/rake test
- name: Upload artifacts
if: failure()
uses: actions/upload-artifact@v3
with:
name: screenshots
path: /home/runner/work/${{ inputs.app_name }}/${{ inputs.app_name }}/tmp/screenshots/