Skip to content

feat(qemu): Complete QEMU USB/IP test tool implementation #18

feat(qemu): Complete QEMU USB/IP test tool implementation

feat(qemu): Complete QEMU USB/IP test tool implementation #18

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
# Global environment variables for consistent status reporting
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
lint:
name: Code Quality (SwiftLint)
runs-on: macos-latest
steps:
- name: πŸ“‹ Starting Code Quality Check
run: |
echo "::notice title=Code Quality Check::Starting SwiftLint validation for code quality and style compliance"
echo "πŸ” This check validates Swift code against project style guidelines"
echo "πŸ“Š Status: STARTING"
- name: Checkout code
uses: actions/checkout@v4
- name: Cache SwiftLint
uses: actions/cache@v3
with:
path: |
/usr/local/bin/swiftlint
/opt/homebrew/bin/swiftlint
key: ${{ runner.os }}-swiftlint-${{ hashFiles('.swiftlint.yml') }}
restore-keys: |
${{ runner.os }}-swiftlint-
- name: πŸ”§ Install SwiftLint
run: |
echo "::group::SwiftLint Installation"
echo "πŸ“¦ Checking SwiftLint installation status..."
# Check if SwiftLint is already installed
if ! command -v swiftlint &> /dev/null; then
echo "::notice title=SwiftLint Installation::Installing SwiftLint via Homebrew"
echo "⬇️ SwiftLint not found, installing via Homebrew..."
brew install swiftlint
echo "βœ… SwiftLint installation completed"
else
echo "::notice title=SwiftLint Found::Using cached SwiftLint installation"
echo "βœ… SwiftLint is already installed"
echo "πŸ“‹ Version: $(swiftlint version)"
fi
echo "::endgroup::"
- name: πŸ” Run SwiftLint Analysis
run: |
echo "::group::SwiftLint Analysis"
echo "::notice title=Code Analysis::Running SwiftLint with strict validation"
echo "πŸ” Analyzing Swift code for style violations..."
echo "πŸ“Š Status: RUNNING"
echo "βš™οΈ Configuration: Using .swiftlint.yml rules"
echo "🎯 Mode: Strict (warnings treated as errors)"
# Use --strict to fail on warnings, --reporter xcode for detailed output
if swiftlint lint --strict --reporter xcode; then
echo "::notice title=SwiftLint Success::No code style violations found"
echo "βœ… Code quality check PASSED"
echo "πŸ“Š Status: SUCCESS"
else
echo "::error title=SwiftLint Violations::Code style violations detected"
echo "❌ Code quality check FAILED"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
continue-on-error: false
- name: πŸ“Š Code Quality Summary
if: always()
run: |
echo "::group::Code Quality Check Summary"
if [ ${{ job.status }} == 'success' ]; then
echo "::notice title=Code Quality Complete::All code quality checks passed successfully"
echo "βœ… SwiftLint validation: PASSED"
echo "πŸ“‹ No style violations found"
echo "🎯 Code meets project quality standards"
else
echo "::error title=Code Quality Failed::Code quality checks failed"
echo "❌ SwiftLint validation: FAILED"
echo "πŸ“‹ Style violations detected - see details above"
echo "πŸ”§ Action required: Fix code style issues before merging"
fi
echo "::endgroup::"
build:
name: Build Validation
runs-on: macos-latest
steps:
- name: πŸ—οΈ Starting Build Validation
run: |
echo "::notice title=Build Validation::Starting project compilation and build validation"
echo "πŸ”¨ This check validates that the project compiles successfully"
echo "πŸ“Š Status: STARTING"
- name: Checkout code
uses: actions/checkout@v4
- name: πŸ“‹ Verify Build Environment
run: |
echo "::group::Build Environment Information"
echo "::notice title=Environment Setup::Verifying Swift and macOS environment"
echo "πŸ”§ Swift version: $(swift --version | head -n1)"
echo "πŸ–₯️ macOS runner: $(sw_vers -productName) $(sw_vers -productVersion)"
echo "πŸ“Š Environment status: READY"
echo "::endgroup::"
- name: Cache Swift packages
uses: actions/cache@v3
with:
path: |
.build
~/Library/Caches/org.swift.swiftpm
~/Library/org.swift.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('Package.swift', 'Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: πŸ“¦ Resolve Dependencies
run: |
echo "::group::Dependency Resolution"
echo "::notice title=Dependencies::Resolving Swift package dependencies"
echo "πŸ“¦ Resolving Swift package dependencies..."
echo "πŸ“Š Status: RESOLVING"
if swift package resolve; then
echo "::notice title=Dependencies Success::All dependencies resolved successfully"
echo "βœ… Dependencies resolved successfully"
echo "πŸ“Š Status: RESOLVED"
else
echo "::error title=Dependencies Failed::Failed to resolve package dependencies"
echo "❌ Dependency resolution failed"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
- name: πŸ”¨ Build Project
run: |
echo "::group::Project Compilation"
echo "::notice title=Build Process::Compiling project with Swift Package Manager"
echo "πŸ”¨ Building project with Swift Package Manager..."
echo "πŸ“Š Status: BUILDING"
echo "βš™οΈ Build mode: Debug with verbose output"
# Build with verbose output to capture detailed error information
if swift build --verbose; then
echo "::notice title=Build Success::Project compiled successfully"
echo "βœ… Build completed successfully"
echo "πŸ“Š Status: SUCCESS"
echo "🎯 All Swift modules compiled without errors"
else
echo "::error title=Build Failed::Project compilation failed"
echo "❌ Build failed - see detailed error information above"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
continue-on-error: false
- name: πŸ“Š Build Validation Summary
if: always()
run: |
echo "::group::Build Validation Summary"
if [ ${{ job.status }} == 'success' ]; then
echo "::notice title=Build Complete::Build validation completed successfully"
echo "βœ… Project compilation: PASSED"
echo "βœ… Dependency resolution: PASSED"
echo "🎯 All Swift modules built successfully"
echo "πŸ“‹ Build artifacts ready for testing"
else
echo "::error title=Build Failed::Build validation failed"
echo "❌ Project compilation: FAILED"
echo "πŸ”§ Action required: Fix build errors before merging"
echo "πŸ“‹ Common build issues to check:"
echo " β€’ Missing or incompatible dependencies"
echo " β€’ Swift syntax or compilation errors"
echo " β€’ Import resolution failures"
echo " β€’ Platform compatibility issues"
echo " β€’ Package.swift configuration problems"
fi
echo "::endgroup::"
test:
name: Unit Tests
runs-on: macos-latest
steps:
- name: πŸ§ͺ Starting Unit Test Execution
run: |
echo "::notice title=Unit Tests::Starting comprehensive unit test execution"
echo "πŸ§ͺ This check validates functionality through automated unit tests"
echo "πŸ“Š Status: STARTING"
- name: Checkout code
uses: actions/checkout@v4
- name: πŸ“‹ Verify Test Environment
run: |
echo "::group::Test Environment Information"
echo "::notice title=Test Environment::Verifying Swift and macOS test environment"
echo "πŸ”§ Swift version: $(swift --version | head -n1)"
echo "πŸ–₯️ macOS runner: $(sw_vers -productName) $(sw_vers -productVersion)"
echo "πŸ“Š Test environment status: READY"
echo "::endgroup::"
- name: Cache Swift packages
uses: actions/cache@v3
with:
path: |
.build
~/Library/Caches/org.swift.swiftpm
~/Library/org.swift.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('Package.swift', 'Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: πŸ“¦ Resolve Test Dependencies
run: |
echo "::group::Test Dependency Resolution"
echo "::notice title=Test Dependencies::Resolving dependencies for test execution"
echo "πŸ“¦ Resolving Swift package dependencies for testing..."
echo "πŸ“Š Status: RESOLVING"
if swift package resolve; then
echo "::notice title=Dependencies Success::Test dependencies resolved successfully"
echo "βœ… Dependencies resolved successfully"
echo "πŸ“Š Status: RESOLVED"
else
echo "::error title=Dependencies Failed::Failed to resolve test dependencies"
echo "❌ Test dependency resolution failed"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
- name: πŸ§ͺ Execute Unit Tests
run: |
echo "::group::Unit Test Execution"
echo "::notice title=Test Execution::Running comprehensive unit test suite"
echo "πŸ§ͺ Running unit tests with Swift Package Manager..."
echo "πŸ“Š Status: TESTING"
echo "βš™οΈ Test mode: Parallel execution with verbose output"
echo "🎯 Test suites to execute:"
echo " β€’ USBIPDCoreTests - Core functionality validation"
echo " β€’ USBIPDCLITests - Command-line interface validation"
# Run tests with verbose output and proper error reporting
if swift test --verbose --parallel; then
echo "::notice title=Tests Success::All unit tests passed successfully"
echo "βœ… Unit tests completed successfully"
echo "πŸ“Š Status: SUCCESS"
else
echo "::error title=Tests Failed::Unit test execution failed"
echo "❌ Unit tests failed - see detailed failure information above"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
continue-on-error: false
- name: πŸ“Š Unit Test Summary
if: always()
run: |
echo "::group::Unit Test Execution Summary"
if [ ${{ job.status }} == 'success' ]; then
echo "::notice title=Tests Complete::Unit test execution completed successfully"
echo "βœ… All unit tests: PASSED"
echo "🎯 Test suites executed successfully:"
echo " β€’ USBIPDCoreTests - Core functionality validation"
echo " β€’ USBIPDCLITests - Command-line interface validation"
echo "πŸ“‹ All functionality validated through automated tests"
else
echo "::error title=Tests Failed::Unit test execution failed"
echo "❌ Unit test execution: FAILED"
echo "πŸ”§ Action required: Fix failing tests before merging"
echo "πŸ“‹ Common test failure causes:"
echo " β€’ Assertion failures in test cases"
echo " β€’ Runtime errors during test execution"
echo " β€’ Missing test dependencies or setup"
echo " β€’ Platform-specific test compatibility issues"
echo " β€’ Test data or mock configuration problems"
fi
echo "::endgroup::"
integration-test:
name: Integration Tests (QEMU)
runs-on: macos-latest
steps:
- name: πŸ”— Starting Integration Test Execution
run: |
echo "::notice title=Integration Tests::Starting end-to-end integration test validation"
echo "πŸ”— This check validates complete system functionality with QEMU test server"
echo "πŸ“Š Status: STARTING"
- name: Checkout code
uses: actions/checkout@v4
- name: πŸ“‹ Verify Integration Test Environment
run: |
echo "::group::Integration Test Environment Information"
echo "::notice title=Integration Environment::Verifying Swift and macOS integration test environment"
echo "πŸ”§ Swift version: $(swift --version | head -n1)"
echo "πŸ–₯️ macOS runner: $(sw_vers -productName) $(sw_vers -productVersion)"
echo "πŸ“Š Integration test environment status: READY"
echo "::endgroup::"
- name: Cache Swift packages
uses: actions/cache@v3
with:
path: |
.build
~/Library/Caches/org.swift.swiftpm
~/Library/org.swift.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('Package.swift', 'Package.resolved') }}
restore-keys: |
${{ runner.os }}-swift-
- name: πŸ”§ Setup Integration Test Dependencies
run: |
echo "::group::Integration Test Setup"
echo "::notice title=Test Setup::Configuring integration test dependencies"
echo "πŸ”§ Setting up integration test dependencies..."
echo "πŸ“Š Status: CONFIGURING"
# Ensure Scripts directory is executable
chmod +x Scripts/run-qemu-tests.sh
echo "βœ… Test script permissions configured"
echo "πŸ“Š Status: CONFIGURED"
echo "::endgroup::"
- name: πŸ“¦ Resolve Integration Dependencies
run: |
echo "::group::Integration Dependency Resolution"
echo "::notice title=Integration Dependencies::Resolving dependencies for integration testing"
echo "πŸ“¦ Resolving Swift package dependencies for integration testing..."
echo "πŸ“Š Status: RESOLVING"
if swift package resolve; then
echo "::notice title=Dependencies Success::Integration dependencies resolved successfully"
echo "βœ… Dependencies resolved successfully"
echo "πŸ“Š Status: RESOLVED"
else
echo "::error title=Dependencies Failed::Failed to resolve integration dependencies"
echo "❌ Integration dependency resolution failed"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
- name: πŸ—οΈ Build QEMU Test Server
run: |
echo "::group::QEMU Test Server Build"
echo "::notice title=QEMU Build::Building QEMU test server for integration testing"
echo "πŸ—οΈ Building QEMU test server..."
echo "πŸ“Š Status: BUILDING"
if swift build --product QEMUTestServer; then
echo "::notice title=QEMU Build Success::QEMU test server built successfully"
echo "βœ… QEMU test server built successfully"
echo "πŸ“Š Status: BUILT"
else
echo "::error title=QEMU Build Failed::Failed to build QEMU test server"
echo "❌ QEMU test server build failed"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
- name: πŸ§ͺ Run QEMU Test Script Validation
run: |
echo "::group::QEMU Script Validation"
echo "::notice title=QEMU Validation::Running QEMU test server validation script"
echo "πŸ§ͺ Running QEMU test server validation script..."
echo "πŸ“Š Status: VALIDATING"
if ./Scripts/run-qemu-tests.sh; then
echo "::notice title=QEMU Validation Success::QEMU test script validation completed successfully"
echo "βœ… QEMU test script validation completed"
echo "πŸ“Š Status: VALIDATED"
else
echo "::error title=QEMU Validation Failed::QEMU test script validation failed"
echo "❌ QEMU test script validation failed"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
continue-on-error: false
- name: πŸ”— Execute Integration Tests
run: |
echo "::group::Integration Test Execution"
echo "::notice title=Integration Execution::Running end-to-end integration tests"
echo "πŸ”— Running integration tests with QEMU test server..."
echo "πŸ“Š Status: TESTING"
echo "βš™οΈ Test mode: Integration tests with verbose output"
echo "🎯 Integration test components:"
echo " β€’ QEMU test server functionality"
echo " β€’ End-to-end protocol flow validation"
echo " β€’ Network communication layer testing"
# Run only the integration tests
if swift test --filter IntegrationTests --verbose; then
echo "::notice title=Integration Success::Integration tests completed successfully"
echo "βœ… Integration tests completed successfully"
echo "πŸ“Š Status: SUCCESS"
else
echo "::error title=Integration Failed::Integration test execution failed"
echo "❌ Integration tests failed - see detailed failure information above"
echo "πŸ“Š Status: FAILED"
exit 1
fi
echo "::endgroup::"
continue-on-error: false
- name: πŸ“Š Integration Test Summary
if: always()
run: |
echo "::group::Integration Test Execution Summary"
if [ ${{ job.status }} == 'success' ]; then
echo "::notice title=Integration Complete::Integration test execution completed successfully"
echo "βœ… All integration tests: PASSED"
echo "βœ… QEMU test server: VALIDATED"
echo "🎯 Integration test components validated:"
echo " β€’ QEMU test server functionality"
echo " β€’ End-to-end protocol flow validation"
echo " β€’ Network communication layer testing"
echo " β€’ System integration and compatibility"
echo "πŸ“‹ Complete system functionality validated"
else
echo "::error title=Integration Failed::Integration test execution failed"
echo "❌ Integration test execution: FAILED"
echo "πŸ”§ Action required: Fix integration issues before merging"
echo "πŸ“‹ Common integration test failure causes:"
echo " β€’ QEMU test server setup or configuration issues"
echo " β€’ Network connectivity or communication problems"
echo " β€’ USB/IP protocol compatibility issues"
echo " β€’ Test environment configuration problems"
echo " β€’ System-level integration failures"
echo " β€’ Resource availability or timing issues"
fi
echo "::endgroup::"