Merge pull request #529 from elfenpiff/iox2-528-make-signal-registrat… #1973
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main, release* ] | |
# env: | |
# RUSTFLAGS: "-C debug-assertions" | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
source-code: ${{ steps.filter.outputs.source-code }} | |
markdown: ${{ steps.filter.outputs.markdown }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Check for changed file types | |
uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
source-code: | |
- '!**/*.md' | |
markdown: | |
- '**/*.md' | |
preflight-check: | |
needs: changes | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Check format of all commit messages | |
run: ./internal/scripts/ci_test_commit_msg.sh | |
- name: Check license header | |
run: ./internal/scripts/ci_test_spdx_license_header.sh | |
linting-markdown: | |
needs: changes | |
if: ${{ needs.changes.outputs.markdown == 'true' }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup GitHub CLI | |
run: | | |
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) | |
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ | |
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ | |
&& sudo apt update \ | |
&& sudo apt install gh -y | |
- name: Setup node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install linters | |
run: npm install -g markdownlint-cli prettier | |
- name: Check linting | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }} | |
GITHUB_BEFORE: ${{ github.event.before }} | |
GITHUB_AFTER: ${{ github.event.after }} | |
run: ./internal/scripts/check_markdown_linting.sh | |
static-code-analysis-rust: | |
needs: preflight-check | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macOS-latest] | |
timeout-minutes: 10 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
run: cargo fmt --all -- --check | |
- name: Run cargo clippy | |
run: cargo clippy -- -D warnings | |
- name: Run code examples in documentation | |
run: cargo test --workspace --doc | |
- name: Build documentation | |
run: cargo doc | |
static-code-analysis-cpp: | |
needs: preflight-check | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install clang-tidy and clang-format | |
uses: ./.github/actions/install-iceoryx-deps-and-clang | |
- name: clang-format and clang-tidy versions | |
run: | | |
clang-format --version | |
clang-tidy --version | |
- name: Run clang-format | |
run: git ls-files | grep -E "\.(c|cc|cpp|cxx|inl|h|hh|hpp|hxx)$" | xargs clang-format -i -style=file --Werror --dry-run | |
- name: Run clang-tidy | |
run: | | |
git fetch origin main | |
internal/scripts/clang_tidy_scan.sh warning-as-error diff-to-main | |
# just to have a sync point for the C++ and Rust static code analysis | |
static-code-analysis: | |
needs: [static-code-analysis-cpp, static-code-analysis-rust] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Static code analysis sync point | |
run: echo "Nothing to see, move along!" | |
cargo-nextest: | |
needs: preflight-check | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and cache cargo-nextest | |
uses: ./.github/actions/build-and-cache-rust-tool | |
with: | |
rust-toolchain: stable | |
check-and-install-cmd: cargo-nextest --version > /dev/null || cargo install cargo-nextest --locked | |
print-version-cmd: cargo-nextest --version | |
# increment cache-N-${{}} if a new nextest version is required | |
cache-key: cache-2-${{ runner.os }}-cargo-nextest | |
artifact-bin-name: cargo-nextest | |
artifact-upload-name: ${{ runner.os }}-cargo-nextest | |
x86_32: | |
needs: [preflight-check, static-code-analysis, cargo-nextest] | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] # [windows-latest, ubuntu-latest, macos-latest] | |
toolchain: [stable] # [stable, 1.75.0, beta, nightly] | |
mode: | |
- name: "release" | |
arg: "--release" | |
cmake-build-type: "-DCMAKE_BUILD_TYPE=Release" | |
- name: "debug" | |
arg: "" | |
cmake-build-type: "-DCMAKE_BUILD_TYPE=Debug" | |
timeout-minutes: 60 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
targets: i686-unknown-linux-gnu | |
components: rustfmt, clippy | |
- name: Download artifact cargo-nextest | |
uses: ./.github/actions/download-cached-rust-tool | |
with: | |
artifact-bin-name: cargo-nextest | |
artifact-upload-name: ${{ runner.os }}-cargo-nextest | |
- name: Prepare Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: internal\scripts\ci_prepare_windows.ps1 | |
- name: Prepare Linux | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
internal/scripts/ci_prepare_ubuntu.sh | |
uname -a | |
- name: Run cargo build | |
run: cargo build --workspace --all-targets ${{ matrix.mode.arg }} --target i686-unknown-linux-gnu | |
- name: Run cargo nextest | |
run: cargo nextest run --workspace --all-targets --no-fail-fast ${{ matrix.mode.arg }} --target i686-unknown-linux-gnu | |
- name: Build language bindings | |
run: | | |
cmake -S . \ | |
-B target/ffi/build \ | |
-DCMAKE_INSTALL_PREFIX=target/ffi/install \ | |
-DBUILD_CXX_BINDING=OFF \ | |
-DBUILD_EXAMPLES=ON \ | |
-DBUILD_TESTING=ON \ | |
-DRUST_TARGET_TRIPLET="i686-unknown-linux-gnu" \ | |
-DCMAKE_C_FLAGS="-m32" \ | |
-DCMAKE_CXX_FLAGS="-m32" \ | |
${{ matrix.mode.cmake-build-type }} | |
cmake --build target/ffi/build | |
cmake --install target/ffi/build | |
- name: Run language binding tests | |
run: target/ffi/build/tests/iceoryx2-c-tests | |
- name: Build C language binding examples in out-of-tree configuration | |
if: false # TODO: [#262] out-of-tree cross-compilation is currently not supported | |
run: | | |
rm -rf target/ffi/build | |
cmake -S examples/c \ | |
-B target/ffi/out-of-tree-c \ | |
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install \ | |
-DCMAKE_C_FLAGS="-m32" \ | |
-DCMAKE_CXX_FLAGS="-m32" \ | |
-${{ matrix.mode.cmake-build-type }} | |
cmake --build target/ffi/out-of-tree-c | |
- name: Build C++ language binding examples in out-of-tree configuration | |
if: false # TODO: [#262] out-of-tree cross-compilation is currently not supported | |
run: | | |
cmake -S examples/cxx \ | |
-B target/ffi/out-of-tree-cxx \ | |
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install \ | |
-DCMAKE_C_FLAGS="-m32" \ | |
-DCMAKE_CXX_FLAGS="-m32" \ | |
-${{ matrix.mode.cmake-build-type }} | |
cmake --build target/ffi/out-of-tree-cxx | |
x86_64: | |
needs: [preflight-check, static-code-analysis, cargo-nextest] | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
# NOTE: enable for MinGW | |
# toolchain: [stable, stable-gnu, 1.75.0] | |
toolchain: [stable, 1.75.0] | |
mode: | |
- name: "release" | |
arg: "--release" | |
cmake-build-type: "-DCMAKE_BUILD_TYPE=Release" # required for Makefile Generators at config time | |
cmake-build-config: "--config Release" # required for Visual Studio at build and install time | |
- name: "debug" | |
arg: "" | |
cmake-build-type: "-DCMAKE_BUILD_TYPE=Debug" # required for Makefile Generators at config time | |
cmake-build-config: "--config Debug" # required for Visual Studio at build and install time | |
include: | |
# NOTE: enable for MinGW | |
# - toolchain: stable-gnu | |
# cmake-build-system-generator: '-G "MinGW Makefiles"' | |
- os: windows-latest | |
toolchain: stable | |
cmake-cxx-flags: '-DCMAKE_CXX_FLAGS="/MP"' | |
# NOTE: enable for MinGW | |
# exclude: | |
# - os: ubuntu-latest | |
# toolchain: stable-gnu | |
# - os: macos-latest | |
# toolchain: stable-gnu | |
timeout-minutes: 60 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
- name: Download artifact cargo-nextest | |
uses: ./.github/actions/download-cached-rust-tool | |
with: | |
artifact-bin-name: cargo-nextest | |
artifact-upload-name: ${{ runner.os }}-cargo-nextest | |
- name: Prepare Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: internal\scripts\ci_prepare_windows.ps1 | |
- name: Prepare Linux | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
internal/scripts/ci_prepare_ubuntu.sh | |
uname -a | |
- name: Run cargo build | |
run: cargo build --workspace --all-targets ${{ matrix.mode.arg }} | |
- name: Run cargo nextest | |
run: cargo nextest run --workspace --all-targets --no-fail-fast ${{ matrix.mode.arg }} | |
- name: Build iceoryx_hoofs on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: internal\scripts\ci_build_and_install_iceoryx_hoofs.ps1 -mode ${{ matrix.mode.name }} -toolchain ${{ matrix.toolchain }} | |
- name: Build iceoryx_hoofs on non-Windows | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: internal/scripts/ci_build_and_install_iceoryx_hoofs.sh | |
- name: Print native libs of FFI target | |
if: false # This step takes 1 to 2 minutes; only enable if there are linker issues with the FFI target | |
run: | | |
cd iceoryx2-ffi/ffi | |
cargo rustc -q -- --print=native-static-libs | |
- name: Build language bindings | |
run: | | |
cmake -S . -B target/ffi/build -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON ${{ matrix.mode.cmake-build-type }} ${{ matrix.mode.cmake-cxx-flags }} ${{ matrix.cmake-build-system-generator }} -DCMAKE_INSTALL_PREFIX=target/ffi/install -DCMAKE_PREFIX_PATH="${{ github.workspace }}/target/iceoryx/install" | |
cmake --build target/ffi/build ${{ matrix.mode.cmake-build-config }} | |
cmake --install target/ffi/build ${{ matrix.mode.cmake-build-config }} | |
- name: Run C language binding tests | |
run: target/ffi/build/tests/iceoryx2-c-tests | |
- name: Run C++ language binding tests | |
run: target/ffi/build/tests/iceoryx2-cxx-tests | |
- name: Remove language binding build artifacts on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: rm -r -force target/ffi/build | |
- name: Remove language binding build artifacts on non-Windows | |
if: ${{ matrix.os != 'windows-latest' }} | |
run: rm -rf target/ffi/build | |
- name: Build C language binding examples in out-of-tree configuration | |
run: | | |
cmake -S examples/c -B target/ffi/out-of-tree-c ${{ matrix.mode.cmake-build-type }} ${{ matrix.mode.cmake-cxx-flags }} ${{ matrix.cmake-build-system-generator }} -DCMAKE_PREFIX_PATH="${{ github.workspace }}/target/ffi/install" | |
cmake --build target/ffi/out-of-tree-c ${{ matrix.mode.cmake-build-config }} | |
- name: Build C++ language binding examples in out-of-tree configuration | |
run: | | |
cmake -S examples/cxx -B target/ffi/out-of-tree-cxx ${{ matrix.mode.cmake-build-type }} ${{ matrix.mode.cmake-cxx-flags }} ${{ matrix.cmake-build-system-generator }} -DCMAKE_PREFIX_PATH="${{ github.workspace }}/target/ffi/install;${{ github.workspace }}/target/iceoryx/install" | |
cmake --build target/ffi/out-of-tree-cxx ${{ matrix.mode.cmake-build-config }} | |
x86_64_unstable: | |
needs: [preflight-check, static-code-analysis, cargo-nextest] | |
if: ${{ needs.changes.outputs.source-code == 'true' && github.ref != 'refs/heads/main' }} | |
continue-on-error: true | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
toolchain: [beta, nightly] | |
mode: | |
- name: "release" | |
arg: "--release" | |
- name: "debug" | |
arg: "" | |
timeout-minutes: 60 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
- name: Download artifact cargo-nextest | |
uses: ./.github/actions/download-cached-rust-tool | |
with: | |
artifact-bin-name: cargo-nextest | |
artifact-upload-name: ${{ runner.os }}-cargo-nextest | |
- name: Prepare Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: internal\scripts\ci_prepare_windows.ps1 | |
- name: Prepare Linux | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
internal/scripts/ci_prepare_ubuntu.sh | |
uname -a | |
- name: Run cargo build | |
run: cargo build --workspace --all-targets ${{ matrix.mode.arg }} | |
- name: Run cargo nextest | |
run: cargo nextest run --workspace --all-targets --no-fail-fast ${{ matrix.mode.arg }} | |
### TODO: does not work yet reliable on the GitHub CI, seems to end up in an infinite loop | |
### current alternative is a cirrus.yml aarch64 target | |
# arm: | |
# runs-on: ubuntu-latest | |
# if: ${{ needs.changes.outputs.source-code == 'true' }} | |
# strategy: | |
# matrix: | |
# architecture: ["aarch64"] # ["aarch64", "armv7"] | |
# toolchain: [ stable ] # [stable, 1.75.0, beta, nightly] | |
# mode: ["--release", ""] | |
# timeout-minutes: 30 | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: uraimo/run-on-arch-action@v2 | |
# name: Run commands | |
# with: | |
# arch: ${{ matrix.architecture }} | |
# distro: archarm_latest | |
# run: | | |
# ./internal/scripts/ci_prepare_archlinux.sh | |
# rustup default ${{ matrix.toolchain }} | |
# cargo fmt --all -- --check | |
# cargo clippy -- -D warnings | |
# cargo build --workspace --all-targets ${{ matrix.mode }} | |
# cargo test --workspace --all-targets --no-fail-fast ${{ matrix.mode }} | |
freebsd: | |
needs: [preflight-check, static-code-analysis] | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
matrix: | |
freebsd_version: [ "14.0" ] | |
toolchain: [ "stable", "1.75.0" ] # [stable, 1.75.0, beta, nightly] | |
mode: ["debug"] # ["release", "debug"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: vmactions/freebsd-vm@v1 | |
with: | |
release: ${{ matrix.freebsd_version }} | |
mem: 16384 | |
copyback: false | |
prepare: pkg install -y cmake curl gcc git llvm | |
run: | | |
git config --global --add safe.directory /home/runner/work/iceoryx2/iceoryx2 | |
./internal/scripts/ci_prepare_freebsd.sh | |
./internal/scripts/ci_build_and_test_freebsd.sh --toolchain ${{ matrix.toolchain }} --mode ${{ matrix.mode }} | |
x86_64_bazel: | |
needs: [preflight-check, static-code-analysis] | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
strategy: | |
matrix: | |
os: [ubuntu-24.04] | |
toolchain: [stable] | |
timeout-minutes: 60 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
- name: Prepare Linux | |
run: | | |
internal/scripts/ci_prepare_ubuntu.sh | |
uname -a | |
- name: Run bazel build | |
run: bazel build //... | |
- name: Run bazel test | |
run: bazel test //... | |
grcov: | |
needs: [preflight-check, static-code-analysis] | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build and cache grcov | |
uses: ./.github/actions/build-and-cache-rust-tool | |
with: | |
rust-toolchain: stable | |
rust-components: llvm-tools-preview | |
check-and-install-cmd: grcov --version > /dev/null || cargo install grcov | |
print-version-cmd: grcov --version | |
cache-key: cache-1-${{ runner.os }}-grcov | |
artifact-bin-name: grcov | |
artifact-upload-name: ${{ runner.os }}-grcov | |
coverage: | |
needs: grcov | |
if: ${{ needs.changes.outputs.source-code == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: sudo apt-get -y install libacl1-dev llvm | |
- name: Create test users and groups | |
run: | | |
sudo useradd testuser1 | |
sudo useradd testuser2 | |
sudo groupadd testgroup1 | |
sudo groupadd testgroup2 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
components: llvm-tools-preview | |
- name: Download artifact grcov | |
uses: ./.github/actions/download-cached-rust-tool | |
with: | |
artifact-bin-name: grcov | |
artifact-upload-name: ${{ runner.os }}-grcov | |
- name: Generate raw coverage results | |
run: ./internal/scripts/generate-cov-report.sh --generate | |
- name: Generate coverage results for html artifacts | |
run: ./internal/scripts/generate-cov-report.sh --html | |
- name: Archive coverage-html artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-html | |
path: target/debug/coverage/html/* | |
retention-days: 90 | |
- name: Generate coverage report for Codecov | |
run: ./internal/scripts/generate-cov-report.sh --lcov | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: target/debug/coverage/lcov.info | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} |