-
-
Notifications
You must be signed in to change notification settings - Fork 638
106 lines (93 loc) · 3.07 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
name: Test & lint
on: [push, pull_request]
env:
RAILS_ENV: test
PGHOST: localhost
PGUSER: postgres
jobs:
tests:
name: Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3']
gemfile: ['gemfiles/activerecord_5.2.2.gemfile', 'gemfiles/activerecord_6.0.0.gemfile', 'gemfiles/activerecord_6.1.0.gemfile', 'gemfiles/activerecord_7.0.0.gemfile', 'gemfiles/activerecord_7.1.0.gemfile', 'gemfiles/activerecord_main.gemfile']
include:
- gemfile: 'gemfiles/activerecord_7.1.0.gemfile'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_7.1.0.gemfile'
ruby: '3.0'
- gemfile: 'gemfiles/activerecord_7.0.0.gemfile'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_7.0.0.gemfile'
ruby: '3.0'
- gemfile: 'gemfiles/activerecord_6.1.0.gemfile'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_6.1.0.gemfile'
ruby: '3.0'
exclude:
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.0'
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.1'
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.2'
- gemfile: 'gemfiles/activerecord_5.2.2.gemfile'
ruby: '3.3'
- gemfile: 'gemfiles/activerecord_7.0.0.gemfile'
ruby: '2.7'
- gemfile: 'gemfiles/activerecord_7.1.0.gemfile'
ruby: '2.7'
- gemfile: 'gemfiles/activerecord_main.gemfile'
ruby: '2.7'
- gemfile: 'gemfiles/activerecord_main.gemfile'
ruby: '3.0'
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_DB: cancan_postgresql_spec
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports: ["5432:5432"]
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: '20'
# https://github.com/CanCanCommunity/cancancan/pull/669#issuecomment-748019539
- name: Nokogiri support for Truffleruby
run: sudo apt-get -yqq install libxml2-dev libxslt-dev
if: ${{ matrix.ruby == 'truffleruby' }}
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run tests on sqlite
run: DB=sqlite bundle exec rspec
- name: Run tests on postgres
run: DB=postgres bundle exec rspec
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: '20'
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Run linter
run: bundle exec rubocop