chrome_lens_ocr 0.3.0

Port of chrome-lens-py used in Mangatan
Documentation
name: Rust

on:
  push:
    branches: [ "master" ]
  pull_request:
    branches: [ "master" ]
  merge_group:

env:
  CARGO_TERM_COLOR: always

jobs:
  format:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - name: Install Rust nightly
      run: rustup install nightly

    - name: Install rustfmt for nightly
      run: rustup component add --toolchain nightly-x86_64-unknown-linux-gnu rustfmt

    - uses: Swatinem/rust-cache@v2
      with:
        cache-on-failure: true    

    - name: Check `map_err` variable naming
      run: make fmt
      
  cargo-clippy:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - uses: Swatinem/rust-cache@v2
      with:
        cache-on-failure: true        

    - name: Run Clippy
      run: |
        cargo clippy --all --all-targets --no-deps -- --deny warnings

  cargo-sort:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4

    - uses: Swatinem/rust-cache@v2
      with:
        cache-on-failure: true        

    # Install this commit as there isn't a release yet which works for workspace's
    - name: Install cargo sort
      run: cargo install --git https://github.com/DevinR528/cargo-sort.git --rev 25a60ad860ce7cd0055abf4b69c18285cb07ab41 cargo-sort

    - name: Run cargo sort
      run: cargo sort --grouped --check --workspace

  test:
    runs-on: ubuntu-latest
    needs: [format, cargo-clippy]

    steps:
    - uses: actions/checkout@v4

    - uses: Swatinem/rust-cache@v2
      with:
        cache-on-failure: true        

    - name: Test
      run: cargo test --release --workspace -- --nocapture