-
Notifications
You must be signed in to change notification settings - Fork 10.3k
171 lines (156 loc) · 5.89 KB
/
Copy pathsemgrep-ci.yml
File metadata and controls
171 lines (156 loc) · 5.89 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# Copyright IBM Corp. 2014, 2026
# "SPDX-License-Identifier: MPL-2.0"
name: Semgrep Checks
on:
push:
branches:
- main
- 'release/**'
pull_request:
paths:
- internal/**
- .semgrep*yml
- .ci/semgrep*
- .ci/semgrep/**
- .ci/.semgrep*
- .github/workflows/semgrep-ci.yml
## NOTE: !!!
## When changing these workflows, ensure that the following is updated:
## - Documentation: docs/continuous-integration.md
## - Documentation: docs/makefile-cheat-sheet.md
## - Makefile: ./GNUmakefile
env:
SEMGREP_SEND_METRICS: "off"
SEMGREP_ENABLE_VERSION_CHECK: false
SEMGREP_TIMEOUT: 300
SEMGREP_ARGS: --error --quiet
permissions:
contents: read # required for checkout
jobs:
semgrep-validate:
name: Validate Code Quality Rules
runs-on: ubuntu-latest
container:
image: &semgrep_image "semgrep/semgrep:1.168.0"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: |
semgrep --validate \
--config .ci/.semgrep.yml \
--config .ci/.semgrep-constants.yml \
--config .ci/.semgrep-test-constants.yml \
--config .ci/semgrep/
semgrep-test:
name: Semgrep Rule Tests
needs: [semgrep-validate]
runs-on: ubuntu-latest
container:
image: *semgrep_image
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: |
semgrep --quiet --test .ci/semgrep/
semgrep --quiet --test --config .ci/semgrep-caps-aws-ec2.yml .ci/semgrep-caps-aws-ec2.go
constants:
name: Constants Check (make semgrep-constants)
needs: [semgrep-test]
runs-on: custom-ubuntu-22.04-large
container:
image: *semgrep_image
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: |
semgrep $SEMGREP_ARGS \
--config .ci/.semgrep-constants.yml \
--config .ci/.semgrep-test-constants.yml
semgrep:
name: Code Quality Scan (make semgrep-code-quality)
needs: [semgrep-test]
runs-on: custom-ubuntu-22.04-large
container:
image: *semgrep_image
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: |
semgrep $SEMGREP_ARGS \
--config .ci/.semgrep.yml \
--config .ci/semgrep/ \
--config 'r/dgryski.semgrep-go.anon-struct-args' \
--config 'r/dgryski.semgrep-go.badnilguard' \
--config 'r/dgryski.semgrep-go.contextcancelable' \
--config 'r/dgryski.semgrep-go.ctx-time' \
--config 'r/dgryski.semgrep-go.errnilcheck' \
--config 'r/dgryski.semgrep-go.ioutil' \
--config 'r/dgryski.semgrep-go.mail-address' \
--config 'r/dgryski.semgrep-go.marshaljson' \
--config 'r/dgryski.semgrep-go.nilerr' \
--config 'r/dgryski.semgrep-go.oddcompare' \
--config 'r/dgryski.semgrep-go.oddifsequence' \
--config 'r/dgryski.semgrep-go.oserrors' \
--config 'r/dgryski.semgrep-go.parseint-downcast' \
--config 'r/dgryski.semgrep-go.readeof' \
--config 'r/dgryski.semgrep-go.readfull' \
--config 'r/dgryski.semgrep-go.sprinterr' \
--config 'r/dgryski.semgrep-go.unixnano' \
--config 'r/dgryski.semgrep-go.writestring' \
--config 'r/dgryski.semgrep-go.wrongerrcall'
naming_cae:
name: Naming Scan Caps/AWS/EC2 (make semgrep-naming-cae)
runs-on: ubuntu-latest
container:
image: *semgrep_image
if: (github.action != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: semgrep --validate --config .ci/semgrep-caps-aws-ec2.yml
- run: semgrep $SEMGREP_ARGS --config .ci/semgrep-caps-aws-ec2.yml
naming_tests:
name: Test Configs Scan (make semgrep-naming)
runs-on: ubuntu-latest
container:
image: *semgrep_image
if: (github.action != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: semgrep --validate --config .ci/.semgrep-configs.yml
- run: semgrep $SEMGREP_ARGS --config .ci/.semgrep-configs.yml
naming_semgrep0:
name: Service Name Scan A-C (make semgrep-service-naming)
runs-on: ubuntu-latest
container:
image: *semgrep_image
if: (github.action != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: semgrep --validate --config .ci/.semgrep-service-name0.yml
- run: semgrep $SEMGREP_ARGS --config .ci/.semgrep-service-name0.yml
naming_semgrep1:
name: Service Name Scan C-I (make semgrep-service-naming)
runs-on: ubuntu-latest
container:
image: *semgrep_image
if: (github.action != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: semgrep --validate --config .ci/.semgrep-service-name1.yml
- run: semgrep $SEMGREP_ARGS --config .ci/.semgrep-service-name1.yml
naming_semgrep2:
name: Service Name Scan I-Q (make semgrep-service-naming)
runs-on: ubuntu-latest
container:
image: *semgrep_image
if: (github.action != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: semgrep --validate --config .ci/.semgrep-service-name2.yml
- run: semgrep $SEMGREP_ARGS --config .ci/.semgrep-service-name2.yml
naming_semgrep3:
name: Service Name Scan Q-Z (make semgrep-service-naming)
runs-on: ubuntu-latest
container:
image: *semgrep_image
if: (github.action != 'dependabot[bot]')
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: semgrep --validate --config .ci/.semgrep-service-name3.yml
- run: semgrep $SEMGREP_ARGS --config .ci/.semgrep-service-name3.yml