-
Notifications
You must be signed in to change notification settings - Fork 0
136 lines (123 loc) · 3.79 KB
/
coveritup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
on:
pull_request:
paths:
- '**/*.go'
- '**/*.mod'
- '**/*.sum'
- '**/*.yml'
- '**/*.astro'
push:
tags-ignore:
- '**'
paths:
- '**/*.go'
- '**/*.mod'
- '**/*.sum'
- '**/*.yml'
- '**/*.astro'
name: "Cover It Up"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
coveritup:
strategy:
matrix:
go-version: [mod]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: kevincobain2000/action-gobrew@v2
with:
version: ${{ matrix.go-version }}
- name: Install Tools
run: |
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: Setup Node
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Prepare frontend
working-directory: frontend
run: |
BUILD_START=$SECONDS
npm install
echo SCORE=$(($SECONDS-BUILD_START)) >> "$GITHUB_ENV"
- uses: kevincobain2000/action-coveritup@v1
with:
type: npm-install-time
- name: Node Modules Size
working-directory: frontend
run: |
echo SCORE=`du -sm node_modules/ | awk '{print $1}'` >> "$GITHUB_ENV"
- uses: kevincobain2000/action-coveritup@v1
with:
type: npm-modules-size
- name: NPM Build time
working-directory: frontend
run: |
BUILD_START=$SECONDS
npm run build
echo SCORE=$(($SECONDS-BUILD_START)) >> "$GITHUB_ENV"
- uses: kevincobain2000/action-coveritup@v1
with:
type: npm-build-time
metric: sec
- name: Go Build time
run: |
BUILD_START=$SECONDS
go build -ldflags '-s -w' -o main main.go
echo SCORE=$(($SECONDS-BUILD_START)) >> "$GITHUB_ENV"
- uses: kevincobain2000/action-coveritup@v1
with:
type: go-build-time
metric: sec
- 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
with:
type: unit-test-run-time
- name: Coverage
run: |
go tool cover -html=coverage.out -o coverage.html
gocov convert coverage.out | gocov-xml > coverage.xml
- 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
- uses: kevincobain2000/action-coveritup@v1
with:
type: coverage
- name: Go Binary Size
run: |
echo SCORE=`du -sk main | awk '{print $1}'` >> "$GITHUB_ENV"
shell: bash
- uses: kevincobain2000/action-coveritup@v1
with:
type: go-binary-size
- 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
with:
type: go-mod-dependencies
- 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
with:
type: go-sec-issues
- uses: kevincobain2000/action-coveritup@v1
with:
pr_comment: true