netcorehost 0.20.1

A Rust library for hosting the .NET Core runtime.
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUSTDOCFLAGS: "--deny warnings"
  RUSTFLAGS: "--deny warnings"
  RUST_TEST_THREADS: 1
  # COREHOST_TRACE: 2

jobs:
  test:
    runs-on: ${{ matrix.os }}-latest
    strategy:
      fail-fast: false
      matrix:
        toolchain: ["beta"]
        target: ["x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc", "i686-pc-windows-msvc", "aarch64-apple-darwin"]
        dotnet: ["8.0", "9.0", "10.0"]
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu
            arch: x64
          - target: x86_64-pc-windows-msvc
            os: windows
            arch: x64
          - target: i686-pc-windows-msvc
            os: windows
            arch: x86
          - target: aarch64-apple-darwin
            os: macos
            arch: arm64
    env:
      NETCOREHOST_TEST_NETCORE_VERSION: net${{ matrix.dotnet }}
    steps:
    - uses: actions/checkout@v6

    - name: Uninstall .NET SDKs
      run: ./.github/scripts/uninstall-dotnet-${{ matrix.os }}
      env:
        GITHUB_TOKEN: ${{ github.token }}
        
    - name: Install .NET SDK ${{ matrix.dotnet }}
      run: ./.github/scripts/install-dotnet-${{ matrix.os }} ${{ matrix.dotnet }} ${{ matrix.arch }}

    - name: Check .NET Installation
      run: dotnet --info
        
    - name: Install latest ${{ matrix.toolchain }}
      uses: dtolnay/rust-toolchain@master
      with:
          target: ${{ matrix.target }}
          toolchain: ${{ matrix.toolchain }}
      
    - name: Build
      run: cargo build --target ${{ matrix.target }} --no-default-features --features "nethost-download $("net" + "${{ matrix.dotnet }}".replace(".", "_"))"
      shell: pwsh  
      
    - name: Test
      run: cargo test --target ${{ matrix.target }} --all-targets --no-fail-fast --no-default-features --features "nethost-download $("net" + "${{ matrix.dotnet }}".replace(".", "_"))" -- --nocapture
      shell: pwsh  

  arm-build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        toolchain: ["beta"]
        target: ["aarch64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf"]
    steps:
      - uses: actions/checkout@v6
      - name: Install latest rust nightly for ${{ matrix.target }}
        uses: dtolnay/rust-toolchain@nightly
        with:
          targets: ${{ matrix.target }}
      - name: Check main crate
        run: cargo check --target ${{ matrix.target }} --all-features
        
  examples:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        toolchain: ["beta"]
        example: ["run-app", "run-app-with-args", "call-managed-function", "passing-parameters", "return-string-from-managed"]
    steps:
    - uses: actions/checkout@v6
    - name: Install latest ${{ matrix.toolchain }}
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ matrix.toolchain }}
    - name: Build .NET project for '${{ matrix.example }}'
      working-directory: ./examples/${{ matrix.example }}/ExampleProject
      run: dotnet build 
    - name: Run example '${{ matrix.example }}'
      run: cargo run --example ${{ matrix.example }}
  
  nightly-examples:
    runs-on: windows-latest
    strategy:
      matrix:
        toolchain: ["nightly"]
        example: ["call-native-function"]
    steps:
    - uses: actions/checkout@v6
    - name: Install latest ${{ matrix.toolchain }}
      uses: dtolnay/rust-toolchain@master
      with:
        toolchain: ${{ matrix.toolchain }}
    - name: Build .NET project for '${{ matrix.example }}'
      working-directory: ./examples/${{ matrix.example }}/ExampleProject
      run: dotnet build 
    - name: Run example '${{ matrix.example }}'
      env:
        RUSTFLAGS: -Z export-executable-symbols
      run: cargo run --example ${{ matrix.example }}
      
  hack:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install latest nightly
        uses: dtolnay/rust-toolchain@nightly
      - name: cargo install cargo-hack
        uses: taiki-e/install-action@cargo-hack
      - name: cargo hack
        run: cargo hack --feature-powerset check
        
  machete:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - name: Install latest nightly
        uses: dtolnay/rust-toolchain@nightly
      - name: cargo install cargo-machete
        uses: taiki-e/install-action@cargo-machete
      - run: cargo machete
        
  documentation:
    runs-on: ${{ matrix.os }}-latest
    strategy:
      matrix:
        include:
          - os: ubuntu
          - os: windows
    steps:
    - uses: actions/checkout@v6
    - name: Install latest nightly
      uses: dtolnay/rust-toolchain@nightly
    - name: Generate documentation
      run: cargo doc --all-features
    - name: Install cargo-deadlinks
      run: cargo install cargo-deadlinks
    - name: Check dead links in doc
      run: cargo deadlinks

  clippy:
    runs-on: ${{ matrix.os }}-latest
    strategy:
      matrix:
        include:
          - os: ubuntu
          - os: windows
    steps:
      - uses: actions/checkout@v6
      - name: Install latest nightly
        uses: dtolnay/rust-toolchain@nightly
        with:
          components: clippy
            
      - name: Clippy check
        run: cargo clippy --all-features
          
  fmt:
    runs-on: ${{ matrix.os }}-latest
    strategy:
      matrix:
        include:
          - os: ubuntu
          - os: windows
    steps:
    - uses: actions/checkout@v6
    - name: Install latest nightly
      uses: dtolnay/rust-toolchain@nightly
      with:
          components: rustfmt
          
    - name: Format check
      run: cargo fmt --all -- --check