CI: kernel: Cache external toolchain

Cache external toolchain for each target to remove load from openwrt cdn
server and make the external toolchain setup quicker.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
(cherry picked from commit f522c27385)
This commit is contained in:
Christian Marangi 2022-09-09 21:09:30 +02:00 committed by Josef Schlehofer
parent 5978ab409c
commit 8dc0a963a8
No known key found for this signature in database
GPG Key ID: B950216FE4329F4C

View File

@ -102,12 +102,23 @@ jobs:
- name: Parse toolchain file - name: Parse toolchain file
working-directory: openwrt working-directory: openwrt
run: | run: |
TOOLCHAIN_FILE=$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \ TOOLCHAIN_STRING="$(curl "https://downloads.cdn.openwrt.org/snapshots/targets/${{ env.TARGET }}/${{ env.SUBTARGET }}/sha256sums" \
| sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p') | grep ".*openwrt-toolchain.*tar.xz")"
TOOLCHAIN_FILE=$(echo "$TOOLCHAIN_STRING" | sed -n -e 's/.*\(openwrt-toolchain.*\).tar.xz/\1/p')
TOOLCHAIN_SHA256=$(echo "$TOOLCHAIN_STRING" | cut -d ' ' -f 1)
echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV" echo "TOOLCHAIN_FILE=$TOOLCHAIN_FILE" >> "$GITHUB_ENV"
echo "TOOLCHAIN_SHA256=$TOOLCHAIN_SHA256" >> "$GITHUB_ENV"
- name: Cache external toolchain
id: cache-external-toolchain
uses: actions/cache@v3
with:
path: openwrt/${{ env.TOOLCHAIN_FILE }}
key: ${{ env.TOOLCHAIN_FILE }}-${{ env.TOOLCHAIN_SHA256 }}
- name: Download external toolchain - name: Download external toolchain
if: ${{ steps.cache-external-toolchain.outputs.cache-hit != 'true' }}
shell: su buildbot -c "sh -e {0}" shell: su buildbot -c "sh -e {0}"
working-directory: openwrt working-directory: openwrt
run: | run: |