-
Notifications
You must be signed in to change notification settings - Fork 4
80 lines (69 loc) · 1.81 KB
/
go-test.yml
File metadata and controls
80 lines (69 loc) · 1.81 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
# Copyright 2025 SAP SE or an SAP affiliate company
#
# SPDX-License-Identifier: Apache-2.0
name: go-test
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
test:
strategy:
matrix:
include:
- database: mariadb
db_url: mysql://root:root@localhost/test_suite_controller?sql_mode=%27ANSI_QUOTES%27
- database: postgres
db_url: postgresql://root:root@localhost/test_suite_controller?sslmode=disable
runs-on: ubuntu-latest
services:
postgres:
image: postgres:18
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: test_suite_controller
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U root"
--health-interval=10s
--health-timeout=5s
--health-retries=5
mariadb:
image: mariadb:10.11
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test_suite_controller
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: ./go.mod
- name: Wait for Postgres
if: ${{ matrix.database == 'postgres' }}
run: |
until pg_isready -h localhost -U root; do
sleep 1
done
- name: Wait for MariaDB
if: ${{ matrix.database == 'mariadb' }}
run: |
until mysqladmin ping -h127.0.0.1 -proot --silent; do
sleep 1
done
- name: Test
env:
DB_URL: ${{ matrix.db_url }}
run: go test -v ./...