Skip to content

Commit 5d4dd45

Browse files
committed
CI: support testing on Windows
1 parent 5ad0b24 commit 5d4dd45

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,29 @@ 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
107+
cp $env:CARGO_HOME/bin/pkgconf.exe $env:CARGO_HOME/bin/pkg-config.exe
78108
79109
- name: Test pkgconf
80110
if: startsWith(matrix.os, 'ubuntu')
@@ -90,6 +120,18 @@ jobs:
90120
test "${CFLAGS%% }" = "-I/usr/local/include/example-project-0.1"
91121
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
92122
123+
- name: Test pkgconf
124+
if: startsWith(matrix.os, 'windows')
125+
shell: bash
126+
run: |
127+
set -x
128+
pkgconf --version
129+
CFLAGS=$(pkgconf --cflags example_project)
130+
LIBS=$(pkgconf --libs example_project)
131+
132+
test "${CFLAGS%% }" = "-I${CARGO_HOME//\\//}/bin/../include/example-project-0.1"
133+
test "${LIBS%% }" = "-L${CARGO_HOME//\\//}/bin/../lib -lexample-project"
134+
93135
- name: Update dynamic linker cache
94136
if: startsWith(matrix.os, 'ubuntu')
95137
run: |
@@ -101,3 +143,11 @@ jobs:
101143
run: |
102144
make
103145
146+
- name: Test usage from C (Meson)
147+
if: startsWith(matrix.os, 'windows')
148+
working-directory: example-project/usage-from-c
149+
shell: pwsh
150+
run: |
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)