textcon 0.4.1

Streaming file bundling and one-pass template references for AI/LLM context
Documentation
name: CI

on:
  push:
    branches: [ main, dev ]
  pull_request:
    branches: [ main, dev ]

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, beta]
        exclude:
          # Skip beta on Windows to save CI time
          - os: windows-latest
            rust: beta
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
          components: rustfmt, clippy
      
      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: ~/.cargo/registry
          key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo index
        uses: actions/cache@v4
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}

      - name: Cache cargo build
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}

      - name: Check formatting
        run: cargo fmt -- --check
        if: matrix.rust == 'stable'

      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -W clippy::pedantic -W clippy::nursery -W clippy::all -D warnings
        if: matrix.rust == 'stable'

      - name: Build
        run: cargo build --verbose --all-features

      - name: Run tests
        run: cargo test --verbose --all-features

      - name: Build documentation
        run: cargo doc --no-deps --all-features
        if: matrix.rust == 'stable'

  minimal-versions:
    name: Minimal Versions
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

      - name: Check with minimal versions
        run: |
          cargo +nightly update -Z direct-minimal-versions
          cargo +nightly check --all-features --locked

  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || github.event_name == 'pull_request'
    steps:
      - uses: actions/checkout@v4

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

      - name: Install tarpaulin
        run: cargo install cargo-tarpaulin

      - name: Generate coverage
        run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          file: ./cobertura.xml
          fail_ci_if_error: false

  ancillary:
    name: Man page, package, and agent skill
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Install documentation dependencies
        run: |
          sudo apt-get update
          sudo apt-get install -y mandoc
          cargo install just --locked
      - name: Build pinned scdoc
        shell: bash
        run: |
          git clone https://git.sr.ht/~sircmpwn/scdoc "$RUNNER_TEMP/scdoc"
          git -C "$RUNNER_TEMP/scdoc" checkout --detach 24be30ef17d5ca0162f11b35258c8fa2413d556a
          test "$(git -C "$RUNNER_TEMP/scdoc" rev-parse HEAD)" = 24be30ef17d5ca0162f11b35258c8fa2413d556a
          make -C "$RUNNER_TEMP/scdoc" scdoc
          echo "$RUNNER_TEMP/scdoc" >> "$GITHUB_PATH"
      - name: Verify generated man page
        run: just man-check
      - name: Verify source-only skill helper
        run: python3 -m unittest discover -s tests_py
      - name: Verify Cargo package boundaries
        shell: bash
        run: |
          package_files="$RUNNER_TEMP/textcon-package-files.txt"
          cargo package --list --locked > "$package_files"
          grep -qx 'docs/man/textcon.1' "$package_files"
          grep -qx 'docs/man/textcon.1.scd' "$package_files"
          if grep -q '^skills/' "$package_files"; then
            echo 'source-only skill leaked into Cargo package' >&2
            exit 1
          fi