Merge pull request #106 from warriors-vn/dev-feature #218
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: prepare-before-merge | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: '1.18' | |
- name: go-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.46.2 | |
- name: unit-test | |
run: go test -coverprofile=coverage.out ./... | |
- name: coverage | |
run: | | |
SUM_COVERAGE=$(go test ./... --cover | awk '{if ($1 != "?") print $5; else print "0.0";}' | sed 's/\%//g' | awk '{s+=$1} END {printf "%.2f\n", s}') | |
SUM_TEST=$(go test ./... --cover | wc -l) | |
COVER_AVERAGE=$(echo "$SUM_COVERAGE/$SUM_TEST" | bc -l) | |
echo $COVER_AVERAGE | |
- name: upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |