Skip to content

Commit 5a53869

Browse files
committed
update ci
1 parent 947d72f commit 5a53869

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

.github/workflows/test.yml

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,39 @@ on:
66
pull_request:
77
branches:
88
- master
9+
concurrency:
10+
group: ${{github.workflow}}-${{github.event.pull_request.number || github.ref}}
11+
cancel-in-progress: true
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
1215
strategy:
1316
matrix:
14-
ruby:
15-
- '3.3'
16-
- '3.2'
17-
- '3.1'
17+
ruby: ['3.3', '3.2', '3.1']
18+
database: ['sqlite', 'postgres', 'mysql', 'mariadb']
19+
services:
20+
postgres:
21+
image: postgres:15
22+
ports:
23+
- 5432:5432
24+
env:
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
POSTGRES_DB: test
28+
mysql:
29+
image: mysql:8.0
30+
ports:
31+
- 3306:3306
32+
env:
33+
MYSQL_ROOT_PASSWORD: root
34+
MYSQL_DATABASE: test
35+
mariadb:
36+
image: 'mariadb:11'
37+
env:
38+
MARIADB_ROOT_PASSWORD: root
39+
MARIADB_DATABASE: test
40+
ports:
41+
- 3307:3306 # avoid conflict w/ mysql
1842
steps:
1943
- name: Checkout
2044
uses: actions/checkout@v4
@@ -23,5 +47,23 @@ jobs:
2347
with:
2448
ruby-version: ${{matrix.ruby}}
2549
bundler-cache: true
50+
- name: Setup database
51+
run: |
52+
case ${{matrix.database}} in
53+
sqlite)
54+
echo "DATABASE_URL=sqlite3::memory:" >> $GITHUB_ENV
55+
;;
56+
postgres)
57+
echo "DATABASE_URL=postgres://postgres:postgres@localhost/test" >> $GITHUB_ENV
58+
;;
59+
mysql)
60+
echo "DATABASE_URL=mysql2://root:root@127.0.0.1/test" >> $GITHUB_ENV
61+
;;
62+
mariadb)
63+
echo "DATABASE_URL=mysql2://root:root@127.0.0.1:3307/test" >> $GITHUB_ENV
64+
;;
65+
esac
2666
- name: Test
2767
run: bundle exec rake test
68+
# nothing but postgres is supported right now so we'll ignore failures
69+
continue-on-error: ${{matrix.database != 'postgres'}}

0 commit comments

Comments
 (0)