Skip to content

Commit

Permalink
CI: support testing on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
amyspark committed Sep 11, 2024
1 parent 1604c1c commit 3a48279
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/example-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ jobs:
working-directory: example-project
run: |
sudo cp -r temp/usr/local/* /usr/local/
- name: Install into Cargo root
if: startsWith(matrix.os, 'windows')
working-directory: example-project
run: |
cargo cinstall --verbose --release --prefix=$CARGO_HOME
- name: Test pkg-config
if: startsWith(matrix.os, 'macos')
Expand All @@ -76,6 +82,17 @@ jobs:
with:
packages: pkgconf

# https://github.com/pkgconf/pkgconf/issues/364
- name: Install pkgconf
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
git clone https://github.com/amyspark/pkgconf --branch msvc
cd pkgconf
meson setup build --prefix=$CARGO_HOME
meson compile -C build
meson install -C build
- name: Test pkgconf
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand All @@ -90,6 +107,18 @@ jobs:
test "${CFLAGS%% }" = "-I/usr/local/include/example-project-0.1"
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project"
- name: Test pkgconf
if: startsWith(matrix.os, 'windows')
shell: bash
run: |
set -x
pkgconf --version
CFLAGS=$(pkgconf --cflags example_project)
LIBS=$(pkgconf --libs example_project)
test "${CFLAGS%% }" = "-I$CARGO_HOME/bin/../include/example-project-0.1"
test "${LIBS%% }" = "-L$CARGO_HOME/bin/../lib -lexample-project"
- name: Update dynamic linker cache
if: startsWith(matrix.os, 'ubuntu')
run: |
Expand All @@ -101,3 +130,23 @@ jobs:
run: |
make
- name: Setup MSVC for test
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64

- name: Setup Meson + Ninja
if: startsWith(matrix.os, 'windows')
run: |
python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install meson ninja
- name: Test usage from C (Meson)
if: startsWith(matrix.os, 'windows')
working-directory: example-project/usage-from-c
shell: pwsh
run:
meson setup build
meson compile -C build
meson test -C build
7 changes: 7 additions & 0 deletions example-project/usage-from-c/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project('example', 'c')

dep = dependency('example_project', static: true, required: true)

exe = executable('run_tests', files('run_tests.c'), dependencies: dep)

test('run_tests', exe)

0 comments on commit 3a48279

Please sign in to comment.