Skip to content

feat:add auto create database #159

feat:add auto create database

feat:add auto create database #159

Workflow file for this run

name: Go
on:
push:
paths:
- "**.go"
- "**.yml"
- "**.mod"
pull_request:
paths:
- "**.go"
- "**.yml"
- "**.mod"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.22.4
- name: Start Docker Composer
run: docker-compose up -d
- name: Init MySQL
run: |
go mod tidy
go run ./cmd/begonia init -c ./config/settings.yml -e dev
cat ~/.begonia/admin-app.json
- name: Init Minio
run: |
go install github.com/minio/mc@latest
cat << EOF > /tmp/policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"arn:aws:s3:::*"
]
}
]
}
EOF
- name: Configure Minio
run: |
mc alias set myminio http://127.0.0.1:9000 begonia begoniabegonia
mc admin user add myminio begonia-2 begoniabegonia
mc admin user svcacct add \
--access-key "begonia" \
--secret-key "begoniabegonia" \
--policy "/tmp/policy.json" \
myminio begonia-2
- name: Type a temporary tag
run: git tag test-$(date '+%Y%m%d%H%M%S')
- name: Download protos
run: |
mkdir -p /tmp/protos
git clone https://github.com/begonia-org/protos.git /tmp/protos
cp cert/* /tmp/
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "22.2"
- name: Install protoc-gen-grpc-gateway
run: |
git clone https://github.com/geebytes/grpc-gateway.git
cd grpc-gateway
go install ./protoc-gen-grpc-gateway
- name: Test
run: go test -p 1 -v -gcflags=-l -coverprofile=coverage.txt -covermode=atomic -ldflags -X=github.com/begonia-org/begonia.Version=$(git describe --tags --abbrev=0)\ -X=github.com/begonia-org/begonia.BuildTime=$(date '+%Y%m%d%H%M%S')\ -X=github.com/begonia-org/begonia.Commit=$(git rev-parse --short HEAD)\ -X=github.com/begonia-org/begonia.Env=test ./...
- name: Upload coverage to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}