Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

ci: refactor test workflow #43

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
with:
go-version: ${{ inputs.GO_VERSION }}
- name: Run unit test
run: make test
run: make test-unit
- name: upload coverage report
uses: codecov/[email protected]
with:
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf
LDFLAGS=-ldflags="-X '$(versioningPath).buildTime=$(shell date)' -X '$(versioningPath).lastCommit=$(shell git rev-parse HEAD)' -X '$(versioningPath).semanticVersion=$(shell git describe --tags --dirty=-dev 2>/dev/null || git rev-parse --abbrev-ref HEAD)'"

# Define pkgs, run, and cover vairables for test so that we can override them in
# Define all_pkgs, unit_pkgs, run, and cover vairables for test so that we can override them in
# the terminal more easily.
pkgs := $(shell go list ./...)
all_pkgs := $(shell go list ./...)
unit_pkgs := ./celestia
run := .
count := 1

Expand All @@ -30,7 +31,7 @@ clean:
cover:
@echo "--> Generating Code Coverage"
@go install github.com/ory/go-acc@latest
@go-acc -o coverage.txt $(pkgs)
@go-acc -o coverage.txt $(unit_pkgs)
.PHONY: cover

## deps: Install dependencies
Expand Down Expand Up @@ -63,15 +64,21 @@ fmt:
## vet: Run go vet
vet:
@echo "--> Running go vet"
@go vet $(pkgs)
@go vet $(all_pkgs)
.PHONY: vet

## test: Running unit tests
## test: Running all tests
test: vet
@echo "--> Running unit tests"
@go test -v -race -covermode=atomic -coverprofile=coverage.txt $(pkgs) -run $(run) -count=$(count)
@echo "--> Running all tests"
@go test -v -race -covermode=atomic -coverprofile=coverage.txt $(all_pkgs) -run $(run) -count=$(count)
.PHONY: test

## test: Running unit tests
test-unit: vet
@echo "--> Running unit tests"
@go test -v -race -covermode=atomic -coverprofile=coverage.txt $(unit_pkgs) -run $(run) -count=$(count)
.PHONY: test-unit

### proto-gen: Generate protobuf files. Requires docker.
#proto-gen:
# @echo "--> Generating Protobuf files"
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions celestia/celestia_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package celestia

import (
"testing"
)

func TestCelestiaDA(t *testing.T) {
// TODO
}
tuxcanfly marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion celestia_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
rpc "github.com/celestiaorg/celestia-node/api/rpc/client"
"github.com/celestiaorg/celestia-node/share"

"github.com/rollkit/celestia-da"
"github.com/rollkit/celestia-da/celestia"
"github.com/rollkit/go-da/test"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/celestia-da/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
rpc "github.com/celestiaorg/celestia-node/api/rpc/client"
"github.com/celestiaorg/celestia-node/share"

"github.com/rollkit/celestia-da"
"github.com/rollkit/celestia-da/celestia"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
Expand Down
Loading