name: CI on: push: branches: [ main ] pull_request: branches: [ main ] merge_group: concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: detect-ci-tier: name: Detect CI tier runs-on: ubuntu-latest outputs: full_embedded: ${{ steps.tier.outputs.full_embedded }} reason: ${{ steps.tier.outputs.reason }} steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 0 - name: Decide embedded Dolt coverage id: tier env: PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: bash .github/scripts/ci-embedded-tier.sh # Fast check: every `go build|test|run|generate|install` invocation in # tracked scripts/hooks/CI carries -tags=gms_pure_go. Prevents ICU-linkage # regressions from re-entering the build (see docs/ICU-POLICY.md). check-build-tags: name: Check build-tag policy runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - run: ./scripts/check-build-tags.sh - run: ./scripts/check-go-install-guidance.sh # Fast check to ensure all version files are in sync check-version-consistency: name: Check version consistency runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Check all versions match run: ./scripts/check-versions.sh # Check documentation references match actual CLI flags check-doc-flags: name: Check doc flags freshness runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: 'go.mod' - name: Build bd run: go build -tags gms_pure_go -o bd ./cmd/bd/ - name: Validate docs against CLI run: ./scripts/check-doc-flags.sh ./bd # Fast check to catch accidental .beads/issues.jsonl changes from contributors check-no-beads-changes: name: Check for .beads changes runs-on: ubuntu-latest if: github.event_name == 'pull_request' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 0 - name: Check for .beads/issues.jsonl changes run: | if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q "^\.beads/issues\.jsonl$"; then echo "This PR includes changes to .beads/issues.jsonl" echo "" echo "This file is the project's issue database and should not be modified in PRs." echo "" echo "To fix, run:" echo " git checkout origin/main -- .beads/issues.jsonl" echo " git commit --amend" echo " git push --force" echo "" exit 1 fi echo "No .beads/issues.jsonl changes detected" # Cross-platform test matrix (Linux/macOS only - Windows uses smoke tests) test: name: Test (${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] include: # Linux: full test suite with coverage - os: ubuntu-latest coverage: true test-flags: '-v -race -short -coverprofile=coverage.out' # macOS: full test suite, no coverage (faster) - os: macos-latest coverage: false test-flags: '-v -race -short' steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: 'go.mod' - name: Install Dolt (Linux) if: runner.os == 'Linux' run: curl -fsSL https://github.com/dolthub/dolt/releases/latest/download/install.sh | sudo bash - name: Install Dolt (macOS) if: runner.os == 'macOS' run: brew install dolt - name: Configure Git and Dolt identity run: | git config --global user.name "CI Bot" git config --global user.email "ci@beads.test" dolt config --global --add user.name "CI Bot" dolt config --global --add user.email "ci@beads.test" - name: Install gotestsum if: matrix.coverage run: go install gotest.tools/gotestsum@latest - name: Build run: go build -v -tags gms_pure_go ./cmd/bd - name: Test (with coverage + JUnit XML) if: matrix.coverage run: | gotestsum \ --junitfile junit.xml \ --format testdox \ -- -tags gms_pure_go -race -short -coverprofile=coverage.out -skip '^TestEmbedded' ./... - name: Test if: ${{ !matrix.coverage }} run: go test -tags gms_pure_go ${{ matrix.test-flags }} -skip '^TestEmbedded' ./... - name: Upload coverage to Codecov if: matrix.coverage && !cancelled() uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6 continue-on-error: true with: files: coverage.out token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false - name: Upload test results to Codecov if: matrix.coverage && !cancelled() uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6 continue-on-error: true with: files: junit.xml token: ${{ secrets.CODECOV_TOKEN }} report_type: test_results fail_ci_if_error: false # Embedded Dolt tests - test the in-process Dolt engine (no server required) # # Split into: build → storage tests + parallel cmd test shards. # cmd/bd embedded tests use a committed shard manifest; newly-added tests # still auto-distribute via hash fallback until the manifest is updated. build-embedded: name: Build (Embedded Dolt) needs: detect-ci-tier if: needs.detect-ci-tier.outputs.full_embedded == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: 'go.mod' - name: Build embedded bd binary run: go build -tags gms_pure_go -race -o /tmp/bd-embedded-test ./cmd/bd/ - name: Build embedded storage test binary run: go test -tags gms_pure_go -race -c -o /tmp/embeddeddolt-test ./internal/storage/embeddeddolt/ - name: Build embedded cmd test binary run: go test -tags gms_pure_go -race -c -o /tmp/bd-cmd-test ./cmd/bd/ - name: Upload binaries uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 with: name: embedded-test-binaries path: | /tmp/bd-embedded-test /tmp/embeddeddolt-test /tmp/bd-cmd-test retention-days: 1 test-embedded-storage: name: Test (Embedded Dolt Storage) needs: [detect-ci-tier, build-embedded] if: needs.detect-ci-tier.outputs.full_embedded == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Download binaries uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: name: embedded-test-binaries path: /tmp/ - name: Fix permissions run: chmod +x /tmp/embeddeddolt-test - name: Configure Git run: | git config --global user.name "CI Bot" git config --global user.email "ci@beads.test" - name: Test env: BEADS_TEST_EMBEDDED_DOLT: "1" BEADS_TEST_EMBEDDED_TEST_BINARY: /tmp/embeddeddolt-test run: /tmp/embeddeddolt-test -test.v -test.count=1 -test.timeout=10m test-embedded-cmd: name: Test (Embedded Dolt Cmd ${{ matrix.shard }}/${{ strategy.job-total }}) needs: [detect-ci-tier, build-embedded] if: needs.detect-ci-tier.outputs.full_embedded == 'true' runs-on: ubuntu-latest strategy: fail-fast: false matrix: shard: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Download binaries uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: name: embedded-test-binaries path: /tmp/ - name: Fix permissions run: chmod +x /tmp/bd-embedded-test /tmp/embeddeddolt-test /tmp/bd-cmd-test - name: Configure Git run: | git config --global user.name "CI Bot" git config --global user.email "ci@beads.test" - name: Test env: BEADS_TEST_EMBEDDED_DOLT: "1" BEADS_TEST_BD_BINARY: /tmp/bd-embedded-test run: bash .github/scripts/embedded-test-shard.sh ${{ matrix.shard }} 20 # Windows smoke tests only - full test suite times out (see bd-bmev) # Linux/macOS run comprehensive tests; Windows just verifies binary works # # Windows uses -tags gms_pure_go to avoid the ICU regex dependency. # go-icu-regex's regex_windows.go also uses Go stdlib regexp (build tag: windows). # CGO is still required for gozstd (bundled C source) and the embedded dolt engine. test-windows: name: Test (Windows - smoke) runs-on: windows-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: 'go.mod' - name: Configure Git run: | git config --global user.name "CI Bot" git config --global user.email "ci@beads.test" - name: Build (pure Go regex) run: go build -v -tags gms_pure_go -o bd.exe ./cmd/bd - name: Smoke test - version run: ./bd.exe version - name: Smoke test - help run: ./bd.exe help fmt-check: name: Check formatting runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: 'go.mod' - name: Check gofmt run: make fmt-check lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - name: Set up Go uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version-file: 'go.mod' - name: golangci-lint uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9 with: version: latest args: --timeout=5m --build-tags=gms_pure_go test-nix: name: Test Nix Flake runs-on: ubuntu-latest timeout-minutes: 10 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - uses: DeterminateSystems/determinate-nix-action@f4c468f2287f0f14a113841b41f2dc8957119519 # v3 - name: Run bd help via Nix id: nix_help run: | nix run .#default -- --help > help.txt - name: Verify help text if: steps.nix_help.outcome == 'success' run: | FIRST_LINE=$(head -n 1 help.txt) EXPECTED="Issues chained together like beads. A lightweight issue tracker with first-class dependency support." if [ "$FIRST_LINE" != "$EXPECTED" ]; then echo "First line of help.txt doesn't match expected output" echo "Expected: $EXPECTED" echo "Got: $FIRST_LINE" exit 1 fi echo "Help text first line is correct"