Skip to content

Commit

Permalink
CI: use MSYS2 cargo package for example project
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier authored and lu-zero committed Jan 9, 2022
1 parent b84d67a commit 97a9d53
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/example-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,42 @@ jobs:
run: |
make
example-project-msys2:

runs-on: windows-latest
defaults:
run:
shell: msys2 {0}

steps:
- name: Clone Git repository
uses: actions/checkout@v2

- name: Install MSYS2
if: startsWith(matrix.os, 'windows') && matrix.toolchain-suffix == '-gnu'
uses: msys2/setup-msys2@v2
with:
release: false
update: true
install: >-
base-devel
make
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-rust
# mingw-w64-x86_64-cargo-c

- name: Copy installed files
if: startsWith(matrix.os, 'windows') && matrix.toolchain-suffix == '-gnu'
# NB: cargo-c is available from the package mingw-w64-x86_64-cargo-c
# (https://packages.msys2.org/base/mingw-w64-cargo-c),
# which is the recommended way to use cargo-c on MSYS2.
# For testing purposes, we compile and install the latest version from the Git repo
# (which takes much longer than installing the MSYS2 package!):

- name: Install cargo-c applet
run: |
cargo install --path .
- name: Install C API for example project
working-directory: example-project
run: |
# NB: --prefix doesn't seem to matter on Windows
cp -r temp/usr/local/{lib,bin,include} /mingw64/
shell: msys2 {0}
cargo cinstall --verbose --release --prefix /mingw64 --target x86_64-pc-windows-gnu
- name: Test usage from C (using Makefile)
if: startsWith(matrix.os, 'windows') && matrix.toolchain-suffix == '-gnu'
working-directory: example-project/usage-from-c
run: |
make
shell: msys2 {0}

0 comments on commit 97a9d53

Please sign in to comment.