-
Notifications
You must be signed in to change notification settings - Fork 8
224 lines (219 loc) · 6.98 KB
/
ci.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- "*"
jobs:
test-ksuid:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- "2.7"
- "3.0"
- "3.1"
- jruby-9.3
name: Test ksuid on Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v3
with:
path: ksuid/vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ matrix.ruby }}-
- name: Run test suite
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
cd ./ksuid
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
gem install bundler
bundle config path vendor/bundle
bundle check || bundle install --jobs 4 --retry 3
./cc-test-reporter before-build
bundle exec rake spec
./cc-test-reporter after-build --exit-code $?
test-activerecord-ksuid-mysql:
runs-on: ubuntu-latest
env:
DB_HOST: 127.0.0.1
DB_USERNAME: root
DRIVER: mysql2
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: activerecord-ksuid_test
MYSQL_ROOT_PASSWORD: ""
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 3306:3306
strategy:
matrix:
ruby:
- "2.7"
- "3.0"
- "3.1"
- jruby-9.3
rails:
- "6.0"
- "6.1"
- "7.0"
exclude:
- ruby: "3.0"
rails: "6.0"
- ruby: "3.1"
rails: "6.0"
- ruby: jruby-9.3
rails: "7.0"
name: Test activerecord-ksuid on Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}, and MySQL
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v3
with:
path: activerecord-ksuid/vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('Gemfile.lock', 'activerecord-ksuid/gemfiles/*.gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
- name: Run test suite
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
cd ./activerecord-ksuid
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
gem install bundler
bundle config path vendor/bundle
bundle check || bundle install --jobs 4 --retry 3
./cc-test-reporter before-build
bundle exec rspec
./cc-test-reporter after-build --exit-code $?
test-activerecord-ksuid-postgresql:
runs-on: ubuntu-latest
env:
DB_HOST: 127.0.0.1
DB_USERNAME: postgres
DRIVER: postgresql
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: activerecord-ksuid_test
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
ruby:
- "2.7"
- "3.0"
- "3.1"
- jruby-9.3
rails:
- "6.0"
- "6.1"
- "7.0"
exclude:
- ruby: "3.0"
rails: "6.0"
- ruby: "3.1"
rails: "6.0"
- ruby: jruby-9.3
rails: "7.0"
name: Test activerecord-ksuid on Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}, and PostgreSQL
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v3
with:
path: activerecord-ksuid/vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('Gemfile.lock', 'activerecord-ksuid/gemfiles/*.gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
- name: Run test suite
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
cd ./activerecord-ksuid
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
gem install bundler
bundle config path vendor/bundle
bundle check || bundle install --jobs 4 --retry 3
./cc-test-reporter before-build
bundle exec rspec
./cc-test-reporter after-build --exit-code $?
test-activerecord-ksuid-sqlite:
runs-on: ubuntu-latest
env:
DATABASE: ":memory:"
DRIVER: sqlite3
strategy:
matrix:
ruby:
- "2.7"
- "3.0"
- "3.1"
- jruby-9.3
rails:
- "6.0"
- "6.1"
- "7.0"
exclude:
- ruby: "3.0"
rails: "6.0"
- ruby: "3.1"
rails: "6.0"
- ruby: jruby-9.3
rails: "7.0"
name: Test activerecord-ksuid on Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }}, and SQLite
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- uses: actions/cache@v3
with:
path: activerecord-ksuid/vendor/bundle
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-${{ hashFiles('Gemfile.lock', 'activerecord-ksuid/gemfiles/*.gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.rails }}-
- name: Run test suite
env:
BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
cd ./activerecord-ksuid
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
gem install bundler
bundle config path vendor/bundle
bundle check || bundle install --jobs 4 --retry 3
./cc-test-reporter before-build
bundle exec rspec
./cc-test-reporter after-build --exit-code $?