Skip to content

Commit d440e59

Browse files
committed
chore: use same target for sandboxed and native tests
Signed-off-by: CrazyMax <[email protected]>
1 parent f8e94d9 commit d440e59

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,13 @@ jobs:
9595
echo -e "trust\n5\ny" | gpg --batch --no-tty --command-fd 0 --edit-key 7D851EB72D73BDA0
9696
pass init 7D851EB72D73BDA0
9797
fi
98-
go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./...
99-
go tool cover -func=./coverage.txt
98+
make test COVERAGEDIR=${{ env.DESTDIR }}
10099
shell: bash
101100
-
102101
name: Upload coverage
103102
uses: codecov/codecov-action@v3
104103
with:
105-
file: ./coverage.txt
104+
file: ${{ env.DESTDIR }}/coverage.txt
106105

107106
test-sandboxed:
108107
runs-on: ubuntu-22.04

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ RUN --mount=type=bind,target=. \
8686
gpg -k
8787

8888
mkdir /out
89-
xx-go test -short -v -coverprofile=/out/coverage.txt -covermode=atomic ./...
90-
xx-go tool cover -func=/out/coverage.txt
89+
xx-go --wrap
90+
make test COVERAGEDIR=/out
9191
EOT
9292

9393
FROM scratch AS test-coverage

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ GO_LDFLAGS = -s -w -X ${GO_PKG}/credentials.Version=${VERSION} -X ${GO_PKG}/cred
77

88
BUILDX_CMD ?= docker buildx
99
DESTDIR ?= ./bin/build
10+
COVERAGEDIR ?= ./bin/coverage
1011

1112
.PHONY: all
1213
all: cross
@@ -35,8 +36,10 @@ release: # create release
3536
./hack/release
3637

3738
.PHONY: test
38-
test: # tests all packages except vendor
39-
go test -v `go list ./... | grep -v /vendor/`
39+
test:
40+
mkdir -p $(COVERAGEDIR)
41+
go test -short -v -coverprofile=$(COVERAGEDIR)/coverage.txt -covermode=atomic ./...
42+
go tool cover -func=$(COVERAGEDIR)/coverage.txt
4043

4144
.PHONY: lint
4245
lint:

0 commit comments

Comments
 (0)