mago 1.20.1

A comprehensive suite of PHP tooling inspired by Rust’s approach, providing parsing, linting, formatting, and more through a unified CLI and library interface.
name: Continuous Integration

on:
  push:
    branches: [main]
  pull_request:

jobs:
  build-and-test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, nightly]
        exclude:
          - { os: windows-latest, rust: nightly }
          - { os: macos-latest, rust: nightly }

    runs-on: ${{ matrix.os }}

    permissions:
      contents: read

    steps:
      - name: checkout
        uses: actions/checkout@v4

      - name: install rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          toolchain: ${{ matrix.rust }}
          components: rustfmt, clippy

      - name: cache rust toolchain
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ runner.os }}-rust-${{ matrix.rust }}
          shared-key: ${{ runner.os }}-rust-${{ matrix.rust }}
          cache-on-failure: true

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

      - name: cargo check
        if: matrix.os == 'macos-latest'
        run: cargo check --workspace --locked

      - name: cargo fmt
        if: matrix.os == 'macos-latest'
        run: cargo fmt --all -- --check

      - name: cargo clippy
        if: matrix.os == 'macos-latest'
        run: cargo clippy --workspace --all-features -- -D warnings

      - name: cargo test
        run: cargo test --workspace --locked

      - name: cargo build
        if: matrix.rust == 'stable'
        run: cargo build --release --locked

      - name: Install PHP
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        uses: shivammathur/setup-php@master
        with:
          php-version: "8.3"
          tools: "composer:v2"

      - name: Install composer dependencies
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        run: composer install

      - name: Validate composer code format
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        run: ./target/release/mago format --dry-run

      - name: Lint composer code
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        run: ./target/release/mago lint --reporting-format=github

      - name: Analyze composer code
        if: matrix.rust == 'stable' && matrix.os == 'ubuntu-latest'
        run: ./target/release/mago analyze --reporting-format=github

  typos-check:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Search for misspellings
        uses: crate-ci/typos@master