-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (92 loc) · 3.67 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
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: Testing the application
on:
pull_request:
branches: ["master"]
jobs:
rspec-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports: ["5432:5432"]
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setting up Ruby
uses: ruby/[email protected]
with:
ruby-version: 3.1.2
- name: Installing Bundler & Gems
run: |
gem install bundler
bundle install --jobs 4 --retry 3
- name: Run yarn commands
run: |
yarn install
yarn run build
- name: Preparing Database
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: |
bundle exec rails db:create
bundle exec rails db:migrate
- name: StandardRB Linter
run: bundle exec standardrb
- name: erb-lint
run: bundle exec erblint --lint-all
- name: Testing routes
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: rspec spec/routing -fd
- name: Testing requests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: rspec spec/requests -fd
- name: Testing models
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: rspec spec/models -fd
- name: Testing helpers
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: rspec spec/helpers -fd
- name: Setup Chrome
uses: browser-actions/[email protected]
- name: setup-chromedriver
uses: nanasess/[email protected]
- name: Testing features
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/test
RAILS_ENV: test
PG_USER: postgres
run: |
export DISPLAY=:99
chromedriver &
sudo Xvfb -ac :99 > /dev/null 2>&1 & # optional
rspec spec/features -fd
# 'sudo Xvfb -ac :99 > /dev/null 2>&1 & # optional' command launches an instance of Xvfb (X Virtual Framebuffer), a virtual display server for X11 that allows running graphical applications without an actual display hardware.