Skip to content

Commit bfff53d

Browse files
committed
add a windows CI target
1 parent 412f247 commit bfff53d

3 files changed

Lines changed: 35 additions & 5 deletions

File tree

.github/workflows/CI.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on: [push, pull_request]
22

3-
name: CI
3+
name: CI Linux
44

55
jobs:
66
test:
@@ -58,4 +58,4 @@ jobs:
5858
with:
5959
command: test
6060
env:
61-
LD_LIBRARY_PATH: /usr/local/lib
61+
LD_LIBRARY_PATH: /usr/local/lib

.github/workflows/windows.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
on: [push, pull_request]
2+
3+
name: CI Windows
4+
5+
jobs:
6+
test-default-windows:
7+
name: Windows default
8+
runs-on: windows-latest
9+
env:
10+
VCPKGRS_DYNAMIC: 1
11+
VCPKG_DEFAULT_TRIPLET: x64-windows
12+
VCPKG_ROOT: C:\vcpkg
13+
steps:
14+
- name: Setup vcpkg libxml2 Cache
15+
uses: actions/cache@v4
16+
id: vcpkg-cache
17+
with:
18+
path: C:\vcpkg
19+
key: vcpkg-libxml2
20+
- name: Install libxml2 with vcpkg
21+
run: |
22+
vcpkg install libxml2
23+
vcpkg integrate install
24+
- uses: actions/checkout@v2
25+
- name: run tests
26+
uses: actions-rs/cargo@v1
27+
with:
28+
command: test

build.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ fn find_libxml2() -> Option<ProbedLib> {
5151
})
5252
}
5353

54-
#[cfg(windows)]
54+
#[cfg(target_family = "windows")]
5555
{
56-
if let Some(meta) = vcpkg_dep::find() {
56+
if let Some(meta) = vcpkg_dep::vcpkg_find_libxml2() {
5757
return Some(meta);
58+
} else {
59+
eprintln!("vcpkg did not succeed in finding libxml2.");
5860
}
5961
}
6062

@@ -110,7 +112,7 @@ fn main() {
110112
#[cfg(target_family = "windows")]
111113
mod vcpkg_dep {
112114
use crate::ProbedLib;
113-
pub fn find() -> Option<ProbedLib> {
115+
pub fn vcpkg_find_libxml2() -> Option<ProbedLib> {
114116
if let Ok(metadata) = vcpkg::find_package("libxml2") {
115117
Some(ProbedLib { version: vcpkg_version(), include_paths: metadata.include_paths })
116118
} else {

0 commit comments

Comments
 (0)