Skip to content

Commit 3a48279

Browse files
committed
CI: support testing on Windows
1 parent 1604c1c commit 3a48279

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/example-project.yml

+49
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ 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+
working-directory: example-project
69+
run: |
70+
cargo cinstall --verbose --release --prefix=$CARGO_HOME
6571
6672
- name: Test pkg-config
6773
if: startsWith(matrix.os, 'macos')
@@ -76,6 +82,17 @@ jobs:
7682
with:
7783
packages: pkgconf
7884

85+
# https://github.com/pkgconf/pkgconf/issues/364
86+
- name: Install pkgconf
87+
if: startsWith(matrix.os, 'windows')
88+
shell: bash
89+
run: |
90+
git clone https://github.com/amyspark/pkgconf --branch msvc
91+
cd pkgconf
92+
meson setup build --prefix=$CARGO_HOME
93+
meson compile -C build
94+
meson install -C build
95+
7996
- name: Test pkgconf
8097
if: startsWith(matrix.os, 'ubuntu')
8198
run: |
@@ -90,6 +107,18 @@ jobs:
90107
test "${CFLAGS%% }" = "-I/usr/local/include/example-project-0.1"
91108
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
92109
110+
- name: Test pkgconf
111+
if: startsWith(matrix.os, 'windows')
112+
shell: bash
113+
run: |
114+
set -x
115+
pkgconf --version
116+
CFLAGS=$(pkgconf --cflags example_project)
117+
LIBS=$(pkgconf --libs example_project)
118+
119+
test "${CFLAGS%% }" = "-I$CARGO_HOME/bin/../include/example-project-0.1"
120+
test "${LIBS%% }" = "-L$CARGO_HOME/bin/../lib -lexample-project"
121+
93122
- name: Update dynamic linker cache
94123
if: startsWith(matrix.os, 'ubuntu')
95124
run: |
@@ -101,3 +130,23 @@ jobs:
101130
run: |
102131
make
103132
133+
- name: Setup MSVC for test
134+
if: startsWith(matrix.os, 'windows')
135+
uses: ilammy/msvc-dev-cmd@v1
136+
with:
137+
arch: x86_64
138+
139+
- name: Setup Meson + Ninja
140+
if: startsWith(matrix.os, 'windows')
141+
run: |
142+
python3 -m pip install --upgrade pip setuptools wheel
143+
python3 -m pip install meson ninja
144+
145+
- name: Test usage from C (Meson)
146+
if: startsWith(matrix.os, 'windows')
147+
working-directory: example-project/usage-from-c
148+
shell: pwsh
149+
run:
150+
meson setup build
151+
meson compile -C build
152+
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)