-
Notifications
You must be signed in to change notification settings - Fork 50
232 lines (221 loc) · 6.98 KB
/
main.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: CI
on:
push:
branches:
- "**"
env:
CUR_REGISTRY: "registry.cennso.com"
REGISTRY: "quay.io"
IMAGE_NAME: travelping/upg-vpp
# Make 'git am' work
GIT_AUTHOR_NAME: Dummy
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Dummy
GIT_COMMITTER_EMAIL: [email protected]
UPG_BUILDENV: docker
# FIXME: UDP tests are unstable, likely due to a shortcoming in
# Linux namespace handling code
E2E_SKIP: ".*IPv6 session measurement.*counts UDP traffic.*"
# Uncomment to disable pushing the upg-vpp images.
# Build images will still be pushed in case if a new one needs to be built.
# This may be helpful during workflow debugging
# NO_PUSH: y
# Uncomment/change the following to run only a subset of tests.
# But don't forget to comment it back for a finished PR!
# E2E_FOCUS: "TDF.*IPv4.*no proxy.*counts plain HTTP traffic"
E2E_PARALLEL_NODES: "10"
jobs:
build:
runs-on: ["self-hosted"]
strategy:
matrix:
build_type: [debug, release]
env:
# avoid conflicts between parallel jobs
K8S_ID_SUFFIX: ${{ matrix.build_type }}
steps:
# https://github.com/actions/runner/issues/434#issuecomment-992865457
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Login to quay.io
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USER_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
# for git describe
fetch-depth: 0
- name: Build UPG image
run: |
make ci-build BUILD_TYPE="${{ matrix.build_type }}"
mv /tmp/_out _out
- name: Upload debs
uses: actions/upload-artifact@v2
with:
name: debs-${{ matrix.build_type }}
path: _out/*.deb
# image.txt used by the release workflow
- name: Upload image.txt
uses: actions/upload-artifact@v2
with:
name: image-${{ matrix.build_type }}
path: image-${{ matrix.build_type }}.txt
- name: Upload image.txt for the dev image
uses: actions/upload-artifact@v2
with:
name: image-dev-${{ matrix.build_type }}
path: image-dev-${{ matrix.build_type }}.txt
checkstyle:
runs-on: ["self-hosted"]
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v2
- name: Check the code style
uses: jidicula/[email protected]
with:
clang-format-version: '11'
integration:
runs-on: ["self-hosted", "hugepages"]
strategy:
fail-fast: false
matrix:
build_type: [debug, release]
env:
BUILD_TYPE: ${{ matrix.build_type }}
needs: build
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v2
with:
# for git describe
fetch-depth: 0
- name: Get dev image info
uses: actions/download-artifact@v2
with:
name: image-dev-${{ matrix.build_type }}
- name: Run tests
run: |
dev_image=$(cat image-dev-${BUILD_TYPE}.txt)
make retest DEV_IMAGE="${dev_image}"
e2e:
runs-on: ["self-hosted", "hugepages"]
strategy:
fail-fast: false
matrix:
build_type: [debug, release]
env:
BUILD_TYPE: ${{ matrix.build_type }}
needs: build
steps:
- name: Clean the workspace
uses: docker://alpine
with:
args: /bin/sh -c "rm -rf /github/workspace/.* 2>/dev/null || rm -rf /github/workspace/*"
- name: Login to the registry
uses: docker/login-action@v1
with:
registry: ${{ env.CUR_REGISTRY }}
username: ${{ secrets.CUR_REGISTRY_LOGIN }}
password: ${{ secrets.CUR_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v2
with:
# for git describe
fetch-depth: 0
- name: Get dev image info
uses: actions/download-artifact@v2
with:
name: image-dev-${{ matrix.build_type }}
- name: Run tests
run: |
dev_image=$(cat image-dev-${BUILD_TYPE}.txt)
mkdir junit-output
if ! make retest-e2e \
DEV_IMAGE="${dev_image}" \
E2E_RETEST=y \
E2E_PARALLEL=y \
E2E_PARALLEL_NODES="${E2E_PARALLEL_NODES}" \
E2E_QUICK=y \
E2E_ARTIFACTS_DIR="/src/artifacts" \
E2E_JUNIT_DIR="/src/artifacts/junit-output" \
E2E_FOCUS="${E2E_FOCUS}" \
E2E_SKIP="${E2E_SKIP}" \
E2E_NO_GDB=1 \
GRAB_ARTIFACTS=1; then
docker run -v "${PWD}:/src" alpine /bin/sh -c "chown -v -R $(id -u).$(id -g) /src/artifacts"
exit 1
fi
- name: Upload artifacts for failed tests
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-artifacts-${{ matrix.kind }}-${{ matrix.build_type }}
path: artifacts/
# dummy job for release.yaml to wait on
conclude:
runs-on: ["self-hosted"]
needs:
- checkstyle
- integration
- e2e
steps:
- name: Dummy step
run: echo ok
# based on ergw GH Action config
slack:
needs:
- conclude
runs-on: ["self-hosted"]
if: always()
steps:
- name: Set status
run: |
if [[ ${{ needs.conclude.result }} =~ ^(success|failure)$ ]]; then
echo '::set-output name=STATUS::${{ needs.conclude.result }}'
else
echo '::set-output name=STATUS::cancelled'
fi
id: set-status
- name: Slack notification
uses: 8398a7/action-slack@v3
with:
author_name: "GitHub Actions"
username: ${{ github.event.repository.name }}
icon_emoji: ':octocat:'
fields: repo, message, ref, commit, author, action, eventName, workflow, job, took
status: ${{ steps.set-status.outputs.STATUS }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}