forked from stackrox/stackrox
-
Notifications
You must be signed in to change notification settings - Fork 0
190 lines (160 loc) · 4.92 KB
/
style.yaml
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: Style
on:
push:
tags:
- '*'
branches:
- master
- release-*
pull_request:
types:
- opened
- reopened
- synchronize
env:
ROX_PRODUCT_BRANDING: RHACS_BRANDING
jobs:
check-generated-files:
env:
ARTIFACT_DIR: junit-reports/
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
with:
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }}
- name: Create artifacts dir
run: mkdir -p "$ARTIFACT_DIR"
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies
- name: Check Generated
run: scripts/ci/jobs/check-generated.sh
misc-checks:
env:
ARTIFACT_DIR: junit-reports/
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
with:
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }}
- name: Create artifacts dir
run: mkdir -p "$ARTIFACT_DIR"
- name: Ensure no trailing whitespaces
if: github.event_name == 'pull_request'
# Markdown files aren't checked for trailing whitespaces because it's a valid linebreak there.
run: git diff --check "${{ github.event.pull_request.base.sha }}" ':(exclude)*.md'
- name: Check PR fixes
run: scripts/ci/jobs/check-pr-fixes.sh
- name: Check TODOs
run: scripts/ci/jobs/check-todos.sh
- name: Check Policies
run: scripts/ci/jobs/policy-checks.sh
style-check:
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4
volumes:
- /usr:/mnt/usr
- /opt:/mnt/opt
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
with:
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }}
- name: Free more disk space
shell: bash
run: |
set +e
set -x
df -h
for delete in /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL; do
rm -rf "/mnt${delete:?}"
done
df -h
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies
- name: Cache UI dependencies
uses: ./.github/actions/cache-ui-dependencies
- name: Cache QA Test dependencies
uses: ./.github/actions/cache-gradle-dependencies
- name: Fetch UI deps
run: make -C ui deps
- name: make style-slim
run: make style-slim
golangci-lint:
timeout-minutes: 240
runs-on: ubuntu-latest
container:
image: quay.io/stackrox-io/apollo-ci:stackrox-test-0.4.4
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: ./.github/actions/job-preamble
with:
gcp-account: ${{ secrets.GCP_SERVICE_ACCOUNT_STACKROX_CI }}
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies
- name: Check Cache golangci-lint
run: make golangci-lint-cache-status
- name: Cache golangci-lint
uses: actions/cache@v4
with:
path: /github/home/.cache/golangci-lint
key: go-lint-v2-${{ hashFiles('**/go.sum') }}
restore-keys: |
go-lint-v2-${{ hashFiles('**/go.sum') }}
go-lint-v2-
- name: Check cache golangci-lint
run: make golangci-lint-cache-status
- name: make golangci-lint
run: make golangci-lint
- name: Check Cache golangci-lint
run: make golangci-lint-cache-status
slack-on-style-failure:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_CI_INTEGRATION_TESTING_WEBHOOK: ${{ secrets.SLACK_CI_INTEGRATION_TESTING_WEBHOOK }}
TEST_FAILURES_NOTIFY_WEBHOOK: ${{ secrets.TEST_FAILURES_NOTIFY_WEBHOOK }}
if: |
failure() && (
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'ci-test-github-action-slack-messages')
)
name: Post failure message to Slack
runs-on: ubuntu-latest
needs:
- check-generated-files
- misc-checks
- style-check
- golangci-lint
permissions:
actions: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Slack message
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: |
source scripts/ci/lib.sh
slack_workflow_failure