feat:add pkg unit test #98
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
pull_request: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.20.7 | |
- name: Start Docker Composer | |
run: docker-compose up -d | |
- name: Init MySQL | |
run: | | |
go run ./cmd/gateway/main.go init -e dev | |
cat ~/.begonia/admin-app.json | |
- 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 -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 }} |