diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a85f039 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,33 @@ +version: 2 + +updates: + - package-ecosystem: gomod + directory: / + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + labels: + - dependencies + - go + commit-message: + prefix: "chore(deps)" + include: scope + groups: + charmbracelet: + patterns: + - "github.com/charmbracelet/*" + - "charm.land/*" + + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: monday + open-pull-requests-limit: 5 + labels: + - dependencies + - ci + commit-message: + prefix: "chore(ci)" + include: scope diff --git a/.github/rulesets/main-protection.json b/.github/rulesets/main-protection.json new file mode 100644 index 0000000..a5abea9 --- /dev/null +++ b/.github/rulesets/main-protection.json @@ -0,0 +1,43 @@ +{ + "name": "main branch protection", + "target": "branch", + "enforcement": "active", + "conditions": { + "ref_name": { + "include": ["~DEFAULT_BRANCH"], + "exclude": [] + } + }, + "rules": [ + { "type": "deletion" }, + { "type": "non_fast_forward" }, + { + "type": "pull_request", + "parameters": { + "required_approving_review_count": 0, + "dismiss_stale_reviews_on_push": false, + "require_code_owner_review": false, + "require_last_push_approval": false, + "required_review_thread_resolution": false, + "allowed_merge_methods": ["merge", "squash"] + } + }, + { + "type": "required_status_checks", + "parameters": { + "strict_required_status_checks_policy": true, + "do_not_enforce_on_create": false, + "required_status_checks": [ + { "context": "Test (ubuntu-latest)" }, + { "context": "Test (macos-latest)" }, + { "context": "Test (windows-latest)" }, + { "context": "Mod Tidy Drift" }, + { "context": "GoReleaser Config" }, + { "context": "Lint" }, + { "context": "Analyze (go)" } + ] + } + } + ], + "bypass_actors": [] +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58dc6d2..b22f538 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,15 @@ permissions: jobs: test: - name: Test - runs-on: ubuntu-latest + name: Test (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 @@ -34,16 +41,14 @@ jobs: - name: Test run: go test -race -v ./... - build-matrix: - name: Build (${{ matrix.os }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest + - name: Build + env: + CGO_ENABLED: "0" + run: go build ./... + + mod-tidy: + name: Mod Tidy Drift + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 @@ -54,10 +59,35 @@ jobs: go-version-file: go.mod cache: true - - name: Build - env: - CGO_ENABLED: "0" - run: go build ./... + - name: Tidy + run: go mod tidy + + - name: Verify no drift + run: | + git diff --exit-code go.mod go.sum || { + echo "::error::go.mod or go.sum is out of sync. Run 'go mod tidy' locally and commit the result." + exit 1 + } + + goreleaser-check: + name: GoReleaser Config + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: false + + - name: Validate .goreleaser.yml + uses: goreleaser/goreleaser-action@v6 + with: + distribution: goreleaser + version: "~> v2" + args: check lint: name: Lint