- Add testutil.TempDirInMemory() using /dev/shm on Linux for 20-30% I/O speedup - Update slow hash multiclone tests to use in-memory filesystem - Convert 17 scripttest tests (~200+s) to fast CLI tests (31s) with --no-daemon - Disable slow scripttest suite behind build tag - Add README_TESTING.md documenting test strategy and optimizations - Update CI to use -short flag for PR checks, full tests nightly Results: - TestHashIDs_* reduced from ~20s to ~11s (45% reduction) - Scripttest suite eliminated from default runs (massive speedup) - Total integration test time significantly reduced Closes bd-gm7p, bd-l5gq Amp-Thread-ID: https://ampcode.com/threads/T-c2b9434a-cd29-4725-b8e0-cbea50b36fe2 Co-authored-by: Amp <amp@ampcode.com>
110 lines
2.8 KiB
YAML
110 lines
2.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- 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 -v -race -short -coverprofile=coverage.out ./...
|
|
|
|
- name: Check coverage threshold
|
|
run: |
|
|
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
|
echo "Coverage: $COVERAGE%"
|
|
if (( $(echo "$COVERAGE < 50" | bc -l) )); then
|
|
echo "❌ Coverage is below 50% threshold"
|
|
exit 1
|
|
elif (( $(echo "$COVERAGE < 55" | bc -l) )); then
|
|
echo "⚠️ Coverage is below 55% (warning threshold)"
|
|
else
|
|
echo "✅ Coverage meets threshold"
|
|
fi
|
|
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v4
|
|
if: success()
|
|
with:
|
|
file: ./coverage.out
|
|
fail_ci_if_error: false
|
|
|
|
test-windows:
|
|
name: Test (Windows)
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- 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 -v -short ./...
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24'
|
|
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v8
|
|
with:
|
|
version: latest
|
|
args: --timeout=5m
|
|
test-nix:
|
|
name: Test Nix Flake
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- run: nix run .#default > 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"
|