mono-rt 0.2.0

Dynamic bindings to the Mono runtime for process injection into Unity games and Mono-hosted applications on Windows
Documentation
name: Rust CI

on:
  workflow_dispatch:
  push:
    branches:
      - main
      - dev
    paths:
      - "src/**"
      - "Cargo.lock"
      - "tests/**"
  pull_request:
    paths:
      - "src/**"
      - "Cargo.lock"
      - "tests/**"

# cancel in-progress runs on new commits to the same PR
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  MAIN_BRANCH: main

jobs:
  build:
    name: Build & lint
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v6

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

      - name: Restore Cargo cache
        uses: Swatinem/rust-cache@v2

      - name: Run rustfmt
        run: cargo fmt --all -- --check

      - name: Run clippy
        # dtolnay/rust-toolchain automatically adds problem matchers for annotations
        run: cargo clippy --all-targets --all

      - name: Build project
        run: cargo build

      - name: Generate documentation
        run: cargo doc --no-deps --document-private-items

  test:
    name: Test suite
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v6

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

      - name: Restore Cargo cache
        uses: Swatinem/rust-cache@v2

      - name: Install nextest
        uses: taiki-e/install-action@v2
        with:
          tool: nextest

      - name: Run tests (nextest)
        run: cargo nextest run --all

      - name: Run doctests
        run: cargo test --doc

      - name: Install Mono runtime
        run: choco install mono -y --no-progress

      - name: Verify Mono DLL exists
        run: |

          $dll = "C:\Program Files\Mono\bin\mono-2.0-sgen.dll"
          if (-not (Test-Path $dll)) {
            Write-Error "mono-2.0-sgen.dll not found at $dll"
            exit 1
          }

      - name: Run integration tests
        run: >

          cargo run --features integration-tests --bin mono-rt-integration --
          "C:\Program Files\Mono\bin\mono-2.0-sgen.dll"
          "${{ github.workspace }}\tests\fixtures\MonoRtFixture.dll"