mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Merge pull request #18 from Icinga/feature/github-actions
Create github action for go build
This commit is contained in:
commit
28743ca4d3
2 changed files with 62 additions and 1 deletions
61
.github/workflows/go.yml
vendored
Normal file
61
.github/workflows/go.yml
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
name: Go
|
||||
on: [push]
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
go: [ '1.11', '1.12', '1.13' ]
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8.0
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: icingadb
|
||||
MYSQL_USER: icingadb
|
||||
MYSQL_PASSWORD: icingadb
|
||||
ports:
|
||||
- 3800:3306
|
||||
|
||||
redis:
|
||||
image: redis:5
|
||||
ports:
|
||||
- 6379:6379
|
||||
|
||||
steps:
|
||||
- name: Set up Go ${{ matrix.go }}
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Go Build
|
||||
run: go build -v -o icingadb .
|
||||
|
||||
- name: Go Test
|
||||
env:
|
||||
ICINGADB_TEST_REDIS_HOST: 127.0.0.1
|
||||
ICINGADB_TEST_REDIS_PORT: 6379
|
||||
|
||||
ICINGADB_TEST_MYSQL_HOST: 127.0.0.1
|
||||
ICINGADB_TEST_MYSQL_PORT: 3800
|
||||
ICINGADB_TEST_MYSQL_DATABASE: icingadb
|
||||
ICINGADB_TEST_MYSQL_USER: icingadb
|
||||
ICINGADB_TEST_MYSQL_PASSWORD: icingadb
|
||||
timeout-minutes: 10
|
||||
run: |
|
||||
mysql -h ${ICINGADB_TEST_MYSQL_HOST} -P ${ICINGADB_TEST_MYSQL_PORT} \
|
||||
-u${ICINGADB_TEST_MYSQL_USER} -p${ICINGADB_TEST_MYSQL_PASSWORD} ${ICINGADB_TEST_MYSQL_DATABASE} \
|
||||
<etc/schema/mysql/mysql.schema.sql
|
||||
go test -v ./...
|
||||
|
|
@ -30,7 +30,7 @@ func mkMysql(dbType string, dbDsn string, maxOpenConns int) (*sql.DB, error) {
|
|||
}
|
||||
|
||||
dbDsn = dbDsn + sep +
|
||||
"innodb_strict_mode=1&sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION,PIPES_AS_CONCAT,ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER'"
|
||||
"innodb_strict_mode=1&sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,NO_ENGINE_SUBSTITUTION,PIPES_AS_CONCAT,ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO'"
|
||||
|
||||
db, errConn := sql.Open(dbType, dbDsn)
|
||||
if errConn != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue