libxml2-rs 0.1.1

Rust bindings for the libxml2 C library
Documentation
name: Test Rust

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Setup vcpkg libxml2 Cache
        if: contains(matrix.os, 'windows')
        uses: actions/cache@v4
        id: vcpkg-cache
        with:
          path: C:\vcpkg
          key: vcpkg-libxml2

      - name: Install libxml2 (Windows)
        if: contains(matrix.os, 'windows')
        shell: pwsh
        run: |
          vcpkg install libxml2
          vcpkg integrate install


      - name: Setup environment (Windows)
        if: contains(matrix.os, 'windows')
        run: |
          echo "CMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake" >> $env:GITHUB_ENV
          echo "LIBXML2_INCLUDE_DIR=C:\vcpkg\installed\x64-windows\include\libxml2\" >> $env:GITHUB_ENV
          echo "LIBXML2_LIBRARY_DIR=C:\vcpkg\installed\x64-windows\lib\" >> $env:GITHUB_ENV
          "C:\vcpkg\installed\x64-windows\bin\" | Out-File -FilePath "$env:GITHUB_PATH" -Append
   
      - name: Build
        run: cargo build --verbose

      - name: Run tests
        run: cargo test --verbose