log-watcher 0.2.1

Real-time log file monitoring with pattern highlighting and desktop notifications
Documentation
name: CI/CD Pipeline

on:
  push:
    branches: [main]
    tags: ['v*']
    paths-ignore:
      - '**.md'
      - 'docs/**'
      - '.gitignore'
      - 'LICENSE'
  pull_request:
    branches: [main]
    paths-ignore:
      - '**.md'
      - 'docs/**'
      - '.gitignore'
      - 'LICENSE'

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, beta]
        include:
          - os: ubuntu-latest
            rust: stable
            target: x86_64-unknown-linux-gnu
          - os: macos-latest
            rust: stable
            target: x86_64-apple-darwin
          - os: macos-latest
            rust: stable
            target: aarch64-apple-darwin
          - os: windows-latest
            rust: stable
            target: x86_64-pc-windows-msvc

    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}

      - name: Install rustfmt
        run: rustup component add rustfmt

      - name: Install clippy
        run: rustup component add clippy

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

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

      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

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

      - name: Run integration tests
        run: cargo test --test integration

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

      - name: Run tests with coverage
        run: cargo tarpaulin --out Xml --output-dir . --verbose
        continue-on-error: true

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v4
        with:
          file: ./cobertura.xml
          flags: unittests
          name: codecov-umbrella
          fail_ci_if_error: false
        continue-on-error: true

      - name: Build
        run: cargo build --release

  build:
    name: Build Release
    needs: test
    if: startsWith(github.ref, 'refs/tags/')
    strategy:
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
            artifact: logwatcher-linux-x86_64.tar.gz
          - os: macos-latest
            target: x86_64-apple-darwin
            artifact: logwatcher-macos-x86_64.tar.gz
          - os: macos-latest
            target: aarch64-apple-darwin
            artifact: logwatcher-macos-aarch64.tar.gz
          - os: windows-latest
            target: x86_64-pc-windows-msvc
            artifact: logwatcher-windows-x86_64.zip

    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Install rustfmt
        run: rustup component add rustfmt

      - name: Install clippy
        run: rustup component add clippy

      - name: Install cross-compilation toolchain
        run: rustup target add ${{ matrix.target }}

      - name: Build release binary
        run: cargo build --release --target ${{ matrix.target }}

      - name: Strip symbols
        if: matrix.os != 'windows-latest'
        run: strip target/${{ matrix.target }}/release/logwatcher

      - name: Create archive (Linux/macOS)
        if: matrix.os != 'windows-latest'
        run: |
          tar -czf ${{ matrix.artifact }} -C target/${{ matrix.target }}/release logwatcher

      - name: Create archive (Windows)
        if: matrix.os == 'windows-latest'
        run: |
          powershell Compress-Archive -Path target/${{ matrix.target }}/release/logwatcher.exe -DestinationPath ${{ matrix.artifact }}

      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.artifact }}
          path: ${{ matrix.artifact }}

  release:
    name: Create Release
    needs: build
    if: startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Download all artifacts
        uses: actions/download-artifact@v4

      - name: List downloaded files
        run: |
          find . -name "*.tar.gz" -o -name "*.zip" | head -10

      - name: Create checksums
        run: |
          find . -name "*.tar.gz" -o -name "*.zip" | while read file; do
            if [ -f "$file" ]; then
              sha256sum "$file" > "$file.sha256"
              echo "Created checksum for: $file"
            fi
          done

      - name: Create Release
        uses: softprops/action-gh-release@v1
        with:
          files: |
            **/*.tar.gz
            **/*.zip
            **/*.sha256
          generate_release_notes: true
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

  security:
    name: Security Audit
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Install rustfmt
        run: rustup component add rustfmt

      - name: Install clippy
        run: rustup component add clippy

      - name: Install cargo-audit
        run: cargo install cargo-audit

      - name: Run security audit
        run: cargo audit