-
Notifications
You must be signed in to change notification settings - Fork 34
88 lines (78 loc) · 3.05 KB
/
fetch-cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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-