Skip to content

fetch cache

fetch cache #294

Workflow file for this run

name: fetch cache
permissions: {}
on:
workflow_dispatch:
schedule:
- cron: "00 00 */3 * *"
jobs:
fetch_cache:
name: fetch cache
runs-on: ubuntu-22.04
env:
SOURCE_REPO: 'HiGarfield/lede-17.01.4-Mod'
steps:
- name: Checkout
uses: actions/checkout@main
with:
ref: master
fetch-depth: 0
- name: Clone source code
working-directory: ${{ github.workspace }}
run: |
if [ -f "$GITHUB_WORKSPACE/version" ]; then
WORKING_DIR="$GITHUB_WORKSPACE"
else
git clone "https://github.com/$SOURCE_REPO" -b master source
WORKING_DIR="$GITHUB_WORKSPACE/source"
fi
echo "WORKING_DIR=${WORKING_DIR}" >>$GITHUB_ENV
- name: Initialize environment
working-directory: ${{ env.WORKING_DIR }}
run: |
sudo swapoff -a
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install aria2
sudo cp -f ".github/backup/apt-fast" /usr/local/sbin/apt-fast
sudo -E apt-fast -y -qq install build-essential binutils bzip2 gettext flex python2.7 perl findutils diffutils unzip gawk util-linux subversion zlib1g-dev zip git coreutils
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
- name: Generate cache mixkey
id: gen_cache_mixkey
working-directory: ${{ env.WORKING_DIR }}
run: |
target_device_arch_1="ar71xx"
target_device_arch_2="ramips"
gcc_hash=$(gcc --version | sha256sum | awk '{print substr($1,1,8)}')
ldd_hash=$(ldd --version | sha256sum | awk '{print substr($1,1,8)}')
mixkey1="${target_device_arch_1}-${gcc_hash}-${ldd_hash}"
mixkey2="${target_device_arch_2}-${gcc_hash}-${ldd_hash}"
echo "mixkey1=$mixkey1" >> $GITHUB_OUTPUT
echo "mixkey2=$mixkey2" >> $GITHUB_OUTPUT
- name: Cache1
uses: HiGarfield/cachewrtbuild@main
with:
ccache: 'true'
mixkey: ${{ steps.gen_cache_mixkey.outputs.mixkey1 }}
prefix: ${{ env.WORKING_DIR }}
skip_saving: 'true'
- name: Cache2
uses: HiGarfield/cachewrtbuild@main
with:
ccache: 'true'
mixkey: ${{ steps.gen_cache_mixkey.outputs.mixkey2 }}
prefix: ${{ env.WORKING_DIR }}
skip_saving: 'true'
- name: Restore cached dl
id: restore_cached_dl
uses: actions/cache/restore@main
with:
path: ${{ env.WORKING_DIR }}/dl
key: ${{ github.repository_id }}-dl-${{ github.run_id }}
restore-keys: ${{ github.repository_id }}-dl-