Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,10 @@ RUN --mount=target=/context \
exit 1
fi
EOT

FROM base AS test
RUN apk add --no-cache gcc musl-dev
WORKDIR /src
RUN --mount=target=. \
--mount=target=/root/.cache,type=cache \
CGO_ENABLED=1 go test -race -v ./...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make unit-tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! make unit-tests does not call the tests with the race detector enabled (which can catch some issues), and I was afraid to change it and break something else that I was missing (enabling the race detector requires cgo and gcc). Happy to change the unit-tests target and use it if there are no objections.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! I didn't know enabling race detector requires cgo and gcc. I vote to merge it now then, as it's already an improvement.
Once we are confident that using make unit-tests will not break something else we can add a follow up pr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we've decided that adding the race detector was safe enough to do it in this PR. Thanks for the feedback!

11 changes: 10 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ group "default" {
}

group "validate" {
targets = ["validate-docs"]
targets = [
"validate-docs",
"validate-tests"
]
}

target "validate-docs" {
Expand All @@ -37,3 +40,9 @@ target "update-docs" {
target = "docs-update"
output = ["./docs/reference"]
}

target "validate-tests" {
inherits = ["_common"]
target = "test"
output = ["type=cacheonly"]
}
Loading