From b9e17ec3e1410c8f589f0835bd6033cd189434b3 Mon Sep 17 00:00:00 2001 From: Grygoriy Ensary Date: Thu, 21 Mar 2024 15:21:12 -0500 Subject: [PATCH] Drop Travis, Enable GitHub Actions --- .github/workflows/golang.yaml | 27 +++++++ .golangci.yaml | 137 ---------------------------------- .travis.yml | 15 ---- Makefile | 2 +- 4 files changed, 28 insertions(+), 153 deletions(-) create mode 100644 .github/workflows/golang.yaml delete mode 100644 .golangci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/golang.yaml b/.github/workflows/golang.yaml new file mode 100644 index 0000000..1b67afc --- /dev/null +++ b/.github/workflows/golang.yaml @@ -0,0 +1,27 @@ +on: [push] + +jobs: + golang: + runs-on: ubuntu-latest # we execute everything except make in docker anyway + name: GoLang Basics + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: FS Permissions + # workaround for permissions with contaner attempting to create directories + run: chmod 777 -R "$(pwd)" + - name: Dep + run: make dep + - name: Lint + run: make lint + - name: Unit Tests + run: make test + - name: Integration Tests + run: make integration + - name: Test Coverage + run: make coverage + - name: Upload Coverage + uses: codecov/codecov-action@v4 + with: + files: .coverage/combined.cover.out + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index 990bce8..0000000 --- a/.golangci.yaml +++ /dev/null @@ -1,137 +0,0 @@ -run: - deadline: 3m - issues-exit-code: 1 - tests: true - skip-dirs: - - .coverage -output: - format: colored-line-number - print-issued-lines: true - print-linter-name: true -linters-settings: - errcheck: - # report about not checking of errors in type assetions: `a := b.(MyStruct)`; - # default is false: such cases aren't reported by default. - check-type-assertions: false - - # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; - # default is false: such cases aren't reported by default. - check-blank: false - govet: - # report about shadowed variables - check-shadowing: true - golint: - # minimal confidence for issues, default is 0.8 - min-confidence: 0.8 - gofmt: - # simplify code: gofmt with `-s` option, true by default - simplify: false - gocyclo: - # minimal code complexity to report, 30 by default (but we recommend 10-20) - min-complexity: 30 - dupl: - # tokens count to trigger issue, 150 by default - threshold: 150 - goconst: - # minimal length of string constant, 3 by default - min-len: 3 - # minimal occurrences count to trigger, 3 by default - min-occurrences: 3 - depguard: - list-type: blacklist - include-go-root: false - packages: - - github.com/davecgh/go-spew/spew - misspell: - # Correct spellings using locale preferences for US or UK. - # Default is to use a neutral variety of English. - # Setting locale to US will correct the British spelling of 'colour' to 'color'. - locale: US - lll: - # max line length, lines longer will be reported. Default is 120. - # '\t' is counted as 1 character by default, and can be changed with the tab-width option - line-length: 120 - # tab width in spaces. Default to 1. - tab-width: 1 - unused: - # treat code as a program (not a library) and report unused exported identifiers; default is false. - # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find funcs usages. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false - unparam: - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. - # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: - # if it's called for subdir of a project it can't find external interfaces. All text editor integrations - # with golangci-lint call it on a directory with the changed file. - check-exported: false - nakedret: - # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 - max-func-lines: 30 - prealloc: - # XXX: we don't recommend using this linter before doing performance profiling. - # For most programs usage of prealloc will be a premature optimization. - - # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. - # True by default. - simple: true - range-loops: true # Report preallocation suggestions on range loops, true by default - for-loops: true # Report preallocation suggestions on for loops, false by default -linters: - disable-all: true - enable: - - govet - - errcheck - - staticcheck - - unused - - gosimple - - structcheck - - varcheck - - ineffassign - - deadcode - - golint - - gosec - - unconvert - - dupl - - goconst - - gocyclo - - gofmt - - goimports - - depguard - - misspell - - unparam - - nakedret - - prealloc - - gochecknoinits -issues: - exclude-use-default: false - exclude: - # errcheck: Almost all programs ignore errors on these functions and in most cases it's ok - - Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked - - # golint: False positive when tests are defined in package 'test' - - func name will be used as test\.Test.* by other packages, and that stutters; consider calling this - - # govet: Common false positives - - (possible misuse of unsafe.Pointer|should have signature) - - # megacheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore - - ineffective break statement. Did you mean to break out of the outer loop - - # gas: Too many false-positives on 'unsafe' usage - - Use of unsafe calls should be audited - - # gas: Too many false-positives for parametrized shell calls - - Subprocess launch(ed with variable|ing should be audited) - - # gas: Duplicated errcheck checks - - G104 - - # gas: Too many issues in popular repos - - (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less) - - # gas: False positive is triggered by 'src, err := ioutil.ReadFile(filename)' - - Potential file inclusion via variable - - max-per-linter: 50 - max-same: 3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e54aeff..0000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go -sudo: false -go: - - 1.19.x -services: - - docker -install: - - chmod 777 -R "$(pwd)" -script: - - travis_retry make dep - - make lint - - make test - - make integration - - make coverage - - bash <(curl -s https://codecov.io/bash) -f .coverage/combined.cover.out diff --git a/Makefile b/Makefile index 98c2530..f9f5f2f 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ TAG := $(shell git rev-parse --short HEAD) DIR := $(shell pwd -L) DIR := $(shell pwd -L) -SDCLI_VERSION :=v1.4.0 +SDCLI_VERSION :=v1.5 SDCLI=docker run --rm -v "$(DIR):$(DIR)" -w "$(DIR)" asecurityteam/sdcli:$(SDCLI_VERSION)