Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#38 Refactor to template #39

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/add-issue-to-project-t-comm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/add-triage-label.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/go-test-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/go-test-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/go-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/gosec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
# - https://github.com/securego/gosec

name: gosec.yaml

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
gosec:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/identify-customer.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-

## [0.1.9] - 2023-10-17

### Changed in 0.1.9

- Refactor to [template-go](https://github.com/Senzing/template-go)
- Update dependencies
- github.com/senzing/go-common v0.3.1
- github.com/spf13/viper v1.17.0

## [0.1.8] - 2023-08-29

### Changed in 0.1.8
Expand Down
29 changes: 10 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -55,6 +54,10 @@ default: help
-include Makefile.$(OSTYPE)
-include Makefile.$(OSTYPE)_$(OSARCH)


.PHONY: hello-world
hello-world: hello-world-osarch-specific

# -----------------------------------------------------------------------------
# Dependency management
# -----------------------------------------------------------------------------
Expand All @@ -67,51 +70,40 @@ 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-all $(PLATFORMS)
build-all: $(PLATFORMS)
@mv $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME) $(TARGET_DIRECTORY)/windows-amd64/$(PROGRAM_NAME).exe
.PHONY: build
build: build-osarch-specific

# -----------------------------------------------------------------------------
# Test
# -----------------------------------------------------------------------------

.PHONY: test
test:
@go test -v -p 1 ./...
# @go test -v ./engineconfiguration

test: test-osarch-specific

# -----------------------------------------------------------------------------
# Run
# -----------------------------------------------------------------------------

.PHONY: run
run:
@go run main.go
run: run-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
Expand All @@ -129,8 +121,7 @@ print-make-variables:


.PHONY: setup
setup:
@echo "No setup required."
setup: setup-osarch-specific


.PHONY: update-pkg-cache
Expand Down
37 changes: 30 additions & 7 deletions Makefile.darwin
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
# Makefile extensions for darwin.

# -----------------------------------------------------------------------------
# Makefile targets supported by all platforms.
# Variables
# -----------------------------------------------------------------------------

.PHONY: hello-world
hello-world:
@echo "Hello World, from darwin."

# -----------------------------------------------------------------------------
# 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:
@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.
Expand Down
38 changes: 31 additions & 7 deletions Makefile.linux
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
# 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:
@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.
Expand Down
38 changes: 31 additions & 7 deletions Makefile.windows
Original file line number Diff line number Diff line change
@@ -1,21 +1,45 @@
# 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.
# -----------------------------------------------------------------------------
Expand Down
Loading