mirror of
https://github.com/openwrt-xiaomi/builder.git
synced 2026-01-02 20:13:37 +05:00
build: Add new option "Use cache for host tools'"
This commit is contained in:
37
.github/workflows/build.yml
vendored
37
.github/workflows/build.yml
vendored
@@ -3,6 +3,14 @@ name: build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
use_cache:
|
||||
description: 'Use cache for host tools'
|
||||
required: true
|
||||
default: 'false'
|
||||
type: choice
|
||||
options:
|
||||
- true
|
||||
- false
|
||||
first_kernel_compile:
|
||||
description: 'First kernel compile'
|
||||
required: true
|
||||
@@ -12,7 +20,7 @@ on:
|
||||
- true
|
||||
- false
|
||||
test_build:
|
||||
description: 'Test build'
|
||||
description: 'Test build (only spec target) '
|
||||
required: true
|
||||
default: 'false'
|
||||
type: choice
|
||||
@@ -20,12 +28,12 @@ on:
|
||||
- true
|
||||
- false
|
||||
target_name:
|
||||
description: 'Target Name'
|
||||
description: 'Target Name for test build'
|
||||
required: false
|
||||
default: 'r3d'
|
||||
type: string
|
||||
package_dir:
|
||||
description: 'Package Dir'
|
||||
description: 'Package Dir for test build'
|
||||
required: false
|
||||
default: ''
|
||||
type: string
|
||||
@@ -213,15 +221,21 @@ jobs:
|
||||
|
||||
- name: Update OpenWrt packages
|
||||
id: update
|
||||
env:
|
||||
USE_CACHE: ${{ github.event.inputs.use_cache }}
|
||||
run: |
|
||||
./xupdate.sh -f
|
||||
mkdir -p logs
|
||||
echo "status=success" >> $GITHUB_OUTPUT
|
||||
rm -rf staging_dir/
|
||||
mkdir -p staging_dir/host
|
||||
echo "USE_CACHE=$USE_CACHE" >> $GITHUB_ENV
|
||||
if [ "$USE_CACHE" = "true" ]; then
|
||||
rm -rf staging_dir/
|
||||
mkdir -p staging_dir/host
|
||||
fi
|
||||
|
||||
- name: Restore cache for host tools
|
||||
id: tools_cache_restore
|
||||
if: github.event.inputs.use_cache == 'true'
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
key: host-tools-${{ runner.os }}-${{ needs.check.outputs.fw_ver }}-${{ hashFiles('tools/**') }}
|
||||
@@ -284,15 +298,24 @@ jobs:
|
||||
make toolchain/install -j$(nproc)
|
||||
echo "status=success" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Save cache for host tools
|
||||
- name: Save cache for host tools (use_cache = true)
|
||||
id: tools_cache_save
|
||||
if: steps.tools.outputs.status == 'success' && steps.tools_cache_restore.outputs.cache-hit != 'true'
|
||||
if: steps.tools.outputs.status == 'success' && github.event.inputs.use_cache == 'true' && steps.tools_cache_restore.outputs.cache-hit != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
key: ${{ steps.tools_cache_restore.outputs.cache-primary-key }}
|
||||
path: |
|
||||
staging_dir/host
|
||||
|
||||
- name: Save cache for host tools (use_cache = false)
|
||||
id: tools_cache_save_2
|
||||
if: steps.tools.outputs.status == 'success' && github.event.inputs.use_cache != 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
key: host-tools-${{ runner.os }}-${{ needs.check.outputs.fw_ver }}-${{ hashFiles('tools/**') }}
|
||||
path: |
|
||||
staging_dir/host
|
||||
|
||||
- name: Kernel compile
|
||||
id: kernel
|
||||
if: ${{ steps.tools.outputs.status == 'success' && github.event.inputs.first_kernel_compile == 'true' && github.event.inputs.fake_build != 'true' }}
|
||||
|
||||
Reference in New Issue
Block a user