File tree Expand file tree Collapse file tree 5 files changed +114
-1
lines changed Expand file tree Collapse file tree 5 files changed +114
-1
lines changed Original file line number Diff line number Diff line change 1515 - main
1616
1717jobs :
18+ tidy :
19+ runs-on : ubuntu-latest
20+ steps :
21+ - uses : actions/checkout@v3
22+ - uses : actions/setup-go@v3
23+ with :
24+ go-version : ' ^1.19.4'
25+ - uses : actions/cache@v3
26+ with :
27+ path : ~/go/pkg/mod
28+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+ restore-keys : |
30+ ${{ runner.os }}-go-
31+ - name : Tidy
32+ run : make gotidy
33+ working-directory : collector
34+ test :
35+ runs-on : ubuntu-latest
36+ steps :
37+ - uses : actions/checkout@v3
38+ - uses : actions/setup-go@v3
39+ with :
40+ go-version : ' ^1.19.4'
41+ - uses : actions/cache@v3
42+ with :
43+ path : ~/go/pkg/mod
44+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
45+ restore-keys : |
46+ ${{ runner.os }}-go-
47+ - name : Run tests
48+ run : make gotest
49+ working-directory : collector
1850 build :
1951 runs-on : ubuntu-latest
52+ needs : [test, tidy]
2053 strategy :
2154 matrix :
2255 architecture : [ amd64, arm64 ]
Original file line number Diff line number Diff line change 1+ include ./Makefile.Common
2+
13BASE_SPACE: =$(shell pwd)
24BUILD_SPACE: =$(BASE_SPACE ) /build
35BUCKET_NAME: =lambda-artifacts-$(shell dd if=/dev/random bs=8 count=1 2>/dev/null | od -An -tx1 | tr -d ' \t\n')
@@ -12,6 +14,20 @@ BUILD_INFO_IMPORT_PATH=main
1214LDFLAGS =-ldflags "-s -w -X $(BUILD_INFO_IMPORT_PATH ) .GitHash=$(GIT_SHA ) -X $(BUILD_INFO_IMPORT_PATH ) .Version=$(VERSION ) \
1315-X github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter.collectorDistribution=opentelemetry-collector-lambda"
1416
17+ ALL_MODULES := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort | egrep '^./' )
18+
19+ GOMODULES = $(ALL_MODULES ) $(PWD )
20+
21+ # Define a delegation target for each module
22+ .PHONY : $(GOMODULES )
23+ $(GOMODULES ) :
24+ @echo " Running target '$( TARGET) ' in module '$@ '"
25+ $(MAKE ) -C $@ $(TARGET )
26+
27+ # Triggers each module's delegation target
28+ .PHONY : for-all-target
29+ for-all-target : $(GOMODULES )
30+
1531clean :
1632 rm -rf build/
1733
@@ -35,3 +51,11 @@ publish-layer: package
3551 aws s3 rm s3://$(BUCKET_NAME ) /collector-extension.zip
3652 aws s3 rb s3://$(BUCKET_NAME )
3753 @echo OpenTelemetry Collector layer published.
54+
55+ .PHONY : gotidy
56+ gotidy :
57+ @$(MAKE ) for-all-target TARGET=" tidy"
58+
59+ .PHONY : gotest
60+ gotest :
61+ @$(MAKE ) for-all-target TARGET=" test"
Original file line number Diff line number Diff line change 1+ # ALL_PKGS is the list of all packages where ALL_SRC files reside.
2+ ALL_PKGS := $(sort $(shell go list ./...))
3+
4+ GOTEST_OPT?= -race -timeout 120s
5+ GOCMD?= go
6+ GOTEST=$(GOCMD) test
7+ GO_ACC=go-acc
8+ LINT=golangci-lint
9+ IMPI=impi
10+
11+ GOOS := $(shell $(GOCMD) env GOOS)
12+ GOARCH := $(shell $(GOCMD) env GOARCH)
13+ GH := $(shell which gh)
14+
15+ .PHONY: test
16+ test:
17+ $(GOTEST) $(GOTEST_OPT) ./...
18+
19+ .PHONY: test-with-cover
20+ test-with-cover:
21+ $(GO_ACC) --output=coverage.out ./...
22+
23+ .PHONY: benchmark
24+ benchmark:
25+ $(GOTEST) -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -run=notests ./
26+
27+ .PHONY: fmt
28+ fmt:
29+ gofmt -w -s ./
30+ goimports -w -local github.com/open-telemetry/opentelemetry-lambda/collector ./
31+
32+ .PHONY: tidy
33+ tidy:
34+ rm -fr go.sum
35+ $(GOCMD) mod tidy -compat=1.18
36+
37+ .PHONY: lint
38+ lint:
39+ $(LINT) run
40+
41+ .PHONY: generate
42+ generate:
43+ $(GOCMD) generate ./...
44+
45+ .PHONY: impi
46+ impi:
47+ @$(IMPI) --local github.com/open-telemetry/opentelemetry-lambda/collector --scheme stdThirdPartyLocal ./...
48+
49+ .PHONY: moddownload
50+ moddownload:
51+ $(GOCMD) mod download
52+
53+ .PHONY: align
54+ align:
55+ -fieldalignment -fix .
Original file line number Diff line number Diff line change 1+ include ../Makefile.Common
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ require (
1010 github.com/open-telemetry/opentelemetry-collector-contrib/processor/probabilisticsamplerprocessor v0.68.0
1111 github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourceprocessor v0.68.0
1212 github.com/open-telemetry/opentelemetry-collector-contrib/processor/spanprocessor v0.68.0
13+ go.opentelemetry.io/collector v0.68.0
1314 go.opentelemetry.io/collector/component v0.68.0
1415 go.opentelemetry.io/collector/exporter/loggingexporter v0.68.0
1516 go.opentelemetry.io/collector/exporter/otlpexporter v0.68.0
@@ -74,7 +75,6 @@ require (
7475 github.com/tidwall/wal v1.1.7 // indirect
7576 github.com/yusufpapurcu/wmi v1.2.2 // indirect
7677 go.opencensus.io v0.24.0 // indirect
77- go.opentelemetry.io/collector v0.68.0 // indirect
7878 go.opentelemetry.io/collector/confmap v0.68.0 // indirect
7979 go.opentelemetry.io/collector/consumer v0.68.0 // indirect
8080 go.opentelemetry.io/collector/featuregate v0.68.0 // indirect
You can’t perform that action at this time.
0 commit comments