26 runs-on: ubuntu-latest
28 owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
29 ccache_hash: ${{ steps.ccache_hash.outputs.ccache_hash }}
33 uses: actions/checkout@v3
35 - name: Set lower case owner name
38 OWNER_LC=$(echo "${{ github.repository_owner }}" \
39 | tr '[:upper:]' '[:lower:]')
40 echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
42 - name: Generate ccache hash
45 CCACHE_HASH=$(md5sum include/kernel-* | awk '{ print $1 }' \
46 | md5sum | awk '{ print $1 }')
47 echo "ccache_hash=$CCACHE_HASH" >> $GITHUB_OUTPUT
50 name: Build with external toolchain
52 runs-on: ubuntu-latest
54 container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/tools:latest
61 - name: Checkout master directory
62 uses: actions/checkout@v3
66 - name: Checkout packages feed
67 if: inputs.include_feeds == true
68 uses: actions/checkout@v3
70 repository: openwrt/packages
71 path: openwrt/feeds/packages
73 - name: Checkout luci feed
74 if: inputs.include_feeds == true
75 uses: actions/checkout@v3
77 repository: openwrt/luci
78 path: openwrt/feeds/luci
80 - name: Checkout routing feed
81 if: inputs.include_feeds == true
82 uses: actions/checkout@v3
84 repository: openwrt/routing
85 path: openwrt/feeds/routing
87 - name: Checkout telephony feed
88 if: inputs.include_feeds == true
89 uses: actions/checkout@v3
91 repository: openwrt/telephony
92 path: openwrt/feeds/telephony
94 - name: Fix permission
96 chown -R buildbot:buildbot openwrt
98 - name: Initialization environment
100 TARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 1)
101 SUBTARGET=$(echo ${{ inputs.target }} | cut -d "/" -f 2)
102 echo "TARGET=$TARGET" >> "$GITHUB_ENV"
103 echo "SUBTARGET=$SUBTARGET" >> "$GITHUB_ENV"
105 - name: Update & Install feeds
106 if: inputs.include_feeds == true
107 shell: su buildbot -c "sh -e {0}"
108 working-directory: openwrt
110 ./scripts/feeds update -a
111 ./scripts/feeds install -a
113 - name: Parse toolchain file
114 if: inputs.build_toolchain == false
115 working-directory: openwrt
117 TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \
118 | grep ".*openwrt-toolchain.*tar.xz")"
119 TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p')
120 TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1)
122 echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV"
123 echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV"
125 - name: Cache external toolchain
126 if: inputs.build_toolchain == false
127 id: cache-external-toolchain
128 uses: actions/cache@v3
130 path: openwrt/${{ env.TOOLCHAIN_FILE }}
131 key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }}
134 uses: actions/cache@v3
136 path: openwrt/.ccache
137 key: ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-${{ needs.setup_build.outputs.ccache_hash }}
139 ccache-kernel-${{ env.TARGET }}/${{ env.SUBTARGET }}-
141 - name: Download external toolchain
142 if: inputs.build_toolchain == false && steps.cache-external-toolchain.outputs.cache-hit != 'true'
143 shell: su buildbot -c "sh -e {0}"
144 working-directory: openwrt
146 wget -O - https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/${TOOLCHAIN_FILE}.tar.xz \
149 - name: Extract prebuilt tools
150 shell: su buildbot -c "sh -e {0}"
151 working-directory: openwrt
152 run: ./scripts/ext-tools.sh --tools /tools.tar
154 - name: Configure all kernel modules
155 if: inputs.build_all_kmods == true
156 shell: su buildbot -c "sh -e {0}"
157 working-directory: openwrt
159 echo CONFIG_ALL_KMODS=y >> .config
161 - name: Configure all modules
162 if: inputs.build_all_modules == true
163 shell: su buildbot -c "sh -e {0}"
164 working-directory: openwrt
166 echo CONFIG_ALL=y >> .config
168 - name: Configure external toolchain
169 if: inputs.build_toolchain == false
170 shell: su buildbot -c "sh -e {0}"
171 working-directory: openwrt
173 echo CONFIG_DEVEL=y >> .config
174 echo CONFIG_AUTOREMOVE=y >> .config
175 echo CONFIG_CCACHE=y >> .config
177 ./scripts/ext-toolchain.sh \
178 --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \
180 --config ${{ env.TARGET }}/${{ env.SUBTARGET }}
182 - name: Configure internal toolchain
183 if: inputs.build_toolchain == true
184 shell: su buildbot -c "sh -e {0}"
185 working-directory: openwrt
187 echo CONFIG_DEVEL=y >> .config
188 echo CONFIG_AUTOREMOVE=y >> .config
189 echo CONFIG_CCACHE=y >> .config
191 echo "CONFIG_TARGET_${{ env.TARGET }}=y" >> .config
192 echo "CONFIG_TARGET_${{ env.TARGET }}_${{ env.SUBTARGET }}=y" >> .config
196 - name: Show configuration
197 shell: su buildbot -c "sh -e {0}"
198 working-directory: openwrt
199 run: ./scripts/diffconfig.sh
202 shell: su buildbot -c "sh -e {0}"
203 working-directory: openwrt
204 run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
206 - name: Build toolchain
207 shell: su buildbot -c "sh -e {0}"
208 working-directory: openwrt
209 run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
212 shell: su buildbot -c "sh -e {0}"
213 working-directory: openwrt
214 run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
216 - name: Build Kernel Kmods
217 shell: su buildbot -c "sh -e {0}"
218 working-directory: openwrt
219 run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
221 - name: Build everything
222 if: inputs.build_full == true
223 shell: su buildbot -c "sh -e {0}"
224 working-directory: openwrt
225 run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
229 uses: actions/upload-artifact@v3
231 name: ${{ env.TARGET }}-${{ env.SUBTARGET }}-logs