2023-01-11 09:26:16 +00:00
|
|
|
# ci:kernel:x86:64 is going to trigger CI kernel check jobs for x86/64 target
|
|
|
|
|
|
|
|
name: Build kernel and check patches for target specified in labels
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types:
|
|
|
|
- labeled
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
set_target:
|
|
|
|
if: startsWith(github.event.label.name, 'ci:kernel:')
|
|
|
|
name: Set target
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2023-05-31 15:40:11 +00:00
|
|
|
targets_subtargets: ${{ steps.set_target.outputs.targets_subtargets }}
|
|
|
|
targets: ${{ steps.set_target.outputs.targets }}
|
2023-01-11 09:26:16 +00:00
|
|
|
|
|
|
|
steps:
|
2023-05-31 15:40:11 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Parse label
|
|
|
|
id: parse_label
|
2023-01-11 09:26:16 +00:00
|
|
|
env:
|
|
|
|
CI_EVENT_LABEL_NAME: ${{ github.event.label.name }}
|
|
|
|
run: |
|
2023-05-31 15:40:11 +00:00
|
|
|
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/target=\1/p' | tee --append $GITHUB_OUTPUT
|
|
|
|
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/subtarget=\2/p' | tee --append $GITHUB_OUTPUT
|
|
|
|
echo "$CI_EVENT_LABEL_NAME" | sed -n 's/ci:kernel:\([^:]*\):\([^:]*\):*\([^:]*\)$/testing=\3/p' | tee --append $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Set targets
|
|
|
|
id: set_target
|
|
|
|
run: |
|
|
|
|
ALL_TARGETS="$(perl ./scripts/dump-target-info.pl kernels 2>/dev/null)"
|
|
|
|
|
|
|
|
TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1)"
|
|
|
|
TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1)"
|
|
|
|
|
|
|
|
[ "${{ steps.parse_label.outputs.subtarget }}" = "first" ] && TARGETS_SUBTARGETS=$TARGETS
|
|
|
|
|
|
|
|
JSON_TARGETS_SUBTARGETS='['
|
|
|
|
FIRST=1
|
|
|
|
while IFS= read -r line; do
|
|
|
|
TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1)
|
|
|
|
TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1)
|
|
|
|
SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2)
|
|
|
|
|
|
|
|
[ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != "$TARGET" ] && continue
|
|
|
|
[ "${{ steps.parse_label.outputs.subtarget }}" != "all" ] && [ "${{ steps.parse_label.outputs.subtarget }}" != "first" ] &&
|
|
|
|
[ "${{ steps.parse_label.outputs.subtarget }}" != $SUBTARGET ] && continue
|
|
|
|
if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then
|
|
|
|
TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3)
|
|
|
|
[ -z "$TESTING_KERNEL_VER" ] && continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}'
|
|
|
|
[[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
|
|
|
|
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS""$TUPLE"
|
|
|
|
FIRST=0
|
|
|
|
done <<< "$TARGETS_SUBTARGETS"
|
|
|
|
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']'
|
|
|
|
|
|
|
|
JSON_TARGETS='['
|
|
|
|
FIRST=1
|
|
|
|
while IFS= read -r line; do
|
|
|
|
TARGET_SUBTARGET=$(echo $line | cut -d " " -f 1)
|
|
|
|
TARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 1)
|
|
|
|
SUBTARGET=$(echo $TARGET_SUBTARGET | cut -d "/" -f 2)
|
|
|
|
|
|
|
|
[ "${{ steps.parse_label.outputs.target }}" != "all" ] && [ "${{ steps.parse_label.outputs.target }}" != $TARGET ] && continue
|
|
|
|
if [ "${{ steps.parse_label.outputs.testing }}" = "testing" ]; then
|
|
|
|
TESTING_KERNEL_VER=$(echo $line | cut -d " " -f 3)
|
|
|
|
[ -z "$TESTING_KERNEL_VER" ] && continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
TUPLE='{"target":"'"$TARGET"'","subtarget":"'"$SUBTARGET"'","testing":"'"$TESTING_KERNEL_VER"'"}'
|
|
|
|
[[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
|
|
|
|
JSON_TARGETS="$JSON_TARGETS""$TUPLE"
|
|
|
|
FIRST=0
|
|
|
|
done <<< "$TARGETS"
|
|
|
|
JSON_TARGETS="$JSON_TARGETS"']'
|
|
|
|
|
|
|
|
echo -e "\n---- targets to build ----\n"
|
|
|
|
echo "$JSON_TARGETS_SUBTARGETS"
|
|
|
|
echo -e "\n---- targets to build ----\n"
|
|
|
|
|
|
|
|
echo -e "\n---- targets to check patch ----\n"
|
|
|
|
echo "$JSON_TARGETS"
|
|
|
|
echo -e "\n---- targets to check patch ----\n"
|
|
|
|
|
|
|
|
echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT
|
|
|
|
echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT
|
2023-01-11 09:26:16 +00:00
|
|
|
|
|
|
|
build_kernel:
|
|
|
|
name: Build Kernel with external toolchain
|
|
|
|
needs: set_target
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
2023-05-28 00:55:26 +00:00
|
|
|
actions: write
|
2023-01-11 09:26:16 +00:00
|
|
|
uses: ./.github/workflows/build.yml
|
2023-05-31 15:40:11 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: False
|
|
|
|
matrix:
|
|
|
|
include: ${{fromJson(needs.set_target.outputs.targets_subtargets)}}
|
2023-01-11 09:26:16 +00:00
|
|
|
with:
|
2023-05-28 01:44:01 +00:00
|
|
|
container_name: toolchain
|
2023-05-31 15:40:11 +00:00
|
|
|
target: ${{ matrix.target }}
|
|
|
|
subtarget: ${{ matrix.subtarget }}
|
|
|
|
testing: ${{ matrix.testing != '' && true }}
|
2023-01-11 09:26:16 +00:00
|
|
|
build_kernel: true
|
|
|
|
build_all_kmods: true
|
|
|
|
|
|
|
|
check-kernel-patches:
|
|
|
|
name: Check Kernel patches
|
|
|
|
needs: set_target
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
2023-05-28 00:55:26 +00:00
|
|
|
actions: write
|
2023-05-31 15:40:11 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: False
|
|
|
|
matrix:
|
|
|
|
include: ${{fromJson(needs.set_target.outputs.targets)}}
|
2023-01-11 09:26:16 +00:00
|
|
|
uses: ./.github/workflows/check-kernel-patches.yml
|
|
|
|
with:
|
2023-05-31 15:40:11 +00:00
|
|
|
target: ${{ matrix.target }}
|
|
|
|
subtarget: ${{ matrix.subtarget }}
|
|
|
|
testing: ${{ matrix.testing != '' && true }}
|