Skip to content

Commit 4ec2bde

Browse files
committed
Modify PR checks
Signed-off-by: mehabhalodiya <mehabhalodiya@gmail.com>
1 parent 6cfe2c6 commit 4ec2bde

2 files changed

Lines changed: 73 additions & 44 deletions

File tree

.codecov.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,36 @@
1+
# See http://docs.codecov.io/docs/coverage-configuration
12
coverage:
3+
precision: 2 # 2 = xx.xx%, 0 = xx%
4+
round: down
5+
# For example: 20...60 would result in any coverage less than 20%
6+
# would have a red background. The color would gradually change to
7+
# green approaching 60%. Any coverage over 60% would result in a
8+
# solid green color.
9+
range: "20...60"
10+
211
status:
3-
patch: off
4-
project:
5-
default:
6-
target: auto
7-
threshold: 0.2%
8-
removed_code_behavior: adjust_base
12+
# project will give us the diff in the total code coverage between a commit
13+
# and its parent
14+
project: yes
15+
# Patch gives just the coverage of the patch
16+
patch: yes
17+
# changes tells us if there are unexpected code co verage changes in other files
18+
# which were not changed by the diff
19+
changes: yes
20+
21+
# See http://docs.codecov.io/docs/ignoring-paths
22+
ignore:
23+
- "build/*"
24+
- "hack/*"
25+
- "openshift-ci/*"
26+
- "Makefile"
27+
- ".travis.yml"
28+
29+
# See http://docs.codecov.io/docs/pull-request-comments-1
30+
comment:
31+
layout: "diff, files"
32+
behavior: ""
33+
# default = posts once then update, posts new if delete
34+
# once = post once then updates
35+
# new = delete old, post new
36+
# spammy = post new

.github/workflows/pr-checks.yml

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
name: static checks
1+
name: PR checks
2+
23
on:
3-
workflow_dispatch:
4-
push:
5-
branches:
6-
- "master"
74
pull_request:
85
branches:
9-
- "*"
6+
- master
7+
- 'v*.*'
108

119
jobs:
1210
lint:
@@ -15,57 +13,60 @@ jobs:
1513

1614
steps:
1715
- name: Set up Go
18-
uses: actions/setup-go@v4
16+
uses: actions/setup-go@v5
1917
with:
2018
go-version: "^1.18"
2119

20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.11"
24+
architecture: "x64"
25+
2226
- name: Checkout repo
23-
uses: actions/checkout@v3
27+
uses: actions/checkout@v4
28+
29+
- name: Run linters
30+
run: make lint
31+
2432

2533
unit:
2634
name: Unit Tests with Code coverage
2735
runs-on: ubuntu-20.04
2836

2937
steps:
3038
- name: Set up Go
31-
uses: actions/setup-go@v4
39+
uses: actions/setup-go@v5
3240
with:
3341
go-version: "^1.18"
3442

3543
- name: Checkout Git Repository
36-
uses: actions/checkout@v3
37-
38-
- name: Run Go Tests
39-
run: make test
40-
41-
- name: Check format
42-
run: |
43-
if [[ $(go fmt `go list ./... | grep -v vendor`) ]]; then
44-
echo "not well formatted sources are found"
45-
exit 1
46-
fi
44+
uses: actions/checkout@v4
4745

48-
- name: Generate coverage report
46+
- name: Unit Tests with Code Coverage
4947
run: |
50-
go test `go list ./... | grep -v examples` -coverprofile=coverage.txt -covermode=atomic
48+
make test
5149
52-
- name: Upload coverage report
53-
uses: codecov/codecov-action@v1
50+
- name: Upload Code Coverage Report
51+
uses: codecov/codecov-action@v3
5452
with:
55-
file: ./coverage.txt
56-
flags: unittests
57-
name: codecov-umbrella
53+
file: cover.out
54+
verbose: true
55+
fail_ci_if_error: true
56+
57+
source-scan:
58+
name: Gosec code scanning
59+
runs-on: ubuntu-20.04
60+
steps:
61+
- name: Checkout code
62+
uses: actions/checkout@v4
5863

59-
- name: Get code coverage artifiact
60-
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
61-
with:
62-
name: code-coverage
63-
- name: Get test result artifact
64-
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
64+
- name: Run gosec
65+
uses: securego/gosec@v2.18.2
6566
with:
66-
name: test-results
67-
path: test-results
68-
- name: Upload code coverage information to codecov.io
69-
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
67+
args: '-no-fail -fmt sarif -out gosec.sarif ./...'
68+
69+
- name: Upload gosec scan results to GitHub Security tab
70+
uses: github/codeql-action/upload-sarif@v2
7071
with:
71-
file: coverage.out
72+
sarif_file: 'gosec.sarif'

0 commit comments

Comments
 (0)