Skip to content

Commit 2f734f5

Browse files
committed
CI: support testing on Windows
1 parent b92637d commit 2f734f5

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

.github/workflows/example-project.yml

+50
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ jobs:
6262
working-directory: example-project
6363
run: |
6464
sudo cp -r temp/usr/local/* /usr/local/
65+
66+
- name: Install into Cargo root
67+
if: startsWith(matrix.os, 'windows')
68+
shell: bash
69+
working-directory: example-project
70+
run: |
71+
cargo cinstall --verbose --release --prefix=$CARGO_HOME
6572
6673
- name: Test pkg-config
6774
if: startsWith(matrix.os, 'macos')
@@ -75,6 +82,28 @@ jobs:
7582
uses: awalsh128/cache-apt-pkgs-action@latest
7683
with:
7784
packages: pkgconf
85+
86+
- name: Setup Meson + Ninja
87+
if: startsWith(matrix.os, 'windows')
88+
run: |
89+
python3 -m pip install --upgrade pip setuptools wheel
90+
python3 -m pip install meson ninja
91+
92+
- name: Setup MSVC for test
93+
if: startsWith(matrix.os, 'windows')
94+
uses: ilammy/msvc-dev-cmd@v1
95+
with:
96+
arch: x86_64
97+
98+
# https://github.com/pkgconf/pkgconf/issues/364
99+
- name: Install pkgconf
100+
if: startsWith(matrix.os, 'windows')
101+
run: |
102+
git clone https://github.com/amyspark/pkgconf --branch msvc
103+
cd pkgconf
104+
meson setup build --prefix=$env:CARGO_HOME
105+
meson compile -C build
106+
meson install -C build
78107
79108
- name: Test pkgconf
80109
if: startsWith(matrix.os, 'ubuntu')
@@ -90,6 +119,18 @@ jobs:
90119
test "${CFLAGS%% }" = "-I/usr/local/include/example-project-0.1"
91120
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
92121
122+
- name: Test pkgconf
123+
if: startsWith(matrix.os, 'windows')
124+
shell: bash
125+
run: |
126+
set -x
127+
pkgconf --version
128+
CFLAGS=$(pkgconf --cflags example_project)
129+
LIBS=$(pkgconf --libs example_project)
130+
131+
test "${CFLAGS%% }" = "-I${CARGO_HOME//\\//}/bin/../include/example-project-0.1"
132+
test "${LIBS%% }" = "-L${CARGO_HOME//\\//}/bin/../lib -lexample-project"
133+
93134
- name: Update dynamic linker cache
94135
if: startsWith(matrix.os, 'ubuntu')
95136
run: |
@@ -101,3 +142,12 @@ jobs:
101142
run: |
102143
make
103144
145+
- name: Test usage from C (Meson)
146+
if: startsWith(matrix.os, 'windows') && matrix.toolchain-suffix == '-msvc'
147+
working-directory: example-project/usage-from-c
148+
shell: pwsh
149+
run: |
150+
$env:PKG_CONFIG="$env:CARGO_HOME/bin/pkgconf.exe"
151+
meson setup build
152+
meson compile -C build
153+
meson test -C build
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
project('example', 'c')
2+
3+
dep = dependency('example_project', static: true, required: true)
4+
5+
exe = executable('run_tests', files('run_tests.c'), dependencies: dep)
6+
7+
test('run_tests', exe)

0 commit comments

Comments
 (0)