1 # ci:kernel:x86:64 is going to trigger CI kernel check jobs for x86/64 target
3 name: Build kernel and check patches for target specified in labels
11 if: startsWith(github.event.label.name, 'ci:kernel:')
13 runs-on: ubuntu-latest
15 targets_subtargets: ${{ steps.set_target.outputs.targets_subtargets }}
16 targets: ${{ steps.set_target.outputs.targets }}
20 uses: actions/checkout@v3
25 CI_EVENT_LABEL_NAME: ${{ github.event.label.name }}
27 echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT
28 echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT
29 echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p' | tee --append $GITHUB_OUTPUT
34 ALL_TARGETS="$(perl ./scripts/dump-target-info.pl kernels 2>/dev/null)"
36 TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1)"
37 TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1)"
39 [ "${{ steps.parse_label.outputs.subtarget }}" = "first" ] && TARGETS_SUBTARGETS=$TARGETS
41 JSON_TARGETS_SUBTARGETS='['
43 while IFS= read -r line; do
44 TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1)
45 TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1)
46 SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2)
48 [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != "$TARGET" ] && continue
49 [ "${{ steps.parse_label.outputs.subtarget }}" != "all" ] && [ "${{ steps.parse_label.outputs.subtarget }}" != "first" ] &&
50 [ "${{ steps.parse_label.outputs.subtarget }}" != $SUBTARGET ] && continue
51 if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then
52 TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3)
53 [ -z "$TESTING_KERNEL_VER" ] && continue
56 TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}'
57 [[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
58 JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE"
60 done <<< "$TARGETS_SUBTARGETS"
61 JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']'
65 while IFS= read -r line; do
66 TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1)
67 TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1)
68 SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2)
70 [ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != $TARGET ] && continue
71 if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then
72 TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3)
73 [ -z "$TESTING_KERNEL_VER" ] && continue
76 TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}'
77 [[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
78 JSON_TARGETS="$JSON_TARGETS""$TUPLE"
81 JSON_TARGETS="$JSON_TARGETS"']'
83 echo -e "\n---- targets to build ----\n"
84 echo "$JSON_TARGETS_SUBTARGETS"
85 echo -e "\n---- targets to build ----\n"
87 echo -e "\n---- targets to check patch ----\n"
89 echo -e "\n---- targets to check patch ----\n"
91 echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT
92 echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT
95 name: Build Kernel with external toolchain
101 uses: ./.github/workflows/build.yml
105 include: ${{fromJson(needs.set_target.outputs.targets_subtargets)}}
107 container_name: toolchain
108 target: ${{ matrix.target }}
109 subtarget: ${{ matrix.subtarget }}
110 testing: ${{ matrix.testing != '' && true }}
112 build_all_kmods: true
114 check-kernel-patches:
115 name: Check Kernel patches
124 include: ${{fromJson(needs.set_target.outputs.targets)}}
125 uses: ./.github/workflows/check-kernel-patches.yml
127 target: ${{ matrix.target }}
128 subtarget: ${{ matrix.subtarget }}
129 testing: ${{ matrix.testing != '' && true }}