logcut 0.3.0

Local-first stacktrace, runtime log & compiler error slicing for AI coding agents and terminal pipelines
Documentation
name: CI & Release

on:
  push:
    branches: [main]
    tags: ["v*"]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: "-Dwarnings"

jobs:
  check:
    name: Check & Test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - name: Checkout repository
        uses: actions/checkout@v7

      - name: Install Rust stable toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy

      - name: Cache Cargo artifacts
        uses: Swatinem/rust-cache@v2

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Run Clippy lints
        run: cargo clippy --all-targets --all-features

      - name: Run test suite (hybrid build)
        run: cargo test --locked

      - name: Verify MCP-only feature build
        run: cargo check --locked --no-default-features --features mcp

  build-release:
    name: Build Release (${{ matrix.target }})
    needs: check
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            archive: logcut-x86_64-unknown-linux-gnu.tar.gz
            bin: logcut
          - os: macos-latest
            target: aarch64-apple-darwin
            archive: logcut-aarch64-apple-darwin.tar.gz
            bin: logcut
          - os: macos-latest
            target: x86_64-apple-darwin
            archive: logcut-x86_64-apple-darwin.tar.gz
            bin: logcut
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            archive: logcut-x86_64-pc-windows-msvc.zip
            bin: logcut.exe

    steps:
      - name: Checkout repository
        uses: actions/checkout@v7

      - name: Install Rust toolchain for target
        uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Cache Cargo artifacts
        uses: Swatinem/rust-cache@v2
        with:
          key: release-${{ matrix.target }}

      - name: Build release binary
        env:
          RUSTFLAGS: ""
        run: cargo build --release --locked --target ${{ matrix.target }}

      - name: Package archive (Unix)
        if: matrix.os != 'windows-latest'
        run: |
          tar -czf ${{ matrix.archive }} -C target/${{ matrix.target }}/release ${{ matrix.bin }}
          shasum -a 256 ${{ matrix.archive }} > ${{ matrix.archive }}.sha256

      - name: Package archive (Windows)
        if: matrix.os == 'windows-latest'
        shell: pwsh
        run: |
          Compress-Archive -Path target/${{ matrix.target }}/release/${{ matrix.bin }} -DestinationPath ${{ matrix.archive }}
          (Get-FileHash ${{ matrix.archive }} -Algorithm SHA256).Hash.ToLower() + "  ${{ matrix.archive }}" | Out-File -Encoding ascii ${{ matrix.archive }}.sha256

      - name: Upload release artifacts
        uses: actions/upload-artifact@v7
        with:
          name: release-${{ matrix.target }}
          path: |
            ${{ matrix.archive }}
            ${{ matrix.archive }}.sha256

  publish-release:
    name: Publish GitHub Release
    needs: build-release
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: ubuntu-latest
    permissions:
      contents: write

    steps:
      - name: Download all release artifacts
        uses: actions/download-artifact@v8
        with:
          path: artifacts
          merge-multiple: true

      - name: Create GitHub Release
        uses: softprops/action-gh-release@v3
        with:
          generate_release_notes: true
          files: artifacts/*