-
Notifications
You must be signed in to change notification settings - Fork 4
207 lines (183 loc) · 5.63 KB
/
ci.yml
File metadata and controls
207 lines (183 loc) · 5.63 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Main CI
on:
push:
branches:
- main
- release-*
tags:
- '*'
pull_request:
schedule:
- cron: '0 6 * * *'
concurrency:
# append event name on the off chance that a push to master
# runs at the same time as the nightlies - we want both to run
group: ${{ github.head_ref || github.run_id }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
basic:
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
rust-version:
- stable
- nightly
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libbpf-dev \
protobuf-compiler
rustup +${{ matrix.rust-version }} component add clippy
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-${{ runner.arch }}-cargo-${{ matrix.rust-version }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo +${{ matrix.rust-version }} build --release
- name: Lint
run: cargo +${{ matrix.rust-version }} clippy --all-targets --all-features -- -D warnings
- name: Test
run: cargo +${{ matrix.rust-version }} test
format-check:
runs-on: ubuntu-24.04
env:
CLANG_FMT: clang-format-18
steps:
- uses: actions/checkout@v4
- name: Check code format
run: |
rustup component add rustfmt
make format-check
vars:
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.vars.outputs.tag }}
stackrox-io-image: ${{ steps.vars.outputs.stackrox-io-image }}
rhacs-eng-image: ${{ steps.vars.outputs.rhacs-eng-image }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- id: vars
run: |
cat << EOF >> "$GITHUB_OUTPUT"
tag=$(make tag)
stackrox-io-image=$(make image-name)
rhacs-eng-image=$(FACT_REGISTRY="quay.io/rhacs-eng/fact" make image-name)
EOF
container:
needs:
- vars
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || 'ubuntu-24.04' }}
env:
FACT_TAG: ${{ needs.vars.outputs.tag }}-${{ matrix.arch }}
FACT_VERSION: ${{ needs.vars.outputs.tag }}
STACKROX_IO_IMAGE: ${{ needs.vars.outputs.stackrox-io-image }}-${{ matrix.arch }}
RHACS_ENG_IMAGE: ${{ needs.vars.outputs.rhacs-eng-image }}-${{ matrix.arch }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build image
run: DOCKER=podman make image
- name: Login to quay.io/stackrox-io
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
- run: podman push "${STACKROX_IO_IMAGE}"
- name: Login to quay.io/rhacs-eng
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
- name: Tag and push to rhacs-eng
run: |
podman tag "${STACKROX_IO_IMAGE}" "${RHACS_ENG_IMAGE}"
podman push "${RHACS_ENG_IMAGE}"
manifest-stackrox-io:
runs-on: ubuntu-24.04
needs:
- container
- vars
env:
ARCHS: amd64 arm64
steps:
- uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}
password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}
- name: Create multiarch manifest
run: |
podman manifest create ${{ needs.vars.outputs.stackrox-io-image }} \
${{ needs.vars.outputs.stackrox-io-image }}-amd64 \
${{ needs.vars.outputs.stackrox-io-image }}-arm64
podman manifest inspect ${{ needs.vars.outputs.stackrox-io-image }}
podman manifest push ${{ needs.vars.outputs.stackrox-io-image }}
manifest-rhacs-eng:
runs-on: ubuntu-24.04
needs:
- container
- vars
env:
ARCHS: amd64 arm64
steps:
- uses: redhat-actions/podman-login@v1
with:
registry: quay.io
username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}
password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}
- name: Create multiarch manifest
run: |
podman manifest create ${{ needs.vars.outputs.rhacs-eng-image }} \
${{ needs.vars.outputs.rhacs-eng-image }}-amd64 \
${{ needs.vars.outputs.rhacs-eng-image }}-arm64
podman manifest inspect ${{ needs.vars.outputs.rhacs-eng-image }}
podman manifest push ${{ needs.vars.outputs.rhacs-eng-image }}
unit-tests:
uses: ./.github/workflows/unit-tests.yml
secrets: inherit
integration-tests:
needs:
- vars
- manifest-stackrox-io
- manifest-rhacs-eng
uses: ./.github/workflows/integration-tests.yml
with:
tag: ${{ needs.vars.outputs.tag }}
secrets: inherit
performance-tests:
if: github.event_name == 'schedule'
needs:
- vars
- manifest-stackrox-io
- manifest-rhacs-eng
- integration-tests
uses: ./.github/workflows/performance-tests.yml
with:
tag: ${{ needs.vars.outputs.tag }}
secrets: inherit