diff --git a/.github/workflows/golangci_lint.yml b/.github/workflows/golangci_lint.yml index ac7274cf95..5392366e45 100644 --- a/.github/workflows/golangci_lint.yml +++ b/.github/workflows/golangci_lint.yml @@ -44,15 +44,30 @@ jobs: version=$(grep '^golangci-lint ' .tool-versions | awk '{print $2}') echo "version=${version}" | tee -a "$GITHUB_OUTPUT" + - name: Sanitize artifact name + id: artifact-name + env: + MODULE: ${{ matrix.module }} + run: | + safe_name="${MODULE#./}" + safe_name="${safe_name#/}" + safe_name="${safe_name//\//-}" + if [[ -z "$safe_name" || "$safe_name" = "." ]]; then + safe_name="root" + fi + echo "value=golangci-lint-report-${safe_name}" | tee -a "$GITHUB_OUTPUT" + - name: golangci-lint ${{ matrix.module }} if: ${{ always() && !contains(join(github.event.pull_request.labels.*.name, ' '), 'allow-lint-issues') }} # NOTE: Keep this version in sync with ACTION_CI_LINT_GO_GIT_TAG in ./script/lint.sh - uses: smartcontractkit/.github/actions/ci-lint-go@ci-lint-go/3.0.0 + uses: smartcontractkit/.github/actions/ci-lint-go@ci-lint-go/v4 with: checkout-repo: false + artifact-name: ${{ steps.artifact-name.outputs.value }} golangci-lint-version: v${{ steps.get-version.outputs.version }} go-directory: ${{ matrix.module }} - golangci-lint-args: --output.text.path=stdout --output.checkstyle.path=${{ matrix.module }}/golangci-lint-report.xml + golangci-lint-args: "--output.text.path=stdout --output.checkstyle.path=${{ github.workspace }}/${{ matrix.module }}/golangci-lint-report.xml" + only-new-issues: false golangci-lint: # Required sink job that waits for all lint jobs to complete diff --git a/pkg/utils/tests/tests.go b/pkg/utils/tests/tests.go index dd0173c89e..f653a5c123 100644 --- a/pkg/utils/tests/tests.go +++ b/pkg/utils/tests/tests.go @@ -2,9 +2,6 @@ package tests import ( "context" - "os" - "strconv" - "sync" "testing" "time" @@ -71,29 +68,3 @@ func RequireSignal(t *testing.T, ch <-chan struct{}, failMsg string) { t.Fatal(failMsg) } } - -// SkipShort skips tb during -short runs, and notes why. -func SkipShort(tb testing.TB, why string) { - if testing.Short() { - tb.Skipf("skipping: %s", why) - } -} - -const envVarRunFlakey = "CL_RUN_FLAKEY" - -var runFlakey = sync.OnceValues(func() (bool, error) { - s := os.Getenv(envVarRunFlakey) - if s == "" { - return false, nil - } - return strconv.ParseBool(s) -}) - -func SkipFlakey(t *testing.T, ticketURL string) { - if ok, err := runFlakey(); !ok { - if err != nil { - t.Logf("Failed to parse %s: %v", envVarRunFlakey, err) - } - t.Skip("Flakey", ticketURL) - } -} diff --git a/script/lint.sh b/script/lint.sh index da256f38ab..75fd0786dd 100755 --- a/script/lint.sh +++ b/script/lint.sh @@ -27,7 +27,7 @@ if [[ -n "${GOLANGCI_LINT_CONFIG:-}" ]]; then echo "Using user-provided config: $CONFIG_FILE" else # NOTE: Keep this version in sync with the action tag in /.github/workflows/golangci_lint.yml - ACTION_CI_LINT_GO_GIT_TAG="${CI_LINT_GO_VERSION:-ci-lint-go/3.0.0}" + ACTION_CI_LINT_GO_GIT_TAG="${CI_LINT_GO_VERSION:-ci-lint-go/v4}" # Download remote golangci-lint config to gitignored directory REMOTE_CONFIG_URL="https://raw.githubusercontent.com/smartcontractkit/.github/refs/tags/${ACTION_CI_LINT_GO_GIT_TAG}/actions/ci-lint-go/files/golangci-default.yml" CONFIG_FILE="$DIRECTORY/golangci.remote.yml"