Skip to content

Commit 1041533

Browse files
authored
优化APTC及其清除逻辑,加快第二次构建速度
1 parent ecbfe75 commit 1041533

2 files changed

Lines changed: 12 additions & 33 deletions

File tree

.github/workflows/Build SukiSU Ultra OnePlus.yml

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -269,36 +269,11 @@ jobs:
269269
git config --global user.name "Numbersf"
270270
git config --global user.email "263623064@qq.com"
271271
272-
- name: Configure APTC
273-
run: |
274-
APT_CACHE_DIR="$HOME/apt-cache"
275-
mkdir -p "$APT_CACHE_DIR"/{archives,lists/partial}
276-
echo "Dir::Cache \"$APT_CACHE_DIR\";" | sudo tee /etc/apt/apt.conf.d/90user-cache
277-
echo "Dir::Cache::archives \"$APT_CACHE_DIR/archives\";" | sudo tee -a /etc/apt/apt.conf.d/90user-cache
278-
echo "Dir::State::lists \"$APT_CACHE_DIR/lists\";" | sudo tee -a /etc/apt/apt.conf.d/90user-cache
279-
echo "Acquire::Check-Valid-Until \"false\";" | sudo tee -a /etc/apt/apt.conf.d/90user-cache
280-
echo "Acquire::Languages \"none\";" | sudo tee -a /etc/apt/apt.conf.d/90user-cache
281-
sudo chown -R $USER:$USER "$APT_CACHE_DIR"
282-
283-
- name: Set APT Cache
284-
uses: actions/cache@v3
285-
with:
286-
path: ${{ env.HOME }}/apt-cache
287-
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/Build SukiSU Ultra OnePlus.yml') }}
288-
restore-keys: |
289-
${{ runner.os }}-apt-
290-
291-
- name: Install Dependencies
292-
run: |
293-
sudo rm -f /var/lib/apt/lists/lock /var/lib/dpkg/lock
294-
APT_CACHE_DIR="$HOME/apt-cache"
295-
mkdir -p "$APT_CACHE_DIR/lists/partial"
296-
sudo apt -o Dir::Cache="$APT_CACHE_DIR" update -qq
297-
sudo DEBIAN_FRONTEND=noninteractive apt -o Dir::Cache="$APT_CACHE_DIR" install -yq --no-install-recommends \
298-
python3 git curl ccache libelf-dev \
299-
build-essential flex bison libssl-dev \
300-
libncurses-dev liblz4-tool zlib1g-dev \
301-
libxml2-utils rsync unzip
272+
- name: Install Dependencies + APTC
273+
uses: awalsh128/cache-apt-pkgs-action@latest
274+
with:
275+
packages: python3 git curl ccache libelf-dev build-essential flex bison libssl-dev libncurses-dev liblz4-tool zlib1g-dev libxml2-utils rsync unzip gawk
276+
execute_install_scripts: true
302277

303278
- name: Restore Ccache
304279
uses: actions/cache@v3

.github/workflows/delete.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ on:
3838
type: boolean
3939
default: false
4040
clear_cache:
41-
description: '是否删除所有ccache缓存'
41+
description: '是否删除所有缓存'
4242
required: false
4343
type: boolean
4444
default: false
@@ -154,7 +154,7 @@ jobs:
154154
permissions:
155155
actions: write
156156
steps:
157-
- name: 删除并重置缓存
157+
- name: 删除并重置缓存 (ccache + apt-cache)
158158
uses: actions/github-script@v6
159159
with:
160160
script: |
@@ -174,7 +174,11 @@ jobs:
174174
if (!caches || caches.length === 0) break;
175175
176176
for (const cache of caches) {
177-
if (cache.key.startsWith('ccache-')) {
177+
if (
178+
cache.key.startsWith('ccache-') ||
179+
cache.key.includes('apt-cache') ||
180+
cache.key.includes('apt')
181+
) {
178182
console.log(`删除缓存: ${cache.key}`);
179183
await github.rest.actions.deleteActionsCacheById({
180184
owner,

0 commit comments

Comments
 (0)