diff --git a/.gitea/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from .gitea/ISSUE_TEMPLATE/bug_report.md rename to .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.gitea/ISSUE_TEMPLATE/feature-request---enhancement.md b/.github/ISSUE_TEMPLATE/feature-request---enhancement.md similarity index 100% rename from .gitea/ISSUE_TEMPLATE/feature-request---enhancement.md rename to .github/ISSUE_TEMPLATE/feature-request---enhancement.md diff --git a/.gitea/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md similarity index 100% rename from .gitea/ISSUE_TEMPLATE/question.md rename to .github/ISSUE_TEMPLATE/question.md diff --git a/.gitea/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from .gitea/PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/workflows/job_coverage.yml b/.github/workflows/job_coverage.yml new file mode 100644 index 0000000..3238e77 --- /dev/null +++ b/.github/workflows/job_coverage.yml @@ -0,0 +1,53 @@ +name: coverage + +on: + push: + branches: [ main, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' + pull_request: + branches: [ main, v3, v4 ] + +jobs: + + build: + if: github.server_url != 'https://github.com' + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + with: + filter: 'blob:none' + + - name: setup go + uses: actions/setup-go@v5 + with: + cache-dependency-path: "**/*.sum" + go-version: 'stable' + + - name: test coverage + run: | + go test -v -cover ./... -covermode=count -coverprofile coverage.out -coverpkg ./... + go tool cover -func coverage.out -o coverage.out + + - name: coverage badge + uses: tj-actions/coverage-badge-go@v2 + with: + green: 80 + filename: coverage.out + + - uses: stefanzweifel/git-auto-commit-action@v4 + name: autocommit + with: + commit_message: Apply Code Coverage Badge + skip_fetch: false + skip_checkout: false + file_pattern: ./README.md + + - name: push + if: steps.auto-commit-action.outputs.changes_detected == 'true' + uses: ad-m/github-push-action@master + with: + github_token: ${{ github.token }} + branch: ${{ github.ref }} diff --git a/.gitea/workflows/job_lint.yml b/.github/workflows/job_lint.yml similarity index 72% rename from .gitea/workflows/job_lint.yml rename to .github/workflows/job_lint.yml index d97e747..1c104db 100644 --- a/.gitea/workflows/job_lint.yml +++ b/.github/workflows/job_lint.yml @@ -3,10 +3,10 @@ name: lint on: pull_request: types: [opened, reopened, synchronize] - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' jobs: lint: @@ -20,10 +20,10 @@ jobs: uses: actions/setup-go@v5 with: cache-dependency-path: "**/*.sum" - go-version: 'stable' + go-version: 'stable' - name: setup deps run: go get -v ./... - name: run lint - uses: https://github.com/golangci/golangci-lint-action@v6 + uses: golangci/golangci-lint-action@v6 with: version: 'latest' diff --git a/.gitea/workflows/job_test.yml b/.github/workflows/job_test.yml similarity index 80% rename from .gitea/workflows/job_test.yml rename to .github/workflows/job_test.yml index f68cbca..59a95ae 100644 --- a/.gitea/workflows/job_test.yml +++ b/.github/workflows/job_test.yml @@ -3,15 +3,12 @@ name: test on: pull_request: types: [opened, reopened, synchronize] - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] push: - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' jobs: test: diff --git a/.gitea/workflows/job_tests.yml b/.github/workflows/job_tests.yml similarity index 68% rename from .gitea/workflows/job_tests.yml rename to .github/workflows/job_tests.yml index e911576..9af2291 100644 --- a/.gitea/workflows/job_tests.yml +++ b/.github/workflows/job_tests.yml @@ -3,15 +3,12 @@ name: test on: pull_request: types: [opened, reopened, synchronize] - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] push: - branches: - - master - - v3 - - v4 + branches: [ master, v3, v4 ] + paths-ignore: + - '.github/**' + - '.gitea/**' jobs: test: @@ -35,19 +32,19 @@ jobs: go-version: 'stable' - name: setup go work env: - GOWORK: /workspace/${{ github.repository_owner }}/go.work + GOWORK: ${{ github.workspace }}/go.work run: | go work init go work use . - go work use micro-tests + go work use micro-tests - name: setup deps env: - GOWORK: /workspace/${{ github.repository_owner }}/go.work + GOWORK: ${{ github.workspace }}/go.work run: go get -v ./... - name: run tests env: INTEGRATION_TESTS: yes - GOWORK: /workspace/${{ github.repository_owner }}/go.work + GOWORK: ${{ github.workspace }}/go.work run: | cd micro-tests - go test -mod readonly -v ./... || true + go test -mod readonly -v ./... || true diff --git a/.golangci.yml b/.golangci.yml index 20f3144..c6a7985 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,21 +1,5 @@ run: concurrency: 8 - deadline: 5m + timeout: 5m issues-exit-code: 1 tests: true - -linters: - enable: - - staticcheck - - unused - - gosimple - - govet - - prealloc - - unconvert - - nakedret - -linters-settings: - govet: - check-all: true - enable: - - fieldalignment \ No newline at end of file diff --git a/kgo_test.go b/kgo_test.go index a1955dd..891f504 100644 --- a/kgo_test.go +++ b/kgo_test.go @@ -117,6 +117,10 @@ func TestFail(t *testing.T) { } func TestConnect(t *testing.T) { + if tr := os.Getenv("INTEGRATION_TESTS"); len(tr) > 0 { + t.Skip() + } + var addrs []string ctx := context.TODO() b := kgo.NewBroker(