1 name: Refresh kernel for target
11 use_openwrt_container:
21 runs-on: ubuntu-latest
23 owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
24 container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
27 - name: Set lower case owner name
30 OWNER_LC=$(echo "${{ github.repository_owner }}" \
31 | tr '[:upper:]' '[:lower:]')
33 if [ ${{ inputs.use_openwrt_container }} == "true" ]; then
37 echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
39 # Per branch tools container tag
40 # By default stick to latest
41 # For official test targetting openwrt stable branch
42 # Get the branch or parse the tag and push dedicated tools containers
43 # For local test to use the correct container for stable release testing
44 # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]-
45 - name: Determine tools container tag
46 id: determine_tools_container
49 if [ -n "${{ github.base_ref }}" ]; then
50 if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
51 CONTAINER_TAG="${{ github.base_ref }}"
53 elif [ ${{ github.ref_type }} == "branch" ]; then
54 if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
55 CONTAINER_TAG=${{ github.ref_name }}
56 elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
57 CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
59 elif [ ${{ github.ref_type }} == "tag" ]; then
60 if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
61 CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
64 echo "Tools container to use tools:$CONTAINER_TAG"
65 echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
68 name: Check Kernel patches
70 runs-on: ubuntu-latest
72 container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }}
79 - name: Checkout master directory
80 uses: actions/checkout@v3
84 - name: Fix permission
86 chown -R buildbot:buildbot openwrt
88 - name: Initialization environment
90 TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1)
91 SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2)
92 echo "TARGET=$TARGET" >> "$GITHUB_ENV"
93 echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV"
95 - name: Prepare prebuilt tools
96 shell: su buildbot -c "sh -e {0}"
97 working-directory: openwrt
99 mkdir -p staging_dir build_dir
100 ln -sf /prebuilt_tools/staging_dir/host staging_dir/host
101 ln -sf /prebuilt_tools/build_dir/host build_dir/host
103 ./scripts/ext-tools.sh --refresh
105 - name: Configure testing kernel
106 if: inputs.testing == true
107 shell: su buildbot -c "sh -e {0}"
108 working-directory: openwrt
110 echo CONFIG_TESTING_KERNEL=y >> .config
112 - name: Configure system
113 shell: su buildbot -c "sh -e {0}"
114 working-directory: openwrt
116 echo CONFIG_ALL_KMODS=y >> .config
117 echo CONFIG_DEVEL=y >> .config
118 echo CONFIG_AUTOREMOVE=y >> .config
119 echo CONFIG_CCACHE=y >> .config
121 echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config
122 echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config
127 shell: su buildbot -c "sh -e {0}"
128 working-directory: openwrt
129 run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
131 - name: Refresh Kernel patches
132 shell: su buildbot -c "sh -e {0}"
133 working-directory: openwrt
134 run: make target/linux/refresh V=s
136 - name: Validate Refreshed Kernel Patches
137 shell: su buildbot -c "sh -e {0}"
138 working-directory: openwrt
140 . .github/workflows/scripts/ci_helpers.sh
142 if git diff --name-only --exit-code; then
143 success "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} seems ok"
145 err "Kernel patches for ${{ env.TARGET }}/${{ env.SUBTARGET }} require refresh. (run 'make target/linux/refresh' and force push this pr)"
146 err "You can also check the provided artifacts with the refreshed patch from this CI run."
147 mkdir ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed
148 for f in $(git diff --name-only); do
149 cp --parents $f ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed/
154 - name: Upload Refreshed Patches
156 uses: actions/upload-artifact@v3
158 name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed
159 path: openwrt/${{ env.TARGET }}-${{ env.SUBTARGET }}-refreshed