Skip to content
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
9 changes: 9 additions & 0 deletions .github/coverage/testcoverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ threshold:
# (optional; default 0)
# The minimum total coverage project should have
total: 80

override:
- threshold: 70
path: ^cmd/

exclude:
paths:
- ^cmd
#
# Holds regexp rules which will override thresholds for matched files or packages
# using their paths.
#
Expand Down
107 changes: 96 additions & 11 deletions .github/linters/.golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,133 @@
version: "2"
run:
modules-download-mode: readonly
timeout: 10m

output:
print-linter-name: false
show-stats: true
sort-results: true

linters:
enable:
# List generated from: https://golangci-lint.run/usage/linters/
# We are enabling all defaults as well as any bug/security related
- asasalint
- asciicheck
- bidichk
- bodyclose
- canonicalheader
- containedctx
- contextcheck
- copyloopvar
# - cyclop
- decorder
# - depguard
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
# - exhaustruct
- exptostd
- fatcontext
# - forbidigo
# - forcetypeassert
- funlen
- ginkgolinter
- gocheckcompilerdirectives
# - gochecknoglobals
# - gochecknoinits
- gochecksumtype
- gocognit
- goconst
- gocritic
- gofmt
- gocyclo
# - godot
# - godox
- goheader
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- gosmopolitan
- govet
- grouper
- iface
- importas
- inamedparam
- ineffassign
- interfacebloat
- intrange
- ireturn
# - lll
- loggercheck
- maintidx
- makezero
- mirror
- misspell
# - mnd
- musttag
- nakedret
- nestif
- nilerr
- nilnesserr
- nilnil
# - nlreturn
- noctx
- nolintlint
- nonamedreturns
- nosprintfhostport
# - paralleltest
# - perfsprint
- prealloc
- predeclared
- promlinter
- protogetter
- reassign
- recvcheck
- revive
- rowserrcheck
- sloglint
- spancheck
- sqlclosecheck
- staticcheck
- tagalign
- tagliatelle
# - testableexamples
- testifylint
# - testpackage
# - thelper
- tparallel
- unconvert
- unparam
- unused
# - usestdlibvars
# - usetesting
# - varnamelen
- wastedassign
- whitespace
# - wrapcheck
# - wsl
- zerologlint
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$

formatters:
enable:
- gci
- gofmt
# - gofumpt
- goimports
# - golines
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 4 additions & 0 deletions .github/linters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
- Used by [golangci-lint.yaml]
- [golangci-lint]
- [golangci-lint configuration]
- [golangci linters]
- [wsl]

## .jscpd.json

Expand Down Expand Up @@ -44,11 +46,13 @@
[.yaml-lint.yml]: .yaml-lint.yml
[checkov configuration]: https://www.checkov.io/2.Basics/CLI%20Command%20Reference.html
[checkov]: https://www.checkov.io/
[golangci linters]: https://golangci-lint.run/usage/linters/
[golangci-lint configuration]: https://golangci-lint.run/usage/configuration/
[golangci-lint.yaml]: ../workflows/README.md#golangci-lintyaml
[golangci-lint]: https://golangci-lint.run/
[jscpd configuration]: https://github.com/kucherenko/jscpd/tree/master/apps/jscpd#options
[jscpd]: https://github.com/kucherenko/jscpd
[lint-workflows.yaml]: ../workflows/README.md#lint-workflowsyaml
[wsl]: https://github.com/bombsimon/wsl
[yaml-lint configuration]: https://yamllint.readthedocs.io/en/stable/configuration.html
[yaml-lint]: https://github.com/adrienverge/yamllint
2 changes: 0 additions & 2 deletions .github/workflows/docker-build-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
- name: Build docker image
uses: senzing-factory/github-action-docker-buildx-build@v2
with:
build-options: "-q"
image-repository: senzing/${{ steps.repo-basename.outputs.repo }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
platforms: linux/amd64
username: ${{ secrets.DOCKERHUB_USERNAME }}
21 changes: 13 additions & 8 deletions .github/workflows/go-test-darwin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ permissions:

jobs:
go-test-darwin:
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: macos-latest; Go: ${{ matrix.go }}"
runs-on: macos-latest
name: "Go test with Senzing: ${{ matrix.senzingsdk-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.21"]
go: ["1.24"]
os: [macos-latest]
senzingsdk-version: [staging-v4]

steps:
Expand All @@ -24,7 +25,7 @@ jobs:
with:
fetch-depth: 0

- name: Setup go
- name: Setup go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
Expand All @@ -46,19 +47,23 @@ jobs:
echo "SENZING_PATH=${SENZING_PATH}"
echo "LD_LIBRARY_PATH=${SENZING_PATH}/er/lib:${SENZING_PATH}/er/lib/macos"
echo "DYLD_LIBRARY_PATH=${SENZING_PATH}/er/lib:${SENZING_PATH}/er/lib/macos"
echo "SENZING_DATA_DIR=${SENZING_PATH}/er/data"
echo CGO_CFLAGS="-g -I${SENZING_PATH}/er/sdk/c"
echo CGO_LDFLAGS="-L${SENZING_PATH}/er/lib -lSz -Wl,-no_warn_duplicate_libraries"
} >> "$GITHUB_ENV"

