url-preview 0.6.0

High-performance URL preview generator for messaging and social media applications
Documentation
name: Rust
on:
  push:
    branches: ["main"]
  pull_request:
    branches: ["main"]

env:
  CARGO_TERM_COLOR: always

jobs:
  # First job: Code style and formatting checks
  format-and-lint:
    name: Check formatting and run clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      # Install the nightly toolchain for more formatting options
      - name: Install nightly toolchain with rustfmt
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: nightly
          components: rustfmt
          override: true

      # Run rustfmt to check code formatting
      - name: Check formatting
        run: cargo fmt -- --check

      # Switch to stable toolchain for clippy
      - name: Install stable toolchain with clippy
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          components: clippy
          override: true

      # Run clippy with specific configuration
      - name: Run clippy
        run: cargo clippy -- -D warnings

  # Second job: Build and test (your existing job)
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: cargo build --verbose
      - name: Run tests
        run: cargo test --verbose

  # Optional: Add caching to speed up builds
  cache:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Cache cargo registry
        uses: actions/cache@v3
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-