webview2 0.1.3

Rust bindings for WebView2
Documentation
on: [push, pull_request]

name: Continuous Integration

jobs:
  test:
    name: Test
    runs-on: windows-latest
    strategy:
      matrix:
        version:
          - stable
          - 1.51.0
        arch:
          - x86_64
          - i686
        env:
          - msvc
          - gnu
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.version }}-${{ matrix.arch }}-pc-windows-${{ matrix.env }}
          override: true
      # Copy the DLL if using gnu toolchain.
      - run: |

          mkdir -p target/debug/deps &&
          cp webview2-sys/Microsoft.Web.WebView2.*/build/native/${{ fromJson('{ "x86_64": "x64", "i686": "x86" }')[matrix.arch] }}/WebView2Loader.dll target/debug/deps &&
          mkdir -p webview2-sys/target/debug/deps &&
          cp webview2-sys/Microsoft.Web.WebView2.*/build/native/${{ fromJson('{ "x86_64": "x64", "i686": "x86" }')[matrix.arch] }}/WebView2Loader.dll webview2-sys/target/debug/deps
        if: ${{ matrix.env == 'gnu' }}
      # This together with `resolver = 2` checks that we are not missing any
      # features in dependencies, like in issue #7.
      - uses: actions-rs/cargo@v1
        with:
          command: check
      - uses: actions-rs/cargo@v1
        with:
          command: test
      # Test webview2-sys alone. This is to make sure that we are not missing
      # any features of winapi necessary for linking in webview2-sys.
      #
      # Just run cargo because actions-rs/cargo does not support working-directory.
      - run: |

          echo '[workspace]' >> Cargo.toml &&
          cargo test --tests
        working-directory: webview2-sys

  test-minimal-versions:
    name: Test (Minimal versions)
    runs-on: windows-latest
    strategy:
      matrix:
        toolchain:
          - nightly-x86_64-pc-windows-msvc
          - nightly-i686-pc-windows-gnu
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ matrix.toolchain }}
          override: true
      # Copy the DLL if using gnu toolchain.
      - run: |

          mkdir -p target/debug/deps &&
          cp webview2-sys/Microsoft.Web.WebView2.*/build/native/x86/WebView2Loader.dll target/debug/deps
        if: ${{ endsWith(matrix.toolchain, 'gnu') }}
      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: -Z minimal-versions

  fmt:
    name: Rustfmt
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          # Use fixed version because format result can change between different rust versions.
          toolchain: 1.51.0
          override: true
      - run: rustup component add rustfmt
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check

  clippy:
    name: Clippy
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          # Use fixed version because clippy warnings can change between rust versions.
          toolchain: 1.51.0
          override: true
      - run: rustup component add clippy
      - uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all --all-targets -- -D warnings
      - uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --no-default-features --all --all-targets -- -D warnings

  check-generated-code:
    name: Check Generated Code (make sure they are up to date)
    # Using bash from ubuntu is easier.
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          # Use fixed version because format result can change between different rust versions.
          toolchain: 1.51.0
          override: true
      - run: rustup component add rustfmt
      - run: cargo run < ../Microsoft.Web.WebView2.*/WebView2.idl > ../src/lib.rs && rustfmt ../src/lib.rs
        working-directory: webview2-sys/idl2rs
      - run: cargo run -- interface_wrappers < ../Microsoft.Web.WebView2.*/WebView2.idl > ../../src/interfaces.rs && rustfmt ../../src/interfaces.rs
        working-directory: webview2-sys/idl2rs
      - run: git diff --exit-code