diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 15a098b..a8f8224 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,25 +8,16 @@ on: env: CARGO_TERM_COLOR: always - RUST_BACKTRACE: 1 jobs: test: name: Test runs-on: ubuntu-latest - strategy: - matrix: - rust: [stable] - target: [x86_64-unknown-linux-gnu] steps: - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master + - uses: dtolnay/rust-toolchain@stable with: - toolchain: ${{ matrix.rust }} - targets: ${{ matrix.target }} components: rustfmt, clippy - name: Cache dependencies @@ -38,7 +29,7 @@ jobs: target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Check code formatting + - name: Check formatting run: cargo fmt --all -- --check - name: Run clippy @@ -47,184 +38,23 @@ jobs: - name: Run tests run: cargo test --all-features - - name: Run tests with coverage - if: matrix.rust == 'stable' - run: | - cargo install cargo-tarpaulin - cargo tarpaulin --out Xml --output-dir coverage - continue-on-error: true + - name: Build examples + run: cargo build --examples --all-features - - name: Upload coverage to Codecov - if: matrix.rust == 'stable' - uses: codecov/codecov-action@v4 - with: - file: ./coverage/cobertura.xml - flags: unittests - name: codecov-umbrella - fail_ci_if_error: false - - bench: - name: Benchmarks - runs-on: ubuntu-latest - strategy: - matrix: - rust: [stable] - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy - - - name: Cache dependencies - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - - name: Run benchmarks - run: cargo bench --no-run - - - name: Run benchmarks (dry run) - run: cargo bench --no-run --verbose + - name: Build documentation + run: cargo doc --no-deps --all-features security: name: Security audit runs-on: ubuntu-latest + continue-on-error: true steps: - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy + - uses: dtolnay/rust-toolchain@stable - name: Install cargo-audit run: cargo install cargo-audit - name: Run security audit - run: cargo audit - - docs: - name: Documentation - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy - - - name: Build documentation - run: cargo doc --no-deps --all-features - - - name: Check documentation - run: cargo doc --no-deps --all-features --document-private-items - - examples: - name: Examples - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy - - - name: Build examples - run: cargo build --examples --all-features - - - name: Run examples - run: | - cargo run --example snipe -- --help || true - - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy - - - name: Install system dependencies for cargo-spellcheck - run: | - sudo apt-get update - sudo apt-get install -y libclang-dev clang - - - name: Install cargo-spellcheck - run: cargo install cargo-spellcheck - - - name: Check spelling - run: cargo spellcheck --code 1 - continue-on-error: true - - - name: Check for common issues - run: | - # Check for TODO comments - if grep -r "TODO" src/; then - echo "Found TODO comments in source code" - exit 1 - fi - - # Check for FIXME comments - if grep -r "FIXME" src/; then - echo "Found FIXME comments in source code" - exit 1 - fi - - # Check for unwrap() calls (should use proper error handling) - if grep -r "\.unwrap()" src/; then - echo "Found unwrap() calls in source code - consider using proper error handling" - # Don't fail CI for unwrap() calls as they might be intentional in examples/tests - # exit 1 - fi - - release: - name: Release - runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - - steps: - - uses: actions/checkout@v4 - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: stable - components: rustfmt, clippy - - - name: Build for release - run: cargo build --release --all-features - - - name: Run tests in release mode - run: cargo test --release --all-features - - - name: Create release archive - run: | - tar -czf polyfill-rs.tar.gz target/release/ - echo "Release archive created: polyfill-rs.tar.gz" - - - name: Upload release artifacts - uses: actions/upload-artifact@v4 - with: - name: release-files - path: polyfill-rs.tar.gz \ No newline at end of file + run: cargo audit \ No newline at end of file