2022-11-01 18:10:01 +00:00
|
|
|
name: Refresh kernel for target
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
target:
|
|
|
|
required: true
|
|
|
|
type: string
|
2023-05-22 14:47:08 +00:00
|
|
|
subtarget:
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-12-03 02:04:40 +00:00
|
|
|
testing:
|
|
|
|
type: boolean
|
2023-01-23 18:47:41 +00:00
|
|
|
use_openwrt_container:
|
|
|
|
type: boolean
|
|
|
|
default: true
|
2022-11-01 18:10:01 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup_build:
|
|
|
|
name: Setup build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
|
2022-11-27 18:53:08 +00:00
|
|
|
container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
|
2022-11-01 18:10:01 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set lower case owner name
|
|
|
|
id: lower_owner
|
|
|
|
run: |
|
|
|
|
OWNER_LC=$(echo "${{ github.repository_owner }}" \
|
|
|
|
| tr '[:upper:]' '[:lower:]')
|
2023-01-23 18:47:41 +00:00
|
|
|
|
|
|
|
if [ ${{ inputs.use_openwrt_container }} == "true" ]; then
|
|
|
|
OWNER_LC=openwrt
|
|
|
|
fi
|
|
|
|
|
2022-11-01 18:10:01 +00:00
|
|
|
echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
|
|
|
|
|
2022-11-27 18:53:08 +00:00
|
|
|
# Per branch tools container tag
|
|
|
|
# By default stick to latest
|
|
|
|
# For official test targetting openwrt stable branch
|
|
|
|
# Get the branch or parse the tag and push dedicated tools containers
|
|
|
|
# For local test to use the correct container for stable release testing
|
|
|
|
# you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]-
|
|
|
|
- name: Determine tools container tag
|
|
|
|
id: determine_tools_container
|
|
|
|
run: |
|
|
|
|
CONTAINER_TAG=latest
|
|
|
|
if [ -n "${{ github.base_ref }}" ]; then
|
2022-12-04 19:28:28 +00:00
|
|
|
if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
2022-11-27 18:53:08 +00:00
|
|
|
CONTAINER_TAG="${{ github.base_ref }}"
|
|
|
|
fi
|
|
|
|
elif [ ${{ github.ref_type }} == "branch" ]; then
|
2022-12-04 19:28:28 +00:00
|
|
|
if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
|
|
|
|
CONTAINER_TAG=${{ github.ref_name }}
|
|
|
|
elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
|
2022-11-27 18:53:08 +00:00
|
|
|
CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
|
|
|
|
fi
|
|
|
|
elif [ ${{ github.ref_type }} == "tag" ]; then
|
2022-12-04 19:28:28 +00:00
|
|
|
if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
|
|
|
|
CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
|
2022-11-27 18:53:08 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
echo "Tools container to use tools:$CONTAINER_TAG"
|
|
|
|
echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
|
|
|
|
|
2022-11-01 18:10:01 +00:00
|
|
|
check-patch:
|
|
|
|
name: Check Kernel patches
|
|
|
|
needs: setup_build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2022-11-27 18:53:08 +00:00
|
|
|
container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }}
|
2022-11-01 18:10:01 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: read
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout master directory
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
path: openwrt
|
|
|
|
|
|
|
|
- name: Fix permission
|
|
|
|
run: |
|
|
|
|
chown -R buildbot:buildbot openwrt
|
|
|
|
|
2022-11-10 18:53:15 +00:00
|
|
|
- name: Prepare prebuilt tools
|
2022-11-01 18:10:01 +00:00
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
2022-11-10 18:53:15 +00:00
|
|
|
run: |
|
|
|
|
mkdir -p staging_dir build_dir
|
|
|
|
ln -sf /prebuilt_tools/staging_dir/host staging_dir/host
|
|
|
|
ln -sf /prebuilt_tools/build_dir/host build_dir/host
|
|
|
|
|
|
|
|
./scripts/ext-tools.sh --refresh
|
2022-11-01 18:10:01 +00:00
|
|
|
|
2022-12-03 02:04:40 +00:00
|
|
|
- name: Configure testing kernel
|
|
|
|
if: inputs.testing == true
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: |
|
|
|
|
echo CONFIG_TESTING_KERNEL=y >> .config
|
|
|
|
|
2022-11-01 18:10:01 +00:00
|
|
|
- name: Configure system
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: |
|
|
|
|
echo CONFIG_ALL_KMODS=y >> .config
|
|
|
|
echo CONFIG_DEVEL=y >> .config
|
|
|
|
echo CONFIG_AUTOREMOVE=y >> .config
|
|
|
|
echo CONFIG_CCACHE=y >> .config
|
|
|
|
|
2023-05-22 14:47:08 +00:00
|
|
|
echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
|
|
|
|
echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
|
2022-11-01 18:10:01 +00:00
|
|
|
|
|
|
|
make defconfig
|
|
|
|
|
|
|
|
- name: Build tools
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
|
|
|
run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
|
|
|
|
|
|
|
|
- name: Refresh Kernel patches
|
|
|
|
shell: su buildbot -c "sh -e {0}"
|
|
|
|
working-directory: openwrt
|
2023-04-22 00:27:08 +00:00
|
|
|
run: make target/linux/refresh V=s
|
2022-11-01 18:10:01 +00:00
|
|
|
|
2023-04-22 00:27:08 +00:00
|
|
|
- name: Validate Refreshed Kernel Patches
|
2023-05-22 13:27:48 +00:00
|
|
|
shell: su buildbot -c "sh -e {0}"
|
2023-04-22 00:27:08 +00:00
|
|
|
working-directory: openwrt
|
|
|
|
run: |
|
2022-11-01 18:10:01 +00:00
|
|
|
. .github/workflows/scripts/ci_helpers.sh
|
|
|
|
|
|
|
|
if git diff --name-only --exit-code; then
|
2023-05-22 14:47:08 +00:00
|
|
|
success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok"
|
2022-11-01 18:10:01 +00:00
|
|
|
else
|
2023-05-22 14:47:08 +00:00
|
|
|
err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)"
|
2023-04-22 00:27:08 +00:00
|
|
|
err "You can also check the provided artifacts with the refreshed patch from this CI run."
|
2023-05-22 14:47:08 +00:00
|
|
|
mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
|
2023-04-22 00:27:08 +00:00
|
|
|
for f in $(git diff --name-only); do
|
2023-05-22 14:47:08 +00:00
|
|
|
cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/
|
2023-04-22 00:27:08 +00:00
|
|
|
done
|
2022-11-01 18:10:01 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2023-04-22 00:27:08 +00:00
|
|
|
|
|
|
|
- name: Upload Refreshed Patches
|
|
|
|
if: failure()
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2023-05-22 14:47:08 +00:00
|
|
|
name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
|
|
|
|
path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
|