Skip to content
Merged
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
50 changes: 40 additions & 10 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,35 @@ jobs:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Free up disk space
run: |
# Remove unnecessary tools and files to free up ~10GB
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-coverage-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
key: ${{ runner.os }}-cargo-coverage-only-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-cargo-coverage-1.88-
${{ runner.os }}-cargo-
${{ runner.os }}-cargo-coverage-only-1.88-

- name: Generate code coverage
- name: Clean previous coverage artifacts
run: |
# Clean any existing coverage data
# Remove previous coverage data but keep compiled dependencies
cargo llvm-cov clean --workspace
# Show disk space before coverage generation
df -h

- name: Generate code coverage
run: |
# Run tests with coverage for all packages (excluding same files as Codecov)
# Use debug mode for coverage (release mode can interfere with coverage instrumentation)
cargo llvm-cov test --all-features --workspace --lcov --output-path lcov.info \
Expand Down Expand Up @@ -95,18 +107,36 @@ jobs:
> coverage-summary.txt
cat coverage-summary.txt

# Clean target to save space after coverage generation
du -sh target || true
cargo clean
echo "Cleaned target directory to save disk space"

# Extract coverage percentage for PR comment (use tail -1 to get TOTAL line, not first file)
COVERAGE=$(grep -oP '\d+\.\d+(?=%)' coverage-summary.txt | tail -1)
echo "COVERAGE_PERCENT=$COVERAGE" >> $GITHUB_ENV

# Note: Coverage validation is now handled by Codecov, not locally
echo "ℹ️ Coverage validation delegated to Codecov - see https://codecov.io/gh/${{ github.repository }}"

- name: Cleanup cache before saving
run: |
echo "📊 Disk usage before cleanup:"
du -sh target || true

# Remove coverage-specific artifacts that shouldn't be cached
rm -rf target/llvm-cov-target
rm -rf target/debug/.fingerprint/*-llvm-cov*
rm -rf target/*/debug/coverage*

# Remove test binaries (large and rebuilt every time)
find target -type f -name '*-????????????????' -executable -delete 2>/dev/null || true

# Remove incremental compilation data (doesn't help across runs)
rm -rf target/debug/incremental
rm -rf target/release/incremental

# Keep: compiled dependencies in target/debug/deps/*.rlib
# Keep: build script outputs in target/debug/build/*/out

echo "📊 Disk usage after cleanup:"
du -sh target || true

- name: Post coverage comment
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
Expand Down
79 changes: 58 additions & 21 deletions .github/workflows/external-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ env:
MCP_VALIDATOR_API_URL: https://api.mcp-validator.com
JSONRPC_VALIDATOR_URL: https://json-rpc.dev/api/validate

permissions:
contents: read
packages: read

jobs:
# Fast validation for PRs - Ubuntu only
validate-framework-fast:
Expand Down Expand Up @@ -54,8 +58,7 @@ jobs:
target
key: ${{ runner.os }}-cargo-external-fast-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-cargo-external-1.88-
${{ runner.os }}-cargo-
${{ runner.os }}-cargo-external-fast-1.88-

- name: Clean procedural macro artifacts
run: |
Expand All @@ -64,11 +67,13 @@ jobs:

- name: Build framework (parallel)
run: |
cargo build --all-features --release --jobs $(nproc)
# Cargo automatically detects CPU count for parallel builds
cargo build --all-features --release

- name: Run core tests (parallel)
run: |
cargo test --all-features --release --jobs $(nproc) --workspace --exclude pulseengine-mcp-external-validation
# Cargo automatically detects CPU count for parallel tests
cargo test --all-features --release --workspace --exclude pulseengine-mcp-external-validation

- name: Run external validation tests
run: |
Expand Down Expand Up @@ -114,18 +119,26 @@ jobs:
with:
python-version: ${{ matrix.python }}

