feat(cluster): implement clustering support using gossip #620
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Build & Test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - docs/** | |
| - "**.md" | |
| - .github/workflows/docs-website.yaml | |
| - .github/workflows/validations.yaml | |
| - .github/workflows/release.yaml | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: | |
| - main | |
| paths-ignore: | |
| - docs/** | |
| - "**.md" | |
| - .github/workflows/docs-website.yaml | |
| - .github/workflows/validations.yaml | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| validate: | |
| name: Quality Validations | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout code | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| # Set up Go environment | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| cache-dependency-path: "**/*.sum" | |
| - name: GolangCI Lint | |
| uses: golangci/golangci-lint-action@v9 | |
| with: | |
| version: latest | |
| - name: Run format-check | |
| run: | | |
| UNFORMATTED=$(gofmt -l .) | |
| if [ -n "$UNFORMATTED" ]; then | |
| echo "The following files are not formatted according to gofmt:" | |
| echo "$UNFORMATTED" | |
| exit 1 | |
| fi | |
| test: | |
| name: Unit Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout code | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| # Set up Go environment | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| cache-dependency-path: "**/*.sum" | |
| - name: Run tests | |
| run: go test -race -cover -covermode=atomic -coverprofile=coverage.txt ./... | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| prepare: | |
| name: Prepare Build Config | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_pr: ${{ steps.config.outputs.is_pr }} | |
| should_push_docker: ${{ steps.config.outputs.should_push_docker }} | |
| steps: | |
| - id: config | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| # PR builds: no Docker push | |
| echo "is_pr=true" >> "$GITHUB_OUTPUT" | |
| echo "should_push_docker=false" >> "$GITHUB_OUTPUT" | |
| else | |
| # Main branch: push Docker with 'main' tag | |
| echo "is_pr=false" >> "$GITHUB_OUTPUT" | |
| echo "should_push_docker=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| build: | |
| name: Build with GoReleaser | |
| runs-on: ubuntu-latest | |
| needs: | |
| - test | |
| - validate | |
| - prepare | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: "go.mod" | |
| cache: true | |
| cache-dependency-path: "**/*.sum" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| if: needs.prepare.outputs.should_push_docker == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Modify GoReleaser config for CI builds | |
| run: | | |
| # Install yq | |
| sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
| sudo chmod +x /usr/local/bin/yq | |
| if [[ "${{ needs.prepare.outputs.is_pr }}" == "true" ]]; then | |
| # PR builds: Build Docker images but don't sign or publish | |
| yq eval -i 'del(.dockers_v2)' .goreleaser.yaml | |
| else | |
| # Main branch builds: Change image tags to 'main' | |
| yq eval -i ' | |
| .dockers_v2[0].images = ["ghcr.io/spechtlabs/tka"] | | |
| .dockers_v2[0].tags = ["main"] | | |
| del(.docker_signs) | |
| ' .goreleaser.yaml | |
| fi | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| args: release --snapshot --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |