build: Fix using github cache (also on failure)

This commit is contained in:
remittor
2025-12-31 15:03:41 +03:00
parent e6e97ddbc8
commit 08cccf41b7

View File

@@ -214,6 +214,7 @@ jobs:
id: update
run: |
./xupdate.sh -f
mkdir -p logs
echo "status=success" >> $GITHUB_OUTPUT
- name: Configure
@@ -291,6 +292,7 @@ jobs:
- name: Kernel compile
id: kernel
continue-on-error: true
if: ${{ steps.tools.outputs.status == 'success' && github.event.inputs.first_kernel_compile == 'true' && github.event.inputs.fake_build != 'true' }}
run: |
make target/linux/compile -j$(nproc)
@@ -298,6 +300,7 @@ jobs:
- name: Build the firmware image
id: compile
continue-on-error: true
if: steps.tools.outputs.status == 'success'
env:
TARGET: ${{ matrix.target }}
@@ -321,7 +324,6 @@ jobs:
mkdir -p $OUT_DIR
echo "$G_BOARD_NAME $G_SUBTARGET_NAME $G_DEVICE_NAME" > "$OUT_DIR/$G_DEVICE_NAME.txt"
touch "$OUT_DIR/kernel-debug.tar.zst"
ls -la
BLD_VER=$FW_VER
else
BLD_VER=$( cat $OUT_DIR/profiles.json | grep -so '"version_number":"[^"]*' | grep -so '[^"]*$' )
@@ -332,12 +334,23 @@ jobs:
exit 100
fi
echo "status=success" >> $GITHUB_OUTPUT
echo "DEVICE_NAME=$G_DEVICE_NAME" >> $GITHUB_ENV
echo "BOARD_NAME=$G_BOARD_NAME" >> $GITHUB_ENV
echo "SUBTARGET_NAME=$G_SUBTARGET_NAME" >> $GITHUB_ENV
echo "FW_BUILD_OK=1" >> $GITHUB_ENV
echo "BLD_VER=$BLD_VER" >> $GITHUB_ENV
echo "OUT_DIR=$OUT_DIR" >> $GITHUB_ENV
- name: Mark firmware build failed
if: steps.compile.outcome == 'failure'
run: |
echo "Firmware build failed, continuing pipeline"
echo "FW_BUILD_OK=0" >> $GITHUB_ENV
OUT_DIR=_bin_fake
mkdir -p $OUT_DIR
echo "$G_BOARD_NAME $G_SUBTARGET_NAME $G_DEVICE_NAME" > "$OUT_DIR/$G_DEVICE_NAME.txt"
touch "$OUT_DIR/kernel-debug.tar.zst"
echo "BUILD FAILED" > $OUT_DIR/FAILED.txt
echo "BLD_VER=$FW_VER" >> $GITHUB_ENV
echo "OUT_DIR=$OUT_DIR" >> $GITHUB_ENV
- name: Check space usage
run: df -hT
@@ -372,7 +385,7 @@ jobs:
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success'
with:
name: openwrt-${{ env.BLD_VER }}-${{ needs.check.outputs.build_date }}-${{ env.DEVICE_NAME }}
name: openwrt-${{ env.BLD_VER }}-${{ needs.check.outputs.build_date }}-${{ env.G_DEVICE_NAME }}
path: ${{ env.OUT_DIR }}
if-no-files-found: error