- name: Free up disk space
if: runner.os == 'Linux'
run: |
# Remove unnecessary tools and files to free up ~10GB
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-external-${{ matrix.rust }}-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
key: ${{ runner.os }}-cargo-external-full-${{ matrix.rust }}-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-cargo-external-${{ matrix.rust }}-1.88-
${{ runner.os }}-cargo-external-1.88-
${{ runner.os }}-cargo-
${{ runner.os }}-cargo-external-full-${{ matrix.rust }}-1.88-

- name: Cache Python dependencies
uses: actions/cache@v4
Expand Down Expand Up @@ -180,13 +193,13 @@ jobs:

- name: Build framework (parallel)
run: |
# Use parallel compilation and release mode
cargo build --all-features --release --jobs $(if [ "${{ runner.os }}" = "Windows" ]; then echo $NUMBER_OF_PROCESSORS; else nproc; fi)
# Use parallel compilation and release mode (Cargo automatically detects CPU count)
cargo build --all-features --release

- name: Run core tests (parallel)
run: |
# Run tests in parallel, excluding external validation to reduce time
cargo test --all-features --release --jobs $(if [ "${{ runner.os }}" = "Windows" ]; then echo $NUMBER_OF_PROCESSORS; else nproc; fi) --workspace --exclude pulseengine-mcp-external-validation
# Run tests in parallel, excluding external validation to reduce time (Cargo automatically detects CPU count)
cargo test --all-features --release --workspace --exclude pulseengine-mcp-external-validation

- name: Run external validation tests
run: |
Expand All @@ -201,6 +214,7 @@ jobs:
echo "✅ Validation tools built successfully"

- name: Build timedate-mcp-server for stdio testing
shell: bash
run: |
# Check if timedate-mcp-server exists in external workspace
if [ -d "../timedate-mcp" ]; then
Expand All @@ -217,6 +231,7 @@ jobs:
continue-on-error: true

- name: Run stdio integration tests
shell: bash
run: |
# Only run if we have the timedate-mcp-server binary
if [ -f "./target/release/timedate-mcp-server" ]; then
Expand All @@ -229,6 +244,24 @@ jobs:
env:
RUST_LOG: info

- name: Cleanup cache before saving
run: |
echo "📊 Disk usage before cleanup:"
du -sh target 2>/dev/null || true

# Remove test binaries (large and rebuilt every time)
find target -type f -name '*-????????????????' -executable -delete 2>/dev/null || true

# Remove incremental compilation data (doesn't help across runs)
rm -rf target/debug/incremental
rm -rf target/release/incremental

# Keep: compiled dependencies in target/*/deps/*.rlib
# Keep: build script outputs in target/*/build/*/out

echo "📊 Disk usage after cleanup:"
du -sh target 2>/dev/null || true

# TODO: Re-enable server validation once we have a proper HTTP test server
# - name: Run full compliance validation
# run: |
Expand Down Expand Up @@ -265,7 +298,6 @@ jobs:
key: ${{ runner.os }}-cargo-stdio-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-cargo-stdio-1.88-
${{ runner.os }}-cargo-

- name: Build framework
run: |
Expand All @@ -280,20 +312,25 @@ jobs:
continue-on-error: true

- name: Build timedate-mcp-server
shell: bash
run: |
if [ -d "timedate-mcp" ]; then
echo "Building timedate-mcp-server"
cd timedate-mcp
cargo build --release
cd ..
# Copy binary to expected location
mkdir -p ./target/release
cp timedate-mcp/target/release/timedate-mcp-server ./target/release/
echo "✅ timedate-mcp-server built successfully"
if cargo build --release; then
cd ..
# Copy binary to expected location
mkdir -p ./target/release
cp timedate-mcp/target/release/timedate-mcp-server ./target/release/
echo "✅ timedate-mcp-server built successfully"
else
cd ..
echo "❌ timedate-mcp-server build failed - tests will be skipped"
fi
else
echo "❌ timedate-mcp repository not available"
exit 1
echo "⚠️ timedate-mcp repository not available - tests will be skipped"
fi
continue-on-error: true

