From 4e4036382b8216067cc856330009f82b9f1660d8 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Tue, 20 Aug 2019 10:45:56 +0200 Subject: [PATCH] improving load time for lint and tests commands --- build/lint/Dockerfile | 8 +++++--- build/tests/Dockerfile | 8 +++++--- build/tests/docker-entrypoint.sh | 19 +------------------ 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/build/lint/Dockerfile b/build/lint/Dockerfile index 82b67453..49349b5e 100644 --- a/build/lint/Dockerfile +++ b/build/lint/Dockerfile @@ -24,11 +24,13 @@ RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.s USER gotenberg WORKDIR /gotenberg/lint -# Copy our code source. -COPY --chown=gotenberg:gotenberg . . - # Install module dependencies. +COPY --chown=gotenberg:gotenberg go.mod go.sum ./ + RUN go mod download &&\ go mod verify +# Copy our code source. +COPY --chown=gotenberg:gotenberg . . + CMD ["golangci-lint", "run" ,"--tests=false", "--enable-all", "--disable=dupl" ] \ No newline at end of file diff --git a/build/tests/Dockerfile b/build/tests/Dockerfile index 55599671..cccf031a 100644 --- a/build/tests/Dockerfile +++ b/build/tests/Dockerfile @@ -4,11 +4,13 @@ FROM thecodingmachine/gotenberg:workspace USER gotenberg WORKDIR /gotenberg/tests -# Copy our code source. -COPY --chown=gotenberg:gotenberg . . - # Install module dependencies. +COPY --chown=gotenberg:gotenberg go.mod go.sum ./ + RUN go mod download &&\ go mod verify +# Copy our code source. +COPY --chown=gotenberg:gotenberg . . + ENTRYPOINT [ "build/tests/docker-entrypoint.sh" ] \ No newline at end of file diff --git a/build/tests/docker-entrypoint.sh b/build/tests/docker-entrypoint.sh index de0361d9..6b8a3aed 100755 --- a/build/tests/docker-entrypoint.sh +++ b/build/tests/docker-entrypoint.sh @@ -14,21 +14,4 @@ fi go run github.com/thecodingmachine/gotenberg/test/cmd/pm2 # Run our tests. -go test -race -cover ./... - -# Testing PM2 processes launch separatly for avoiding -# spending to much time on each tests depending on -# them. -#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestChromeStart -#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvStart - -# Running others tests. -#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/config -#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/random -#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/standarderror -#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/pkg/timeout -#go test -race -cover -covermode=atomic github.com/thecodingmachine/gotenberg/internal/app/api - -# Finally testing processes shutdown. -#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestChromeShutdown -#go test github.com/thecodingmachine/gotenberg/internal/pkg/pm2 -run TestUnoconvShutdown \ No newline at end of file +go test -race -cover ./... \ No newline at end of file