fix: update GitHub Actions workflows and code fixes #51
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | ||
| on: | ||
| push: | ||
| branches: [ main, develop ] | ||
| pull_request: | ||
| branches: [ main ] | ||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| jobs: | ||
| testing-agent: | ||
| name: Testing Agent | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| rust: [stable, beta] | ||
| exclude: | ||
| # Reduce CI load - only test beta on Ubuntu | ||
| - os: windows-latest | ||
| rust: beta | ||
| - os: macos-latest | ||
| rust: beta | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| toolchain: ${{ matrix.rust }} | ||
| components: rustfmt, clippy | ||
| - name: Cache cargo registry | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
| - name: Check formatting | ||
| run: cargo fmt --all -- --check | ||
| continue-on-error: true | ||
| id: fmt-check | ||
| - name: Formatting feedback | ||
| if: steps.fmt-check.outcome == 'failure' | ||
| run: | | ||
| echo "::warning::Code formatting issues detected!" | ||
| echo "Please run 'cargo fmt --all' to fix formatting." | ||
| echo "Or add this to your pre-commit hook:" | ||
| echo " cargo fmt --all" | ||
| - name: Run clippy | ||
| run: cargo clippy --all-targets --all-features -- -D warnings | ||
| continue-on-error: true | ||
| id: clippy-check | ||
| - name: Clippy feedback | ||
| if: steps.clippy-check.outcome == 'failure' | ||
| run: | | ||
| echo "::warning::Clippy issues detected!" | ||
| echo "Please run 'cargo clippy --all-targets --all-features --fix --allow-dirty' to fix issues." | ||
| echo "Or add this to your development workflow:" | ||
| echo " cargo clippy --fix --allow-dirty" | ||
| echo "Or run './scripts/fix-code-quality.sh' to auto-fix both formatting and clippy issues." | ||
| - name: Build | ||
| run: cargo build --verbose | ||
| - name: Run tests | ||
| run: cargo test --verbose | ||
| - name: Run doc tests | ||
| run: cargo test --doc | ||
| coverage: | ||
| name: Coverage | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: llvm-tools-preview | ||
| - name: Install cargo-llvm-cov | ||
| uses: taiki-e/install-action@cargo-llvm-cov | ||
| - name: Cache cargo registry | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }} | ||
| - name: Generate code coverage | ||
| run: cargo llvm-cov --all-features --lcov --output-path lcov.info | ||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: lcov.info | ||
| security: | ||
| name: Security Audit | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install cargo-audit | ||
| uses: taiki-e/install-action@cargo-audit | ||
| - name: Run security audit | ||
| run: cargo audit | ||
| code-review-agent: | ||
| name: Code Review Agent | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
| with: | ||
| components: clippy | ||
| - name: Run clippy | ||
| run: cargo clippy --all-targets --all-features -- -D warnings | ||
| - name: Comment on PR if issues found | ||
| if: failure() | ||
| run: gh pr comment ${{ github.event.pull_request.number }} --body "Code review agent detected issues. Please address the clippy warnings." | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||