Skip to content

6_rename_bindings

6_rename_bindings #178

Workflow file for this run

name: C Test Suite
on:
push:
branches: ["main"]
paths:
- .github/workflows/*_c.yml
- bindings/c/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
pull_request:
paths:
- .github/workflows/*_c.yml
- bindings/c/**
- src/**
- Cargo.lock
- Cargo.toml
- deny.toml
- .gitmodules
permissions:
contents: read
jobs:
test:
name: C test
defaults:
run:
working-directory: bindings/c
shell: bash
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
include:
- os: ubuntu-latest
runs-on: ${{matrix.os}}
steps:
- name: Harden Runner
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@d0592fe69e35bc8f12e3dbaf9ad2694d976cb8e3 # stable
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Run Cargo Clippy
run: cargo clippy
- name: Run Cargo Fmt
run: cargo fmt --check
- name: Run Cargo Deny
uses: EmbarkStudios/cargo-deny-action@3f4a782664881cf5725d0ffd23969fcce89fd868 # v1.6.3
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Setup Python
id: setup-python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: 3
cache: 'pip'
- name: Cache virtualenv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version}}-${{ hashFiles('pyproject.toml') }}
path: .venv
- name: Setup virtual environment
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
- name: Install ninja
run: |
python -m venv .venv
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt-get install ninja-build
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install ninja
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install ninja
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Install meson
run: python -m pip install .[build]
- name: Meson Setup
run: meson setup build -Dtests=true -Db_coverage=true
- name: Meson Compile
working-directory: bindings/c/build
run: |
meson compile
- name: Meson Test
working-directory: bindings/c/build
run: |
meson test
- name: Run Valgrind
working-directory: bindings/c/build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y valgrind
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_check
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_item
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_result
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_runner
valgrind -v --leak-check=full --show-leak-kinds=all tests/test_status
- name: Run LCov
working-directory: bindings/c/build
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt update
sudo apt install -y lcov
lcov -c -d . -o coverage.info
- uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
flags: lang-c
files: build/coverage.info