mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
71 lines
1.5 KiB
YAML
71 lines
1.5 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
redis-version:
|
|
- 6.2
|
|
env:
|
|
MYSQL_DATABASE: bbgo
|
|
MYSQL_USER: "root"
|
|
MYSQL_PASSWORD: "root"
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/.cache/go-build
|
|
~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Set up MySQL
|
|
run: |
|
|
sudo /etc/init.d/mysql start
|
|
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }}
|
|
|
|
- name: Set up redis
|
|
uses: shogo82148/actions-setup-redis@v1
|
|
with:
|
|
redis-version: ${{ matrix.redis-version }}
|
|
# auto-start: "false"
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.17
|
|
|
|
- name: Install Migration Tool
|
|
run: go install github.com/c9s/rockhopper/cmd/rockhopper@v1.2.1
|
|
|
|
- name: Test Migration SQL Files For MySQL
|
|
run: |
|
|
rockhopper --config rockhopper_mysql.yaml up
|
|
|
|
- name: Test Migration SQL Files For SQLite
|
|
run: |
|
|
rockhopper --config rockhopper_sqlite.yaml up
|
|
|
|
- name: Build
|
|
run: go build -v ./cmd/bbgo
|
|
|
|
- name: Test
|
|
run: go test -v ./pkg/...
|
|
|
|
- name: TestDnum
|
|
run: go test -tags dnum -v ./pkg/...
|