-
Notifications
You must be signed in to change notification settings - Fork 1
133 lines (129 loc) · 3.83 KB
/
tests.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
name: "Quails Tests"
on:
- push
jobs:
test:
name: Tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
# Keep default ruby version the first in the matrix.
ruby: ['3.3.0', '3.2', '3.1']
services:
postgres:
image: postgres:15-alpine
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: quails
POSTGRES_DB: quails_test
POSTGRES_PASSWORD: "quails"
env:
BUNDLE_WITHOUT: development
RAILS_ENV: test
DATABASE_URL: "postgres://quails:quails@localhost:5432/quails_test"
MINITEST_REPORTER: Minitest::Reporters::SpecReporter
COVERAGE: 1
PARALLEL_WORKERS: 1
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup test environment
uses: ./.github/actions/setup
with:
ruby: ${{ matrix.ruby }}
- name: Run tests
run: bin/rails test
- name: Code coverage results
uses: actions/upload-artifact@v3
# Ideally default ruby should be the first in the matrix.
if: strategy.job-index == 0
with:
name: Coverage (${{ matrix.ruby }})
path: coverage/
system_test:
name: ${{ matrix.driver.name }} system tests (${{ matrix.ruby }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
ruby: ['3.3.0', '3.2', '3.1']
driver:
- name: Chrome
js_driver: selenium
js_browser: headless_chrome
# - name: Firefox
# js_driver: selenium
# js_browser: headless_firefox
services:
postgres:
image: postgres:15-alpine
ports:
- "5432:5432"
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_USER: quails
POSTGRES_DB: quails_test
POSTGRES_PASSWORD: "quails"
env:
BUNDLE_WITHOUT: development
RAILS_ENV: test
DATABASE_URL: "postgres://quails:quails@localhost:5432/quails_test"
MINITEST_REPORTER: Minitest::Reporters::SpecReporter
PARALLEL_WORKERS: 1
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup test environment
uses: ./.github/actions/setup
with:
ruby: ${{ matrix.ruby }}
- name: Run tests
env:
# To prevent ugly xvfb warning
XDG_RUNTIME_DIR: '/tmp/runtime-runner'
JS_DRIVER: ${{ matrix.driver.js_driver }}
JS_BROWSER: ${{ matrix.driver.js_browser }}
run: xvfb-run bin/rails test:system
- name: Screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: Screenshots-${{ matrix.ruby }}-${{ matrix.driver.js_driver }}-${{ matrix.driver.js_browser }}
path: tmp/screenshots
build_image:
name: "Docker image"
uses: ./.github/workflows/build.yml
secrets:
DOCKER_AWS_ACCESS_KEY_ID: ${{ secrets.DOCKER_AWS_ACCESS_KEY_ID }}
DOCKER_AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCKER_AWS_SECRET_ACCESS_KEY }}
needs:
- test
- system_test
if: github.ref == 'refs/heads/main'
# lint:
# runs-on: ubuntu-20.04
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Install Ruby and gems
# uses: ruby/setup-ruby@v1
# with:
# bundler-cache: true
# # Add or replace any other lints here
# - name: Security audit dependencies
# run: bin/bundler-audit --update
# - name: Security audit application code
# run: bin/brakeman -q -w2
# - name: Lint Ruby files
# run: bin/rubocop --parallel