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 12, 2024
1 parent 5ad0b24 commit 5d4dd45
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/example-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ jobs:
working-directory: example-project
run: |
sudo cp -r temp/usr/local/* /usr/local/
- name: Install into Cargo root
if: startsWith(matrix.os, 'windows')
shell: bash
working-directory: example-project
run: |
cargo cinstall --verbose --release --prefix=$CARGO_HOME
- name: Test pkg-config
if: startsWith(matrix.os, 'macos')
Expand All @@ -75,6 +82,29 @@ jobs:
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: pkgconf

- 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: Setup MSVC for test
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x86_64

# https://github.com/pkgconf/pkgconf/issues/364
- name: Install pkgconf
if: startsWith(matrix.os, 'windows')
run: |
git clone https://github.com/amyspark/pkgconf --branch msvc
cd pkgconf
meson setup build --prefix=$env:CARGO_HOME
meson compile -C build
meson install -C build
cp $env:CARGO_HOME/bin/pkgconf.exe $env:CARGO_HOME/bin/pkg-config.exe
- name: Test pkgconf
if: startsWith(matrix.os, 'ubuntu')
Expand All @@ -90,6 +120,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 +143,11 @@ jobs:
run: |
make
- 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 5d4dd45

Please sign in to comment.