2022-03-09 17:22:22 +00:00
|
|
|
name: Build Kernel
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
paths:
|
2022-12-04 19:58:11 +00:00
|
|
|
- '.github/workflows/check-kernel-patches.yml'
|
|
|
|
- '.github/workflows/build.yml'
|
2022-08-07 16:18:40 +00:00
|
|
|
- '.github/workflows/kernel.yml'
|
2022-10-19 21:02:43 +00:00
|
|
|
- 'include/kernel*'
|
2022-03-09 17:22:22 +00:00
|
|
|
- 'package/kernel/**'
|
2023-01-20 14:13:21 +00:00
|
|
|
- 'target/linux/**'
|
2022-10-08 17:25:54 +00:00
|
|
|
push:
|
|
|
|
paths:
|
2022-12-04 19:58:11 +00:00
|
|
|
- '.github/workflows/check-kernel-patches.yml'
|
|
|
|
- '.github/workflows/build.yml'
|
2022-10-08 17:25:54 +00:00
|
|
|
- '.github/workflows/kernel.yml'
|
2022-10-19 21:02:43 +00:00
|
|
|
- 'include/kernel*'
|
2022-10-08 17:25:54 +00:00
|
|
|
- 'package/kernel/**'
|
2023-01-10 22:20:07 +00:00
|
|
|
- 'target/linux/**'
|
2022-09-19 10:20:37 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-01-11 12:52:38 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
|
2022-03-09 17:22:22 +00:00
|
|
|
jobs:
|
|
|
|
determine_targets:
|
|
|
|
name: Set targets
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2023-01-10 22:20:07 +00:00
|
|
|
targets_subtargets: ${{ steps.find_targets.outputs.targets_subtargets }}
|
|
|
|
targets: ${{ steps.find_targets.outputs.targets }}
|
2022-03-09 17:22:22 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-10-12 13:24:11 +00:00
|
|
|
uses: actions/checkout@v3
|
2023-01-10 22:20:07 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 2
|
|
|
|
|
|
|
|
- name: Get changed files
|
|
|
|
id: changed-files
|
|
|
|
uses: tj-actions/changed-files@v35
|
2022-03-09 17:22:22 +00:00
|
|
|
|
|
|
|
- name: Set targets
|
|
|
|
id: find_targets
|
|
|
|
run: |
|
2023-01-11 15:24:37 +00:00
|
|
|
ALL_TARGETS="$(perl ./scripts/dump-target-info.pl targets 2>/dev/null)"
|
|
|
|
CHANGED_FILES="$(echo ${{ steps.changed-files.outputs.all_changed_files }} | tr ' ' '\n')"
|
2023-01-10 22:20:07 +00:00
|
|
|
|
2023-01-11 15:24:37 +00:00
|
|
|
TARGETS_SUBTARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1 | awk '{ print $1 }')"
|
|
|
|
TARGETS="$(echo "$ALL_TARGETS" | sort -u -t '/' -k1,1 | awk '{ print $1 }')"
|
2022-03-09 17:22:22 +00:00
|
|
|
|
2023-02-19 22:35:42 +00:00
|
|
|
# On testing non-specific target, skip testing each subtarget
|
|
|
|
if echo "$CHANGED_FILES" | grep -v -q target/linux ||
|
|
|
|
echo "$CHANGED_FILES" | grep -q target/linux/generic; then
|
|
|
|
TARGETS_SUBTARGETS=$TARGETS
|
|
|
|
fi
|
|
|
|
|
2023-01-10 22:20:07 +00:00
|
|
|
JSON_TARGETS_SUBTARGETS='['
|
|
|
|
FIRST=1
|
|
|
|
for TARGET in $TARGETS_SUBTARGETS; do
|
2023-01-11 15:24:37 +00:00
|
|
|
if echo "$CHANGED_FILES" | grep -v -q target/linux ||
|
|
|
|
echo "$CHANGED_FILES" | grep -q target/linux/generic ||
|
|
|
|
echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
|
2023-01-10 22:20:07 +00:00
|
|
|
[[ $FIRST -ne 1 ]] && JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"','
|
|
|
|
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"'"'"${TARGET}"'"'
|
|
|
|
FIRST=0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
JSON_TARGETS_SUBTARGETS="$JSON_TARGETS_SUBTARGETS"']'
|
|
|
|
|
|
|
|
JSON_TARGETS='['
|
2022-03-09 17:22:22 +00:00
|
|
|
FIRST=1
|
|
|
|
for TARGET in $TARGETS; do
|
2023-01-11 15:24:37 +00:00
|
|
|
if echo "$CHANGED_FILES" | grep -v -q target/linux ||
|
|
|
|
echo "$CHANGED_FILES" | grep -q target/linux/generic ||
|
|
|
|
echo "$CHANGED_FILES" | grep -q $(echo $TARGET | cut -d "/" -f 1); then
|
2023-01-10 22:20:07 +00:00
|
|
|
[[ $FIRST -ne 1 ]] && JSON_TARGETS="$JSON_TARGETS"','
|
|
|
|
JSON_TARGETS="$JSON_TARGETS"'"'"${TARGET}"'"'
|
|
|
|
FIRST=0
|
|
|
|
fi
|
2022-03-09 17:22:22 +00:00
|
|
|
done
|
2023-01-10 22:20:07 +00:00
|
|
|
JSON_TARGETS="$JSON_TARGETS"']'
|
|
|
|
|
|
|
|
echo -e "\n---- targets to build ----\n"
|
|
|
|
echo "$JSON_TARGETS_SUBTARGETS"
|
|
|
|
echo -e "\n---- targets to build ----\n"
|
2022-03-09 17:22:22 +00:00
|
|
|
|
2023-01-10 22:20:07 +00:00
|
|
|
echo -e "\n---- targets to check patch ----\n"
|
|
|
|
echo "$JSON_TARGETS"
|
|
|
|
echo -e "\n---- targets to check patch ----\n"
|
2022-03-09 17:22:22 +00:00
|
|
|
|
2023-01-10 22:20:07 +00:00
|
|
|
echo "targets_subtargets=$JSON_TARGETS_SUBTARGETS" >> $GITHUB_OUTPUT
|
|
|
|
echo "targets=$JSON_TARGETS" >> $GITHUB_OUTPUT
|
2022-03-09 17:22:22 +00:00
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build Kernel with external toolchain
|
|
|
|
needs: determine_targets
|
2022-11-01 18:10:01 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
2022-03-09 17:22:22 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: False
|
|
|
|
matrix:
|
2023-01-10 22:20:07 +00:00
|
|
|
target: ${{fromJson(needs.determine_targets.outputs.targets_subtargets)}}
|
2022-11-01 18:10:01 +00:00
|
|
|
uses: ./.github/workflows/build.yml
|
|
|
|
with:
|
|
|
|
target: ${{ matrix.target }}
|
2022-12-07 13:44:34 +00:00
|
|
|
build_kernel: true
|
2022-11-01 18:10:01 +00:00
|
|
|
build_all_kmods: true
|
2022-03-09 17:22:22 +00:00
|
|
|
|
2022-11-01 18:10:01 +00:00
|
|
|
check-kernel-patches:
|
|
|
|
name: Check Kernel patches
|
|
|
|
needs: determine_targets
|
2022-09-05 21:18:00 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
2022-10-15 08:56:46 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: False
|
|
|
|
matrix:
|
2023-01-10 22:20:07 +00:00
|
|
|
target: ${{fromJson(needs.determine_targets.outputs.targets)}}
|
2022-11-01 18:10:01 +00:00
|
|
|
uses: ./.github/workflows/check-kernel-patches.yml
|
|
|
|
with:
|
|
|
|
target: ${{ matrix.target }}
|
2022-10-15 08:56:46 +00:00
|
|
|
|