Skip to content

Commit d1a8202

Browse files
authored
Tests: fix Github workflows (#294)
* CI: Update dependency retrieval for examples * CI: Tidy up internal/build before linting
1 parent ea31bd1 commit d1a8202

File tree

10 files changed

+35
-10
lines changed

10 files changed

+35
-10
lines changed

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ test-examples: ## Execute the _examples
101101
printf "\033[2m────────────────────────────────────────────────────────────────────────────────\n"; \
102102
printf "\033[1mUpdating dependencies for $$d\033[0m\n"; \
103103
printf "\033[2m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \
104-
(cd $$d && go mod download) || \
104+
(cd $$d && go mod download && make setup) || \
105105
( \
106106
printf "\033[31m────────────────────────────────────────────────────────────────────────────────\033[0m\n"; \
107107
printf "\033[31;1m⨯ ERROR\033[0m\n"; \
@@ -152,7 +152,7 @@ lint: ## Run lint on the package
152152
set -e ; \
153153
trap "test -d ../../../.git && git checkout --quiet go.mod" INT TERM EXIT; \
154154
echo "cd internal/build/ && go vet ./..."; \
155-
cd "internal/build/" && go mod download && go vet ./...; \
155+
cd "internal/build/" && go mod tidy && go mod download && go vet ./...; \
156156
}
157157

158158

_examples/bulk/Makefile

+6-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ test-benchmarks: clean setup
1313

1414
setup:
1515
@go get -u github.com/mailru/easyjson/...
16-
cd benchmarks && go generate ./model
16+
@go mod download github.com/dustin/go-humanize
17+
@go mod download github.com/cenkalti/backoff/v4
18+
@cd benchmarks && \
19+
go mod download && \
20+
go mod download github.com/mailru/easyjson && \
21+
go generate ./model
1722

1823
clean:
1924
@rm -f benchmarks/model/*_easyjson.go

_examples/cloudfunction/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ GO_TEST_CMD = $(if $(shell which richgo),richgo test,go test)
33
test: ## Run tests
44
$(GO_TEST_CMD) -v ./...
55

6-
.PHONY: test
6+
setup:
7+
8+
.PHONY: test setup

_examples/encoding/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ bench: clean setup # Run benchmarks
1010

1111
setup: ## Install & Setup
1212
@go get -u github.com/mailru/easyjson/...
13+
@go mod tidy
14+
@go mod download
1315
go generate ./model
1416

1517
clean: ## Remove artifacts

_examples/extension/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ GO_TEST_CMD = $(if $(shell which richgo),richgo test,go test)
33
test: ## Run tests
44
go run main.go
55

6-
.PHONY: test
6+
setup:
7+
8+
.PHONY: test setup

_examples/fasthttp/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,8 @@ test: ## Run tests
66
bench: ## Run benchmarks
77
$(GO_TEST_CMD) -run=none -bench=. -benchmem -benchtime=10s -v fasthttp_benchmark_test.go
88

9-
.PHONY: test bench
9+
setup:
10+
@go mod tidy
11+
@go mod download
12+
13+
.PHONY: test bench setup

_examples/instrumentation/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ test:
33
go build -o /dev/null opencensus.go
44
go build -o /dev/null apmelasticsearch.go
55

6-
.PHONY: test
6+
setup:
7+
@go mod tidy
8+
@go mod download
9+
10+
.PHONY: test setup

_examples/logging/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ test: ## Run tests
44
go run default.go
55
go run custom.go
66

7-
.PHONY: test
7+
setup:
8+
9+
.PHONY: test setup

_examples/security/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ certificates-clean:
3131
cluster-clean:
3232
docker-compose --file elasticsearch-cluster.yml down --volumes
3333

34-
.PHONY: test test-integ certificates cluster certificates-clean cluster-clean
34+
setup:
35+
36+
.PHONY: test test-integ certificates cluster certificates-clean cluster-clean setup

_examples/xkcdsearch/Makefile

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ GO_TEST_CMD = $(if $(shell which richgo),richgo test,go test)
33
test: ## Run tests
44
$(GO_TEST_CMD) -v ./...
55

6-
.PHONY: test
6+
setup:
7+
8+
.PHONY: test setup

0 commit comments

Comments
 (0)