ci: run codecov outside docker

This commit is contained in:
2021-11-04 19:32:02 +01:00
parent 2186a7ac85
commit 4a3e7c03b9
3 changed files with 12 additions and 25 deletions
+1
View File
@@ -1,2 +1,3 @@
.idea .idea
/release /release
exported
+4 -2
View File
@@ -14,6 +14,8 @@ build:
services: services:
- docker:dind - docker:dind
script: script:
- ci_env=`bash <(curl -s https://codecov.io/env)` - build
- build ${ci_env//-e /--build-arg } - curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
- ./codecov -t ${CODECOV_TOKEN}
- push - push
+3 -19
View File
@@ -1,21 +1,4 @@
FROM golang:1.17.2 as build FROM golang:1.17.2 as build
ARG CODECOV_ENV
ARG CODECOV_TOKEN
ARG CODECOV_URL
ARG CODECOV_SLUG
ARG VCS_COMMIT_ID
ARG VCS_BRANCH_NAME
ARG VCS_PULL_REQUEST
ARG VCS_SLUG
ARG VCS_TAG
ARG CI_BUILD_URL
ARG CI_BUILD_ID
ARG CI_JOB_ID
ARG GITLAB_CI
ARG CI_BUILD_REF_NAME
ARG CI_BUILD_ID
ARG CI_BUILD_REPO
ARG CI_BUILD_REF
WORKDIR /build WORKDIR /build
ENV CGO_ENABLED=0 ENV CGO_ENABLED=0
ADD . /build ADD . /build
@@ -27,10 +10,11 @@ RUN ["/bin/bash", "-c", "cat coverage.txt.tmp | grep -v -f <(find . -type f | xa
RUN go tool cover -html=coverage.txt -o coverage.html RUN go tool cover -html=coverage.txt -o coverage.html
RUN go tool cover -func=coverage.txt RUN go tool cover -func=coverage.txt
RUN rm coverage.txt.tmp RUN rm coverage.txt.tmp
RUN curl -s https://codecov.io/bash | bash
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=readonly -o release/cron-checker -ldflags '-w -s' RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -mod=readonly -o release/cron-checker -ldflags '-w -s'
FROM scratch as export
COPY --from=build /build/coverage.txt /
FROM scratch FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /build/release/cron-checker / COPY --from=build /build/release/cron-checker /