fix(iam): resolve clippy warnings and remove unused imports #86
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] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # Format check - runs quickly, fail fast | |
| fmt: | |
| name: Format | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt | |
| - name: Check formatting | |
| run: cargo fmt --all --check --manifest-path Cargo.toml | |
| - name: Clippy | |
| run: cargo clippy --workspace --all-targets --manifest-path Cargo.toml -- -D warnings | |
| # Build and test matrix | |
| test: | |
| name: Test (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.os }} | |
| - name: Build | |
| run: cargo build --workspace --release --manifest-path Cargo.toml --exclude ruststack-py | |
| - name: Run tests | |
| run: cargo test --workspace --all-targets --manifest-path Cargo.toml --exclude ruststack-py | |
| - name: Run doc tests | |
| run: cargo test --workspace --doc --manifest-path Cargo.toml --exclude ruststack-py | |
| # Integration tests with boto3 | |
| integration: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [fmt] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build release binary | |
| run: cargo build --release --manifest-path Cargo.toml | |
| env: | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python dependencies | |
| run: | | |
| pip install boto3 requests pytest | |
| - name: Start RustStack server | |
| run: | | |
| ./target/release/ruststack --port 4566 & | |
| echo "Waiting for server to start..." | |
| for i in {1..30}; do | |
| if curl -s http://localhost:4566/health > /dev/null 2>&1; then | |
| echo "Server is ready!" | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| - name: Run integration tests | |
| run: | | |
| pytest .github/scripts/integration_test.py -v | |
| env: | |
| AWS_ACCESS_KEY_ID: test | |
| AWS_SECRET_ACCESS_KEY: test | |
| AWS_DEFAULT_REGION: us-east-1 | |
| - name: Stop RustStack server | |
| if: always() | |
| run: pkill ruststack || true | |
| # All checks passed | |
| ci-success: | |
| name: CI Success | |
| runs-on: ubuntu-latest | |
| needs: [fmt, test, integration, python-bindings] | |
| if: always() | |
| steps: | |
| - name: Check all jobs passed | |
| run: | | |
| if [[ "${{ needs.fmt.result }}" != "success" ]] || \ | |
| [[ "${{ needs.test.result }}" != "success" ]] || \ | |
| [[ "${{ needs.integration.result }}" != "success" ]] || \ | |
| [[ "${{ needs.python-bindings.result }}" != "success" ]]; then | |
| echo "One or more jobs failed" | |
| exit 1 | |
| fi | |
| echo "All CI jobs passed!" | |
| # Build Python bindings | |
| python-bindings: | |
| name: Python Bindings | |
| runs-on: ubuntu-latest | |
| env: | |
| PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.14' | |
| - name: Install maturin | |
| run: pip install maturin | |
| - name: Build Python bindings | |
| run: | | |
| maturin build --release --interpreter python3 --manifest-path ruststack-py/Cargo.toml --out dist | |
| - name: Install and test bindings | |
| run: | | |
| pip install --find-links dist ruststack-py | |
| python -c "import ruststack_py; print('Python bindings imported successfully!')" |