fix(ci): add cache cleaning step to prevent 'no space left on device' errors (#4513)

修复ci runner免费的磁盘空间不足导致无法完成单元测试的问题
1. 移动example单测到ci sub中
2. 使用go clean -cache清理避免短期内再次出现空间不足的问题
This commit is contained in:
hailaz
2025-11-19 12:54:51 +08:00
committed by GitHub
parent 072b962b81
commit 54453c8e8f
3 changed files with 45 additions and 18 deletions

View File

@ -2,6 +2,12 @@
coverage=$1
# update code of submodules
git clone https://github.com/gogf/examples
# update go.mod in examples directory to replace github.com/gogf/gf packages with local directory
bash .github/workflows/scripts/replace_examples_gomod.sh
# Function to compare version numbers
version_compare() {
local ver1=$1
@ -35,7 +41,19 @@ for file in `find . -name go.mod`; do
dirpath=$(dirname $file)
echo "Processing: $dirpath"
# Only process kubecm directory, skip others
# Only process examples and kubecm directories
# Process examples directory (only build, no tests)
if [[ $dirpath =~ "/examples/" ]]; then
echo " the examples directory only needs to be built, not unit tests."
cd $dirpath
go mod tidy
go build ./...
cd -
continue 1
fi
# Process kubecm directory
if [ "kubecm" != $(basename $dirpath) ]; then
echo " Skipping: not kubecm directory"
continue