1 name: Refresh kernel for target
14 use_openwrt_container:
24 runs-on: ubuntu-latest
26 owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
27 container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
30 - name: Set lower case owner name
33 OWNER_LC=$(echo "${{ github.repository_owner }}" \
34 | tr '[:upper:]' '[:lower:]')
36 if [ ${{ inputs.use_openwrt_container }} == "true" ]; then
40 echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
42 # Per branch tools container tag
43 # By default stick to latest
44 # For official test targetting openwrt stable branch
45 # Get the branch or parse the tag and push dedicated tools containers
46 # For local test to use the correct container for stable release testing
47 # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]-
48 - name: Determine tools container tag
49 id: determine_tools_container
52 if [ -n "${{ github.base_ref }}" ]; then
53 if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
54 CONTAINER_TAG="${{ github.base_ref }}"
56 elif [ ${{ github.ref_type }} == "branch" ]; then
57 if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
58 CONTAINER_TAG=${{ github.ref_name }}
59 elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
60 CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
62 elif [ ${{ github.ref_type }} == "tag" ]; then
63 if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
64 CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
67 echo "Tools container to use tools:$CONTAINER_TAG"
68 echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
71 name: Check Kernel patches
73 runs-on: ubuntu-latest
75 container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:${{ needs.setup_build.outputs.container_tag }}
82 - name: Checkout master directory
83 uses: actions/checkout@v3
87 - name: Fix permission
89 chown -R buildbot:buildbot openwrt
91 - name: Prepare prebuilt tools
92 shell: su buildbot -c "sh -e {0}"
93 working-directory: openwrt
95 mkdir -p staging_dir build_dir
96 ln -sf /prebuilt_tools/staging_dir/host staging_dir/host
97 ln -sf /prebuilt_tools/build_dir/host build_dir/host
99 ./scripts/ext-tools.sh --refresh
101 - name: Configure testing kernel
102 if: inputs.testing == true
103 shell: su buildbot -c "sh -e {0}"
104 working-directory: openwrt
106 echo CONFIG_TESTING_KERNEL=y >> .config
108 - name: Configure system
109 shell: su buildbot -c "sh -e {0}"
110 working-directory: openwrt
112 echo CONFIG_ALL_KMODS=y >> .config
113 echo CONFIG_DEVEL=y >> .config
114 echo CONFIG_AUTOREMOVE=y >> .config
115 echo CONFIG_CCACHE=y >> .config
117 echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
118 echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
123 shell: su buildbot -c "sh -e {0}"
124 working-directory: openwrt
125 run: make tools/quilt/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
127 - name: Refresh Kernel patches
128 shell: su buildbot -c "sh -e {0}"
129 working-directory: openwrt
130 run: make target/linux/refresh V=s
132 - name: Validate Refreshed Kernel Patches
133 shell: su buildbot -c "sh -e {0}"
134 working-directory: openwrt
136 . .github/workflows/scripts/ci_helpers.sh
138 if git diff --name-only --exit-code; then
139 success "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} seems ok"
141 err "Kernel patches for ${{ inputs.target }}/${{ inputs.subtarget }} require refresh. (run 'make target/linux/refresh' and force push this pr)"
142 err "You can also check the provided artifacts with the refreshed patch from this CI run."
143 mkdir ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
144 for f in $(git diff --name-only); do
145 cp --parents $f ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed/
150 - name: Upload Refreshed Patches
152 uses: actions/upload-artifact@v3
154 name: ${{ inputs.target }}-${{ inputs.subtarget }}-refreshed
155 path: openwrt/${{ inputs.target }}-${{ inputs.subtarget }}-refreshed