From c2db74c5ece94581347f0d8a2700e7528093f12e Mon Sep 17 00:00:00 2001 From: reugn Date: Thu, 14 Mar 2024 09:09:00 +0200 Subject: [PATCH] ci: update workflows --- .github/workflows/build.yml | 33 ++++++++++++++++++++++++++++ .github/workflows/golangci-lint.yml | 28 ++++++++++++++++++++++++ .golangci.yml | 34 +++++++++++++++++++++++++++++ .travis.yml | 16 -------------- 4 files changed, 95 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/golangci-lint.yml create mode 100644 .golangci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f65e1e4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build + +on: + push: + branches: + - '**' + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + go-version: [1.19.x, 1.22.x] + steps: + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go-version }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run coverage + run: go test -race ./... -coverprofile=coverage.out -covermode=atomic + + - name: Upload coverage to Codecov + if: ${{ matrix.go-version == '1.19.x' }} + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..3226b45 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,28 @@ +name: golangci-lint + +on: + push: + branches: + - master + pull_request: + +permissions: + contents: read + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + cache: false + + - name: golangci-lint + uses: golangci/golangci-lint-action@v4 + with: + version: v1.56 \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..50951ba --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,34 @@ +linters: + disable-all: true + enable: + - dupl + - errcheck + - errorlint + - exportloopref + - funlen + - gci + - goconst + - gocritic + - gocyclo + - gofmt + - goimports + - gosimple + - govet + - ineffassign + - lll + - misspell + - prealloc + - revive + - staticcheck + - stylecheck + - typecheck + - unconvert + - unparam + - unused + +issues: + exclude-rules: + - path: _test\.go + linters: + - unparam + - funlen \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c1e7469..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go - -go: - - "1.15" - -os: - - linux - -env: - - GO111MODULE=on - -script: - - go test ./... -coverprofile=coverage.txt -covermode=atomic - -after_success: - - bash <(curl -s https://codecov.io/bash) \ No newline at end of file