-
Notifications
You must be signed in to change notification settings - Fork 47
81 lines (69 loc) · 1.97 KB
/
go.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
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
name: Go
on:
push:
branches: [ main ]
pull_request:
types: [opened, reopened, synchronize]
jobs:
build-test:
name: Build, test, and format
strategy:
matrix:
go-version: [1.17.x]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Build
run: go build -v ./...
- name: Test
run: go test -v -race ./...
- name: Format
if: matrix.platform == 'ubuntu-latest'
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
mysql-integration-test:
name: Integration tests for the MySQL backend.
strategy:
matrix:
go-version: [1.17.x]
platform: [ubuntu-latest]
mysql-version: ['8.0']
runs-on: ${{ matrix.platform }}
services:
mysql:
image: mysql:8.0
env:
MYSQL_RANDOM_ROOT_PASSWORD: yes
MYSQL_DATABASE: nanomdm
MYSQL_USER: nanomdm
MYSQL_PASSWORD: nanomdm
ports:
- 3800:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
defaults:
run:
shell: bash
env:
MYSQL_PWD: nanomdm
PORT: 3800
steps:
- uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Verify MySQL connection
run: |
while ! mysqladmin ping --host=localhost --port=$PORT --protocol=TCP --silent; do
sleep 1
done
- name: Set up schema
run: |
mysql --version
mysql --user=nanomdm --host=localhost --port=$PORT --protocol=TCP nanomdm < ./storage/mysql/schema.sql
- name: Test
run: go test -v --tags=integration ./storage/mysql/ -args -dsn "nanomdm:nanomdm@tcp(localhost:$PORT)/nanomdm"