Skip to content

Commit aca7f90

Browse files
committed
adding ci files
1 parent 84b4a51 commit aca7f90

File tree

1 file changed

+171
-0
lines changed

1 file changed

+171
-0
lines changed

.github/workflows/kdevops.yml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Run generic kdevops CI runner workflow
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
pull_request:
8+
branches:
9+
- '**'
10+
workflow_dispatch: # Add this for manual triggering of the workflow
11+
12+
jobs:
13+
run-kdevops:
14+
name: Run kdevops CI on Self-hosted Runner
15+
runs-on: [self-hosted, Linux, X64]
16+
steps:
17+
- name: Configure git
18+
run: |
19+
git config --global --add safe.directory '*'
20+
21+
- name: Set Linux kdevops development path
22+
run: echo "LINUX_KDEVOPS_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
23+
24+
- name: Checkout kdevops
25+
run: |
26+
rm -rf kdevops
27+
git clone /mirror/kdevops.git kdevops
28+
29+
- name: Make sure our repo kdevops defconfig exists
30+
run: |
31+
cd kdevops
32+
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
33+
if [[ "${{ github.event.inputs.defconfig }}" == "all profiles" ]] || [[ "${{ github.event.inputs.defconfig }}" == "" ]]; then
34+
KDEVOPS_DEFCONFIG=$(basename ${{ github.repository }})
35+
else
36+
KDEVOPS_DEFCONFIG="${{ github.event.inputs.defconfig }}-cli"
37+
fi
38+
39+
if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then
40+
echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG"
41+
exit 1
42+
fi
43+
44+
echo "KDEVOPS_DEFCONFIG=$KDEVOPS_DEFCONFIG" >> $GITHUB_ENV
45+
46+
- name: Checkout custom branch with delta on kdevops/linux
47+
run: |
48+
LINUX_TREE="https://github.com/${{ github.repository }}"
49+
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
50+
cd kdevops
51+
git clone $LINUX_TREE --reference /mirror/linux.git/ --depth=5 linux
52+
cd linux
53+
git fetch origin $LINUX_TREE_REF
54+
git checkout $LINUX_TREE_REF
55+
git log -1
56+
57+
- name: Initialize CI metadata for kdevops-results-archive for linux
58+
run: |
59+
cd kdevops/linux
60+
echo "$(basename ${{ github.repository }})" > ../ci.trigger
61+
62+
# Check if the last commit modified .github directory.
63+
# This lets you merge the .github changes either before a patch
64+
# series as kernel-patch-daemon does, or if you want to keep your
65+
# git commit IDs from an existing development tree, at the end.
66+
# You would merge the changes which add the .github directory for
67+
# example if you want to test an existing development tree.
68+
#
69+
# If the last commit was not the one which added .github directory
70+
# use the last commit message. This is for example how
71+
# kernel-patch-daemon pushes changes, the last commit is the last
72+
# patch from series posted and picked up from patchwork.
73+
if git diff-tree --no-commit-id --name-only --diff-filter=A -r HEAD | grep -q "^\.github/"; then
74+
git log -2 --skip=1 --pretty=format:"%s" -1 > ../ci.subject
75+
git describe --exact-match --tags HEAD^ 2>/dev/null || git rev-parse --short HEAD^ > ../ci.ref
76+
else
77+
git log -1 --pretty=format:"%s" > ../ci.subject
78+
git describe --exact-match --tags HEAD 2>/dev/null || git rev-parse --short HEAD > ../ci.ref
79+
fi
80+
81+
# Start out pessimistic
82+
echo "not ok" > ../ci.result
83+
echo "Nothing to write home about." > ../ci.commit_extra
84+
85+
- name: Run a quick Linux kernel defconfig build test
86+
run: |
87+
cd kdevops/linux
88+
make defconfig
89+
make -j$(nproc)
90+
91+
- name: Run kdevops make defconfig-repo
92+
run: |
93+
LINUX_TREE="https://github.com/${{ github.repository }}"
94+
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
95+
KDEVOPS_HOSTS_PREFIX="$(echo ${LINUX_TREE_REF:0:4})"
96+
echo Going to use defconfig-${{ env.KDEVOPS_DEFCONFIG }}
97+
98+
echo "Linux tree: $LINUX_TREE"
99+
echo "Linux trigger ref: $LINUX_TREE_REF"
100+
echo "Linux ref: $(cat ../ci.ref)"
101+
echo "Runner ID: ${{ github.run_id }}"
102+
echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX"
103+
echo "kdevops defconfig: defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
104+
105+
KDEVOPS_ARGS="KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX LINUX_TREE=$LINUX_TREE LINUX_TREE_REF=$LINUX_TREE_REF defconfig-${{ env.KDEVOPS_DEFCONFIG }}"
106+
echo Going to run:
107+
echo make $KDEVOPS_ARGS
108+
109+
cd kdevops
110+
make $KDEVOPS_ARGS
111+
112+
- name: Run kdevops make
113+
run: |
114+
cd kdevops
115+
make -j$(nproc)
116+
117+
- name: Run kdevops make bringup
118+
run: |
119+
cd kdevops
120+
ls -ld linux
121+
make bringup
122+
123+
- name: Build linux and boot test nodes on test kernel
124+
run: |
125+
cd kdevops
126+
make linux
127+
128+
- name: Build required ci tests
129+
run: |
130+
cd kdevops
131+
make ci-build-test
132+
133+
- name: Run CI tests
134+
run: |
135+
cd kdevops
136+
make ci-test
137+
echo "ok" > ci.result
138+
139+
- name: Get systemd journal files
140+
if: always() # This ensures the step runs even if previous steps failed
141+
run: |
142+
cd kdevops
143+
make journal-dump
144+
145+
- name: Start SSH Agent
146+
if: always() # Ensure this step runs even if previous steps failed
147+
uses: webfactory/[email protected]
148+
with:
149+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
150+
151+
- name: Build our kdevops archive results
152+
if: always() # This ensures the step runs even if previous steps failed
153+
run: |
154+
cd kdevops
155+
make ci-archive
156+
157+
- name: Upload our kdevops results archive
158+
if: always() # This ensures the step runs even if previous steps failed
159+
uses: actions/upload-artifact@v4
160+
with:
161+
name: kdevops-ci-results
162+
path: ${{ env.LINUX_KDEVOPS_PATH }}/kdevops/archive/*.zip
163+
164+
# Ensure make destroy always runs, even on failure
165+
- name: Run kdevops make destroy
166+
if: always() # This ensures the step runs even if previous steps failed
167+
run: |
168+
cd kdevops
169+
make destroy
170+
cd ..
171+
rm -rf kdevops

0 commit comments

Comments
 (0)