- name: Install MCP Inspector
run: |
Expand Down
45 changes: 38 additions & 7 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,25 @@ jobs:
echo "Clippy version: $(cargo clippy --version)"
echo "Rustfmt version: $(cargo fmt --version)"

- name: Free up disk space
run: |
# Remove unnecessary tools and files to free up ~10GB
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
df -h

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-pr-release-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
key: ${{ runner.os }}-cargo-pr-quick-1.88-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }}
restore-keys: |
${{ runner.os }}-cargo-pr-1.88-
${{ runner.os }}-cargo-
${{ runner.os }}-cargo-pr-quick-1.88-

- name: Check formatting
run: cargo fmt --all -- --check
Expand All @@ -95,21 +103,44 @@ jobs:
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Clean previous coverage artifacts
run: |
# Remove previous coverage data but keep compiled dependencies
cargo llvm-cov clean --workspace
df -h

- name: Generate coverage report
run: |
# Clean previous builds to save space, then generate coverage
cargo clean
cargo llvm-cov test --all-features --workspace --lcov --output-path lcov.info
cargo llvm-cov report --summary-only > coverage-summary.txt
COVERAGE=$(grep -oP '\d+\.\d+(?=%)' coverage-summary.txt | head -1)
echo "Coverage: $COVERAGE%"

- name: Check documentation
run: |
# Clean before docs to save space, build docs for all packages
cargo clean
# Build docs for all packages
cargo doc --all-features --no-deps

- name: Cleanup cache before saving
run: |
echo "📊 Disk usage before cleanup:"
du -sh target || true

# Remove coverage-specific artifacts
rm -rf target/llvm-cov-target
rm -rf target/debug/.fingerprint/*-llvm-cov*
rm -rf target/*/debug/coverage*

# Remove test binaries (large and rebuilt every time)
find target -type f -name '*-????????????????' -executable -delete 2>/dev/null || true

# Remove incremental compilation data
rm -rf target/debug/incremental
rm -rf target/release/incremental

echo "📊 Disk usage after cleanup:"
du -sh target || true

validation-specific-tests:
name: Validation Framework Tests
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
env:
CARGO_TERM_COLOR: always

permissions:
contents: write
packages: read

jobs:
validate-release:
name: Validate Release
Expand Down Expand Up @@ -87,7 +91,6 @@ jobs:
with:
files: |
mcp-validation-tools-*.tar.gz
release-compliance-report.html
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down Expand Up @@ -145,6 +148,7 @@ jobs:
cargo test --release --target ${{ matrix.target }} --package pulseengine-mcp-external-validation

- name: Package platform-specific release
shell: bash
run: |
mkdir -p dist

Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/scheduled-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ env:
CARGO_TERM_COLOR: always
RUST_LOG: info

permissions:
contents: write
issues: write

jobs:
validate-external-servers:
name: Validate External MCP Servers
Expand Down
3 changes: 0 additions & 3 deletions examples/hello-world-with-auth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ impl HelloWorldAuth {
.name
.unwrap_or_else(|| "Authenticated World".to_string());

// In a real implementation, you could access the auth context here
// let auth = request_context.auth_context();

info!("Hello tool called with name: {}", name);
Ok(format!(
"Hello, {name}! 🔐 (Secured with MCP Security Middleware)"
Expand Down
2 changes: 0 additions & 2 deletions mcp-auth/src/bin/mcp-auth-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,8 +1624,6 @@ async fn handle_rate_limit_operation(
cli: &Cli,
operation: RateLimitCommands,
) -> Result<(), Box<dyn std::error::Error>> {
// use pulseengine_mcp_auth::models::Role;

match operation {
RateLimitCommands::Stats => {
let stats = auth_manager.get_rate_limit_stats().await;
Expand Down
Loading