-
Notifications
You must be signed in to change notification settings - Fork 34
102 lines (89 loc) · 2.94 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Main
on: [push]
jobs:
vm-job:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
NODE_ENV: test
# If you need DB like PostgreSQL then define service below.
# https://github.com/actions/example-services/tree/master/.github/workflows
services:
postgres:
image: postgres:13.9
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Setup Bundler Cache
uses: actions/cache@v3
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Setup Asset Cache
uses: actions/cache@v3
with:
path: public/packs-test
key: ${{ runner.os }}-assets-${{ steps.extract_branch.outputs.branch }}
restore-keys: |
${{ runner.os }}-assets-
# required to compile pg ruby gem
- name: Install PostgreSQL client
run: sudo apt-get install libpq-dev
- name: Build and create DB
env:
# use localhost for the host here because we have specified a container for the job.
# If we were running the job on the VM this would be postgres
PGHOST: localhost
PGUSER: postgres
PGPORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
RAILS_ENV: test
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/dabble_test
run: |
mkdir -p ~/tmp/capybara
mkdir ~/rspec
gem install bundler -v 2.4.22
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
bin/rails db:create
bin/rails db:migrate
- name: Run tests
env:
PGHOST: localhost
PGUSER: postgres
PGPORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
DATABASE_URL: postgres://postgres:postgres@localhost:${{ job.services.postgres.ports[5432] }}/dabble_test
RAILS_ENV: test
AWS_ACCESS_KEY_ID: test
AWS_BUCKET: test
AWS_SECRET_ACCESS_KEY: test
DEVISE_SECRET_KEY: test
GUMROAD_PRODUCT_ID: test
GUMROAD_SELLER_ID: test
MAILCHIMP_API_KEY: test
MAILCHIMP_LIST_ID: test
MAIN_DOMAIN: test
PAYPAL_SELLER_ID: test
SMTP_DOMAIN: test
run: |
bundle exec rake
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: screenshots
path: ~/tmp/capybara