diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e1ca8c..d648dc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,13 +41,19 @@ jobs: - name: Generate code (protobuf and mocks) run: go generate ./... - + + - name: Fetch Codex library + run: make fetch + - name: Build - run: go build -v ./... + run: make build - name: Run unit tests - run: gotestsum --packages="./communities" -f standard-verbose --rerun-fails -- -race -v -count=1 - + run: make test + + - name: Run integration tests + run: make test-integration + - name: Check test coverage for communities package run: | go test -coverprofile=coverage.out ./communities diff --git a/Makefile b/Makefile index 9326732..734995c 100644 --- a/Makefile +++ b/Makefile @@ -24,15 +24,14 @@ fetch: unzip -o -qq $(LIBS_DIR)/codex-${OS}-${ARCH}.zip -d $(LIBS_DIR) rm -f $(LIBS_DIR)/*.zip -build: - CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o $(BIN_NAME) main.go - build-upload: CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o bin/codex-upload ./cmd/upload build-download: CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o bin/codex-download ./cmd/download +build: build-upload build-download + test: @echo "Running unit tests..." CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test -v ./communities @@ -41,6 +40,10 @@ test-integration: @echo "Running tests..." CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test -v -tags=codex_integration ./communities -run Integration -timeout 15s +coverage: + @echo "Running unit tests with coverage..." + CGO_ENABLED=1 CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test -coverprofile=coverage.out ./communities + clean: rm -f $(BIN_NAME) rm -Rf $(LIBS_DIR)/* \ No newline at end of file