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

58 dockter 1 #59

Merged
merged 8 commits into from
Jul 9, 2024
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
68 changes: 68 additions & 0 deletions .github/coverage/testcoverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# (mandatory)
# Path to coverprofile file (output of `go test -coverprofile` command).
#
# For cases where there are many coverage profiles, such as when running
# unit tests and integration tests separately, you can combine all those
# profiles into one. In this case, the profile should have a comma-separated list
# of profile files, e.g., 'cover_unit.out,cover_integration.out'.
profile: cover.out

# (optional; but recommended to set)
# When specified reported file paths will not contain local prefix in the output
local-prefix: "github.com/org/project"

# Holds coverage thresholds percentages, values should be in range [0-100]
threshold:
# (optional; default 0)
# The minimum coverage that each file should have
file: 80

# (optional; default 0)
# The minimum coverage that each package should have
package: 80

# (optional; default 0)
# The minimum total coverage project should have
total: 80
# Holds regexp rules which will override thresholds for matched files or packages
# using their paths.
#
# First rule from this list that matches file or package is going to apply
# new threshold to it. If project has multiple rules that match same path,
# override rules should be listed in order from specific to more general rules.
#override:
# Increase coverage threshold to 100% for `foo` package
# (default is 80, as configured above in this example)
#- threshold: 100
# path: ^pkg/lib/foo$

# Holds regexp rules which will exclude matched files or packages
# from coverage statistics
#exclude:
# Exclude files or packages matching their paths
#paths:
# - \.pb\.go$ # excludes all protobuf generated files
# - ^pkg/bar # exclude package `pkg/bar`

exclude:
paths:
- senzingchatapi/oas_cfg_gen.go
- senzingchatapi/oas_client_gen.go
- senzingchatapi/oas_handlers_gen.go
- senzingchatapi/oas_interfaces_gen.go
- senzingchatapi/oas_json_gen.go
- senzingchatapi/oas_labeler_gen.go
- senzingchatapi/oas_middleware_gen.go
- senzingchatapi/oas_parameters_gen.go
- senzingchatapi/oas_request_decoders_gen.go
- senzingchatapi/oas_request_encoders_gen.go
- senzingchatapi/oas_response_decoders_gen.go
- senzingchatapi/oas_response_encoders_gen.go
- senzingchatapi/oas_router_gen.go
- senzingchatapi/oas_schemas_gen.go
- senzingchatapi/oas_server_gen.go
- senzingchatapi/oas_unimplemented_gen.go
- senzingchatapi/oas_validators_gen.go
# NOTES:
# - symbol `/` in all path regexps will be replaced by current OS file path separator
# to properly work on Windows
47 changes: 47 additions & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
run:
modules-download-mode: readonly
show-stats: true

output:
print-linter-name: false
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
- contextcheck
- durationcheck
- errcheck
- errchkjson
- errorlint
- exhaustive
- exportloopref
- gocheckcompilerdirectives
- gochecksumtype
- gocritic
- gofmt
- gosec
- gosimple
- gosmopolitan
- govet
- ineffassign
- loggercheck
- makezero
- musttag
- nilerr
- noctx
- protogetter
- reassign
- revive
- rowserrcheck
- spancheck
- sqlclosecheck
- staticcheck
- testifylint
- unused
- zerologlint
5 changes: 4 additions & 1 deletion .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"threshold": 3
"ignore": [
"**/*.go,**/go-test*.yaml"
],
"threshold": 20
}
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-container.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
echo "repo=$(basename ${{ github.repository }})" >> "$GITHUB_OUTPUT"
shell: bash

- name: Build docker image
- name: build docker image
uses: senzing-factory/github-action-docker-buildx-build@v1
with:
image-repository: senzing/${{ steps.repo-basename.outputs.repo }}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/go-proxy-pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ permissions:
jobs:
go-proxy-pull:
runs-on: ubuntu-latest

steps:
- name: pull new module version
uses: andrewslotin/go-proxy-pull-action@v1.1.0
uses: andrewslotin/go-proxy-pull-action@v1.2.0
with:
import_path: github.com/${{ github.repository }}
34 changes: 30 additions & 4 deletions .github/workflows/go-test-darwin.yaml.disabled
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: go test darwin

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

env:
DYLD_LIBRARY_PATH: /opt/senzing/g2/lib:/opt/senzing/g2/lib/macos
Expand All @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
go: ["1.21"]
os: [macos-latest]
os: [macos-13]
senzingapi-version: [staging-v4]

steps:
Expand All @@ -32,8 +32,13 @@ jobs:
with:
go-version: ${{ matrix.go }}

- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: install Senzing API
uses: Senzing/github-action-install-senzing-api@v3
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-version: ${{ matrix.senzingapi-version }}

Expand All @@ -44,4 +49,25 @@ jobs:
run: mkdir /tmp/sqlite && cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db

