beads/.github/workflows/ci.yml
beads/crew/emma 2137693dad revert: restore embedded Dolt mode (was only supposed to be removed from Gas Town)
Revert commits e5330641 and 0df41523 which removed embedded Dolt mode
from the beads codebase. The embedded Dolt removal was only intended for
Gas Town, not for Beads.

Restores:
- dolthub/driver dependency and embedded connection path
- Advisory flock (AccessLock) for concurrent process protection
- Embedded connector lifecycle management in DoltStore
- All CGO build tags across ~45 files
- Vendored go-icu-regex library
- nocgo stub files for non-CGO builds
- Bootstrap and embedded_uow helpers
- factory_dolt_test.go and dolt_singleprocess_test.go

Merge conflict resolutions:
- store.go: TCP fail-fast check wrapped inside if cfg.ServerMode
- store.go: backtick-quoting for embedded CREATE DATABASE (prefix-based names)
- perf_dolt.go: port references updated from 3306 to 3307
- ci.yml: restored continue-on-error for Nix (dolthub/driver requires Go 1.25.6+)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-07 21:21:24 -08:00

221 lines
6.7 KiB
YAML

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# 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@v6
- name: Check all versions match
run: ./scripts/check-versions.sh
# 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@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@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Install ICU4C (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install icu4c
dir="$(brew --prefix icu4c)"
echo "CGO_CPPFLAGS=-I$dir/include" >> "$GITHUB_ENV"
echo "CGO_LDFLAGS=-L$dir/lib -Wl,-rpath,$dir/lib" >> "$GITHUB_ENV"
echo "PKG_CONFIG_PATH=$dir/lib/pkgconfig" >> "$GITHUB_ENV"
- name: Configure Git
run: |
git config --global user.name "CI Bot"
git config --global user.email "ci@beads.test"
- name: Build
run: go build -v ./cmd/bd
- name: Test
run: go test ${{ matrix.test-flags }} ./...
- name: Check coverage threshold
if: matrix.coverage
run: |
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
MIN_COVERAGE=42
WARN_COVERAGE=55
echo "Coverage: $COVERAGE%"
if (( $(echo "$COVERAGE < $MIN_COVERAGE" | bc -l) )); then
echo "Coverage is below ${MIN_COVERAGE}% threshold"
exit 1
elif (( $(echo "$COVERAGE < $WARN_COVERAGE" | bc -l) )); then
echo "Coverage is below ${WARN_COVERAGE}% (warning threshold)"
else
echo "Coverage meets threshold"
fi
- name: Upload coverage
uses: codecov/codecov-action@v5
if: matrix.coverage && success()
with:
file: ./coverage.out
fail_ci_if_error: false
# Windows smoke tests only - full test suite times out (see bd-bmev)
# Linux/macOS run comprehensive tests; Windows just verifies binary works
test-windows:
name: Test (Windows - smoke)
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: Install ICU4C (Windows)
id: msys2
uses: msys2/setup-msys2@v2
with:
path-type: inherit
msystem: UCRT64
pacboy: icu:p toolchain:p pkg-config:p
- name: Add MSYS2 UCRT64 to PATH
run: |
echo "${{ steps.msys2.outputs.msys2-location }}\\ucrt64\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Configure Git
run: |
git config --global user.name "CI Bot"
git config --global user.email "ci@beads.test"
- name: Build
run: go build -v -o bd.exe ./cmd/bd
- name: Smoke test - version
run: ./bd.exe version
- name: Smoke test - init and CRUD
run: |
./bd.exe init --quiet --prefix smoke
$output = ./bd.exe create --title "Windows smoke test" --type task
$id = ($output | Select-String -Pattern "smoke-\w+").Matches.Value
echo "Created issue: $id"
./bd.exe list
./bd.exe show $id
./bd.exe update $id --status in_progress
./bd.exe close $id
echo "All smoke tests passed!"
fmt-check:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@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@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=5m
test-nix:
name: Test Nix Flake
runs-on: ubuntu-latest
# Allow failure until nixpkgs updates Go to 1.25.6+
# (dolthub/driver requires go 1.25.6, nixpkgs-unstable has go 1.25.1)
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Run bd help via Nix
run: |
export BEADS_DB="$PWD/.ci-beads/beads.db"
mkdir -p "$(dirname "$BEADS_DB")"
rm -rf .beads
nix run .#default -- --db "$BEADS_DB" init --quiet --prefix ci
nix run .#default -- --db "$BEADS_DB" > help.txt
- name: Verify help text
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"