-
Notifications
You must be signed in to change notification settings - Fork 8
49 lines (39 loc) · 1.12 KB
/
test.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
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
mysql: [ 'mysql:8' ]
go: [ '1.21', '1.22', '1' ]
services:
mysql:
image: ${{ matrix.mysql }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: example
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
id: go
- name: Lint
run: make vet
- name: Test
run: make test
env:
DB_TEST_URI: "root:@tcp(localhost:${{ job.services.mysql.ports[3306] }})/"
DB_EXAMPLE_CLIENT_URI: "root@tcp(localhost:${{ job.services.mysql.ports[3306] }})/example"
DB_EXAMPLE_SERVER_URI: "root@tcp(localhost:${{ job.services.mysql.ports[3306] }})/example"