diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 37d6260e0a..07c12b043c 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -32,14 +32,20 @@ jobs: os: [linux, darwin] arch: [amd64, arm64] steps: + - name: Remove unneeded tooling to free disk space + run: | + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet - name: Install go uses: actions/setup-go@v4 with: cache: false go-version: 1.20.x + - name: Check out source code uses: actions/checkout@v3 - - name: Cache go dependencies id: cache-go-dependencies uses: actions/cache@v3 @@ -94,6 +100,20 @@ jobs: env: AWS_ACCESS_KEY_ID: fake AWS_SECRET_ACCESS_KEY: fake + + - name: Check disk space before build + run: | + cd $GITHUB_WORKSPACE + set -x + df -h + ls -lRh /tmp/* || true + du -sh /tmp || true + du -sh /tmp/* || true + sudo find /tmp/ -size +5M | sudo xargs ls -lh + du -sh ./* || true + find ./ -size +5M | xargs ls -lh + set +x + - name: Run build and test timeout-minutes: 80 run: | @@ -112,6 +132,21 @@ jobs: AWS_SECRET_ACCESS_KEY: fake OS: ${{ matrix.os }} ARCH: ${{ matrix.arch }} + + - name: Check disk space after build + if: always() + run: | + cd $GITHUB_WORKSPACE + set -x + df -h + ls -lRh /tmp/* || true + du -sh /tmp || true + du -sh /tmp/* || true + sudo find /tmp/ -size +5M | sudo xargs ls -lh + du -sh ./* || true + find ./ -size +5M | xargs ls -lh + set +x + - name: Upload code coverage uses: codecov/codecov-action@v3 with: diff --git a/Makefile b/Makefile index 279a3025a8..84748e729b 100644 --- a/Makefile +++ b/Makefile @@ -106,10 +106,14 @@ exporter-minimal: modcheck build-metadata test: $(if $(findstring ui,$(BUILD_LABELS)), ui) test: check-skopeo $(TESTDATA) $(ORAS) go test -failfast -tags $(BUILD_LABELS),containers_image_openpgp -v -trimpath -race -timeout 15m -cover -coverpkg ./... -coverprofile=coverage-extended.txt -covermode=atomic ./... + rm -rf /tmp/getter*; rm -rf /tmp/trivy* go test -failfast -tags containers_image_openpgp -v -trimpath -race -cover -coverpkg ./... -coverprofile=coverage-minimal.txt -covermode=atomic ./... + rm -rf /tmp/getter*; rm -rf /tmp/trivy* # development-mode unit tests possibly using failure injection go test -failfast -tags dev,$(BUILD_LABELS),containers_image_openpgp -v -trimpath -race -timeout 15m -cover -coverpkg ./... -coverprofile=coverage-dev-extended.txt -covermode=atomic ./pkg/test/... ./pkg/api/... ./pkg/storage/... ./pkg/extensions/sync/... -run ^TestInject + rm -rf /tmp/getter*; rm -rf /tmp/trivy* go test -failfast -tags dev,containers_image_openpgp -v -trimpath -race -cover -coverpkg ./... -coverprofile=coverage-dev-minimal.txt -covermode=atomic ./pkg/test/... ./pkg/storage/... ./pkg/extensions/sync/... -run ^TestInject + rm -rf /tmp/getter*; rm -rf /tmp/trivy* go test -failfast -tags stress,$(BUILD_LABELS),containers_image_openpgp -v -trimpath -race -timeout 15m ./pkg/cli/stress_test.go .PHONY: privileged-test diff --git a/pkg/api/routes_test.go b/pkg/api/routes_test.go index 76b0b93a94..a4ffc684ba 100644 --- a/pkg/api/routes_test.go +++ b/pkg/api/routes_test.go @@ -41,11 +41,6 @@ func TestRoutes(t *testing.T) { ctlr.Config.Storage.RootDirectory = t.TempDir() ctlr.Config.Storage.Commit = true - err := test.CopyFiles("../../test/data", ctlr.Config.Storage.RootDirectory) - if err != nil { - panic(err) - } - cm := test.NewControllerManager(ctlr) cm.StartAndWait(port) defer cm.StopServer() diff --git a/pkg/extensions/extension_search_test.go b/pkg/extensions/extension_search_test.go index 6dae4efb5c..b0fa970ee3 100644 --- a/pkg/extensions/extension_search_test.go +++ b/pkg/extensions/extension_search_test.go @@ -43,7 +43,11 @@ func TestTrivyDBGenerator(t *testing.T) { }, } storeController := storage.StoreController{ - DefaultStore: mocks.MockedImageStore{}, + DefaultStore: mocks.MockedImageStore{ + RootDirFn: func() string { + return t.TempDir() + }, + }, } cveInfo := cveinfo.NewCVEInfo(storeController, repoDB, "ghcr.io/project-zot/trivy-db", "", logger)