bbgo_origin/.github/workflows/go.yml

76 lines
1.6 KiB
YAML
Raw Normal View History

2021-12-04 16:37:46 +00:00
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
2021-12-04 16:44:11 +00:00
strategy:
matrix:
redis-version:
- 6.2
2022-05-03 08:23:10 +00:00
env:
2022-05-03 08:26:33 +00:00
MYSQL_DATABASE: bbgo
MYSQL_USER: "root"
MYSQL_PASSWORD: "root"
2021-12-04 16:44:11 +00:00
2021-12-04 16:37:46 +00:00
steps:
2022-05-03 08:23:10 +00:00
2021-12-04 16:37:46 +00:00
- uses: actions/checkout@v2
2021-12-04 16:49:29 +00:00
- uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
2022-05-03 08:23:10 +00:00
- name: Set up MySQL
run: |
sudo /etc/init.d/mysql start
2022-05-03 08:26:33 +00:00
mysql -e 'CREATE DATABASE ${{ env.MYSQL_DATABASE }};' -u${{ env.MYSQL_USER }} -p${{ env.MYSQL_PASSWORD }}
2022-05-03 08:23:10 +00:00
- name: Set up redis
uses: shogo82148/actions-setup-redis@v1
2021-12-04 16:44:11 +00:00
with:
redis-version: ${{ matrix.redis-version }}
# auto-start: "false"
2021-12-04 16:44:11 +00:00
2021-12-04 16:37:46 +00:00
- name: Set up Go
uses: actions/setup-go@v2
with:
2022-05-12 11:07:11 +00:00
go-version: 1.18
2021-12-04 16:37:46 +00:00
- name: Install Migration Tool
run: go install github.com/c9s/rockhopper/cmd/rockhopper@v1.2.1
2022-05-03 08:26:33 +00:00
- name: Test Migration SQL Files For MySQL
run: |
rockhopper --config rockhopper_mysql.yaml up
2022-05-03 08:48:55 +00:00
- name: Test Migration SQL Files For SQLite
run: |
rockhopper --config rockhopper_sqlite.yaml up
2021-12-04 16:37:46 +00:00
- name: Build
run: go build -v ./cmd/bbgo
- name: Test
run: go test -v ./pkg/...
2022-02-15 02:56:09 +00:00
- name: TestDnum
2022-02-15 05:59:41 +00:00
run: go test -tags dnum -v ./pkg/...
2022-05-20 08:48:23 +00:00
- name: Create dotenv file
run: |
echo "DB_DRIVER=mysql" >> .env.local
echo "DB_DSN=root:root@/bbgo" >> .env.local