Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace goacc with go test for coverage checks #27

Merged
merged 9 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 12 additions & 19 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: Build and Test
on: [push, pull_request]
on:
pull_request:
push:
branches:
- master
release:
types:
- created

env:
# go needs absolute directories, using the $HOME variable doesn't work here.
Expand Down Expand Up @@ -38,25 +45,11 @@ jobs:
- name: Test
run: make unit-cover

- name: Send top-level coverage
uses: shogo82148/actions-goveralls@v1
- name: Send coverage
uses: coverallsapp/github-action@v2
with:
path-to-profile: coverage.txt

- name: Send btcec
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: btcec/coverage.txt

- name: Send btcutil coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: btcutil/coverage.txt

- name: Send btcutil coverage for psbt package
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: btcutil/psbt/coverage.txt
files: ./coverage.txt ./btcec/coverage.txt ./btcutil/coverage.txt ./btcutil/psbt/coverage.txt
format: golang

test-race:
name: Unit race
Expand Down
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports

GO_BIN := ${GOPATH}/bin
LINT_BIN := $(GO_BIN)/golangci-lint
GOACC_BIN := $(GO_BIN)/go-acc


LINT_COMMIT := v1.18.0
GOACC_VERSION := v0.2.7
Expand All @@ -15,9 +15,11 @@ DEPGET := cd /tmp && GO111MODULE=on go get -v
GOBUILD := GO111MODULE=on go build -v
GOINSTALL := GO111MODULE=on go install -v
DEV_TAGS := rpctest
GOTEST_DEV = GO111MODULE=on go test -v -tags=$(DEV_TAGS)
GOTEST_DEV = GO111MODULE=on go test -tags=$(DEV_TAGS)
GOTEST := GO111MODULE=on go test -v

GOACC_BIN := $(GOTEST_DEV) -coverprofile=coverage.txt -covermode=atomic

GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*")

RM := rm -f
Expand Down Expand Up @@ -51,10 +53,6 @@ $(LINT_BIN):
@$(call print, "Fetching linter")
$(DEPGET) $(LINT_PKG)@$(LINT_COMMIT)

$(GOACC_BIN):
@$(call print, "Fetching go-acc")
$(GOINSTALL) $(GOACC_PKG)@$(GOACC_VERSION)

goimports:
@$(call print, "Installing goimports.")
$(DEPGET) $(GOIMPORTS_PKG)
Expand Down Expand Up @@ -84,13 +82,13 @@ unit:
cd btcutil; $(GOTEST_DEV) ./... -test.timeout=20m
cd btcutil/psbt; $(GOTEST_DEV) ./... -test.timeout=20m

unit-cover: $(GOACC_BIN)
unit-cover:
@$(call print, "Running unit coverage tests.")
$(GOACC_BIN) ./...

# We need to remove the /v2 pathing from the module to have it work
# nicely with the CI tool we use to render live code coverage.
cd btcec; $(GOACC_BIN) ./...; sed -i.bak 's/v2\///g' coverage.txt
cd btcec; $(GOACC_BIN) ./...

cd btcutil; $(GOACC_BIN) ./...

Expand Down
Loading