Fix/codecovci (#1858)

This commit is contained in:
HaiLaz
2022-05-18 21:18:49 +08:00
committed by GitHub
parent 61271e4f7b
commit 9536b33a6a

View File

@ -94,6 +94,7 @@ jobs:
strategy:
matrix:
go: ["1.15", "1.16", "1.17"]
goarch: ["386","amd64"]
steps:
@ -116,48 +117,27 @@ jobs:
git diff --name-only --exit-code || if [ $? != 0 ]; then echo "Notice: gofmt check failed,please gofmt before pr." && exit 1; fi
echo "gofmt check pass."
sudo echo "127.0.0.1 local" | sudo tee -a /etc/hosts
- name: CLI Build & Test
- name: Build & Test
run: |
cd cmd/gf
go mod tidy
go build ./...
GOARCH=386 go test -v ./... || exit 1
GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
- name: Example Build & Test
run: |
cd example
go mod tidy
go build ./...
GOARCH=386 go test -v ./... || exit 1
GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
- name: Contrib Build & Test
run: |
cd contrib
GOARCH=${{ matrix.goarch }}
for file in `find . -name go.mod`; do
dirpath=$(dirname $file)
# Ignore oracle database driver build&test.
if [ "oracle" = $(basename $dirpath) ]; then
continue 1
fi
cd $dirpath
go mod tidy
go build ./...
GOARCH=386 go test -v ./... || exit 1
GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
go test ./... -race -coverprofile=coverage.out -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
if grep -q "/gogf/gf/.*/v2" go.mod; then
sed -i "s/gogf\/gf\(\/.*\)\/v2/gogf\/gf\/v2\1/g" coverage.out
fi
cd -
done
- name: Main Build & Test
run: |
go build ./...
GOARCH=386 go test -v ./... || exit 1
GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic -coverpkg=./...,github.com/gogf/gf/... || exit 1
- name: Report Coverage
uses: codecov/codecov-action@v2
with:
flags: go-${{ matrix.go }}
flags: go-${{ matrix.go }}-${{ matrix.goarch }}