From e903c644f257a9c29d5ec5a44a2247959f2c0c3b Mon Sep 17 00:00:00 2001 From: Miao Wang Date: Sat, 11 Jan 2025 23:28:37 +0800 Subject: [PATCH] Fix CI test for cgroupv1 The test binary is complied on ubuntu 22.04, linked with higher version of glibc than debian bullseye integrates after upgrading to golang 1.22 Solve this problem by disabling cgo. --- .github/workflows/tunasync.yml | 1 + Makefile | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tunasync.yml b/.github/workflows/tunasync.yml index cfc15a6..221ff3e 100644 --- a/.github/workflows/tunasync.yml +++ b/.github/workflows/tunasync.yml @@ -190,6 +190,7 @@ jobs: run: | CUSER="$(id --user --name)" sudo rsh 254.255.255.2 bash --noprofile --norc -eo pipefail << EOF + exec 2>&1 cd "/home/${CUSER}" lssubsys -am cgcreate -a "$CUSER" -t "$CUSER" -g cpu:tunasync diff --git a/Makefile b/Makefile index 5498489..28f63d4 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,13 @@ $(BUILDBIN): % : build-$(ARCH) build-$(ARCH)/% $(BUILDBIN:%=build-$(ARCH)/%) : build-$(ARCH)/% : cmd/% GOOS=$(GOOS) GOARCH=$(GOARCH) go get ./$< - GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ -ldflags ${LDFLAGS} github.com/tuna/tunasync/$< + GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o $@ -ldflags ${LDFLAGS} github.com/tuna/tunasync/$< test: go test -v -covermode=count -coverprofile=profile.cov ./... build-test-worker: - go test -c -covermode=count ./worker + CGO_ENABLED=0 go test -c -covermode=count ./worker clean: rm -rf build-$(ARCH)