Skip to content

Commit 8ca5a34

Browse files
committed
CI: support testing on Windows
1 parent f71408e commit 8ca5a34

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')
@@ -76,6 +83,17 @@ jobs:
7683
with:
7784
packages: pkgconf
7885

86+
# https://github.com/pkgconf/pkgconf/issues/364
87+
- name: Install pkgconf
88+
if: startsWith(matrix.os, 'windows')
89+
shell: bash
90+
run: |
91+
git clone https://github.com/amyspark/pkgconf --branch msvc
92+
cd pkgconf
93+
meson setup build --prefix=$CARGO_HOME
94+
meson compile -C build
95+
meson install -C build
96+
7997
- name: Test pkgconf
8098
if: startsWith(matrix.os, 'ubuntu')
8199
run: |
@@ -90,6 +108,18 @@ jobs:
90108
test "${CFLAGS%% }" = "-I/usr/local/include/example-project-0.1"
91109
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
92110
111+
- name: Test pkgconf
112+
if: startsWith(matrix.os, 'windows')
113+
shell: bash
114+
run: |
115+
set -x
116+
pkgconf --version
117+
CFLAGS=$(pkgconf --cflags example_project)
118+
LIBS=$(pkgconf --libs example_project)
119+
120+
test "${CFLAGS%% }" = "-I$CARGO_HOME/bin/../include/example-project-0.1"
121+
test "${LIBS%% }" = "-L$CARGO_HOME/bin/../lib -lexample-project"
122+
93123
- name: Update dynamic linker cache
94124
if: startsWith(matrix.os, 'ubuntu')
95125
run: |
@@ -101,3 +131,23 @@ jobs:
101131
run: |
102132
make
103133
134+
- name: Setup MSVC for test
135+
if: startsWith(matrix.os, 'windows')
136+
uses: ilammy/msvc-dev-cmd@v1
137+
with:
138+
arch: x86_64
139+
140+
- name: Setup Meson + Ninja
141+
if: startsWith(matrix.os, 'windows')
142+
run: |
143+
python3 -m pip install --upgrade pip setuptools wheel
144+
python3 -m pip install meson ninja
145+
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)