From 2f4683c28c237883640319ec4fe1313a58c1b00e Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Fri, 15 Mar 2024 00:48:01 +0900 Subject: [PATCH] (ci) coveritup v2 (#188) * (ci) coveritup v2 * (ci) coveritup v2 * (ci) coveritup v2 --- .github/workflows/coveritup.yml | 71 ++++++++++++--------------------- .gitignore | 6 ++- 2 files changed, 30 insertions(+), 47 deletions(-) diff --git a/.github/workflows/coveritup.yml b/.github/workflows/coveritup.yml index 7974845..fb91144 100644 --- a/.github/workflows/coveritup.yml +++ b/.github/workflows/coveritup.yml @@ -33,69 +33,50 @@ jobs: go install github.com/securego/gosec/v2/cmd/gosec@latest go install github.com/axw/gocov/gocov@latest go install github.com/AlekSi/gocov-xml@latest - shell: bash - - name: Test - run: | - BUILD_START=$SECONDS - go test -race -v ./... -count=1 -coverprofile=coverage.out - echo SCORE=$(($SECONDS-BUILD_START)) >> "$GITHUB_ENV" - shell: bash - - uses: kevincobain2000/action-coveritup@v1 + curl -sLk https://raw.githubusercontent.com/kevincobain2000/cover-totalizer/master/install.sh | sh + + - name: Unit Test + uses: kevincobain2000/action-coveritup@v2 with: type: unit-test-run-time + command: go test -race -v ./... -count=1 -coverprofile=coverage.out + record: runtime - name: Coverage - run: | - go tool cover -html=coverage.out -o coverage.html - gocov convert coverage.out | gocov-xml > coverage.xml - - name: Build - run: | - BUILD_START=$SECONDS - go build -ldflags '-s -w' -o main ./cmd/gobrew - echo SCORE=$(($SECONDS-BUILD_START)) >> "$GITHUB_ENV" - shell: bash + run: gocov convert coverage.out | gocov-xml > coverage.xml - - uses: kevincobain2000/action-coveritup@v1 + - name: Coverage Totalizer + uses: kevincobain2000/action-coveritup@v2 with: - type: build-time - - - name: Coveritup - run: | - curl -sLk https://raw.githubusercontent.com/kevincobain2000/cover-totalizer/master/install.sh | sh - echo SCORE=`./cover-totalizer coverage.xml` >> "$GITHUB_ENV" - shell: bash + command: ./cover-totalizer coverage.xml + type: coverage - - uses: kevincobain2000/action-coveritup@v1 + - name: Build time + uses: kevincobain2000/action-coveritup@v2 with: - type: coverage + type: build-time + command: go build -o main ./cmd/gobrew + record: runtime - name: Go Binary Size - run: | - echo SCORE=`du -sk main | awk '{print $1}'` >> "$GITHUB_ENV" - shell: bash - - - uses: kevincobain2000/action-coveritup@v1 + uses: kevincobain2000/action-coveritup@v2 with: type: go-binary-size + command: du -sk main | awk '{print $1}' - - name: Number of dependencies - run: | - echo SCORE=`go list -m all|wc -l|awk '{$1=$1};1'` >> "$GITHUB_ENV" - shell: bash - - - uses: kevincobain2000/action-coveritup@v1 + - name: Go Mod Dependencies + uses: kevincobain2000/action-coveritup@v2 with: type: go-mod-dependencies + command: go list -m all|wc -l|awk '{$1=$1};1' - - name: Number of GO Sec issues - run: | - echo SCORE=`gosec -no-fail --quiet ./...|grep Issues | tail -1 |awk '{print $3}'` >> "$GITHUB_ENV" - shell: bash - - - uses: kevincobain2000/action-coveritup@v1 + - name: Go Sec Issues + uses: kevincobain2000/action-coveritup@v2 with: type: go-sec-issues + command: gosec -no-fail --quiet ./...|grep Issues | tail -1 |awk '{print $3}' - - uses: kevincobain2000/action-coveritup@v1 + - name: PR Comment + uses: kevincobain2000/action-coveritup@v2 with: pr_comment: true diff --git a/.gitignore b/.gitignore index 2a76b39..a89d37a 100755 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ # Output of the go coverage tool, specifically when used with LiteIDE *.out -# diskcache directory +# diskcache directory cache/* vendor/* @@ -19,4 +19,6 @@ tmp/ dist/ bin/ build/ -gobrew \ No newline at end of file +gobrew +coverage.xml +main \ No newline at end of file