forked from linux-kdevops/kdevops-ci-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
262 lines (234 loc) · 9.6 KB
/
kdevops.yml
File metadata and controls
262 lines (234 loc) · 9.6 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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: Run fstests
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch: # Add this for manual triggering of the workflow
inputs:
defconfig:
description: "Select defconfig"
required: false
default: "all profiles"
type: choice
options:
- "all profiles"
- "xfs_reflink_4k"
- "xfs_nocrc_4k"
soak:
description: "Select soak duration"
required: false
default: "No soak"
type: choice
options:
- "No soak"
- "Low - 30 minutes"
- "Mid - 1 hour"
- "High - 2.5 hours"
- "Pathological - 48 hours"
tests:
description: "Select additional test coverage"
required: false
default: "all"
type: choice
options:
- "all"
- "generic/003"
- "generic/751"
- "custom"
custom_tests:
description: "Enter custom test(s) (space or comma-separated: 'test1 test2' or 'test1,test2')"
required: false
type: string
default: ""
timeout_minutes:
description: "Timeout in minutes"
required: true
default: 43200 # 1 month
type: choice
options:
- 1440 # 1 day
- 10080 # 1 week
- 20160 # 2 weeks
- 43200 # 1 month
- 129600 # 3 months
- 259200 # 6 months
jobs:
run-kdevops:
name: Run kdevops CI on Self-hosted Runner
runs-on: [self-hosted, Linux, X64]
timeout-minutes: ${{ fromJson((github.event.inputs && github.event.inputs.timeout_minutes) || '43200') }}
steps:
- name: Output timeout value
run: |
echo "Timeout minutes is ${{ fromJson((github.event.inputs && github.event.inputs.timeout_minutes) || '43200') }}"
- name: Configure git
run: |
git config --global --add safe.directory '*'
- name: Set Linux kdevops development path
run: echo "LINUX_KDEVOPS_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- name: Process test selection
id: process-tests
run: |
if [[ "${{ github.event.inputs.tests }}" == "custom" ]]; then
if [[ -n "${{ github.event.inputs.custom_tests }}" ]]; then
# Replace commas with spaces and collapse multiple spaces into single spaces
TESTS=$(echo "${{ github.event.inputs.custom_tests }}" | tr ',' ' ' | tr -s ' ')
# Trim leading and trailing whitespace
TESTS=$(echo "$TESTS" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
echo "SELECTED_TESTS=$TESTS" >> $GITHUB_ENV
echo "Custom tests selected: $TESTS"
else
echo "No custom tests provided, falling back to all"
echo "SELECTED_TESTS=all" >> $GITHUB_ENV
fi
elif [[ "${{ github.event.inputs.tests }}" == "" ||
"${{ github.event.inputs.tests }}" == "all" ]]; then
echo "Automated test so no specific test requested"
echo "SELECTED_TESTS=all" >> $GITHUB_ENV
fi
- name: Checkout kdevops
run: |
rm -rf kdevops
git clone /mirror/kdevops.git kdevops
- name: Make sure our repo kdevops defconfig exists
run: |
cd kdevops
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
if [[ "${{ github.event.inputs.defconfig }}" == "all profiles" ]] || [[ "${{ github.event.inputs.defconfig }}" == "" ]]; then
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
else
KDEVOPS_DEFCONFIG="${{ github.event.inputs.defconfig }}-cli"
fi
if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then
echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG"
exit 1
fi
echo "KDEVOPS_DEFCONFIG=$KDEVOPS_DEFCONFIG" >> $GITHUB_ENV
- name: Checkout custom branch with delta on kdevops/linux
run: |
LINUX_TREE="https://github.com/${{ github.repository }}"
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
cd kdevops
git clone $LINUX_TREE --reference /mirror/linux.git/ --depth=5 linux
cd linux
git fetch origin $LINUX_TREE_REF
git checkout $LINUX_TREE_REF
git log -1
- name: Initialize CI metadata for kdevops-results-archive for linux
run: |
cd kdevops/linux
echo "$(basename ${{ github.repository }})" > ../ci.trigger
# Check if the last commit modified .github directory.
# This lets you merge the .github changes either before a patch
# series as kernel-patch-daemon does, or if you want to keep your
# git commit IDs from an existing development tree, at the end.
# You would merge the changes which add the .github directory for
# example if you want to test an existing development tree.
#
# If the last commit was not the one which added .github directory
# use the last commit message. This is for example how
# kernel-patch-daemon pushes changes, the last commit is the last
# patch from series posted and picked up from patchwork.
if git diff-tree --no-commit-id --name-only --diff-filter=A -r HEAD | grep -q "^\.github/"; then
git log -2 --skip=1 --pretty=format:"%s" -1 > ../ci.subject
git describe --exact-match --tags HEAD^ 2>/dev/null || git rev-parse --short HEAD^ > ../ci.ref
else
git log -1 --pretty=format:"%s" > ../ci.subject
git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD > ../ci.ref
fi
# Start out pessimistic
echo "not ok" > ../ci.result
echo "Nothing to write home about." > ../ci.commit_extra
- name: Run a quick Linux kernel defconfig build test
run: |
cd kdevops/linux
make defconfig
make -j$(nproc)
- name: Run kdevops make defconfig-repo
run: |
LINUX_TREE="https://github.com/${{ github.repository }}"
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
KDEVOPS_HOSTS_PREFIX="$(echo ${LINUX_TREE_REF:0:4})"
echo Going to use defconfig-$KDEVOPS_DEFCONFIG
echo "Linux tree: $LINUX_TREE"
echo "Linux ref: $LINUX_TREE_REF"
echo "Runner ID: ${{ github.run_id }}"
echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX"
echo "kdevops defconfig: defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
KDEVOPS_ARGS="KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX LINUX_TREE=$LINUX_TREE LINUX_TREE_REF=$LINUX_TREE_REF defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
echo Going to run:
echo make $KDEVOPS_ARGS
cd kdevops
make $KDEVOPS_ARGS
- name: Run kdevops make
run: |
cd kdevops
make -j$(nproc)
- name: Run kdevops make bringup
run: |
cd kdevops
ls -ld linux
make bringup
- name: Build linux and boot test nodes on test kernel
run: |
cd kdevops
make linux
- name: Build required ci tests
run: |
cd kdevops
make ci-build-test
- name: Run CI tests
run: |
cd kdevops
if [[ "${{ env.SELECTED_TESTS }}" == "all" ]]; then
echo "Running all the tests ..."
nohup stdbuf -oL bash -c 'make ci-test' > ci.log 2>&1 &
echo $! > ci.pid
else
echo "We're going to be selective about what we test:"
echo "${{ env.SELECTED_TESTS }}"
nohup stdbuf -oL bash -c 'make fstests-baseline TESTS="${{ env.SELECTED_TESTS }}"' > ci.log 2>&1 &
echo $! > ci.pid
fi
CI_WATCHDOG="./scripts/workflows/fstests/fstests_watchdog.py hosts baseline"
while kill -0 $(cat ci.pid) 2> /dev/null; do
$CI_WATCHDOG || echo watchdog barfed
sleep 60
done
find workflows/fstests/results/last-run -name xunit_results.txt -type f -exec cat {} \; > ci.commit_extra || true
if ! grep -E "failures, [1-9]|errors, [1-9]" ci.commit_extra; then
echo "ok" > ci.result
fi
continue-on-error: true
- name: Get systemd journal files
if: always() # This ensures the step runs even if previous steps failed
run: |
cd kdevops
make journal-dump
- name: Start SSH Agent
if: always() # Ensure this step runs even if previous steps failed
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Build our kdevops archive results
if: always() # This ensures the step runs even if previous steps failed
run: |
cd kdevops
make ci-archive
- name: Upload our kdevops results archive
if: always() # This ensures the step runs even if previous steps failed
uses: actions/upload-artifact@v4
with:
name: kdevops-ci-results
path: ${{ env.LINUX_KDEVOPS_PATH }}/kdevops/archive/*.zip
# Ensure make destroy always runs, even on failure
- name: Run kdevops make destroy
if: always() # This ensures the step runs even if previous steps failed
run: |
cd kdevops
make destroy
cd ..
rm -rf kdevops