Repository navigation
144 lines (141 loc) · 4.93 KB
/
Copy pathdatabase-e2e.yml
File metadata and controls
144 lines (141 loc) · 4.93 KB
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
name: Database E2E
on:
push:
branches: ["main", "release-*", "ci/*"]
pull_request:
branches: ["main", "release-*"]
permissions:
contents: read
jobs:
database-e2e:
name: Database E2E (${{ matrix.db }}, ${{ matrix.ruby == 'jruby' && 'JRuby' || format('Ruby {0}', matrix.ruby) }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
- "4.0"
- "jruby"
db:
- sqlite
- mysql
- mariadb
- postgres
exclude:
# MariaDB is not supported on JRuby
- ruby: jruby
db: mariadb
# NOTE: database names carry the `_test` suffix already: with HANAMI_ENV=test, Hanami
# maps every database URL through Hanami::DB::Testing.database_url, which appends `_test`
# (a no-op when the name is suffixed already). Pre-suffixing keeps E2E_DATABASE_URL and the
# asserted names 1:1 instead of relying on the mapping implicitly.
#
# `jdbc_database_url` is the JRuby equivalent of `database_url`: JRuby connects through
# JDBC, so the e2e script selects it when running on JRuby.
include:
- db: sqlite
database_flag: sqlite
database_url: sqlite://db/sqlite_e2e_test.sqlite
jdbc_database_url: jdbc:sqlite:db/sqlite_e2e_test.sqlite
db_name: db/sqlite_e2e_test.sqlite
db_file: db/sqlite_e2e_test.sqlite
- db: mysql
database_flag: mysql
database_url: mysql2://root:password@127.0.0.1:3307/mysql_e2e_test
jdbc_database_url: jdbc:mysql://127.0.0.1:3307/mysql_e2e_test?user=root&password=password
db_name: mysql_e2e_test
db_port: "3307"
- db: mariadb
database_flag: mysql
database_url: mysql2://root:password@127.0.0.1:3308/mariadb_e2e_test
db_name: mariadb_e2e_test
db_port: "3308"
- db: postgres
database_flag: postgres
database_url: postgres://postgres:password@127.0.0.1:5432/postgres_e2e_test
jdbc_database_url: jdbc:postgresql://127.0.0.1:5432/postgres_e2e_test?user=postgres&password=password
db_name: postgres_e2e_test
env:
HANAMI_ENV: test
E2E_DATABASE_URL: ${{ matrix.database_url }}
E2E_JDBC_DATABASE_URL: ${{ matrix.jdbc_database_url }}
E2E_DB: ${{ matrix.db }}
E2E_DATABASE_FLAG: ${{ matrix.database_flag }}
E2E_DB_NAME: ${{ matrix.db_name }}
E2E_DB_PORT: ${{ matrix.db_port }}
E2E_DB_FILE: ${{ matrix.db_file }}
services:
mysql:
image: mysql:9.6.0
env:
MYSQL_ROOT_PASSWORD: password
ports:
- 3307:3306
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 3
mariadb:
image: mariadb:11.8
env:
MARIADB_ROOT_PASSWORD: password
ports:
- 3308:3306
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized"
--health-interval 10s
--health-timeout 5s
--health-retries 3
postgres:
image: postgres:18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98
with:
persist-credentials: false
- name: Install database client
run: |
case "${{ matrix.db }}" in
mysql)
sudo apt-get update
sudo apt-get install -y --no-install-recommends mysql-client libmysqlclient-dev
mysql --version
mysqldump --version
;;
mariadb)
sudo apt-get update
sudo apt-get remove -y 'mysql-client*' || true
sudo apt-get install -y --no-install-recommends mariadb-client libmariadb-dev
mysql --version
mysqldump --version
;;
postgres)
sudo apt-get update
sudo apt-get install -y --no-install-recommends postgresql-client libpq-dev
psql --version
pg_dump --version
;;
sqlite)
sudo apt-get update
sudo apt-get install -y --no-install-recommends sqlite3 libsqlite3-dev
sqlite3 --version
;;
esac
- name: Set up Ruby
uses: ruby/setup-ruby@7f797815d8adceb1c412e7abefdd1ab4abc47a5f # zizmor: ignore[cache-poisoning]
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run database E2E script
run: bash .github/workflows/database-e2e.sh