Support additional log level types for LogIF #9
This file contains hidden or 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: Core Checks | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| code-checks: | |
| runs-on: ubuntu-latest | |
| env: | |
| GO111MODULE: on | |
| steps: | |
| - name: Checkout Source | |
| uses: actions/checkout@v2 | |
| - name: Set up Go | |
| uses: actions/setup-go@v2 | |
| with: | |
| go-version: '1.20' | |
| - name: WriteGoList | |
| run: go list -json -m all > go.list | |
| - name: DependencyVulnerabilityScan | |
| uses: sonatype-nexus-community/nancy-github-action@main | |
| - name: Verify dependencies | |
| run: go mod verify | |
| - name: Run go vet | |
| if: always() | |
| run: go vet ./... | |
| - name: Install golint | |
| if: always() | |
| run: go install golang.org/x/lint/golint@latest | |
| - name: Run golint | |
| if: always() | |
| run: golint ./... | |
| - name: Run Revive Action by pulling pre-built image | |
| if: always() | |
| uses: docker://morphy/revive-action:v2 | |
| with: | |
| path: "./..." | |
| - name: Run Gosec Security Scanner | |
| uses: securego/gosec@master | |
| with: | |
| args: ./... | |
| env: | |
| GOROOT: "" | |
| - name: Unit Tests | |
| run: go test -v -coverprofile coverage.out ./... | |
| - name: Check Test coverage | |
| env: | |
| TESTCOVERAGE_THRESHOLD: 100 | |
| run: | | |
| echo "Quality Gate: checking test coverage is above threshold ..." | |
| echo "Threshold : $TESTCOVERAGE_THRESHOLD %" | |
| totalCoverage=`go tool cover -func=coverage.out | grep total | grep -Eo '[0-9]+\.[0-9]+'` | |
| echo "Current test coverage : $totalCoverage %" | |
| if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then | |
| echo "OK" | |
| else | |
| echo "Current test coverage is below threshold. Please add more unit tests or adjust threshold to a lower value." | |
| go tool cover -func=coverage.out | |
| exit 1 | |
| fi |