Skip to content

Commit

Permalink
(ci) coveritup v2 (#188)
Browse files Browse the repository at this point in the history
* (ci) coveritup v2

* (ci) coveritup v2

* (ci) coveritup v2
  • Loading branch information
kevincobain2000 authored Mar 14, 2024
1 parent dd3d8a3 commit 2f4683c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 47 deletions.
71 changes: 26 additions & 45 deletions .github/workflows/coveritup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# diskcache directory
# diskcache directory
cache/*
vendor/*

Expand All @@ -19,4 +19,6 @@ tmp/
dist/
bin/
build/
gobrew
gobrew
coverage.xml
main

0 comments on commit 2f4683c

Please sign in to comment.