From 106fb4141363fc5ca72c8a1a92f0c422a0686af8 Mon Sep 17 00:00:00 2001 From: Michael Dockter Date: Wed, 18 Oct 2023 07:27:43 -0700 Subject: [PATCH] 59.dockter.1 (#64) * #59 Update dependencies * #59 Prepare for versioned release --- ...-dependabot-request-to-project-t-comm.yaml | 3 ++ .../add-issue-to-project-t-comm.yaml | 3 ++ .github/workflows/add-triage-label.yaml | 2 + .github/workflows/go-test-darwin.yaml | 7 +-- .github/workflows/go-test-linux.yaml | 7 +-- .github/workflows/go-test-windows.yaml | 7 +-- .github/workflows/gosec.yaml | 2 + .github/workflows/identify-customer.yaml | 3 ++ CHANGELOG.md | 14 ++++++ Dockerfile | 17 +++---- Makefile | 37 +++++++--------- Makefile.darwin | 44 ++++++++++++++++--- Makefile.linux | 39 +++++++++++++--- Makefile.windows | 37 +++++++++++++--- go.mod | 4 +- go.sum | 8 ++-- 16 files changed, 166 insertions(+), 68 deletions(-) diff --git a/.github/workflows/add-dependabot-request-to-project-t-comm.yaml b/.github/workflows/add-dependabot-request-to-project-t-comm.yaml index fb86fc1..5d9cbcb 100644 --- a/.github/workflows/add-dependabot-request-to-project-t-comm.yaml +++ b/.github/workflows/add-dependabot-request-to-project-t-comm.yaml @@ -2,14 +2,17 @@ # - https://github.com/srggrs/assign-one-project-github-action name: add-dependabot-request-to-project-t-comm.yaml + on: pull_request: types: - opened - reopened + env: GITHUB_TOKEN: ${{ secrets.SENZING_GITHUB_ACCESS_TOKEN }} CREATOR: ${{ github.event.pull_request.user.login }} + jobs: add-dependabot-request-to-project: name: Add dependabot pull request to Senzing Community project diff --git a/.github/workflows/add-issue-to-project-t-comm.yaml b/.github/workflows/add-issue-to-project-t-comm.yaml index 8bbabfd..978d2b1 100644 --- a/.github/workflows/add-issue-to-project-t-comm.yaml +++ b/.github/workflows/add-issue-to-project-t-comm.yaml @@ -2,13 +2,16 @@ # - https://github.com/srggrs/assign-one-project-github-action name: add-issue-to-project-t-comm.yaml + on: issues: types: - reopened - opened + env: GITHUB_TOKEN: ${{ secrets.SENZING_GITHUB_ACCESS_TOKEN }} + jobs: add-issue-to-project: name: Add issue to Senzing Community project diff --git a/.github/workflows/add-triage-label.yaml b/.github/workflows/add-triage-label.yaml index cb1c77f..bdbefae 100644 --- a/.github/workflows/add-triage-label.yaml +++ b/.github/workflows/add-triage-label.yaml @@ -3,11 +3,13 @@ # - https://github.com/andymckay/labeler name: add-triage-label.yaml + on: issues: types: - reopened - opened + jobs: add-triage-label: name: Add triage label to issue diff --git a/.github/workflows/go-test-darwin.yaml b/.github/workflows/go-test-darwin.yaml index 1571b78..db29ac2 100644 --- a/.github/workflows/go-test-darwin.yaml +++ b/.github/workflows/go-test-darwin.yaml @@ -6,12 +6,13 @@ name: go-test-darwin.yaml on: [push] jobs: - build: - runs-on: macos-latest + go-test-darwin: + runs-on: ${{ matrix.os }} strategy: matrix: go: ["1.21"] - name: Go ${{ matrix.go }} - darwin + os: [macos-latest] + name: "go test with OS: ${{ matrix.os }}; Go: ${{ matrix.go }}" steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/go-test-linux.yaml b/.github/workflows/go-test-linux.yaml index b930c3e..a5acfa8 100644 --- a/.github/workflows/go-test-linux.yaml +++ b/.github/workflows/go-test-linux.yaml @@ -6,12 +6,13 @@ name: go-test-linux.yaml on: [push] jobs: - build: - runs-on: ubuntu-latest + go-test-linux: + runs-on: ${{ matrix.os }} strategy: matrix: go: ["1.21"] - name: Go ${{ matrix.go }} - linux + os: [ubuntu-latest] + name: "go test with OS: ${{ matrix.os }}; Go: ${{ matrix.go }}" steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/go-test-windows.yaml b/.github/workflows/go-test-windows.yaml index 187b0fc..ca6fe9d 100644 --- a/.github/workflows/go-test-windows.yaml +++ b/.github/workflows/go-test-windows.yaml @@ -6,12 +6,13 @@ name: go-test-windows.yaml on: [push] jobs: - build: - runs-on: windows-latest + go-test-windows: + runs-on: ${{ matrix.os }} strategy: matrix: go: ["1.21"] - name: Go ${{ matrix.go }} - windows + os: [windows-latest] + name: "go test with OS: ${{ matrix.os }}; Go: ${{ matrix.go }}" steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/gosec.yaml b/.github/workflows/gosec.yaml index 42443d8..a4dc82c 100644 --- a/.github/workflows/gosec.yaml +++ b/.github/workflows/gosec.yaml @@ -2,6 +2,7 @@ # - https://github.com/securego/gosec name: gosec.yaml + on: push: branches: @@ -9,6 +10,7 @@ on: pull_request: branches: - main + jobs: gosec: runs-on: ubuntu-latest diff --git a/.github/workflows/identify-customer.yaml b/.github/workflows/identify-customer.yaml index 8770e6d..2e9a0da 100644 --- a/.github/workflows/identify-customer.yaml +++ b/.github/workflows/identify-customer.yaml @@ -1,12 +1,15 @@ name: identify-customer.yaml + on: issues: types: - opened + env: GITHUB_TOKEN: ${{ secrets.ORG_MEMBERSHIP_TOKEN }} MEMBER_LIST: ${{ secrets.SENZING_MEMBERS }} CREATOR: ${{ github.actor }} + jobs: identify-customer: name: Add customer-submission label diff --git a/CHANGELOG.md b/CHANGELOG.md index 931d52f..01dcd88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - +## [0.1.4] - 2023-10-18 + +### Changed in 0.1.4 + +- Refactor to [template-go](https://github.com/Senzing/template-go) +- Update dependencies + - github.com/aws/aws-sdk-go-v2 v1.21.2 + - github.com/aws/aws-sdk-go-v2/config v1.19.0 + - github.com/aws/aws-sdk-go-v2/service/sqs v1.24.7 + - github.com/rabbitmq/amqp091-go v1.9.0 + - github.com/senzing/g2-sdk-go v0.7.4 + - github.com/senzing/go-common v0.3.1 + - github.com/senzing/go-logging v1.3.3 + ## [0.1.3] - 2023-08-16 ### Changed in 0.1.3 diff --git a/Dockerfile b/Dockerfile index 15fa592..4f041ec 100755 --- a/Dockerfile +++ b/Dockerfile @@ -3,39 +3,32 @@ # ----------------------------------------------------------------------------- ARG IMAGE_GO_BUILDER=golang:1.21.0-bullseye -ARG IMAGE_FINAL=senzing/senzingapi-runtime:3.6.0 +ARG IMAGE_FINAL=senzing/senzingapi-runtime:3.7.1 # ----------------------------------------------------------------------------- # Stage: go_builder # ----------------------------------------------------------------------------- FROM ${IMAGE_GO_BUILDER} as go_builder -ENV REFRESHED_AT=2023-08-01 +ENV REFRESHED_AT=2023-10-02 LABEL Name="senzing/go-queueing-builder" \ Maintainer="support@senzing.com" \ Version="0.0.5" -# Build arguments. - -ARG PROGRAM_NAME="unknown" -ARG BUILD_VERSION=0.0.0 -ARG BUILD_ITERATION=0 -ARG GO_PACKAGE_NAME="unknown" - # Copy local files from the Git repository. COPY ./rootfs / -COPY . ${GOPATH}/src/${GO_PACKAGE_NAME} +COPY . ${GOPATH}/src/go-queueing # Build go program. -WORKDIR ${GOPATH}/src/${GO_PACKAGE_NAME} +WORKDIR ${GOPATH}/src/go-queueing RUN make build # Copy binaries to /output. RUN mkdir -p /output \ - && cp -R ${GOPATH}/src/${GO_PACKAGE_NAME}/target/* /output/ + && cp -R ${GOPATH}/src/go-queueing/target/* /output/ # ----------------------------------------------------------------------------- # Stage: final diff --git a/Makefile b/Makefile index d5b731d..9f535c3 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,6 @@ GO_PACKAGE_NAME := $(shell echo $(GIT_REMOTE_URL) | sed -e 's|^git@github.com:|g # Recursive assignment ('=') -CC = gcc GO_OSARCH = $(subst /, ,$@) GO_OS = $(word 1, $(GO_OSARCH)) GO_ARCH = $(word 2, $(GO_OSARCH)) @@ -55,6 +54,10 @@ default: help -include Makefile.$(OSTYPE) -include Makefile.$(OSTYPE)_$(OSARCH) + +.PHONY: hello-world +hello-world: hello-world-osarch-specific + # ----------------------------------------------------------------------------- # Dependency management # ----------------------------------------------------------------------------- @@ -67,17 +70,19 @@ dependencies: # ----------------------------------------------------------------------------- # Build -# - The "build" target is implemented in Makefile.OS.ARCH files. # - docker-build: https://docs.docker.com/engine/reference/commandline/build/ # ----------------------------------------------------------------------------- PLATFORMS := darwin/amd64 linux/amd64 windows/amd64 $(PLATFORMS): @echo Building $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME) - @mkdir -p $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH) || true @GOOS=$(GO_OS) GOARCH=$(GO_ARCH) go build -o $(TARGET_DIRECTORY)/$(GO_OS)-$(GO_ARCH)/$(PROGRAM_NAME) +.PHONY: build +build: build-osarch-specific + + .PHONY: build-all $(PLATFORMS) build-all: $(PLATFORMS) @mv $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME).exe @@ -86,11 +91,6 @@ build-all: $(PLATFORMS) .PHONY: docker-build docker-build: @docker build \ - --build-arg BUILD_ITERATION=$(BUILD_ITERATION) \ - --build-arg BUILD_VERSION=$(BUILD_VERSION) \ - --build-arg GO_PACKAGE_NAME=$(GO_PACKAGE_NAME) \ - --build-arg PROGRAM_NAME=$(PROGRAM_NAME) \ - --file Dockerfile \ --tag $(DOCKER_IMAGE_NAME) \ --tag $(DOCKER_IMAGE_NAME):$(BUILD_VERSION) \ . @@ -100,8 +100,7 @@ docker-build: # ----------------------------------------------------------------------------- .PHONY: test -test: - @go test -v -p 1 ./... +test: test-osarch-specific # ----------------------------------------------------------------------------- # Run @@ -111,18 +110,17 @@ test: docker-run: @docker run \ --interactive \ + --rm \ --tty \ --name $(DOCKER_CONTAINER_NAME) \ $(DOCKER_IMAGE_NAME) .PHONY: run -run: - @go run main.go +run: run-osarch-specific # ----------------------------------------------------------------------------- # Package -# - The "package" target is implemented in Makefile.OS.ARCH files. # ----------------------------------------------------------------------------- .PHONY: docker-build-package @@ -137,18 +135,18 @@ docker-build-package: --tag $(DOCKER_BUILD_IMAGE_NAME) \ . + +.PHONY: package +package: package-osarch-specific + # ----------------------------------------------------------------------------- # Utility targets # ----------------------------------------------------------------------------- .PHONY: clean -clean: +clean: clean-osarch-specific @go clean -cache @go clean -testcache - @docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true - @docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true - @rm -rf $(TARGET_DIRECTORY) || true - @rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true .PHONY: help @@ -166,8 +164,7 @@ print-make-variables: .PHONY: setup -setup: - @echo "No setup required." +setup: setup-osarch-specific .PHONY: update-pkg-cache diff --git a/Makefile.darwin b/Makefile.darwin index d03e58a..74cd752 100644 --- a/Makefile.darwin +++ b/Makefile.darwin @@ -1,19 +1,49 @@ # Makefile extensions for darwin. # ----------------------------------------------------------------------------- -# Makefile targets supported by all platforms. +# Variables # ----------------------------------------------------------------------------- -.PHONY: hello-world -hello-world: - @echo "Hello World, from darwin." +SENZING_DIR ?= /opt/senzing/g2 +SENZING_TOOLS_SENZING_DIRECTORY ?= $(SENZING_DIR) + +LD_LIBRARY_PATH := $(SENZING_TOOLS_SENZING_DIRECTORY)/lib:$(SENZING_TOOLS_SENZING_DIRECTORY)/lib/macos +DYLD_LIBRARY_PATH := $(LD_LIBRARY_PATH) # ----------------------------------------------------------------------------- -# Build +# OS-ARCH specific targets # ----------------------------------------------------------------------------- -.PHONY: build -build: darwin/amd64 +.PHONY: build-osarch-specific +build-osarch-specific: darwin/amd64 + + +.PHONY: clean-osarch-specific +clean-osarch-specific: + @docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true + @docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true + @rm -rf $(TARGET_DIRECTORY) || true + @rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true + + +.PHONY: hello-world-osarch-specific +hello-world-osarch-specific: + @echo "Hello World, from darwin." + + +.PHONY: run-osarch-specific +run-osarch-specific: + @go run -exec macos_exec_dyld.sh main.go + + +.PHONY: setup-osarch-specific +setup-osarch-specific: + @echo "No setup required." + + +.PHONY: test-osarch-specific +test-osarch-specific: + @go test -exec macos_exec_dyld.sh -v -p 1 ./... # ----------------------------------------------------------------------------- # Makefile targets supported only by this platform. diff --git a/Makefile.linux b/Makefile.linux index 741c682..a3172d8 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -1,19 +1,44 @@ # Makefile extensions for linux. # ----------------------------------------------------------------------------- -# Makefile targets supported by all platforms. +# Variables # ----------------------------------------------------------------------------- -.PHONY: hello-world -hello-world: - @echo "Hello World, from linux." # ----------------------------------------------------------------------------- -# Build +# OS-ARCH specific targets # ----------------------------------------------------------------------------- -.PHONY: build -build: linux/amd64 +.PHONY: build-osarch-specific +build-osarch-specific: linux/amd64 + + +.PHONY: clean-osarch-specific +clean-osarch-specific: + @docker rm --force $(DOCKER_CONTAINER_NAME) 2> /dev/null || true + @docker rmi --force $(DOCKER_IMAGE_NAME) $(DOCKER_BUILD_IMAGE_NAME) 2> /dev/null || true + @rm -rf $(TARGET_DIRECTORY) || true + @rm -f $(GOPATH)/bin/$(PROGRAM_NAME) || true + + +.PHONY: hello-world-osarch-specific +hello-world-osarch-specific: + @echo "Hello World, from linux." + + +.PHONY: run-osarch-specific +run-osarch-specific: + @go run main.go + + +.PHONY: setup-osarch-specific +setup-osarch-specific: + @echo "No setup required." + + +.PHONY: test-osarch-specific +test-osarch-specific: + @go test -v -p 1 ./... # ----------------------------------------------------------------------------- # Makefile targets supported only by this platform. diff --git a/Makefile.windows b/Makefile.windows index 3a3dbcb..387042d 100644 --- a/Makefile.windows +++ b/Makefile.windows @@ -1,21 +1,44 @@ # Makefile extensions for windows. # ----------------------------------------------------------------------------- -# Makefile targets supported by all platforms. +# Variables # ----------------------------------------------------------------------------- -.PHONY: hello-world -hello-world: - @echo "Hello World, from windows." # ----------------------------------------------------------------------------- -# Build +# OS-ARCH specific targets # ----------------------------------------------------------------------------- -.PHONY: build -build: windows/amd64 +.PHONY: build-osarch-specific +build-osarch-specific: windows/amd64 @mv $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME).exe + +.PHONY: clean-osarch-specific +clean-osarch-specific: + del /F /S /Q $(TARGET_DIRECTORY) + del /F /S /Q $(GOPATH)/bin/$(PROGRAM_NAME) + + +.PHONY: hello-world-osarch-specific +hello-world-osarch-specific: + @echo "Hello World, from windows." + + +.PHONY: run-osarch-specific +run-osarch-specific: + @go run main.go + + +.PHONY: setup-osarch-specific +setup-osarch-specific: + @echo "No setup required." + + +.PHONY: test-osarch-specific +test-osarch-specific: + @go test -v -p 1 ./... + # ----------------------------------------------------------------------------- # Makefile targets supported only by this platform. # ----------------------------------------------------------------------------- diff --git a/go.mod b/go.mod index 557d918..05ae492 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a // indirect - google.golang.org/grpc v1.58.3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect ) diff --git a/go.sum b/go.sum index 92cb2fd..f9148b7 100644 --- a/go.sum +++ b/go.sum @@ -76,10 +76,10 @@ golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a h1:a2MQQVoTo96JC9PMGtGBymLp7+/RzpFc2yX/9WfFg1c= -google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:4cYg8o5yUbm77w8ZX00LhMVNl/YVBFJRYWDc0uYWMs0= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=