Skip to content

Commit 0154b47

Browse files
committed
add github workflows
1 parent af7cb41 commit 0154b47

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

.github/workflows/kdevops.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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: Checkout kdevops
22+
run: |
23+
rm -rf kdevops
24+
git clone /mirror/kdevops.git kdevops
25+
26+
- name: Checkout custom branch with delta on kdevops/linux
27+
run: |
28+
LINUX_TREE="https://github.com/${{ github.repository }}"
29+
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
30+
cd kdevops
31+
git clone $LINUX_TREE --reference /mirror/linux.git/ --depth=5 linux
32+
cd linux
33+
git fetch origin $LINUX_TREE_REF
34+
git checkout $LINUX_TREE_REF
35+
git log -1
36+
37+
- name: Run a quick Linux kernel defconfig build test
38+
run: |
39+
cd kdevops/linux
40+
make defconfig
41+
make -j$(nproc)
42+
43+
- name: Make sure our repo kdevops defconfig exists
44+
run: |
45+
KDEVOPS_DEFCONFIG=$(echo $(basename ${{ github.repository }}))
46+
cd kdevops
47+
if [[ ! -f defconfigs/$KDEVOPS_DEFCONFIG ]]; then
48+
echo "kdevops lacks a defconfig for this repository, expected to find: defconfigs/$KDEVOPS_DEFCONFIG"
49+
exit 1
50+
fi
51+
52+
- name: Run kdevops make defconfig-repo
53+
run: |
54+
LINUX_TREE="https://github.com/${{ github.repository }}"
55+
LINUX_TREE_REF="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}"
56+
KDEVOPS_DEFCONFIG=$(echo $(basename ${{ github.repository }}))
57+
KDEVOPS_HOSTS_PREFIX="$(echo ${LINUX_TREE_REF:0:4})"
58+
echo Going to use defconfig-$(basename ${{ github.repository }})
59+
60+
echo "Linux tree: $LINUX_TREE"
61+
echo "Linux ref: $LINUX_TREE_REF"
62+
echo "Runner ID: ${{ github.run_id }}"
63+
echo "kdevops host prefix: $KDEVOPS_HOSTS_PREFIX"
64+
65+
KDEVOPS_ARGS="KDEVOPS_HOSTS_PREFIX=$KDEVOPS_HOSTS_PREFIX LINUX_TREE=$LINUX_TREE LINUX_TREE_REF=$LINUX_TREE_REF defconfig-$KDEVOPS_DEFCONFIG"
66+
echo Going to run:
67+
echo make $KDEVOPS_ARGS
68+
69+
cd kdevops
70+
make $KDEVOPS_ARGS
71+
72+
- name: Run kdevops make
73+
run: |
74+
cd kdevops
75+
make -j$(nproc)
76+
77+
- name: Run kdevops make bringup
78+
run: |
79+
cd kdevops
80+
ls -ld linux
81+
make bringup
82+
83+
- name: Build linux and boot test nodes on test kernel
84+
run: |
85+
cd kdevops
86+
make linux
87+
88+
- name: Build required ci tests
89+
run: |
90+
cd kdevops
91+
make ci-build-test
92+
93+
- name: Run CI tests
94+
run: |
95+
cd kdevops
96+
make ci-test
97+
98+
- name: Get the defined CI test results directories for this repository
99+
id: results-dirs
100+
run: |
101+
cd kdevops
102+
make ci-results > results_dirs.txt
103+
104+
- name: Upload all defined test result directories as artifacts
105+
uses: actions/upload-artifact@v3
106+
with:
107+
name: ci-results
108+
path: |
109+
$(cat kdevops/results_dirs.txt | tr '\n' ',')
110+
111+
# Ensure make destroy always runs, even on failure
112+
- name: Run kdevops make destroy
113+
if: always() # This ensures the step runs even if previous steps failed
114+
run: |
115+
cd kdevops
116+
make destroy
117+
cd ..
118+
rm -rf kdevops

0 commit comments

Comments
 (0)