mirror of
https://github.com/lingble/talos.git
synced 2025-12-16 20:47:09 +00:00
chore: add race-enabled test run
As Go race detector doesn't work under libmuscl, use stock glibc-based golang container. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
committed by
Andrey Smirnov
parent
da1f73249f
commit
2227d1f6b6
14
.drone.yml
14
.drone.yml
@@ -145,6 +145,20 @@ steps:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- build.Lint
|
- build.Lint
|
||||||
|
|
||||||
|
- name: test.UnitTestRace
|
||||||
|
image: autonomy/build-container:latest
|
||||||
|
pull: always
|
||||||
|
environment:
|
||||||
|
BUILDKIT_HOST: tcp://buildkitd.ci.svc:1234
|
||||||
|
BINDIR: /usr/local/bin
|
||||||
|
commands:
|
||||||
|
- make test-race
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run/
|
||||||
|
depends_on:
|
||||||
|
- build.Lint
|
||||||
|
|
||||||
# Phase 3
|
# Phase 3
|
||||||
- name: build.Rootfs
|
- name: build.Rootfs
|
||||||
image: autonomy/build-container:latest
|
image: autonomy/build-container:latest
|
||||||
|
|||||||
16
Dockerfile
16
Dockerfile
@@ -1,6 +1,12 @@
|
|||||||
# syntax = docker/dockerfile-upstream:1.1.2-experimental
|
# syntax = docker/dockerfile-upstream:1.1.2-experimental
|
||||||
|
|
||||||
|
# Meta args applied to stage base names.
|
||||||
|
|
||||||
ARG TOOLS
|
ARG TOOLS
|
||||||
|
ARG GO_VERSION
|
||||||
|
|
||||||
|
# The tools target provides base toolchain for the build.
|
||||||
|
|
||||||
FROM $TOOLS AS tools
|
FROM $TOOLS AS tools
|
||||||
ENV PATH /toolchain/bin
|
ENV PATH /toolchain/bin
|
||||||
RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
|
RUN ["/toolchain/bin/mkdir", "/bin", "/tmp"]
|
||||||
@@ -267,6 +273,16 @@ RUN --security=insecure --mount=type=cache,id=testspace,target=/tmp --mount=type
|
|||||||
FROM scratch AS test
|
FROM scratch AS test
|
||||||
COPY --from=test-runner /src/coverage.txt /coverage.txt
|
COPY --from=test-runner /src/coverage.txt /coverage.txt
|
||||||
|
|
||||||
|
# The test-race target performs tests with race detector.
|
||||||
|
|
||||||
|
FROM golang:${GO_VERSION} AS test-race
|
||||||
|
COPY --from=base /src /src
|
||||||
|
COPY --from=base /go/pkg/mod /go/pkg/mod
|
||||||
|
WORKDIR /src
|
||||||
|
ENV GO111MODULE on
|
||||||
|
ARG TESTPKGS
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/go-build go test -v -race ${TESTPKGS}
|
||||||
|
|
||||||
# The lint target performs linting on the source code.
|
# The lint target performs linting on the source code.
|
||||||
|
|
||||||
FROM base AS lint
|
FROM base AS lint
|
||||||
|
|||||||
11
Makefile
11
Makefile
@@ -3,6 +3,7 @@ TOOLS ?= autonomy/tools:b473afb
|
|||||||
# TODO(andrewrynhard): Move this logic to a shell script.
|
# TODO(andrewrynhard): Move this logic to a shell script.
|
||||||
BUILDKIT_VERSION ?= v0.6.0
|
BUILDKIT_VERSION ?= v0.6.0
|
||||||
KUBECTL_VERSION ?= v1.14.1
|
KUBECTL_VERSION ?= v1.14.1
|
||||||
|
GO_VERSION ?= 1.12
|
||||||
BUILDKIT_IMAGE ?= moby/buildkit:$(BUILDKIT_VERSION)
|
BUILDKIT_IMAGE ?= moby/buildkit:$(BUILDKIT_VERSION)
|
||||||
BUILDKIT_HOST ?= tcp://0.0.0.0:1234
|
BUILDKIT_HOST ?= tcp://0.0.0.0:1234
|
||||||
BUILDKIT_CONTAINER_NAME ?= talos-buildkit
|
BUILDKIT_CONTAINER_NAME ?= talos-buildkit
|
||||||
@@ -47,6 +48,7 @@ COMMON_ARGS += --local dockerfile=.
|
|||||||
COMMON_ARGS += --opt build-arg:TOOLS=$(TOOLS)
|
COMMON_ARGS += --opt build-arg:TOOLS=$(TOOLS)
|
||||||
COMMON_ARGS += --opt build-arg:SHA=$(SHA)
|
COMMON_ARGS += --opt build-arg:SHA=$(SHA)
|
||||||
COMMON_ARGS += --opt build-arg:TAG=$(TAG)
|
COMMON_ARGS += --opt build-arg:TAG=$(TAG)
|
||||||
|
COMMON_ARGS += --opt build-arg:GO_VERSION=$(GO_VERSION)
|
||||||
|
|
||||||
DOCKER_ARGS ?=
|
DOCKER_ARGS ?=
|
||||||
# to allow tests to run containerd
|
# to allow tests to run containerd
|
||||||
@@ -229,7 +231,6 @@ e2e-integration:
|
|||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: buildkitd
|
test: buildkitd
|
||||||
@mkdir -p build
|
|
||||||
@$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \
|
@$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \
|
||||||
build \
|
build \
|
||||||
--opt target=$@ \
|
--opt target=$@ \
|
||||||
@@ -237,6 +238,14 @@ test: buildkitd
|
|||||||
--opt build-arg:TESTPKGS=$(TESTPKGS) \
|
--opt build-arg:TESTPKGS=$(TESTPKGS) \
|
||||||
$(COMMON_ARGS)
|
$(COMMON_ARGS)
|
||||||
|
|
||||||
|
.PHONY: test-race
|
||||||
|
test-race: buildkitd
|
||||||
|
@$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \
|
||||||
|
build \
|
||||||
|
--opt target=$@ \
|
||||||
|
--opt build-arg:TESTPKGS=$(TESTPKGS) \
|
||||||
|
$(COMMON_ARGS)
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: buildkitd
|
lint: buildkitd
|
||||||
@$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \
|
@$(BINDIR)/buildctl --addr $(BUILDKIT_HOST) \
|
||||||
|
|||||||
Reference in New Issue
Block a user