-
-
Notifications
You must be signed in to change notification settings - Fork 34
146 lines (122 loc) · 3.74 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
name: Test
# yamllint disable-line rule:truthy
on:
push:
branches: [$default-branch]
pull_request:
env:
CI: true
RAILS_ENV: test
jobs:
lint:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: Gemfile.tools
COVERAGE: true
DISABLE_SPRING: 1
steps:
- run: |-
sudo apt-get update -qq && \
sudo apt-get install -yq --no-install-recommends \
cmake yamllint python3-setuptools python3-pkg-resources pkg-config
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- run: bin/yarn check || bin/yarn install
- run: git fetch origin master --depth 1
- run: bin/lint-pr
test:
needs: [lint]
runs-on: ubuntu-latest
env:
COVERAGE: true
DATABASE_URL: postgresql://postgres_user:postgres@localhost:5432/postgres_db
services:
postgres:
image: circleci/postgres:alpine-ram
env:
POSTGRES_DB: postgres_db
POSTGRES_USER: postgres_user
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install PostgreSQL 11 client
run: |
sudo apt-get -yqq install libpq-dev
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true
- name: Setup DB
run: bundle exec rake db:test:prepare
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- run: bin/yarn check || bin/yarn install
- uses: actions/cache@v2
with:
path: |
public/assets
public/packs-test
tmp/cache/assets
tmp/cache/webpacker
key: "${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}\
-${{ hashFiles('**/app/assets') }}-${{ hashFiles('**/app/javascript') }}"
restore-keys: |
${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/app/assets') }}
${{ runner.os }}-assets-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-assets-
- name: Precompile assets
run: bundle exec rake assets:precompile
- name: Run tests
run: bin/rails test "test/**/*_test.rb"
- name: Upload Coverage
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage
- name: Upload Capybara Screenshots
uses: actions/upload-artifact@v2
with:
name: capybara-screenshots
path: tmp/screenshots