From 0bbb29156c0ebe618b14414b21f293810f96a58d Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 01:10:54 +0500 Subject: [PATCH 1/7] :construction_worker: Updated Drone CI/CD config --- Makefile | 5 ++++- build/ci/.drone.yml | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 88d4989..36a2616 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,10 @@ test: dep: go mod download +gen: + go generate ./... + lint: golangci-lint run -.PHONY: build run clean test dep lint \ No newline at end of file +.PHONY: build run clean test dep gen lint \ No newline at end of file diff --git a/build/ci/.drone.yml b/build/ci/.drone.yml index 71d0879..0549e31 100644 --- a/build/ci/.drone.yml +++ b/build/ci/.drone.yml @@ -1,8 +1,18 @@ --- -name: default -type: docker kind: pipeline +type: docker +name: default + steps: + - name: init + image: golang + volumes: + - name: deps + path: /go + commands: + - make dep + - make gen + - name: test image: golang volumes: @@ -10,6 +20,9 @@ steps: path: /go commands: - make test + depends_on: + - init + - name: build image: golang volumes: @@ -18,7 +31,9 @@ steps: commands: - make build depends_on: + - init - test + volumes: - name: deps temp: {} From 56361ded2ed7d0a0627a53db27f5d8fea333065c Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 03:35:52 +0500 Subject: [PATCH 2/7] :truck: Make Drone config visible, use alpine image --- build/ci/{.drone.yml => drone.yml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename build/ci/{.drone.yml => drone.yml} (81%) diff --git a/build/ci/.drone.yml b/build/ci/drone.yml similarity index 81% rename from build/ci/.drone.yml rename to build/ci/drone.yml index 0549e31..8979091 100644 --- a/build/ci/.drone.yml +++ b/build/ci/drone.yml @@ -5,7 +5,7 @@ name: default steps: - name: init - image: golang + image: golang:1.18.0-alpine3.14 volumes: - name: deps path: /go @@ -14,7 +14,7 @@ steps: - make gen - name: test - image: golang + image: golang:1.18.0-alpine3.14 volumes: - name: deps path: /go @@ -24,7 +24,7 @@ steps: - init - name: build - image: golang + image: golang:1.18.0-alpine3.14 volumes: - name: deps path: /go From 4358d13b0df2e054d6f4a963ad0f8ece153b88d8 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 03:46:50 +0500 Subject: [PATCH 3/7] :construction_worker: Use plain go commands in Drone --- build/ci/drone.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/ci/drone.yml b/build/ci/drone.yml index 8979091..e4ac290 100644 --- a/build/ci/drone.yml +++ b/build/ci/drone.yml @@ -10,8 +10,8 @@ steps: - name: deps path: /go commands: - - make dep - - make gen + - go mod download + - go generate ./internal/... - name: test image: golang:1.18.0-alpine3.14 @@ -19,7 +19,7 @@ steps: - name: deps path: /go commands: - - make test + - go test -v -race -cover ./... depends_on: - init @@ -29,7 +29,7 @@ steps: - name: deps path: /go commands: - - make build + - go build depends_on: - init - test From 746fb0996f67bb96bfdb3907a04554c72fad20f8 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 04:08:41 +0500 Subject: [PATCH 4/7] :green_heart: Disable VCS build metadata in test step of Drone pipeline --- build/ci/drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci/drone.yml b/build/ci/drone.yml index e4ac290..6460a73 100644 --- a/build/ci/drone.yml +++ b/build/ci/drone.yml @@ -19,7 +19,7 @@ steps: - name: deps path: /go commands: - - go test -v -race -cover ./... + - go test -buildvcs=false -v -race -cover ./... depends_on: - init From 7248dd093a295a1a6696a9609f7e7b3c7a93d5db Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 04:22:07 +0500 Subject: [PATCH 5/7] :green_heart: Disable race detection in test step of Drone pipeline --- build/ci/drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci/drone.yml b/build/ci/drone.yml index 6460a73..f9b3f9f 100644 --- a/build/ci/drone.yml +++ b/build/ci/drone.yml @@ -19,7 +19,7 @@ steps: - name: deps path: /go commands: - - go test -buildvcs=false -v -race -cover ./... + - go test -buildvcs=false -v -cover ./... depends_on: - init From 400fb299dd3605bae91153e5ecdbeb9b37b11fa3 Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 17:16:19 +0500 Subject: [PATCH 6/7] :green_heart: Added CGO_ENABLED environment variable in Drone pipeline steps --- build/ci/drone.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build/ci/drone.yml b/build/ci/drone.yml index f9b3f9f..82d9bd9 100644 --- a/build/ci/drone.yml +++ b/build/ci/drone.yml @@ -18,6 +18,8 @@ steps: volumes: - name: deps path: /go + environment: + CGO_ENABLED: 0 commands: - go test -buildvcs=false -v -cover ./... depends_on: @@ -28,6 +30,8 @@ steps: volumes: - name: deps path: /go + environment: + CGO_ENABLED: 0 commands: - go build depends_on: From 70a87c17b37139c6e1c00094f119af1cdf5a18ee Mon Sep 17 00:00:00 2001 From: Maxim Lebedev Date: Sat, 19 Mar 2022 19:32:01 +0500 Subject: [PATCH 7/7] :green_heart: Disable VCS build metadata in build step of Drone pipeline --- build/ci/drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci/drone.yml b/build/ci/drone.yml index 82d9bd9..3815594 100644 --- a/build/ci/drone.yml +++ b/build/ci/drone.yml @@ -33,7 +33,7 @@ steps: environment: CGO_ENABLED: 0 commands: - - go build + - go build -buildvcs=false depends_on: - init - test