fetch cache #298
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: fetch cache | |
permissions: {} | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "00 00 */3 * *" | |
jobs: | |
fetch_cache: | |
name: fetch cache | |
runs-on: ubuntu-24.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 /usr/share/dotnet /usr/local/lib/android /opt/ghc | |
sudo -E apt -qq update | |
sudo -E apt -y -qq install aria2 build-essential binutils bzip2 gettext \ | |
flex perl findutils diffutils unzip gawk util-linux \ | |
subversion zlib1g-dev zip git coreutils \ | |
gcc-11 g++-11 libc6-dev | |
sudo -E apt -qq autoremove --purge | |
sudo -E apt -qq clean | |
sudo -E update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 60 | |
sudo -E update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 60 | |
sudo -E update-alternatives --set gcc /usr/bin/gcc-11 | |
sudo -E update-alternatives --set g++ /usr/bin/g++-11 | |
sudo -E .github/backup/install_python2.sh | |
- 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- |