Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
// .devcontainer/devcontainer.json
{
"name": "n1-dev",
"image": "mcr.microsoft.com/devcontainers/go:1.23", // Sticking with Bookworm base for now
"image": "mcr.microsoft.com/devcontainers/go:1.23",

// Define environment variables for the container - REMOVED LD_LIBRARY_PATH
// "containerEnv": {}, // Can remove if empty
// Use the official feature to handle Docker access
"features": {
"ghcr.io/devcontainers/features/docker-from-docker:1": {}
},

// Simplified postCreateCommand - removed SQLCipher build
"postCreateCommand": "bash -xc 'export DEBIAN_FRONTEND=noninteractive && sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential libssl-dev git sqlite3 && sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/* && go env -w GOPRIVATE=github.com/n1/* && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest'",
// ^^ Kept build-essential, libssl-dev (for keyring/crypto), git, sqlite3 (CLI tool)
// ^^ Removed tcl, clone, configure, make, make install, ldconfig, rm -rf /tmp/sqlcipher
// REMOVED the mounts section

"postAttachCommand": "echo \"🎉 dev-container ready (standard SQLite)\"" // Updated message
// CORRECTED postCreateCommand - removed internal comments
"postCreateCommand": "bash -xc 'export DEBIAN_FRONTEND=noninteractive \\\n && sudo apt-get update \\\n && sudo apt-get install -y --no-install-recommends build-essential libssl-dev git sqlite3 \\\n && sudo apt-get clean \\\n && sudo rm -rf /var/lib/apt/lists/* \\\n && go env -w GOPRIVATE=github.com/n1/* \\\n && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest'",

// Keep customizations
"customizations": {
"vscode": {
"settings": {},
"extensions": [
"golang.go",
"pavelkucera.vscode-roocode",
"ms-azuretools.vscode-docker",
"github.copilot"
]
}
},
"postAttachCommand": "echo \"🎉 dev-container ready (standard SQLite + Docker CLI via Feature)\""
}
39 changes: 21 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,28 @@ jobs:
with:
go-version: '1.23'
- name: Unit Tests
run: go test ./internal/...
run: go test ./internal/... # Focus on unit tests here
- name: Vet
run: go vet ./...
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.64.8

integration:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Build Binary
run: |
mkdir -p bin
go build -o bin/bosr ./cmd/bosr
- name: Integration Tests
run: CI=true go test -v ./test/...
# No version needed if you rely on .golangci.yml
# with:
# version: v1.64.8 # Can be removed

# --- DELETE THIS ENTIRE BLOCK (lines 25-39) ---
# integration:
# runs-on: ubuntu-latest
# needs: build
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.23'
# - name: Build Binary
# run: |
# mkdir -p bin
# go build -o bin/bosr ./cmd/bosr
# - name: Integration Tests
# run: CI=true go test -v ./test/...
# --- END OF BLOCK TO DELETE ---
82 changes: 82 additions & 0 deletions .github/workflows/sync-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Sync Tests

on:
push:
branches: [ main, milestones/* ]
pull_request:
branches: [ main ]

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Build
run: make build

- name: Run unit tests
run: make test

network-tests:
runs-on: ubuntu-latest
needs: unit-tests
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run network tests
run: make test-net

- name: Archive test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: test/sync/data/**/logs/*.log

cross-platform-build:
runs-on: ubuntu-latest
needs: unit-tests
strategy:
matrix:
include:
- os: windows
arch: amd64
output: bosr.exe
- os: linux
arch: amd64
output: bosr-linux-amd64
- os: linux
arch: arm64
output: bosr-linux-arm64
- os: darwin
arch: amd64
output: bosr-darwin-amd64
- os: darwin
arch: arm64
output: bosr-darwin-arm64

steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Build for ${{ matrix.os }}-${{ matrix.arch }}
run: GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o bin/${{ matrix.output }} ./cmd/bosr

- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output }}
path: bin/${{ matrix.output }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
go.work

# Dump
workspace_dump.txt
workspace_dump.txt

# Binary output directory
bin/
34 changes: 33 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
.DEFAULT_GOAL := vet

.PHONY: build test vet lint clean
.PHONY: build test vet lint clean test-net test-net-clean test-net-build

build:
go build -o bin/bosr ./cmd/bosr
go build -o bin/mirord ./cmd/mirord

test:
go test -v ./...
Expand All @@ -16,3 +17,34 @@ lint:

clean:
rm -rf bin/

# Network testing targets
test-net-build:
mkdir -p test/sync/data/vault1 test/sync/data/vault2
# Changed docker-compose to docker compose
docker compose -f test/sync/docker-compose.yml build

test-net-clean:
# Changed docker-compose to docker compose
docker compose -f test/sync/docker-compose.yml down -v
rm -rf test/sync/data

test-net: test-net-build
# Changed docker-compose to docker compose
docker compose -f test/sync/docker-compose.yml up --abort-on-container-exit test-runner
@echo "Network tests completed"

# Run a specific network test
test-net-%: test-net-build
# Start services in detached mode
@echo "Starting background services (toxiproxy, vault1, vault2)..."
docker compose -f test/sync/docker-compose.yml up -d --build toxiproxy vault1 vault2
# Wait for services to initialize (adjust sleep time if needed)
@echo "Waiting 5 seconds for services to initialize..."
@sleep 5
# Run the test runner in the foreground
@echo "Running test: $*"
docker compose -f test/sync/docker-compose.yml run --rm test-runner /app/bin/sync.test -test.v -test.run $*
# Cleanup services and volumes
@echo "Cleaning up services and volumes..."
docker compose -f test/sync/docker-compose.yml down -v
Binary file removed bin/bosr
Binary file not shown.
Loading
Loading