build.yml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. name: Build sub target
  2. on:
  3. workflow_call:
  4. secrets:
  5. coverity_api_token:
  6. inputs:
  7. container_name:
  8. type: string
  9. default: tools
  10. target:
  11. required: true
  12. type: string
  13. subtarget:
  14. required: true
  15. type: string
  16. testing:
  17. type: boolean
  18. build_toolchain:
  19. type: boolean
  20. include_feeds:
  21. type: boolean
  22. build_full:
  23. type: boolean
  24. build_kernel:
  25. type: boolean
  26. build_all_modules:
  27. type: boolean
  28. build_all_kmods:
  29. type: boolean
  30. build_all_boards:
  31. type: boolean
  32. use_openwrt_container:
  33. type: boolean
  34. default: true
  35. coverity_project_name:
  36. type: string
  37. default: OpenWrt
  38. coverity_check_packages:
  39. type: string
  40. coverity_compiler_template_list:
  41. type: string
  42. default: >-
  43. arm-openwrt-linux-gcc
  44. coverity_force_compile_packages:
  45. type: string
  46. default: >-
  47. curl
  48. libnl
  49. mbedtls
  50. wolfssl
  51. openssl
  52. build_external_toolchain:
  53. type: boolean
  54. upload_external_toolchain:
  55. type: boolean
  56. permissions:
  57. contents: read
  58. jobs:
  59. setup_build:
  60. name: Setup build ${{ inputs.target }}/${{ inputs.subtarget }}
  61. runs-on: ubuntu-latest
  62. outputs:
  63. owner_lc: ${{ steps.lower_owner.outputs.owner_lc }}
  64. container_tag: ${{ steps.determine_tools_container.outputs.container_tag }}
  65. container_name: ${{ steps.determine_tools_container.outputs.container_name }}
  66. steps:
  67. - name: Checkout
  68. uses: actions/checkout@v3
  69. - name: Set lower case owner name
  70. id: lower_owner
  71. run: |
  72. OWNER_LC=$(echo "${{ github.repository_owner }}" \
  73. | tr '[:upper:]' '[:lower:]')
  74. if [ ${{ inputs.use_openwrt_container }} == "true" ]; then
  75. OWNER_LC=openwrt
  76. fi
  77. echo "owner_lc=$OWNER_LC" >> $GITHUB_OUTPUT
  78. # Per branch tools container tag
  79. # By default stick to latest
  80. # For official test targetting openwrt stable branch
  81. # Get the branch or parse the tag and push dedicated tools containers
  82. # For local test to use the correct container for stable release testing
  83. # you need to use for the branch name a prefix of openwrt-[0-9][0-9].[0-9][0-9]-
  84. - name: Determine tools container tag
  85. id: determine_tools_container
  86. run: |
  87. CONTAINER_NAME=${{ inputs.container_name }}
  88. CONTAINER_TAG=latest
  89. if [ -n "${{ github.base_ref }}" ]; then
  90. if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
  91. CONTAINER_TAG="${{ github.base_ref }}"
  92. fi
  93. elif [ ${{ github.ref_type }} == "branch" ]; then
  94. if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
  95. CONTAINER_TAG=${{ github.ref_name }}
  96. elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
  97. CONTAINER_TAG="$(echo ${{ github.ref_name }} | sed 's/^\(openwrt-[0-9][0-9]\.[0-9][0-9]\)-.*/\1/')"
  98. fi
  99. elif [ ${{ github.ref_type }} == "tag" ]; then
  100. if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
  101. CONTAINER_TAG=openwrt-"$(echo ${{ github.ref_name }} | sed 's/^v\([0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
  102. fi
  103. fi
  104. if [ "$CONTAINER_NAME" = "toolchain" ]; then
  105. GHCR_TOKEN=$(echo ${{ secrets.GITHUB_TOKEN }} | base64)
  106. GHCR_HEADER="Authorization: Bearer ${GHCR_TOKEN}"
  107. GHCR_MANIFEST_LINK=https://ghcr.io/v2/${{ steps.lower_owner.outputs.owner_lc }}/${{ inputs.container_name }}/manifests/${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG"
  108. # Check if container exist
  109. if [ $(curl -s -o /dev/null -w "%{http_code}" -H "$GHCR_HEADER" -I "$GHCR_MANIFEST_LINK") = 200 ]; then
  110. CONTAINER_TAG=${{ inputs.target }}-${{ inputs.subtarget }}-"$CONTAINER_TAG"
  111. else
  112. CONTAINER_NAME=tools
  113. fi
  114. fi
  115. echo "Tools container to use $CONTAINER_NAME:$CONTAINER_TAG"
  116. echo "container_tag=$CONTAINER_TAG" >> $GITHUB_OUTPUT
  117. echo "container_name=$CONTAINER_NAME" >> $GITHUB_OUTPUT
  118. build:
  119. name: Build ${{ inputs.target }}/${{ inputs.subtarget }}
  120. needs: setup_build
  121. runs-on: ubuntu-latest
  122. container: ghcr.io/${{ needs.setup_build.outputs.owner_lc }}/${{ needs.setup_build.outputs.container_name }}:${{ needs.setup_build.outputs.container_tag }}
  123. permissions:
  124. contents: read
  125. packages: read
  126. actions: write
  127. steps:
  128. - name: Checkout master directory
  129. uses: actions/checkout@v3
  130. with:
  131. path: openwrt
  132. - name: Checkout packages feed
  133. if: inputs.include_feeds == true
  134. uses: actions/checkout@v3
  135. with:
  136. repository: openwrt/packages
  137. path: openwrt/feeds/packages
  138. - name: Checkout luci feed
  139. if: inputs.include_feeds == true
  140. uses: actions/checkout@v3
  141. with:
  142. repository: openwrt/luci
  143. path: openwrt/feeds/luci
  144. - name: Checkout routing feed
  145. if: inputs.include_feeds == true
  146. uses: actions/checkout@v3
  147. with:
  148. repository: openwrt/routing
  149. path: openwrt/feeds/routing
  150. - name: Checkout telephony feed
  151. if: inputs.include_feeds == true
  152. uses: actions/checkout@v3
  153. with:
  154. repository: openwrt/telephony
  155. path: openwrt/feeds/telephony
  156. - name: Parse toolchain file
  157. if: inputs.build_toolchain == false
  158. id: parse-toolchain
  159. working-directory: openwrt
  160. run: |
  161. if [ -d /external-toolchain/ ]; then
  162. echo "toolchain-type=external_container" >> $GITHUB_OUTPUT
  163. exit 0
  164. fi
  165. TOOLCHAIN_PATH=snapshots
  166. if [ -n "${{ github.base_ref }}" ]; then
  167. if echo "${{ github.base_ref }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
  168. major_ver="$(echo ${{ github.base_ref }} | sed 's/^openwrt-/v/')"
  169. fi
  170. elif [ "${{ github.ref_type }}" = "branch" ]; then
  171. if echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]$'; then
  172. major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-/v/')"
  173. elif echo "${{ github.ref_name }}" | grep -q -E '^openwrt-[0-9][0-9]\.[0-9][0-9]-'; then
  174. major_ver="$(echo ${{ github.ref_name }} | sed 's/^openwrt-\([0-9][0-9]\.[0-9][0-9]\)-.*/v\1/')"
  175. fi
  176. elif [ "${{ github.ref_type }}" = "tag" ]; then
  177. if echo "${{ github.ref_name }}" | grep -q -E '^v[0-9][0-9]\.[0-9][0-9]\..+'; then
  178. major_ver="$(echo ${{ github.ref_name }} | sed 's/^\(v[0-9][0-9]\.[0-9][0-9]\)\..\+/\1/')"
  179. fi
  180. fi
  181. if [ -n "$major_ver" ]; then
  182. git fetch --tags -f
  183. latest_tag="$(git tag --sort=-creatordate -l $major_ver* | head -n1)"
  184. if [ -n "$latest_tag" ]; then
  185. TOOLCHAIN_PATH=releases/$(echo $latest_tag | sed 's/^v//')
  186. fi
  187. fi
  188. SUMS_FILE="https://downloads.cdn.openwrt.org/$TOOLCHAIN_PATH/targets/${{ inputs.target }}/${{ inputs.subtarget }}/sha256sums"
  189. if curl $SUMS_FILE | grep -q ".*openwrt-toolchain.*tar.xz"; then
  190. TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-toolchain.*tar.xz")"
  191. TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p')
  192. echo "toolchain-type=external_toolchain" >> $GITHUB_OUTPUT
  193. elif curl $SUMS_FILE | grep -q ".*openwrt-sdk.*tar.xz"; then
  194. TOOLCHAIN_STRING="$( curl $SUMS_FILE | grep ".*openwrt-sdk.*tar.xz")"
  195. TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-sdk.*\).tar.xz/\1/p')
  196. echo "toolchain-type=external_sdk" >> $GITHUB_OUTPUT
  197. else
  198. echo "toolchain-type=internal" >> $GITHUB_OUTPUT
  199. fi
  200. echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV"
  201. echo "TOOLCHAIN_PATH=$TOOLCHAIN_PATH" >> "$GITHUB_ENV"
  202. - name: Fix permission
  203. run: |
  204. chown -R buildbot:buildbot openwrt
  205. - name: Prepare prebuilt tools
  206. shell: su buildbot -c "sh -e {0}"
  207. working-directory: openwrt
  208. run: |
  209. mkdir -p staging_dir build_dir
  210. ln -s /prebuilt_tools/staging_dir/host staging_dir/host
  211. ln -s /prebuilt_tools/build_dir/host build_dir/host
  212. ./scripts/ext-tools.sh --refresh
  213. - name: Update & Install feeds
  214. if: inputs.include_feeds == true
  215. shell: su buildbot -c "sh -e {0}"
  216. working-directory: openwrt
  217. run: |
  218. ./scripts/feeds update -a
  219. ./scripts/feeds install -a
  220. - name: Restore ccache cache
  221. id: restore-ccache-cache
  222. uses: actions/cache/restore@v3
  223. with:
  224. path: openwrt/.ccache
  225. key: ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-${{ hashFiles('openwrt/include/kernel-**') }}
  226. restore-keys: |
  227. ccache-kernel-${{ inputs.target }}/${{ inputs.subtarget }}-
  228. - name: Download external toolchain/sdk
  229. if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type != 'internal' && steps.parse-toolchain.outputs.toolchain-type != 'external_container'
  230. shell: su buildbot -c "sh -e {0}"
  231. working-directory: openwrt
  232. run: |
  233. wget -O - https://downloads.cdn.openwrt.org/${{ env.TOOLCHAIN_PATH }}/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ env.TOOLCHAIN_FILE }}.tar.xz \
  234. | tar --xz -xf -
  235. - name: Configure testing kernel
  236. if: inputs.testing == true
  237. shell: su buildbot -c "sh -e {0}"
  238. working-directory: openwrt
  239. run: |
  240. echo CONFIG_TESTING_KERNEL=y >> .config
  241. - name: Configure all kernel modules
  242. if: inputs.build_all_kmods == true
  243. shell: su buildbot -c "sh -e {0}"
  244. working-directory: openwrt
  245. run: |
  246. echo CONFIG_ALL_KMODS=y >> .config
  247. - name: Configure all modules
  248. if: inputs.build_all_modules == true
  249. shell: su buildbot -c "sh -e {0}"
  250. working-directory: openwrt
  251. run: |
  252. echo CONFIG_ALL=y >> .config
  253. - name: Configure all boards
  254. if: inputs.build_all_boards == true
  255. shell: su buildbot -c "sh -e {0}"
  256. working-directory: openwrt
  257. run: |
  258. echo CONFIG_TARGET_MULTI_PROFILE=y >> .config
  259. echo CONFIG_TARGET_PER_DEVICE_ROOTFS=y >> .config
  260. echo CONFIG_TARGET_ALL_PROFILES=y >> .config
  261. - name: Configure external toolchain in container
  262. if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_container'
  263. shell: su buildbot -c "sh -e {0}"
  264. working-directory: openwrt
  265. run: |
  266. echo CONFIG_DEVEL=y >> .config
  267. echo CONFIG_AUTOREMOVE=y >> .config
  268. echo CONFIG_CCACHE=y >> .config
  269. ./scripts/ext-toolchain.sh \
  270. --toolchain /external-toolchain/$(ls /external-toolchain/ | grep openwrt-toolchain)/toolchain-* \
  271. --overwrite-config \
  272. --config ${{ inputs.target }}/${{ inputs.subtarget }}
  273. - name: Configure external toolchain
  274. if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_toolchain'
  275. shell: su buildbot -c "sh -e {0}"
  276. working-directory: openwrt
  277. run: |
  278. echo CONFIG_DEVEL=y >> .config
  279. echo CONFIG_AUTOREMOVE=y >> .config
  280. echo CONFIG_CCACHE=y >> .config
  281. ./scripts/ext-toolchain.sh \
  282. --toolchain ${{ env.TOOLCHAIN_FILE }}/toolchain-* \
  283. --overwrite-config \
  284. --config ${{ inputs.target }}/${{ inputs.subtarget }}
  285. - name: Adapt external sdk to external toolchain format
  286. if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk'
  287. shell: su buildbot -c "sh -e {0}"
  288. working-directory: openwrt
  289. run: |
  290. TOOLCHAIN_DIR=${{ env.TOOLCHAIN_FILE }}/staging_dir/$(ls ${{ env.TOOLCHAIN_FILE }}/staging_dir | grep toolchain)
  291. TOOLCHAIN_BIN=$TOOLCHAIN_DIR/bin
  292. OPENWRT_DIR=$(pwd)
  293. # Find target name from toolchain info.mk
  294. GNU_TARGET_NAME=$(cat $TOOLCHAIN_DIR/info.mk | grep TARGET_CROSS | sed 's/^TARGET_CROSS=\(.*\)-$/\1/')
  295. cd $TOOLCHAIN_BIN
  296. # Revert sdk wrapper scripts applied to all the bins
  297. for app in $(find . -name "*.bin"); do
  298. TARGET_APP=$(echo $app | sed 's/\.\/\.\(.*\)\.bin/\1/')
  299. rm $TARGET_APP
  300. mv .$TARGET_APP.bin $TARGET_APP
  301. done
  302. # Setup the wrapper script in the sdk toolchain dir simulating an external toolchain build
  303. cp $OPENWRT_DIR/target/toolchain/files/wrapper.sh $GNU_TARGET_NAME-wrapper.sh
  304. for app in cc gcc g++ c++ cpp ld as ; do
  305. [ -f $GNU_TARGET_NAME-$app ] && mv $GNU_TARGET_NAME-$app $GNU_TARGET_NAME-$app.bin
  306. ln -sf $GNU_TARGET_NAME-wrapper.sh $GNU_TARGET_NAME-$app
  307. done
  308. - name: Configure external toolchain with sdk
  309. if: inputs.build_toolchain == false && steps.parse-toolchain.outputs.toolchain-type == 'external_sdk'
  310. shell: su buildbot -c "sh -e {0}"
  311. working-directory: openwrt
  312. run: |
  313. echo CONFIG_DEVEL=y >> .config
  314. echo CONFIG_AUTOREMOVE=y >> .config
  315. echo CONFIG_CCACHE=y >> .config
  316. ./scripts/ext-toolchain.sh \
  317. --toolchain ${{ env.TOOLCHAIN_FILE }}/staging_dir/toolchain-* \
  318. --overwrite-config \
  319. --config ${{ inputs.target }}/${{ inputs.subtarget }}
  320. - name: Configure internal toolchain
  321. if: inputs.build_toolchain == true || steps.parse-toolchain.outputs.toolchain-type == 'internal'
  322. shell: su buildbot -c "sh -e {0}"
  323. working-directory: openwrt
  324. run: |
  325. echo CONFIG_DEVEL=y >> .config
  326. echo CONFIG_AUTOREMOVE=y >> .config
  327. echo CONFIG_CCACHE=y >> .config
  328. echo "CONFIG_TARGET_${{ inputs.target }}=y" >> .config
  329. echo "CONFIG_TARGET_${{ inputs.target }}_${{ inputs.subtarget }}=y" >> .config
  330. make defconfig
  331. - name: Show configuration
  332. shell: su buildbot -c "sh -e {0}"
  333. working-directory: openwrt
  334. run: ./scripts/diffconfig.sh
  335. - name: Build tools
  336. shell: su buildbot -c "sh -e {0}"
  337. working-directory: openwrt
  338. run: make tools/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
  339. - name: Build toolchain
  340. shell: su buildbot -c "sh -e {0}"
  341. working-directory: openwrt
  342. run: make toolchain/install -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
  343. - name: Build Kernel
  344. if: inputs.build_kernel == true
  345. shell: su buildbot -c "sh -e {0}"
  346. working-directory: openwrt
  347. run: make target/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
  348. - name: Build Kernel Kmods
  349. if: inputs.build_kernel == true
  350. shell: su buildbot -c "sh -e {0}"
  351. working-directory: openwrt
  352. run: make package/linux/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
  353. - name: Build everything
  354. if: inputs.build_full == true
  355. shell: su buildbot -c "sh -e {0}"
  356. working-directory: openwrt
  357. run: make -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
  358. - name: Build external toolchain
  359. if: inputs.build_external_toolchain == true
  360. shell: su buildbot -c "sh -e {0}"
  361. working-directory: openwrt
  362. run: make target/toolchain/compile -j$(nproc) BUILD_LOG=1 || ret=$? .github/workflows/scripts/show_build_failures.sh
  363. - name: Coverity prepare toolchain
  364. if: inputs.coverity_check_packages != ''
  365. shell: su buildbot -c "sh -e {0}"
  366. working-directory: openwrt
  367. run: |
  368. wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}" -O coverity.tar.gz
  369. wget -q https://scan.coverity.com/download/linux64 --post-data "token=${{ secrets.coverity_api_token }}&project=${{ inputs.coverity_project_name }}&md5=1" -O coverity.tar.gz.md5
  370. echo ' coverity.tar.gz' >> coverity.tar.gz.md5
  371. md5sum -c coverity.tar.gz.md5
  372. mkdir cov-analysis-linux64
  373. tar xzf coverity.tar.gz --strip 1 -C cov-analysis-linux64
  374. export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH
  375. for template in ${{ inputs.coverity_compiler_template_list }}; do
  376. cov-configure --template --comptype gcc --compiler "$template"
  377. done
  378. - name: Clean and recompile packages with Coverity toolchain
  379. if: inputs.coverity_check_packages != ''
  380. shell: su buildbot -c "bash {0}"
  381. working-directory: openwrt
  382. run: |
  383. set -o pipefail -o errexit
  384. coverity_check_packages=(${{ inputs.coverity_check_packages }})
  385. printf -v clean_packages "package/%s/clean " "${coverity_check_packages[@]}"
  386. make -j$(nproc) BUILD_LOG=1 $clean_packages || ret=$? .github/workflows/scripts/show_build_failures.sh
  387. coverity_force_compile_packages=(${{ inputs.coverity_force_compile_packages }})
  388. printf -v force_compile_packages "package/%s/compile " "${coverity_force_compile_packages[@]}"
  389. make -j$(nproc) BUILD_LOG=1 $force_compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh
  390. printf -v compile_packages "package/%s/compile " "${coverity_check_packages[@]}"
  391. export PATH=$(pwd)/cov-analysis-linux64/bin:$PATH
  392. cov-build --dir cov-int make -j $(nproc) BUILD_LOG=1 $compile_packages || ret=$? .github/workflows/scripts/show_build_failures.sh
  393. - name: Upload build to Coverity for analysis
  394. if: inputs.coverity_check_packages != ''
  395. shell: su buildbot -c "sh -e {0}"
  396. working-directory: openwrt
  397. run: |
  398. tar czf cov-int.tar.gz ./cov-int
  399. curl \
  400. --form token="${{ secrets.coverity_api_token }}" \
  401. --form email="[email protected]" \
  402. --form [email protected] \
  403. --form version="${{ github.ref_name }}-${{ github.sha }}" \
  404. --form description="OpenWrt ${{ github.ref_name }}-${{ github.sha }}" \
  405. "https://scan.coverity.com/builds?project=${{ inputs.coverity_project_name }}"
  406. - name: Upload logs
  407. if: failure()
  408. uses: actions/upload-artifact@v3
  409. with:
  410. name: ${{ inputs.target }}-${{ inputs.subtarget }}-logs
  411. path: "openwrt/logs"
  412. - name: Delete already present ccache cache
  413. if: steps.restore-ccache-cache.outputs.cache-hit == 'true'
  414. uses: octokit/[email protected]
  415. with:
  416. route: DELETE /repos/{repository}/actions/caches?key={key}
  417. env:
  418. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  419. INPUT_REPOSITORY: ${{ github.repository }}
  420. INPUT_KEY: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }}
  421. - name: Save ccache cache
  422. uses: actions/cache/save@v3
  423. with:
  424. path: openwrt/.ccache
  425. key: ${{ steps.restore-ccache-cache.outputs.cache-primary-key }}
  426. - name: Find external toolchain name
  427. id: get-toolchain-name
  428. if: inputs.upload_external_toolchain == true
  429. working-directory: openwrt
  430. run: |
  431. TOOLCHAIN_NAME=$(ls bin/targets/${{inputs.target }}/${{ inputs.subtarget }} | grep toolchain)
  432. echo "toolchain-name=$TOOLCHAIN_NAME" >> $GITHUB_OUTPUT
  433. - name: Upload prebuilt toolchain
  434. if: inputs.upload_external_toolchain == true
  435. uses: actions/upload-artifact@v3
  436. with:
  437. name: ${{ inputs.target }}-${{ inputs.subtarget }}-external-toolchain
  438. path: openwrt/bin/targets/${{ inputs.target }}/${{ inputs.subtarget }}/${{ steps.get-toolchain-name.outputs.toolchain-name }}
  439. retention-days: 1