Skip to content

Route wirecheck tracing to stderr, keep headless stdout pure JSON #479

Route wirecheck tracing to stderr, keep headless stdout pure JSON

Route wirecheck tracing to stderr, keep headless stdout pure JSON #479

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-git-
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Run tests
run: cargo test --workspace --verbose
- name: Build all examples
run: claude-codes/build_examples.sh
- name: Build documentation
run: cargo doc --workspace --no-deps
check-json:
name: Check JSON Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Check JSON test cases are formatted
run: |
set -e
# Check if test cases directory exists
if [ ! -d "claude-codes/test_cases/failed_deserializations" ]; then
echo "No test cases directory found, skipping"
exit 0
fi
# Check each JSON file
FAILED=0
for file in claude-codes/test_cases/failed_deserializations/*.json; do
if [ -f "$file" ]; then
filename=$(basename "$file")
# Create a formatted version
if jq '.' "$file" > /tmp/formatted.json 2>/dev/null; then
# Check if the file is already formatted
if ! cmp -s "$file" /tmp/formatted.json; then
echo "❌ $filename is not properly formatted"
echo " Run ./format_test_cases.sh to fix"
FAILED=1
else
echo "✅ $filename is properly formatted"
fi
else
echo "❌ $filename contains invalid JSON"
FAILED=1
fi
fi
done
if [ "$FAILED" -eq 1 ]; then
echo ""
echo "Some JSON files are not properly formatted."
echo "Please run ./format_test_cases.sh locally and commit the changes."
exit 1
fi
check-versions:
name: Check Version Consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check version strings are in sync
run: |
set -e
FAILED=0
# Extract sources of truth
CLAUDE_VERSION=$(grep '^version' claude-codes/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
CODEX_VERSION=$(grep '^version' codex-codes/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
CLAUDE_TESTED=$(grep 'const TESTED_VERSION' claude-codes/src/version.rs | grep -oP '\d+\.\d+\.\d+')
CODEX_TESTED=$(grep 'Tested against.*Codex CLI' codex-codes/README.md | grep -oP '\d+\.\d+\.\d+')
OPENCODE_VERSION=$(grep '^version' opencode-codes/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
OPENCODE_TESTED=$(grep 'Tested against.*opencode' opencode-codes/README.md | grep -oP '\d+\.\d+\.\d+')
echo "claude-codes version: $CLAUDE_VERSION"
echo "codex-codes version: $CODEX_VERSION"
echo "opencode-codes version: $OPENCODE_VERSION"
echo "Claude CLI tested: $CLAUDE_TESTED"
echo "Codex CLI tested: $CODEX_TESTED"
echo "opencode tested: $OPENCODE_TESTED"
echo ""
# Check root README contains correct claude-codes version
if ! grep -q "claude-codes $CLAUDE_VERSION" README.md; then
echo "❌ README.md missing 'claude-codes $CLAUDE_VERSION'"
FAILED=1
else
echo "✅ README.md has claude-codes $CLAUDE_VERSION"
fi
# Check root README contains correct Claude CLI tested version
if ! grep -q "Claude CLI.*$CLAUDE_TESTED" README.md; then
echo "❌ README.md missing Claude CLI tested version $CLAUDE_TESTED"
FAILED=1
else
echo "✅ README.md has Claude CLI $CLAUDE_TESTED"
fi
# Check claude-codes README contains correct Claude CLI tested version
if ! grep -q "$CLAUDE_TESTED" claude-codes/README.md; then
echo "❌ claude-codes/README.md missing tested version $CLAUDE_TESTED"
FAILED=1
else
echo "✅ claude-codes/README.md has Claude CLI $CLAUDE_TESTED"
fi
# Check root README contains correct codex-codes version
if ! grep -q "$CODEX_VERSION" README.md; then
echo "❌ README.md missing codex-codes version $CODEX_VERSION"
FAILED=1
else
echo "✅ README.md has codex-codes $CODEX_VERSION"
fi
# Check root README contains correct Codex CLI tested version
if ! grep -q "Codex CLI.*$CODEX_TESTED" README.md; then
echo "❌ README.md missing Codex CLI tested version $CODEX_TESTED"
FAILED=1
else
echo "✅ README.md has Codex CLI $CODEX_TESTED"
fi
# Check codex-codes README contains correct Codex CLI tested version
if ! grep -q "$CODEX_TESTED" codex-codes/README.md; then
echo "❌ codex-codes/README.md missing tested version $CODEX_TESTED"
FAILED=1
else
echo "✅ codex-codes/README.md has Codex CLI $CODEX_TESTED"
fi
# Check root README contains correct opencode-codes version
if ! grep -q "opencode-codes $OPENCODE_VERSION" README.md; then
echo "❌ README.md missing 'opencode-codes $OPENCODE_VERSION'"
FAILED=1
else
echo "✅ README.md has opencode-codes $OPENCODE_VERSION"
fi
# Check root README contains correct opencode tested version
if ! grep -q "tested against opencode.*$OPENCODE_TESTED" README.md; then
echo "❌ README.md missing opencode tested version $OPENCODE_TESTED"
FAILED=1
else
echo "✅ README.md has opencode $OPENCODE_TESTED"
fi
# Check opencode-codes README contains correct opencode tested version
if ! grep -q "$OPENCODE_TESTED" opencode-codes/README.md; then
echo "❌ opencode-codes/README.md missing tested version $OPENCODE_TESTED"
FAILED=1
else
echo "✅ opencode-codes/README.md has opencode $OPENCODE_TESTED"
fi
# muse-codes: crate version == tested Muse Code version, in both READMEs.
MUSE_VERSION=$(grep '^version' muse-codes/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
MUSE_TESTED=$(grep 'Tested against Muse Code' muse-codes/README.md | grep -oP '\d+\.\d+\.\d+' | head -1)
echo "muse-codes version: $MUSE_VERSION (tested: $MUSE_TESTED)"
if ! grep -q "muse-codes $MUSE_VERSION" README.md; then
echo "❌ README.md missing 'muse-codes $MUSE_VERSION'"
FAILED=1
else
echo "✅ README.md has muse-codes $MUSE_VERSION"
fi
if ! grep -q "tested against Muse Code.*$MUSE_TESTED" README.md; then
echo "❌ README.md missing Muse Code tested version $MUSE_TESTED"
FAILED=1
else
echo "✅ README.md has Muse Code $MUSE_TESTED"
fi
# Crate may carry a patch offset above the CLI release; require
# only that major.minor track the tested Muse Code version.
if [ "${MUSE_VERSION%.*}" != "${MUSE_TESTED%.*}" ]; then
echo "❌ muse-codes major.minor ($MUSE_VERSION) != tested Muse Code ($MUSE_TESTED)"
FAILED=1
fi
if [ "$FAILED" -eq 1 ]; then
echo ""
echo "Version strings are out of sync. Update the READMEs to match."
exit 1
else
echo ""
echo "All version strings are consistent."
fi
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run cargo audit
run: cargo audit
msrv:
name: Minimum Supported Rust Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust 1.85
uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.85"
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-msrv-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-msrv-
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-git-msrv-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-git-msrv-
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-msrv-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-msrv-
- name: Check MSRV
run: cargo check --workspace
test-annotations:
name: Check Test Annotations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Every integration test carries a /// description
run: python3 scripts/check_test_annotations.py --check