Skip to content

fetch cache

fetch cache #149

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@v3
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 gcc-9 g++-9 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
sudo -E update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo -E update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
- 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'