Skip to content

Commit

Permalink
97 dockter 1 (#101)
Browse files Browse the repository at this point in the history
* #97 Savepoint

* #97 Savepoint

* #97 Clean linting

* #97 Clean tests

* #97 Working tests and linting

* #97 Update dependencies

* #97 Improve testcases

* #97 Prepare for versioned release

* #97 Prepare for versioned release

* Force re-test

* Force re-test

* #97 Uncomment Darwin/Windows

* #97 Savepoint

* #97 Disable Darwin and Windows testing

* Force re-test
  • Loading branch information
docktermj authored Jun 12, 2024
1 parent eb56f9d commit 5f4b09d
Show file tree
Hide file tree
Showing 67 changed files with 1,166 additions and 1,063 deletions.
2 changes: 2 additions & 0 deletions .github/linters/.checkov.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
quiet: true
skip-check: CKV_DOCKER_7
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
4 changes: 3 additions & 1 deletion .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"threshold": 14
"ignore": [
"**/*.go,**/go-test*.yaml"
]
}
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:
ACCEPT_EULA: Y
Expand All @@ -27,7 +27,7 @@ jobs:
strategy:
matrix:
go: ["1.21"]
os: [macos-latest]
os: [macos-13]

steps:
- name: checkout repository
Expand All @@ -40,9 +40,9 @@ jobs:
with:
go-version: ${{ matrix.go }}

# - name: install Docker
# uses: docker-practice/actions-setup-docker@master
# timeout-minutes: 12
- name: install Docker
uses: docker-practice/actions-setup-docker@master
timeout-minutes: 12

- uses: ikalnytskyi/action-setup-postgres@v6
with:
Expand All @@ -55,11 +55,11 @@ jobs:
# - name: postgreSQL service
# run: docker run --detach --env POSTGRESQL_DATABASE --env POSTGRESQL_PASSWORD --env POSTGRESQL_POSTGRES_PASSWORD --env POSTGRESQL_USERNAME --publish 5432:5432 bitnami/postgresql:latest

# - name: MsSQL service
# run: docker run --detach --env ACCEPT_EULA --env MSSQL_PID --env MSSQL_SA_PASSWORD --publish 1433:1433 mcr.microsoft.com/mssql/server
- name: MsSQL service
run: docker run --detach --env ACCEPT_EULA --env MSSQL_PID --env MSSQL_SA_PASSWORD --publish 1433:1433 mcr.microsoft.com/mssql/server

# - name: MySQL service
# run: docker run --detach --env MYSQL_DATABASE --env MYSQL_PASSWORD --env MYSQL_ROOT_PASSWORD --env MYSQL_USER --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=6 --publish 3306:3306 bitnami/mysql
- name: MySQL service
run: docker run --detach --env MYSQL_DATABASE --env MYSQL_PASSWORD --env MYSQL_ROOT_PASSWORD --env MYSQL_USER --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=6 --publish 3306:3306 bitnami/mysql

- run: mkdir /tmp/sqlite

Expand All @@ -71,8 +71,8 @@ jobs:
- name: run go test - main
run: go test -v -p 1 ./.

# - name: run go test - connector
# run: go test -v -p 1 ./connector
- name: run go test - connector
run: go test -v -p 1 ./connector

- name: run go test - connectordb2
run: go test -v -p 1 ./connectordb2
Expand All @@ -83,20 +83,31 @@ jobs:
- name: run go test - connectormysql
run: go test -v -p 1 ./connectormysql

# - name: run go test - connectorpostgresql
# run: go test -v -p 1 ./connectorpostgresql
- name: run go test - connectorpostgresql
run: go test -v -p 1 ./connectorpostgresql

- name: run go test - connectorsqlite
run: go test -v -p 1 ./connectorsqlite

- name: run go test - dbhelper
run: go test -v -p 1 ./dbhelper

# - name: run go test - postgresql
# run: go test -v -p 1 ./postgresql
- name: run go test - postgresql
run: go test -v -p 1 ./postgresql

