From e3bdb2bdbbb2b22358961344bf159c9ee5e0b37d Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 9 Jan 2025 02:03:05 +0100 Subject: [PATCH 1/3] improve ci Signed-off-by: Mark Sagi-Kazar --- .editorconfig | 12 ++++++++++ .github/.editorconfig | 2 ++ .github/workflows/ci.yaml | 49 +++++++++++++++++++++++++++++++++++++++ .golangci.yaml | 13 +++++++++++ 4 files changed, 76 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/.editorconfig create mode 100644 .github/workflows/ci.yaml create mode 100644 .golangci.yaml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..4492e9f9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.go] +indent_style = tab diff --git a/.github/.editorconfig b/.github/.editorconfig new file mode 100644 index 00000000..0902c6ae --- /dev/null +++ b/.github/.editorconfig @@ -0,0 +1,2 @@ +[{*.yml,*.yaml}] +indent_size = 2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..c1d0fbd4 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,49 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + + strategy: + # Fail fast is disabled because there are Go version specific features and tests + # that should be able to fail independently. + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + go: ["1.19", "1.20", "1.21", "1.22", "1.23"] + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: ${{ matrix.go }} + + - name: Test + run: go test -race -v ./... + + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set up Go + uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0 + with: + go-version: "1.23" + + - name: Lint + uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 + with: + version: v1.63.4 diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 00000000..2efd235c --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,13 @@ +linters-settings: + gci: + sections: + - standard + - default + - prefix(github.com/spf13/viper) + +linters: + disable-all: true + enable: + - gofmt + # - gofumpt + - staticcheck From c9556b1da69179886b68c084591177155e53275b Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 9 Jan 2025 02:08:31 +0100 Subject: [PATCH 2/3] drop old actions workflow Signed-off-by: Mark Sagi-Kazar --- .github/workflows/test.yml | 39 -------------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 1755fb84..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,39 +0,0 @@ -on: - push: - branches: [main] - pull_request: -name: Test -permissions: - contents: read -jobs: - test: - strategy: - matrix: - go-version: [1.19.x, 1.20.x, 1.21.x] - platform: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.platform }} - steps: - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: ${{ matrix.go-version }} - - name: Install staticcheck - if: matrix.go-version == '1.21.x' - run: go install honnef.co/go/tools/cmd/staticcheck@latest - shell: bash - - name: Update PATH - run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - shell: bash - - name: Checkout code - uses: actions/checkout@v3 - - name: Fmt - if: matrix.platform != 'windows-latest' # :( - run: "diff <(gofmt -d .) <(printf '')" - shell: bash - - name: Vet - run: go vet ./... - - name: Staticcheck - if: matrix.go-version == '1.21.x' - run: staticcheck ./... - - name: Test - run: go test -race ./... From 8e89e0844d2e1a981b3d644fa0a7eee17ab47062 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Thu, 9 Jan 2025 02:12:33 +0100 Subject: [PATCH 3/3] update description Signed-off-by: Mark Sagi-Kazar --- .github/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c1d0fbd4..5e6fe64d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,8 +11,6 @@ jobs: runs-on: ${{ matrix.os }} strategy: - # Fail fast is disabled because there are Go version specific features and tests - # that should be able to fail independently. fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest]