Skip to content

Commit a341cd1

Browse files
authored
Move tests from Travis to Actions (go-sql-driver#1183)
* Run macOS CI on Github Actions * no cover * Fix workflow name * Actions: Add linux test * fix * fix * fix go 1.10 * Remove .travis.yml
1 parent f6dcc3d commit a341cd1

File tree

3 files changed

+86
-138
lines changed

3 files changed

+86
-138
lines changed

.github/workflows/linux.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test on Linux
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-20.04
9+
strategy:
10+
matrix:
11+
go: [1.15, 1.14, 1.13, 1.12, 1.11, "1.10"]
12+
mysql: ["mysql:8.0"]
13+
include:
14+
- go: 1.15
15+
mysql: "mysql:5.7"
16+
- go: 1.15
17+
mysql: "mysql:5.5"
18+
- go: 1.15
19+
mysql: "mariadb:5.5"
20+
- go: 1.15
21+
mysql: "mariadb:10.1"
22+
23+
services:
24+
mysql:
25+
image: ${{ matrix.mysql }}
26+
ports:
27+
- 3306:3306
28+
env:
29+
MYSQL_DATABASE: gotest
30+
MYSQL_USER: gotest
31+
MYSQL_PASSWORD: secret
32+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
33+
# How can we add these options?
34+
#options: --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
35+
36+
steps:
37+
- uses: actions/setup-go@v2
38+
with:
39+
go-version: ${{ matrix.go }}
40+
- uses: actions/checkout@v2
41+
- name: Run test
42+
env:
43+
MYSQL_TEST_USER: gotest
44+
MYSQL_TEST_PASS: secret
45+
MYSQL_TEST_ADDR: 127.0.0.1:3307
46+
MYSQL_TEST_CONCURRENT: 1
47+
run: |
48+
go test -v -covermode=count -coverprofile=coverage.out
49+
go vet ./...
50+
gofmt -d -s .

.github/workflows/mac.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test on macOS
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: macos-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
14+
- name: Set up MySQL
15+
run: |
16+
brew install mysql
17+
echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB\nlocal_infile=1" >> /usr/local/etc/my.cnf
18+
mysql.server start
19+
mysql -uroot -e 'CREATE USER gotest IDENTIFIED BY "secret"'
20+
mysql -uroot -e 'GRANT ALL ON *.* TO gotest'
21+
mysql -uroot -e 'create database gotest;'
22+
23+
- name: Set up Go
24+
run: |
25+
go install golang.org/x/tools/cmd/cover
26+
27+
- name: Run tests
28+
env:
29+
MYSQL_TEST_USER: gotest
30+
MYSQL_TEST_PASS: secret
31+
MYSQL_TEST_ADDR: 127.0.0.1:3306
32+
MYSQL_TEST_CONCURRENT: 1
33+
run: |
34+
go test -v -covermode=count -coverprofile=coverage.out
35+
go vet ./...
36+
gofmt -d -s .

.travis.yml

-138
This file was deleted.

0 commit comments

Comments
 (0)