- name: run go test
run: go test -exec /Users/runner/work/demo-quickstart/demo-quickstart/bin/macos_exec_dyld.sh -v -p 1 ./...
run: go test -exec /Users/runner/work/demo-quickstart/demo-quickstart/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
with:
name: cover.out
path: ./cover.out

- name: Upload test log
uses: actions/upload-artifact@v4
if: always()
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error

coverage:
name: coverage
needs: go-test-darwin
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2
with:
coverage-config: ./.github/coverage/testcoverage.yaml
30 changes: 28 additions & 2 deletions .github/workflows/go-test-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ jobs:
with:
go-version: ${{ matrix.go }}

- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: install Senzing API
uses: Senzing/github-action-install-senzing-api@v3
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-runtime-version: ${{ matrix.senzingapi-version }}

Expand All @@ -42,4 +47,25 @@ jobs:
run: mkdir /tmp/sqlite && cp testdata/sqlite/G2C.db /tmp/sqlite/G2C.db

- name: run go test
run: go test -v -p 1 ./...
run: go test -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
with:
name: cover.out
path: ./cover.out

- name: Upload test log
uses: actions/upload-artifact@v4
if: always()
with:
name: test-log
path: /tmp/gotest.log
if-no-files-found: error

coverage:
name: coverage
needs: go-test-linux
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2
with:
coverage-config: ./.github/coverage/testcoverage.yaml
40 changes: 34 additions & 6 deletions .github/workflows/go-test-windows.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: go test windows

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

env:
SENZING_TOOLS_DATABASE_URL: "sqlite3://na:na@nowhere/C:\\Temp\\sqlite\\G2C.db"

permissions:
contents: read

env:
SENZING_TOOLS_DATABASE_URL: 'sqlite3://na:na@nowhere/C:\Temp\sqlite\G2C.db'

jobs:
go-test-windows:
name: "go test with Senzing: ${{ matrix.senzingapi-version }}; OS: ${{ matrix.os }}; Go: ${{ matrix.go }}"
Expand All @@ -29,8 +29,13 @@ jobs:
with:
go-version: ${{ matrix.go }}

- name: Set up gotestfmt
uses: gotesttools/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: install Senzing API
uses: Senzing/github-action-install-senzing-api@v3
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-version: ${{ matrix.senzingapi-version }}

Expand All @@ -44,4 +49,27 @@ jobs:
run: mkdir "C:\Temp\sqlite" && copy testdata/sqlite/G2C.db "C:\Temp\sqlite\G2C.db"

- name: run go test
run: go test -v -p 1 ./...
run: |
go test -json -v -p 1 -coverprofile=cover -covermode=atomic -coverpkg=./... ./... 2>&1 | tee "C:\Temp\gotest.log" | gotestfmt
cp cover cover.out

- name: Store coverage file
uses: actions/upload-artifact@v4
with:
name: cover.out
path: cover.out

- name: Upload test log
uses: actions/upload-artifact@v4
if: always()
with:
name: test-log
path: "C:\\Temp\\gotest.log"
if-no-files-found: error

coverage:
name: coverage
needs: go-test-windows
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2
with:
coverage-config: ./.github/coverage/testcoverage.yaml
12 changes: 0 additions & 12 deletions .github/workflows/gofmt.yaml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: golangci-lint

on:
push:
branches-ignore: [main]
pull_request:
branches: [main]

permissions:
# Required: allow read access to the content for analysis.
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest

steps:
- name: checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Senzing API
uses: senzing-factory/github-action-install-senzing-api@v3
with:
senzingapi-runtime-version: staging-v4

- name: Copy Senzing headers
run: |
mkdir --parents ./szconfig/gohelpers
cp /opt/senzing/g2/sdk/c/*.h ./szconfig/
cp /opt/senzing/g2/sdk/c/gohelpers/*.h ./szconfig/gohelpers
mkdir --parents ./szconfigmanager/gohelpers
cp /opt/senzing/g2/sdk/c/*.h ./szconfigmanager/
cp /opt/senzing/g2/sdk/c/gohelpers/*.h ./szconfigmanager/gohelpers
mkdir --parents ./szdiagnostic/gohelpers
cp /opt/senzing/g2/sdk/c/*.h ./szdiagnostic/
cp /opt/senzing/g2/sdk/c/gohelpers/*.h ./szdiagnostic/gohelpers
mkdir --parents ./szengine/gohelpers
cp /opt/senzing/g2/sdk/c/*.h ./szengine/
cp /opt/senzing/g2/sdk/c/gohelpers/*.h ./szengine/gohelpers
mkdir --parents ./szproduct/gohelpers
cp /opt/senzing/g2/sdk/c/*.h ./szproduct/
cp /opt/senzing/g2/sdk/c/gohelpers/*.h ./szproduct/gohelpers

- name: setup go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --config=${{ github.workspace }}/.github/linters/.golangci.yml
only-new-issues: false
version: latest
Loading
Loading