fix workflow build result detection

This commit is contained in:
xopenwrt 2026-06-29 21:09:28 +08:00
parent 2c1f06e0f2
commit 9769cda745
4 changed files with 44 additions and 9 deletions

View File

@ -219,9 +219,16 @@ jobs:
rm feeds/luci/applications/luci-app-adguardhome -rf rm feeds/luci/applications/luci-app-adguardhome -rf
ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome
# 2024.03.03 mosdns build fail by golang 1.22 # 2024.03.03 mosdns build fail by golang 1.22
sed -i 's/CGO_ENABLED=0/CGO_ENABLED=1/g' feeds/packages/net/mosdns/Makefile sed -i "s/CGO_ENABLED=0/CGO_ENABLED=1/g" feeds/packages/net/mosdns/Makefile
make -j4 | tee ./build_log.log || make -j1 V=s set -o pipefail
[ "$?" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV if make -j4 2>&1 | tee ./build_log.log
then
build_status=0
else
make -j1 V=s 2>&1 | tee -a ./build_log.log
build_status=$?
fi
[ "${build_status}" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV

View File

@ -216,9 +216,16 @@ jobs:
rm feeds/luci/applications/luci-app-adguardhome -rf rm feeds/luci/applications/luci-app-adguardhome -rf
ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome
# 2024.03.03 mosdns build fail by golang 1.22 # 2024.03.03 mosdns build fail by golang 1.22
sed -i 's/CGO_ENABLED=0/CGO_ENABLED=1/g' feeds/packages/net/mosdns/Makefile sed -i "s/CGO_ENABLED=0/CGO_ENABLED=1/g" feeds/packages/net/mosdns/Makefile
make -j4 | tee ./build_log.log || make -j1 V=s set -o pipefail
[ "$?" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV if make -j4 2>&1 | tee ./build_log.log
then
build_status=0
else
make -j1 V=s 2>&1 | tee -a ./build_log.log
build_status=$?
fi
[ "${build_status}" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
- name: Check Build Update - name: Check Build Update

View File

@ -214,10 +214,17 @@ jobs:
rm feeds/packages/net/adguardhome -rf rm feeds/packages/net/adguardhome -rf
rm feeds/luci/applications/luci-app-adguardhome -rf rm feeds/luci/applications/luci-app-adguardhome -rf
ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome
set -o pipefail && make -j4 2>&1 | tee build_log.log || make -j1 V=s
# 2024.03.03 mosdns build fail by golang 1.22 # 2024.03.03 mosdns build fail by golang 1.22
sed -i 's/CGO_ENABLED=0/CGO_ENABLED=1/g' feeds/packages/net/mosdns/Makefile sed -i "s/CGO_ENABLED=0/CGO_ENABLED=1/g" feeds/packages/net/mosdns/Makefile
[ "$?" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV set -o pipefail
if make -j4 2>&1 | tee ./build_log.log
then
build_status=0
else
make -j1 V=s 2>&1 | tee -a ./build_log.log
build_status=$?
fi
[ "${build_status}" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV
- name: Check Build Update - name: Check Build Update
run: | run: |

View File

@ -0,0 +1,14 @@
# AI Modification Log: Build Result Detection
Date: 2026-06-29
## Change
- Updated X/Y/Z workflow build steps to use `set -o pipefail` before `make | tee`.
- Captured the build status immediately after the primary build or fallback build.
- Appended fallback build output to `build_log.log`.
- Moved the Z workflow mosdns `CGO_ENABLED=1` fix before `make` runs.
## Reason
Without `pipefail`, `make | tee` could report success when `make` failed. In the Z workflow, the mosdns fix ran after `make`, so it was applied too late and the final `$?` reflected `sed` instead of the build result.