- name: Copy /etc files
run: sudo mkdir -p "${SENZING_PATH}/etc" && sudo cp testdata/senzing-license/g2.lic "${SENZING_PATH}/er/etc/g2.lic"
run: |
sudo mkdir -p "${SENZING_PATH}/etc"
sudo cp testdata/senzing-license/g2.lic "${SENZING_PATH}/er/etc/g2.lic"

- name: Copy test database files
run: mkdir -p /tmp/sqlite && cp testdata/sqlite/G2C.db /tmp/sqlite/
run: |
mkdir -p /tmp/sqlite
cp testdata/sqlite/G2C.db /tmp/sqlite/

- name: Run go test
run: go test -exec "${GITHUB_WORKSPACE}/bin/macos_exec_dyld.sh" -json -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./... 2>&1 | tee /tmp/gotest.log | gotestfmt
run: |
go test -exec "${GITHUB_WORKSPACE}/bin/macos_exec_dyld.sh" -json -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./... 2>&1 | tee /tmp/gotest.log | gotestfmt

- name: Store coverage file
uses: actions/upload-artifact@v4
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/go-test-linux.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Go test linux

on: [push]
on: [push, workflow_dispatch]

env:
SENZING_LOG_LEVEL: TRACE
Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.21"]
go: ["1.24"]
os: [ubuntu-latest]
senzingsdk-version: [staging-v4]

Expand All @@ -25,7 +25,7 @@ jobs:
with:
fetch-depth: 0

- name: Setup go
- name: Setup go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
Expand All @@ -41,16 +41,26 @@ jobs:
senzingsdk-repository-package: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_PACKAGE }}
senzingsdk-repository-path: ${{ secrets.SENZING_APT_BETA_STAGING_REPOSITORY_URL }}

- name: Set environment variables
run: |
SENZING_PATH="/opt/senzing"
{
echo "SENZING_PATH=${SENZING_PATH}"
echo "LD_LIBRARY_PATH=${SENZING_PATH}/er/lib"
} >> "$GITHUB_ENV"

- name: Copy /etc files
run: sudo mkdir -p /etc/opt/senzing && sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing/g2.lic
run: |
sudo mkdir -p /etc/opt/senzing
sudo cp testdata/senzing-license/g2.lic /etc/opt/senzing/g2.lic

- name: Copy test database files
run: mkdir -p /tmp/sqlite && cp testdata/sqlite/G2C.db /tmp/sqlite/
run: |
mkdir -p /tmp/sqlite
cp testdata/sqlite/G2C.db /tmp/sqlite/

- name: Run go test
run: |
export SENZING_PATH="/opt/senzing"
export LD_LIBRARY_PATH="${SENZING_PATH}/er/lib:${SENZING_PATH}/er/lib/macos"
go test -json -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./... 2>&1 | tee /tmp/gotest.log | gotestfmt

- name: Store coverage file
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/go-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
go: ["1.21"]
go: ["1.24"]
senzingsdk-version: [staging-v4]

steps:
Expand All @@ -24,7 +24,7 @@ jobs:
with:
fetch-depth: 0

- name: Setup go
- name: Setup go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
Expand All @@ -40,13 +40,17 @@ jobs:
senzingsdk-repository-path: ${{ secrets.SENZING_WIN_BETA_REPOSITORY }}

- name: Add to "Path" environment variable
run: Add-Content "$env:GITHUB_PATH" "$Env:USERPROFILE\Senzing\er\lib"
run: |
Add-Content "$env:GITHUB_PATH" "$Env:USERPROFILE\Senzing\er\lib"

- name: Copy /etc files
run: copy testdata/senzing-license/g2.lic "$Env:USERPROFILE\Senzing\er\etc\g2.lic"
run: |
copy testdata/senzing-license/g2.lic "$Env:USERPROFILE\Senzing\er\etc\g2.lic"

- name: Copy test database files
run: mkdir "C:\Temp\sqlite" && copy testdata/sqlite/G2C.db "C:\Temp\sqlite\G2C.db"
run: |
mkdir "C:\Temp\sqlite"
copy testdata/sqlite/G2C.db "C:\Temp\sqlite\G2C.db"

- name: Run go test
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
go-version: 1.21

- name: Perform linting
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v7
with:
args: --config=${{ github.workspace }}/.github/linters/.golangci.yaml
only-new-issues: false
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Stages
# -----------------------------------------------------------------------------

ARG IMAGE_BUILDER=golang:1.23.4-bookworm
ARG IMAGE_BUILDER=golang:1.24.1-bookworm
ARG IMAGE_FINAL=senzing/senzingsdk-runtime-beta:latest

# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -69,7 +69,7 @@ COPY ./rootfs /

# Copy files from prior stage.

COPY --from=builder /output/linux-amd64/serve-http /app/serve-http
COPY --from=builder /output/linux/serve-http /app/serve-http

# Run as non-root container

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ hello-world: hello-world-osarch-specific

.PHONY: dependencies-for-development
dependencies-for-development: dependencies-for-development-osarch-specific
@go install github.com/daixiang0/gci@latest
@go install github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
@go install github.com/vladopajic/go-test-coverage/v2@latest
@go install golang.org/x/tools/cmd/godoc@latest
Expand Down
Loading
Loading