From 9769cda74565f39f1c7ed7b56d7756a971e61b6f Mon Sep 17 00:00:00 2001 From: xopenwrt Date: Mon, 29 Jun 2026 21:09:28 +0800 Subject: [PATCH] fix workflow build result detection --- .github/workflows/X-x86_64_X.yml | 13 ++++++++++--- .github/workflows/X-x86_64_Y.yml | 13 ++++++++++--- .github/workflows/X-x86_64_Z.yml | 13 ++++++++++--- AI_CHANGELOG_BUILD_RESULT_DETECTION.md | 14 ++++++++++++++ 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 AI_CHANGELOG_BUILD_RESULT_DETECTION.md diff --git a/.github/workflows/X-x86_64_X.yml b/.github/workflows/X-x86_64_X.yml index 4f60a43..5409602 100644 --- a/.github/workflows/X-x86_64_X.yml +++ b/.github/workflows/X-x86_64_X.yml @@ -219,9 +219,16 @@ jobs: rm feeds/luci/applications/luci-app-adguardhome -rf ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome # 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 - make -j4 | tee ./build_log.log || make -j1 V=s - [ "$?" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + sed -i "s/CGO_ENABLED=0/CGO_ENABLED=1/g" feeds/packages/net/mosdns/Makefile + 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 diff --git a/.github/workflows/X-x86_64_Y.yml b/.github/workflows/X-x86_64_Y.yml index d77d9e0..c271961 100644 --- a/.github/workflows/X-x86_64_Y.yml +++ b/.github/workflows/X-x86_64_Y.yml @@ -216,9 +216,16 @@ jobs: rm feeds/luci/applications/luci-app-adguardhome -rf ln -s ../../../package/other/AutoBuild-Packages/adguardhome package/feeds/packages/adguardhome # 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 - make -j4 | tee ./build_log.log || make -j1 V=s - [ "$?" == 0 ] && echo "Result=true" >> $GITHUB_ENV || echo "Result=false" >> $GITHUB_ENV + sed -i "s/CGO_ENABLED=0/CGO_ENABLED=1/g" feeds/packages/net/mosdns/Makefile + 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 diff --git a/.github/workflows/X-x86_64_Z.yml b/.github/workflows/X-x86_64_Z.yml index cad03b5..06f1876 100644 --- a/.github/workflows/X-x86_64_Z.yml +++ b/.github/workflows/X-x86_64_Z.yml @@ -214,10 +214,17 @@ jobs: rm feeds/packages/net/adguardhome -rf rm feeds/luci/applications/luci-app-adguardhome -rf 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 - 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 + sed -i "s/CGO_ENABLED=0/CGO_ENABLED=1/g" feeds/packages/net/mosdns/Makefile + 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 run: | diff --git a/AI_CHANGELOG_BUILD_RESULT_DETECTION.md b/AI_CHANGELOG_BUILD_RESULT_DETECTION.md new file mode 100644 index 0000000..6c59f65 --- /dev/null +++ b/AI_CHANGELOG_BUILD_RESULT_DETECTION.md @@ -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.