-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding gosec and lint, fixing null_type overflow
ChangeLog: - Adding gosec linting - Adding static type to enum - fixing nulltype overflow - Trying out gotestsum as an alternative to go-junit-report.xml
- Loading branch information
1 parent
f9358ca
commit 974882f
Showing
16 changed files
with
192 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ jobs: | |
build_and_tests: | ||
docker: | ||
# specify the version | ||
- image: cimg/go:1.21.6 | ||
- image: cimg/go:1.22.0 | ||
- image: cimg/postgres:14.10 | ||
environment: | ||
POSTGRES_USER: jet | ||
|
@@ -129,16 +129,21 @@ jobs: | |
# to create test results report | ||
- run: | ||
name: Install go-junit-report | ||
command: go install github.com/jstemmer/go-junit-report@latest | ||
|
||
command: go install github.com/jstemmer/go-junit-report/[email protected] | ||
- run: | ||
name: Install gotestsum | ||
command: go install gotest.tools/gotestsum@latest | ||
- run: mkdir -p $TEST_RESULTS | ||
|
||
# this will run all tests and exclude test files from code coverage report | ||
- run: | | ||
go test -v ./... \ | ||
-covermode=atomic \ | ||
-coverpkg=github.com/go-jet/jet/v2/postgres/...,github.com/go-jet/jet/v2/mysql/...,github.com/go-jet/jet/v2/sqlite/...,github.com/go-jet/jet/v2/qrm/...,github.com/go-jet/jet/v2/generator/...,github.com/go-jet/jet/v2/internal/... \ | ||
-coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml | ||
- run: | ||
name: Running tests | ||
command: gotestsum --junitfile report.xml --format testname | ||
#- run: | | ||
# go test -v ./... \ | ||
# -covermode=atomic \ | ||
# -coverpkg=github.com/go-jet/jet/v2/postgres/...,github.com/go-jet/jet/v2/mysql/...,github.com/go-jet/jet/v2/sqlite/...,github.com/go-jet/jet/v2/qrm/...,github.com/go-jet/jet/v2/generator/...,github.com/go-jet/jet/v2/internal/... \ | ||
# -coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml | ||
|
||
# run mariaDB and cockroachdb tests. No need to collect coverage, because coverage is already included with mysql and postgres tests | ||
- run: MY_SQL_SOURCE=MariaDB go test -v ./tests/mysql/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Code Scanners | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
GO_VERSION: 1.22.0 | ||
|
||
|
||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
|
||
|
||
jobs: | ||
security_scanning: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.0 | ||
cache: true | ||
- name: Setup Tools | ||
run: | | ||
go install github.com/securego/gosec/v2/cmd/gosec@latest | ||
- name: Running Scan | ||
run: gosec --exclude=G402,G304 ./... | ||
lint_scanner: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.22.0 | ||
cache: true | ||
- name: Setup Tools | ||
run: | | ||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest | ||
- name: Running Scan | ||
run: golangci-lint run --timeout=30m ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
run: | ||
# The default concurrency value is the number of available CPU. | ||
concurrency: 4 | ||
# Timeout for analysis, e.g. 30s, 5m. | ||
# Default: 1m | ||
timeout: 30m | ||
# Exit code when at least one issue was found. | ||
# Default: 1 | ||
issues-exit-code: 2 | ||
# Include test files or not. | ||
# Default: true | ||
tests: false | ||
|
||
issues: | ||
exclude-dirs: | ||
- tests | ||
exclude-files: | ||
- "_test.go" | ||
- "testutils.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.