on: [push, pull_request] name: CI Windows # Least privilege: this workflow only reads the repo and runs tests. permissions: contents: read jobs: test-default-windows: name: Windows vcpkg (default) runs-on: windows-latest env: VCPKGRS_DYNAMIC: 1 VCPKG_DEFAULT_TRIPLET: x64-windows VCPKG_ROOT: C:\vcpkg steps: - uses: actions/checkout@v6 - name: Setup vcpkg libxml2 Cache uses: actions/cache@v4 id: vcpkg-cache with: path: C:\vcpkg key: vcpkg-libxml2 - name: Install libxml2 with vcpkg run: | vcpkg install libxml2:x64-windows vcpkg integrate install - name: run tests run: cargo test test-mingw64-windows: name: Windows (mingw64) runs-on: windows-latest defaults: run: shell: msys2 {0} steps: - uses: actions/checkout@v6 - uses: msys2/setup-msys2@v2 with: path-type: minimal release: false update: false msystem: MINGW64 install: >- mingw64/mingw-w64-x86_64-pkg-config mingw64/mingw-w64-x86_64-libxml2 - name: Install stable windows-gnu Rust toolchain uses: dtolnay/rust-toolchain@master with: toolchain: stable-x86_64-pc-windows-gnu targets: x86_64-pc-windows-gnu - name: Ensure mingw64 pkg-config is in path run: echo "C:\msys64\mingw64\bin" >> "$GITHUB_PATH" # Run cargo in the default Windows shell, not the job's msys2 shell: # rustup installs cargo to the Windows user profile, which # `path-type: minimal` strips from the msys2 PATH (exit 127). The old # actions-rs/cargo step ran in the runner's Windows context too, never # msys2. mingw64/bin is on PATH via the step above, so pkg-config, gcc, # and the libxml2 DLLs still resolve for the windows-gnu build. - name: run tests shell: pwsh run: cargo test