reduce the number of feature flags enabled for object
#1081
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build example project | |
on: [push, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
example-project: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
# x86_64: | |
- os: macos-13 | |
# arm64: | |
- os: macos-latest | |
- os: windows-latest | |
toolchain-suffix: -gnu | |
- os: windows-latest | |
toolchain-suffix: -msvc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Clone Git repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable${{ matrix.toolchain-suffix }} | |
- name: Install cargo-c applet | |
run: | | |
cargo install --path . | |
- name: Test example project | |
working-directory: example-project | |
run: | | |
cargo test --verbose | |
- name: Build C API for example project | |
working-directory: example-project | |
run: | | |
cargo cbuild --verbose --release | |
- name: Run C API tests for example project | |
working-directory: example-project | |
run: | | |
cargo ctest --verbose --release | |
- name: Install into temporary location | |
working-directory: example-project | |
run: | | |
cargo cinstall --verbose --release --destdir=temp | |
- name: Copy installed files to /usr/local | |
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') | |
working-directory: example-project | |
run: | | |
sudo cp -r temp/usr/local/* /usr/local/ | |
- name: Test pkg-config | |
if: startsWith(matrix.os, 'macos') | |
run: | | |
set -x | |
test "$(pkg-config --cflags example_project)" = "-I/usr/local/include/example-project-0.1" | |
test "$(pkg-config --libs example_project)" = "-L/usr/local/lib -lexample-project" | |
- name: Install pkgconf | |
if: startsWith(matrix.os, 'ubuntu') | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: pkgconf | |
- name: Test pkgconf | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
set -x | |
pkgconf --version | |
pkg-config --version | |
ARCHDIR=`dpkg-architecture -qDEB_HOST_MULTIARCH` | |
# ubuntu seems to add trailing spaces for no specific reasons. | |
CFLAGS=$(pkgconf --cflags example_project) | |
LIBS=$(pkgconf --libs example_project) | |
test "${CFLAGS%% }" = "-I/usr/local/include/example-project-0.1" | |
test "${LIBS%% }" = "-L/usr/local/lib/${ARCHDIR} -lexample-project" | |
- name: Update dynamic linker cache | |
if: startsWith(matrix.os, 'ubuntu') | |
run: | | |
sudo ldconfig | |
- name: Test usage from C (using Makefile) | |
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') | |
working-directory: example-project/usage-from-c | |
run: | | |
make | |