- name: run go test - sqlexecutor
run: go test -v -p 1 ./sqlexecutor

- name: run go test - main
run: go test -v -p 1 ./.
- name: run go test
run: go test -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./...

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

coverage:
name: coverage
needs: go-test-darwin
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2
13 changes: 12 additions & 1 deletion .github/workflows/go-test-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,15 @@ jobs:
- run: touch /tmp/sqlite/G2C.db

- name: run go test
run: go test -v -p 1 ./...
run: go test -v -p 1 -coverprofile=./cover.out -covermode=atomic -coverpkg=./... ./...

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

coverage:
name: coverage
needs: go-test-linux
uses: senzing-factory/build-resources/.github/workflows/go-coverage.yaml@v2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: go test windows

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

env:
ACCEPT_EULA: Y
Expand Down Expand Up @@ -39,9 +39,9 @@ jobs:
with:
go-version: ${{ matrix.go }}

# - name: install Docker
# uses: docker-practice/actions-setup-docker@v1
# timeout-minutes: 12
- name: install Docker
uses: docker-practice/actions-setup-docker@v1
timeout-minutes: 12

- uses: ikalnytskyi/action-setup-postgres@v6
with:
Expand All @@ -57,8 +57,8 @@ jobs:
# - name: MsSQL service
# run: docker run --detach --env ACCEPT_EULA --env MSSQL_PID --env MSSQL_SA_PASSWORD --publish 1433:1433 mcr.microsoft.com/mssql/server

# - name: MySQL service
# run: docker run --detach --env MYSQL_DATABASE --env MYSQL_PASSWORD --env MYSQL_ROOT_PASSWORD --env MYSQL_USER --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=6 --publish 3306:3306 bitnami/mysql
- name: MySQL service
run: docker run --detach --env MYSQL_DATABASE --env MYSQL_PASSWORD --env MYSQL_ROOT_PASSWORD --env MYSQL_USER --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=6 --publish 3306:3306 bitnami/mysql

- name: create empty Sqlite database file
run: mkdir "C:\Temp\sqlite" && New-Item "C:\Temp\sqlite\G2C.db"
Expand All @@ -69,32 +69,48 @@ jobs:
- name: run go test - main
run: go test -v -p 1 ./.

# - name: run go test - connector
# run: go test -v -p 1 ./connector
- name: run go test - connector
run: go test -v -p 1 ./connector

- name: run go test - connectordb2
run: go test -v -p 1 ./connectordb2

- name: run go test - connectormssql
run: go test -v -p 1 ./connectormssql
# - name: run go test - connectormssql
# run: go test -v -p 1 ./connectormssql

- name: run go test - connectormysql
run: go test -v -p 1 ./connectormysql

# - name: run go test - connectorpostgresql
# run: go test -v -p 1 ./connectorpostgresql
- name: run go test - connectorpostgresql
run: go test -v -p 1 ./connectorpostgresql

- name: run go test - connectorsqlite
run: go test -v -p 1 ./connectorsqlite

- name: run go test - dbhelper
run: go test -v -p 1 ./dbhelper

# - name: run go test - postgresql
# run: go test -v -p 1 ./postgresql
- name: run go test - postgresql
run: go test -v -p 1 ./postgresql

- name: run go test - sqlexecutor
run: go test -v -p 1 ./sqlexecutor

- name: run go test - main
run: go test -v -p 1 ./.

- name: run go test
run: |
go test -v -p 1 -coverprofile=cover -covermode=atomic -coverpkg=./... ./...
cp cover cover.out

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

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

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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: 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
27 changes: 0 additions & 27 deletions .github/workflows/gosec.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ go.work

# Makefile
target/
coverage.html
49 changes: 49 additions & 0 deletions .testcoverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# (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`

# NOTES:
# - symbol `/` in all path regexps will be replaced by current OS file path separator
# to properly work on Windows
Loading

0 comments on commit 5f4b09d

Please sign in to comment.