Skip to content

Commit

Permalink
50.dockter.1 (#54)
Browse files Browse the repository at this point in the history
* #50 Savepoint

* #50 Prepare for versioned release
  • Loading branch information
docktermj authored Oct 23, 2023
1 parent aae1a8d commit a554bbf
Show file tree
Hide file tree
Showing 20 changed files with 183 additions and 116 deletions.
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
26 changes: 0 additions & 26 deletions .github/workflows/build-docker-container.yaml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/docker-build-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: docker-build-container.yaml

on:
pull_request:
branches:
- main
workflow_dispatch:

jobs:
docker-build-container:
runs-on: ubuntu-latest
steps:
- name: Build docker image
uses: Senzing/github-action-docker-buildx-build@latest
with:
image-repository: senzing/test-ground
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go.work

# Visual Studio code
.vscode
*.code-workspace
.history

# Makefile
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-

## [0.1.4] - 2023-10-23

### Changed in 0.1.4

- Refactor to [template-go](https://github.com/Senzing/template-go)
- Update dependencies
- github.com/senzing/go-cmdhelping v0.1.9
- github.com/senzing/go-observing v0.2.8
- github.com/spf13/viper v1.17.0
- google.golang.org/grpc v1.59.0

## [0.1.3] - 2023-08-04

### Changed in 0.1.3
Expand Down
19 changes: 6 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Stages
# -----------------------------------------------------------------------------

ARG IMAGE_SENZINGAPI_RUNTIME=senzing/senzingapi-runtime:3.6.0
ARG IMAGE_SENZINGAPI_RUNTIME=senzing/senzingapi-runtime:3.7.1
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: senzingapi_runtime
Expand All @@ -17,22 +17,15 @@ FROM ${IMAGE_SENZINGAPI_RUNTIME} as senzingapi_runtime
# -----------------------------------------------------------------------------

FROM ${IMAGE_GO_BUILDER} as go_builder
ENV REFRESHED_AT=2023-08-01
ENV REFRESHED_AT=2023-10-02
LABEL Name="senzing/observe-builder" \
Maintainer="support@senzing.com" \
Version="0.1.3"

# 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/observe

# Copy files from prior stage.

Expand All @@ -45,13 +38,13 @@ ENV LD_LIBRARY_PATH=/opt/senzing/g2/lib/

# Build go program.

WORKDIR ${GOPATH}/src/${GO_PACKAGE_NAME}
WORKDIR ${GOPATH}/src/observe
RUN make build

# Copy binaries to /output.

RUN mkdir -p /output \
&& cp -R ${GOPATH}/src/${GO_PACKAGE_NAME}/target/* /output/
&& cp -R ${GOPATH}/src/observe/target/* /output/

# -----------------------------------------------------------------------------
# Stage: final
Expand Down
49 changes: 13 additions & 36 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,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
Expand All @@ -100,11 +105,6 @@ build-scratch:
.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) \
.
Expand All @@ -114,8 +114,7 @@ docker-build:
# -----------------------------------------------------------------------------

.PHONY: test
test:
@go test -v -p 1 ./...
test: test-osarch-specific

# -----------------------------------------------------------------------------
# Run
Expand All @@ -125,44 +124,23 @@ test:
docker-run:
@docker run \
--interactive \
--rm \
--tty \
--name $(DOCKER_CONTAINER_NAME) \
$(DOCKER_IMAGE_NAME)


.PHONY: run
run:
@go run main.go

# -----------------------------------------------------------------------------
# Package
# - The "package" target is implemented in Makefile.OS.ARCH files.
# -----------------------------------------------------------------------------

.PHONY: docker-build-package
docker-build-package:
@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) \
--no-cache \
--file package.Dockerfile \
--tag $(DOCKER_BUILD_IMAGE_NAME) \
.
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 @@ -180,8 +158,7 @@ print-make-variables:


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


.PHONY: update-pkg-cache
Expand Down
Loading

0 comments on commit a554bbf

Please sign in to comment.