linesweeper 0.3.0

Robust sweep-line algorithm and two-dimensional boolean ops
Documentation
env:
  RUST_STABLE_VER: "1.86"

# Rationale
#
# We don't run clippy with --all-targets because then even --lib and --bins are compiled with
# dev dependencies enabled, which does not match how they would be compiled by users.
# A dev dependency might enable a feature that we need for a regular dependency,
# and checking with --all-targets would not find our feature requirements lacking.
# This problem still applies to cargo resolver version 2.
# Thus we split all the targets into two steps, one with --lib --bins
# and another with --tests --benches --examples.
# Also, we can't give --lib --bins explicitly because then cargo will error on binary-only packages.
# Luckily the default behavior of cargo with no explicit targets is the same but without the error.
#
# We use cargo-hack for a similar reason. Cargo's --workspace will do feature unification across
# the whole workspace. While cargo-hack will instead check each workspace package separately.
#
# Using cargo-hack also allows us to more easily test the feature matrix of our packages.
# We use --each-feature & --optional-deps which will run a separate check for every feature.
#
# The MSRV jobs run only cargo check because different clippy versions can disagree on goals and
# running tests introduces dev dependencies which may require a higher MSRV than the bare package.
# Checking is limited to packages that are intended for publishing to keep MSRV as low as possible.
#
# If the workspace uses debug_assertions then we verify code twice, with it set to true or false.
# We always keep it true for external dependencies so that we can reuse the cache for faster builds.
#
# We don't save caches in the merge-group cases, because those caches will never be re-used (apart
# from the very rare cases where there are multiple PRs in the merge queue).
# This is because GitHub doesn't share caches between merge queues and the main branch.

name: CI

on:
  pull_request:
  merge_group:
  # We run on push, even though the commit is the same as when we ran in merge_group.
  # This allows the cache to be primed.
  # See https://github.com/orgs/community/discussions/66430
  push:
    branches:
      - main

jobs:
  fmt:
    name: formatting
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install Rust ${{ env.RUST_STABLE_VER }}
        uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
        with:
          toolchain: ${{ env.RUST_STABLE_VER }}
          components: rustfmt

      - name: Run cargo fmt
        run: cargo fmt --all --check

      - name: Install Taplo
        uses: uncenter/setup-taplo@09968a8ae38d66ddd3d23802c44bf6122d7aa991 # v1
        with:
          version: "0.9.3"

      - name: Run taplo fmt
        run: taplo fmt --check --diff

      - name: Install ripgrep
        run: |
          sudo apt update
          sudo apt install ripgrep

  clippy-stable:
    name: cargo clippy
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install Rust ${{ env.RUST_STABLE_VER }}
        uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
        with:
          toolchain: ${{ env.RUST_STABLE_VER }}
          components: clippy

      - name: Restore cache
        uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
        with:
          save-if: ${{ github.event_name != 'merge_group' }}

      - name: Run cargo clippy
        run: cargo clippy --workspace --locked -- -D warnings

      - name: Run cargo clippy (auxiliary)
        run: cargo clippy --workspace --locked --tests --benches --examples -- -D warnings

      - name: Run cargo clippy (no debug_assertions)
        if: env.USING_DEBUG_ASSERTIONS == 'true'
        run: cargo clippy --workspace --locked -- -D warnings
        env:
          CARGO_PROFILE_CI_DEBUG_ASSERTIONS: "false"

      - name: Run cargo clippy (auxiliary) (no debug_assertions)
        if: env.USING_DEBUG_ASSERTIONS == 'true'
        run: cargo clippy --workspace --locked --tests --benches --examples -- -D warnings
        env:
          CARGO_PROFILE_CI_DEBUG_ASSERTIONS: "false"

  test-stable:
    name: cargo test
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest, macos-latest, ubuntu-latest]
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Restore cache
        uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6
        with:
          save-if: ${{ github.event_name != 'merge_group' }}

      - name: Run cargo test
        run: cargo test --workspace --locked --all-features --no-fail-fast
        env:
          # We do not run the masonry render tests on platforms without a working GPU,
          # because those require Vello rendering to be working
          # See also https://github.com/linebender/vello/pull/610
          SKIP_RENDER_TESTS: ${{ matrix.skip_gpu }}

  doc:
    name: cargo doc
    # NOTE: We don't have any platform specific docs in this workspace, so we only run on Ubuntu.
    #       If we get per-platform docs (win/macos/linux/wasm32/..) then doc jobs should match that.
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Install Rust nightly
        uses: dtolnay/rust-toolchain@nightly

      - name: Restore cache
        uses: Swatinem/rust-cache@v2
        with:
          save-if: ${{ github.event_name != 'merge_group' }}

      # We test documentation using nightly to match docs.rs.
      - name: Run cargo doc
        run: cargo doc --workspace --locked --all-features --no-deps --document-private-items -Zunstable-options -Zrustdoc-scrape-examples
        env:
          RUSTDOCFLAGS: '--cfg docsrs -D warnings'

  # If this fails, consider changing your text or adding something to .typos.toml.
  typos:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Check typos
        uses: crate-ci/typos@v1.31.1