Skip to content

Commit

Permalink
[AUTOPR] Automatic Update (Vonage#293)
Browse files Browse the repository at this point in the history
* New targets to update go and golangci-linter

* Update dependencies


---------

Co-authored-by: nicolaasuni-vonage <[email protected]>
  • Loading branch information
github-actions[bot] and nicolaasuni-vonage authored Oct 3, 2024
1 parent 52e58de commit ab94577
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/depsupdate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
git checkout -B ${{ env.BRANCH_NAME }}
git reset origin/main --hard
- name: update dependencies
run: make modupdate x
run: make updateall x
- name: commit changes
run: |
if [[ -n $(git status | grep -q '"git add"') ]]; then
Expand Down
70 changes: 46 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,25 @@ help:
@echo "GOPATH=$(GOPATH)"
@echo "The following commands are available:"
@echo ""
@echo " make clean : Remove any build artifact"
@echo " make coverage : Generate the coverage report"
@echo " make dbuild : Build everything inside a Docker container"
@echo " make deps : Get dependencies"
@echo " make example : Build and test the service example"
@echo " make format : Format the source code"
@echo " make generate : Generate go code automatically"
@echo " make linter : Check code against multiple linters"
@echo " make mod : Download dependencies"
@echo " make modupdate : Update dependencies"
@echo " make project : Generate a new project from the example using the data set via CONFIG=project.cfg"
@echo " make qa : Run all tests and static analysis tools"
@echo " make tag : Tag the Git repository"
@echo " make test : Run unit tests"
@echo " make version : Update this library version in the examples"
@echo " make versionup : Increase the patch number in the VERSION file"
@echo " make clean : Remove any build artifact"
@echo " make coverage : Generate the coverage report"
@echo " make dbuild : Build everything inside a Docker container"
@echo " make deps : Get dependencies"
@echo " make example : Build and test the service example"
@echo " make format : Format the source code"
@echo " make generate : Generate go code automatically"
@echo " make linter : Check code against multiple linters"
@echo " make mod : Download dependencies"
@echo " make project : Generate a new project from the example using the data set via CONFIG=project.cfg"
@echo " make qa : Run all tests and static analysis tools"
@echo " make tag : Tag the Git repository"
@echo " make test : Run unit tests"
@echo " make updateall : Update everything"
@echo " make updatego : Update Go version"
@echo " make updatelint : Update golangci-lint version"
@echo " make updatemod : Update dependencies"
@echo " make version : Update this library version in the examples"
@echo " make versionup : Increase the patch number in the VERSION file"
@echo ""
@echo "Use DEVMODE=LOCAL for human friendly output."
@echo ""
Expand Down Expand Up @@ -196,13 +199,6 @@ linter:
mod:
$(GO) mod download all

# Update dependencies
.PHONY: modupdate
modupdate:
# $(GO) get $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
$(GO) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' go.mod)
cd examples/service && make modupdate

# Create a new project based on the example template
.PHONY: project
project:
Expand Down Expand Up @@ -249,6 +245,32 @@ test: ensuretarget
-v $(GOPKGS) $(TESTEXTRACMD)
@echo -e "\n\n>>> END: Unit Tests <<<\n\n"

# Update everything
.PHONY: updateall
updateall: updatego updatelint updatemod

# Update go version
.PHONY: updatego
updatego:
$(eval LAST_GO_TOOLCHAIN=$(shell curl -s https://go.dev/dl/ | grep -oP 'go[0-9]+\.[0-9]+\.[0-9]+\.linux-amd64\.tar\.gz' | head -n 1 | grep -oP 'go[0-9]+\.[0-9]+\.[0-9]+'))
$(eval LAST_GO_VERSION=$(shell echo ${LAST_GO_TOOLCHAIN} | grep -oP '[0-9]+\.[0-9]+'))
sed -i "s|^go [0-9]*\.[0-9]*$$|go ${LAST_GO_VERSION}|g" go.mod
sed -i "s|^toolchain go[0-9]*\.[0-9]*\.[0-9]*$$|toolchain ${LAST_GO_TOOLCHAIN}|g" go.mod
cd examples/service && make updatego

# Update linter version
.PHONY: updatelint
updatelint:
$(eval LAST_GOLANGCILINT_VERSION=$(shell curl -sL https://github.com/golangci/golangci-lint/releases/latest | grep -oP '<title>Release \Kv[0-9]+\.[0-9]+\.[0-9]+'))
sed -i "s|^GOLANGCILINTVERSION=v[0-9]*\.[0-9]*\.[0-9]*$$|GOLANGCILINTVERSION=${LAST_GOLANGCILINT_VERSION}|g" Makefile
cd examples/service && make updatelint

# Update dependencies
.PHONY: updatemod
updatemod:
$(GO) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' go.mod)
cd examples/service && make updatemod

# Set the gosrvlib version in the example go.mod
.PHONY: version
version:
Expand All @@ -257,5 +279,5 @@ version:
# Increase the patch number in the VERSION file
.PHONY: versionup
versionup:
echo ${VERSION} | gawk -F. '{printf("%d.%d.%d",$$1,$$2,(($$3+1)));}' > VERSION
echo ${VERSION} | gawk -F. '{printf("%d.%d.%d\n",$$1,$$2,(($$3+1)));}' > VERSION
$(MAKE) version
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.101.2
1.101.3
87 changes: 57 additions & 30 deletions examples/service/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -276,30 +276,34 @@ help:
@echo "GOPATH=$(GOPATH)"
@echo "The following commands are available:"
@echo ""
@echo " make apitest : Execute API tests"
@echo " make buildall : Full build and test sequence"
@echo " make build : Compile the application"
@echo " make clean : Remove any build artifact"
@echo " make confcheck : Check the configuration files"
@echo " make coverage : Generate the coverage report"
@echo " make dbuild : Build everything inside a Docker container"
@echo " make deb : Build a DEB package"
@echo " make deps : Get dependencies"
@echo " make docker : Build a scratch docker container to run this service"
@echo " make dockerpromote : Promote docker image from DEV to PROD reporitory"
@echo " make dockerpush : Push docker container to a remote repository"
@echo " make dockertest : Test the newly built docker container"
@echo " make format : Format the source code"
@echo " make generate : Generate go code automatically"
@echo " make gendoc : Generate static documentation from /doc/src"
@echo " make install : Install this application"
@echo " make linter : Check code against multiple linters"
@echo " make mod : Download dependencies"
@echo " make modupdate : Update dependencies"
@echo " make openapitest : Test the OpenAPI specification"
@echo " make qa : Run all tests and static analysis tools"
@echo " make rpm : Build an RPM package"
@echo " make test : Run unit tests"
@echo " make apitest : Execute API tests"
@echo " make build : Compile the application"
@echo " make buildall : Full build and test sequence"
@echo " make clean : Remove any build artifact"
@echo " make confcheck : Check the configuration files"
@echo " make coverage : Generate the coverage report"
@echo " make dbuild : Build everything inside a Docker container"
@echo " make deb : Build a DEB package"
@echo " make deps : Get dependencies"
@echo " make docker : Build a scratch docker container to run this service"
@echo " make dockerpromote : Promote docker image from DEV to PROD reporitory"
@echo " make dockerpush : Push docker container to a remote repository"
@echo " make dockertest : Test the newly built docker container"
@echo " make format : Format the source code"
@echo " make gendoc : Generate static documentation from /doc/src"
@echo " make generate : Generate go code automatically"
@echo " make install : Install this application"
@echo " make linter : Check code against multiple linters"
@echo " make mod : Download dependencies"
@echo " make openapitest : Test the OpenAPI specification"
@echo " make qa : Run all tests and static analysis tools"
@echo " make rpm : Build an RPM package"
@echo " make test : Run unit tests"
@echo " make updateall : Update everything"
@echo " make updatego : Update Go version"
@echo " make updatelint : Update golangci-lint version"
@echo " make updatemod : Update dependencies"
@echo " make versionup : Increase the patch number in the VERSION file"
@echo ""
@echo "Use DEVMODE=LOCAL for human friendly output."
@echo ""
Expand Down Expand Up @@ -587,12 +591,6 @@ linter:
mod:
$(GO) mod download all

# Update dependencies
.PHONY: modupdate
modupdate:
# $(GO) get $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
$(GO) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' go.mod)

# Test the OpenAPI specification against the real deployed service
.PHONY: openapitest
openapitest:
Expand Down Expand Up @@ -667,6 +665,30 @@ uninstall:
rm -rf $(PATHINSTBIN)$(PROJECT)
rm -rf $(PATHINSTDOC)

# Update everything
.PHONY: updateall
updateall: updatego updatelint updatemod

# Update go version
.PHONY: updatego
updatego:
$(eval LAST_GO_TOOLCHAIN=$(shell curl -s https://go.dev/dl/ | grep -oP 'go[0-9]+\.[0-9]+\.[0-9]+\.linux-amd64\.tar\.gz' | head -n 1 | grep -oP 'go[0-9]+\.[0-9]+\.[0-9]+'))
$(eval LAST_GO_VERSION=$(shell echo ${LAST_GO_TOOLCHAIN} | grep -oP '[0-9]+\.[0-9]+'))
sed -i "s|^go [0-9]*\.[0-9]*$$|go ${LAST_GO_VERSION}|g" go.mod
sed -i "s|^toolchain go[0-9]*\.[0-9]*\.[0-9]*$$|toolchain ${LAST_GO_TOOLCHAIN}|g" go.mod

# Update linter version
.PHONY: updatelint
updatelint:
$(eval LAST_GOLANGCILINT_VERSION=$(shell curl -sL https://github.com/golangci/golangci-lint/releases/latest | grep -oP '<title>Release \Kv[0-9]+\.[0-9]+\.[0-9]+'))
sed -i "s|^GOLANGCILINTVERSION=v[0-9]*\.[0-9]*\.[0-9]*$$|GOLANGCILINTVERSION=${LAST_GOLANGCILINT_VERSION}|g" Makefile

# Update dependencies
.PHONY: updatemod
updatemod:
# $(GO) get $(shell $(GO) list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
$(GO) get -t -u ./... && go mod tidy -compat=$(shell grep -oP 'go \K[0-9]+\.[0-9]+' go.mod)

# Run venom tests (https://github.com/ovh/venom)
.PHONY: venomtest
venomtest:
Expand All @@ -678,3 +700,8 @@ venomtest:
-vv \
--output-dir=$(TARGETDIR)/report/${DEPLOY_ENV}/venom/$(API_TEST_DIR) \
resources/test/venom/$(API_TEST_DIR)/$(API_TEST_FILE)

# Increase the patch number in the VERSION file
.PHONY: versionup
versionup:
echo ${VERSION} | gawk -F. '{printf("%d.%d.%d\n",$$1,$$2,(($$3+1)));}' > VERSION
2 changes: 1 addition & 1 deletion examples/service/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ toolchain go1.23.2
replace github.com/Vonage/gosrvlib => ../..

require (
github.com/Vonage/gosrvlib v1.101.2
github.com/Vonage/gosrvlib v1.101.3
github.com/jstemmer/go-junit-report/v2 v2.1.0
github.com/prometheus/client_golang v1.20.4
github.com/rakyll/gotest v0.0.6
Expand Down
12 changes: 6 additions & 6 deletions examples/service/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20 h1:Xbwbmk44
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.20/go.mod h1:oAfOFzUB14ltPZj1rWwRc3d/6OgD76R8KlvU3EqM9Fg=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18 h1:eb+tFOIl9ZsUe2259/BKPeniKuz4/02zZFH/i4Nf8Rg=
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18/go.mod h1:GVCC2IJNJTmdlyEsSmofEy7EfJncP7DNnXDzRjJ5Keg=
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3 h1:3zt8qqznMuAZWDTDpcwv9Xr11M/lVj2FsRR7oYBt0OA=
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3/go.mod h1:NLTqRLe3pUNu3nTEHI6XlHLKYmc8fbHUdMxAB6+s41Q=
github.com/aws/aws-sdk-go-v2/service/s3 v1.64.0 h1:I0p8knB/IDYSQ3dbanaCr4UhiYQ96bvKRhGYxvLyiD8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.64.0/go.mod h1:NLTqRLe3pUNu3nTEHI6XlHLKYmc8fbHUdMxAB6+s41Q=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.3 h1:W2M3kQSuN1+FXgV2wMv1JMWPxw/37wBN87QHYDuTV0Y=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.3/go.mod h1:WyLS5qwXHtjKAONYZq/4ewdd+hcVsa3LBu77Ow5uj3k=
github.com/aws/aws-sdk-go-v2/service/sqs v1.35.3 h1:Lcs658WFW235QuUfpAdxd8RCy8Va2VUA7/U9iIrcjcY=
Expand Down Expand Up @@ -692,10 +692,10 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tecnickcom/farmhash64 v1.9.18 h1:TEe+6ZxChE1zZYTEV54CzzJSxotcOrLeGUbYDG6qW5s=
github.com/tecnickcom/farmhash64 v1.9.18/go.mod h1:OHlOaGn6L32S55+pLUJy5zSsbziPHqch5zn0c4s2DCI=
github.com/tecnickcom/statsd v1.0.20 h1:plcyFZWPj2v8NEbHp759B9MH343O8SS+VzWCgdifjMo=
github.com/tecnickcom/statsd v1.0.20/go.mod h1:AuCRXs+8OiU19wXr1owes5i9ouTCbATQQdo03Wv90Ao=
github.com/tecnickcom/farmhash64 v1.9.20 h1:sgpdkfIB/LzX+uAYKN4pcu554zWQF3T+31kTTMIakxI=
github.com/tecnickcom/farmhash64 v1.9.20/go.mod h1:OHlOaGn6L32S55+pLUJy5zSsbziPHqch5zn0c4s2DCI=
github.com/tecnickcom/statsd v1.0.22 h1:P4RKl9ZkYYebUnPEL++ZZ9aFxkKVGAysW4CiQ9rKAwI=
github.com/tecnickcom/statsd v1.0.22/go.mod h1:AuCRXs+8OiU19wXr1owes5i9ouTCbATQQdo03Wv90Ao=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926 h1:G3dpKMzFDjgEh2q1Z7zUUtKa8ViPtH+ocF0bE0g00O8=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/undefinedlabs/go-mpatch v1.0.7 h1:943FMskd9oqfbZV0qRVKOUsXQhTLXL0bQTVbQSpzmBs=
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/aperturerobotics/go-brotli-decoder v0.1.1
github.com/aws/aws-sdk-go-v2 v1.31.0
github.com/aws/aws-sdk-go-v2/config v1.27.39
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3
github.com/aws/aws-sdk-go-v2/service/s3 v1.64.0
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.35.3
github.com/aws/smithy-go v1.21.0
Expand All @@ -28,8 +28,8 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/tecnickcom/farmhash64 v1.9.18
github.com/tecnickcom/statsd v1.0.20
github.com/tecnickcom/farmhash64 v1.9.20
github.com/tecnickcom/statsd v1.0.22
github.com/undefinedlabs/go-mpatch v1.0.7
github.com/valkey-io/valkey-go v1.0.47
github.com/valkey-io/valkey-go/mock v1.0.47
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18 h1:eb+tFOIl9ZsUe
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.18/go.mod h1:GVCC2IJNJTmdlyEsSmofEy7EfJncP7DNnXDzRjJ5Keg=
github.com/aws/aws-sdk-go-v2/service/kms v1.30.1 h1:SBn4I0fJXF9FYOVRSVMWuhvEKoAHDikjGpS3wlmw5DE=
github.com/aws/aws-sdk-go-v2/service/kms v1.30.1/go.mod h1:2snWQJQUKsbN66vAawJuOGX7dr37pfOq9hb0tZDGIqQ=
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3 h1:3zt8qqznMuAZWDTDpcwv9Xr11M/lVj2FsRR7oYBt0OA=
github.com/aws/aws-sdk-go-v2/service/s3 v1.63.3/go.mod h1:NLTqRLe3pUNu3nTEHI6XlHLKYmc8fbHUdMxAB6+s41Q=
github.com/aws/aws-sdk-go-v2/service/s3 v1.64.0 h1:I0p8knB/IDYSQ3dbanaCr4UhiYQ96bvKRhGYxvLyiD8=
github.com/aws/aws-sdk-go-v2/service/s3 v1.64.0/go.mod h1:NLTqRLe3pUNu3nTEHI6XlHLKYmc8fbHUdMxAB6+s41Q=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.3 h1:W2M3kQSuN1+FXgV2wMv1JMWPxw/37wBN87QHYDuTV0Y=
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.33.3/go.mod h1:WyLS5qwXHtjKAONYZq/4ewdd+hcVsa3LBu77Ow5uj3k=
github.com/aws/aws-sdk-go-v2/service/sqs v1.35.3 h1:Lcs658WFW235QuUfpAdxd8RCy8Va2VUA7/U9iIrcjcY=
Expand Down Expand Up @@ -932,10 +932,10 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/tecnickcom/farmhash64 v1.9.18 h1:TEe+6ZxChE1zZYTEV54CzzJSxotcOrLeGUbYDG6qW5s=
github.com/tecnickcom/farmhash64 v1.9.18/go.mod h1:OHlOaGn6L32S55+pLUJy5zSsbziPHqch5zn0c4s2DCI=
github.com/tecnickcom/statsd v1.0.20 h1:plcyFZWPj2v8NEbHp759B9MH343O8SS+VzWCgdifjMo=
github.com/tecnickcom/statsd v1.0.20/go.mod h1:AuCRXs+8OiU19wXr1owes5i9ouTCbATQQdo03Wv90Ao=
github.com/tecnickcom/farmhash64 v1.9.20 h1:sgpdkfIB/LzX+uAYKN4pcu554zWQF3T+31kTTMIakxI=
github.com/tecnickcom/farmhash64 v1.9.20/go.mod h1:OHlOaGn6L32S55+pLUJy5zSsbziPHqch5zn0c4s2DCI=
github.com/tecnickcom/statsd v1.0.22 h1:P4RKl9ZkYYebUnPEL++ZZ9aFxkKVGAysW4CiQ9rKAwI=
github.com/tecnickcom/statsd v1.0.22/go.mod h1:AuCRXs+8OiU19wXr1owes5i9ouTCbATQQdo03Wv90Ao=
github.com/testcontainers/testcontainers-go v0.31.0 h1:W0VwIhcEVhRflwL9as3dhY6jXjVCA27AkmbnZ+UTh3U=
github.com/testcontainers/testcontainers-go v0.31.0/go.mod h1:D2lAoA0zUFiSY+eAflqK5mcUx/A5hrrORaEQrd0SefI=
github.com/testcontainers/testcontainers-go/modules/compose v0.31.0 h1:H74o3HisnApIDQx7sWibGzOl/Oo0By8DjyVeUf3qd6I=
Expand Down

0 comments on commit ab94577

Please sign in to comment.