From 88ef610d3a4925061ced74007a050c04eae73d98 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 12 Nov 2024 21:50:05 +0000 Subject: [PATCH 1/2] consolidate actions --- .github/workflows/actions.yml | 46 ++----------------------- .github/workflows/common-workflows.yaml | 17 +++++++++ .github/workflows/go-version.yaml | 2 +- .github/workflows/linters.yaml | 30 ---------------- .golangci.yaml | 30 ---------------- 5 files changed, 21 insertions(+), 104 deletions(-) create mode 100644 .github/workflows/common-workflows.yaml delete mode 100644 .github/workflows/linters.yaml delete mode 100644 .golangci.yaml diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index dd2d893..ddb0cc4 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -1,20 +1,11 @@ name: Workflow -on: +on: # yamllint disable-line rule:truthy push: branches: [main] pull_request: branches: [main] jobs: - code-check: - name: Check Go formatting, linting, vetting - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run the formatter, linter, and vetter - uses: dell/common-github-actions/go-code-formatter-linter-vetter@main - with: - directories: ./... + sanitize: name: Check for forbidden words runs-on: ubuntu-latest @@ -25,38 +16,7 @@ jobs: uses: dell/common-github-actions/code-sanitizer@main with: args: /github/workspace - test: - name: Run Go unit tests and check package coverage - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run unit tests and check package coverage - uses: dell/common-github-actions/go-code-tester@main - with: - threshold: 90 - go_security_scan: - name: Go security - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run Go Security - uses: securego/gosec@master - with: - # exclude "G108: Profiling endpoint is automatically exposed" because we are exposing on an internal port - args: -exclude=G108 ./... - malware_security_scan: - name: Malware Scanner - runs-on: ubuntu-latest - steps: - - name: Checkout the code - uses: actions/checkout@v4 - - name: Run malware scan - uses: dell/common-github-actions/malware-scanner@main - with: - directories: . - options: -ri + image_security_scan: name: Image Scanner runs-on: ubuntu-latest diff --git a/.github/workflows/common-workflows.yaml b/.github/workflows/common-workflows.yaml new file mode 100644 index 0000000..05e4e07 --- /dev/null +++ b/.github/workflows/common-workflows.yaml @@ -0,0 +1,17 @@ +name: Common Workflows +on: # yamllint disable-line rule:truthy + push: + branches: [main] + pull_request: + branches: ["**"] + +jobs: + + # golang static analysis checks + go-static-analysis: + uses: dell/common-github-actions/.github/workflows/go-static-analysis.yaml@main + name: Golang Validation + + common: + name: Quality Checks + uses: dell/common-github-actions/.github/workflows/go-common.yml@main diff --git a/.github/workflows/go-version.yaml b/.github/workflows/go-version.yaml index 1ba387e..51df53b 100644 --- a/.github/workflows/go-version.yaml +++ b/.github/workflows/go-version.yaml @@ -9,7 +9,7 @@ # Reusable workflow to perform go version update on Golang based projects name: Go Version Update -on: +on: # yamllint disable-line rule:truthy workflow_dispatch: repository_dispatch: types: [go-update-workflow] diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml deleted file mode 100644 index c2762d2..0000000 --- a/.github/workflows/linters.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: linters - -on: - push: - branches: [main] - pull_request: - branches: ["**"] - -permissions: - contents: read - -jobs: - golangci-lint: - name: golangci-lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v5 - with: - go-version: "1.23" - cache: false - - name: Checkout the code - uses: actions/checkout@v4 - - name: Vendor packages - run: | - go mod vendor - - name: golangci-lint - uses: golangci/golangci-lint-action@v5 - with: - version: latest - skip-cache: true diff --git a/.golangci.yaml b/.golangci.yaml deleted file mode 100644 index d20d7e0..0000000 --- a/.golangci.yaml +++ /dev/null @@ -1,30 +0,0 @@ -run: - timeout: 20m - issues-exit-code: 0 # we will change this later - tests: true - skip-dirs-use-default: true - modules-download-mode: readonly - -issues: - max-issues-per-linter: 0 - max-same-issues: 0 - new: false - -output: - print-linter-name: true - sort-results: true - uniq-by-line: false - print-issued-lines: true - -linters: - disable-all: true - fast: false - enable: - # A stricter replacement for gofmt. - - gofumpt - # Inspects source code for security problems. - - gosec - # Check for correctness of programs. - - govet - # Drop-in replacement of golint. - - revive From 765cb5f7e6ec6b7e7b38135be1857b6b16f7d303 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 12 Nov 2024 22:15:43 +0000 Subject: [PATCH 2/2] linting --- internal/common/testdata/invalid-format.yaml | 1 - internal/common/testdata/no-global-id.yaml | 1 - internal/common/testdata/sample-config.yaml | 1 - 3 files changed, 3 deletions(-) diff --git a/internal/common/testdata/invalid-format.yaml b/internal/common/testdata/invalid-format.yaml index 06a35be..2f7e905 100644 --- a/internal/common/testdata/invalid-format.yaml +++ b/internal/common/testdata/invalid-format.yaml @@ -1,2 +1 @@ invalid_format - diff --git a/internal/common/testdata/no-global-id.yaml b/internal/common/testdata/no-global-id.yaml index 716213b..0e41112 100644 --- a/internal/common/testdata/no-global-id.yaml +++ b/internal/common/testdata/no-global-id.yaml @@ -6,4 +6,3 @@ arrays: isDefault: true blockProtocol: "auto" nasName: "nas-server" - diff --git a/internal/common/testdata/sample-config.yaml b/internal/common/testdata/sample-config.yaml index 2a0671a..92d69ae 100644 --- a/internal/common/testdata/sample-config.yaml +++ b/internal/common/testdata/sample-config.yaml @@ -14,4 +14,3 @@ arrays: password: "password" skipCertificateValidation: true blockProtocol: "FC" -