Skip to content

Commit 1758cb9

Browse files
committed
GHA: also cover MySQL
1 parent 9b99902 commit 1758cb9

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/tests_with_database.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,66 @@ on:
77
pull_request: {}
88

99
jobs:
10+
mysql:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
image:
17+
- icinga/icingadb-mysql:5.5
18+
- icinga/icingadb-mysql:5.6
19+
- mysql:5.7
20+
- mysql:latest
21+
- icinga/mariadb:10.0
22+
- icinga/mariadb:10.1
23+
- mariadb:10.2
24+
- mariadb:10.3
25+
- mariadb:10.4
26+
- mariadb:10.5
27+
- mariadb:10.6
28+
- mariadb:10.7
29+
- mariadb:latest
30+
31+
env:
32+
NOTIFICATIONS_TESTS_DB_TYPE: mysql
33+
NOTIFICATIONS_TESTS_DB: notifications
34+
NOTIFICATIONS_TESTS_DB_USER: root
35+
NOTIFICATIONS_TESTS_DB_PASSWORD: notifications
36+
NOTIFICATIONS_TESTS_DB_HOST: 127.0.0.1
37+
NOTIFICATIONS_TESTS_DB_PORT: 3306
38+
39+
services:
40+
mysql:
41+
image: ${{ matrix.image }}
42+
env:
43+
MYSQL_ROOT_PASSWORD: ${{ env.NOTIFICATIONS_TESTS_DB_PASSWORD }}
44+
MYSQL_DATABASE: ${{ env.NOTIFICATIONS_TESTS_DB }}
45+
ports:
46+
- 3306:3306
47+
48+
steps:
49+
- name: Setup Go
50+
uses: actions/setup-go@v5
51+
with:
52+
go-version: stable
53+
54+
- name: Checkout code
55+
uses: actions/checkout@v4
56+
57+
- name: Importing Schema
58+
run: >
59+
sleep 15;
60+
mysql -h127.0.0.1 -u${{ env.NOTIFICATIONS_TESTS_DB_USER }} -p${{ env.NOTIFICATIONS_TESTS_DB_PASSWORD }}
61+
${{ env.NOTIFICATIONS_TESTS_DB }} < ${{ github.workspace }}/schema/mysql/schema.sql
62+
63+
- name: Download dependencies
64+
run: go get -v -t -d ./...
65+
66+
- name: Run tests
67+
timeout-minutes: 10
68+
run: go test -v -timeout 5m ./...
69+
1070
postgresql:
1171
name: PostgreSQL ${{ matrix.version }}
1272
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)