mon-core 0.0.3

A robust parser and validator for the Mycel Object Notation (MON) language, designed for fast, efficient, and human-friendly configuration.
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  # Light checks for PRs - fast feedback
  quick-check:
    name: Quick Check (PR)
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request'
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

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

      - name: Run Clippy
        run: cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::needless_doctest_main

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

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

  # Additional OS testing - only on main (Ubuntu already tested in PR)
  cross-platform:
    name: Test on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
    strategy:
      matrix:
        os: [windows-latest, macos-latest]
        rust: [stable]

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

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

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2
        with:
          prefix-key: v1-rust
          shared-key: ${{ matrix.os }}-${{ matrix.rust }}

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

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

  # Beta testing - only on main
  beta-test:
    name: Test with Rust Beta
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

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

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

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

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

  # Coverage - only on main (unique check, not in PR)
  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview

      - name: Cache Rust dependencies
        uses: Swatinem/rust-cache@v2

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Generate coverage
        run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info

      - name: Upload to codecov.io
        uses: codecov/codecov-action@v4
        with:
          files: lcov.info
          fail_ci_if_error: false
          token: ${{ secrets.CODECOV_TOKEN }}