Skip to content

Commit

Permalink
Move tests from Travis to Actions (#1183)
Browse files Browse the repository at this point in the history
* Run macOS CI on Github Actions

* no cover

* Fix workflow name

* Actions: Add linux test

* fix

* fix

* fix go 1.10

* Remove .travis.yml
  • Loading branch information
methane committed Dec 28, 2020
1 parent f6dcc3d commit a341cd1
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 138 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/linux.yaml
@@ -0,0 +1,50 @@
name: Test on Linux
on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-20.04
strategy:
matrix:
go: [1.15, 1.14, 1.13, 1.12, 1.11, "1.10"]
mysql: ["mysql:8.0"]
include:
- go: 1.15
mysql: "mysql:5.7"
- go: 1.15
mysql: "mysql:5.5"
- go: 1.15
mysql: "mariadb:5.5"
- go: 1.15
mysql: "mariadb:10.1"

services:
mysql:
image: ${{ matrix.mysql }}
ports:
- 3306:3306
env:
MYSQL_DATABASE: gotest
MYSQL_USER: gotest
MYSQL_PASSWORD: secret
MYSQL_ALLOW_EMPTY_PASSWORD: yes
# How can we add these options?
#options: --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1

steps:
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v2
- name: Run test
env:
MYSQL_TEST_USER: gotest
MYSQL_TEST_PASS: secret
MYSQL_TEST_ADDR: 127.0.0.1:3307
MYSQL_TEST_CONCURRENT: 1
run: |
go test -v -covermode=count -coverprofile=coverage.out
go vet ./...
gofmt -d -s .
36 changes: 36 additions & 0 deletions .github/workflows/mac.yaml
@@ -0,0 +1,36 @@
name: Test on macOS
on:
push:
pull_request:

jobs:
build:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up MySQL
run: |
brew install mysql
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
mysql.server start
mysql -uroot -e 'CREATE USER gotest IDENTIFIED BY "secret"'
mysql -uroot -e 'GRANT ALL ON *.* TO gotest'
mysql -uroot -e 'create database gotest;'
- name: Set up Go
run: |
go install golang.org/x/tools/cmd/cover
- name: Run tests
env:
MYSQL_TEST_USER: gotest
MYSQL_TEST_PASS: secret
MYSQL_TEST_ADDR: 127.0.0.1:3306
MYSQL_TEST_CONCURRENT: 1
run: |
go test -v -covermode=count -coverprofile=coverage.out
go vet ./...
gofmt -d -s .
138 changes: 0 additions & 138 deletions .travis.yml

This file was deleted.

0 comments on commit a341cd1

Please sign in to comment.