Skip to content

Commit

Permalink
[eclipse-iceoryx#210] Extend CI for FFI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jun 14, 2024
1 parent c312b93 commit 2de2757
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 13 deletions.
36 changes: 36 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,38 @@ iox2_common_build_and_test_no_doc_tests_release_template: &IOX2_COMMON_BUILD_AND
<<: *IOX2_COMMON_BUILD_RELEASE
test_script: cargo nextest run --release --tests --workspace --no-fail-fast

iox2_ffi_common_debug_template: &IOX2_FFI_COMMON_DEBUG
ffi_script:
- cmake -B target/ffi/build \
-H. \
-DCMAKE_INSTALL_PREFIX=target/ffi/install \
-DEXAMPLES=ON \
-DCMAKE_BUILD_TYPE="Debug"
- cmake --build target/ffi/build
- cmake --install target/ffi/build
- rm -rf target/ffi/build
- cmake -B target/ffi/out-of-tree \
-Hexamples/c/ \
-DCMAKE_PREFIX_PATH=$( pwd )/target/ffi/install \
-DCMAKE_BUILD_TYPE="Debug"
- cmake --build target/ffi/out-of-tree

iox2_ffi_common_release_template: &IOX2_FFI_COMMON_RELEASE
ffi_script:
- cmake -B target/ffi/build \
-H. \
-DCMAKE_INSTALL_PREFIX=target/ffi/install \
-DEXAMPLES=ON \
-DCMAKE_BUILD_TYPE="Release"
- cmake --build target/ffi/build
- cmake --install target/ffi/build
- rm -rf target/ffi/build
- cmake -B target/ffi/out-of-tree \
-Hexamples/c/ \
-DCMAKE_PREFIX_PATH=$( pwd )/target/ffi/install \
-DCMAKE_BUILD_TYPE="Release"
- cmake --build target/ffi/out-of-tree

iox2_freebsd_setup_template: &IOX2_FREEBSD_SETUP
setup_script:
- uname -a
Expand Down Expand Up @@ -206,6 +238,7 @@ ubuntu_22_04_aarch64_stable_debug_task:
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
<<: *IOX2_FFI_COMMON_DEBUG

ubuntu_22_04_aarch64_beta_debug_task:
depends_on: ubuntu_22_04_aarch64_stable_debug
Expand All @@ -223,6 +256,7 @@ ubuntu_22_04_aarch64_stable_release_task:
<<: *IOX2_CONTAINER_UBUNTU_22_04_AARCH64
set_toolchain_script: rustup default stable
<<: *IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
<<: *IOX2_FFI_COMMON_RELEASE

#
# Arch Linux x86
Expand All @@ -237,6 +271,7 @@ arch_linux_x64_stable_debug_task:
set_toolchain_script: rustup default stable
<<: *IOX2_CARGO_FMT_AND_CLIPPY
<<: *IOX2_COMMON_BUILD_AND_TEST_DEBUG
<<: *IOX2_FFI_COMMON_DEBUG

arch_linux_x64_beta_debug_task:
depends_on: arch_linux_x64_stable_debug
Expand All @@ -254,6 +289,7 @@ arch_linux_x64_stable_release_task:
<<: *IOX2_CONTAINER_ARCH_LINUX_X64
set_toolchain_script: rustup default stable
<<: *IOX2_COMMON_BUILD_AND_TEST_NO_DOC_TESTS_RELEASE
<<: *IOX2_FFI_COMMON_RELEASE

#
# Windows Server 2019 x86
Expand Down
75 changes: 65 additions & 10 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ jobs:
mode:
- name: "release"
arg: "--release"
cmake_build_type: "Release"
- name: "debug"
arg: ""
cmake_build_type: "Debug"
timeout-minutes: 60
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -125,29 +127,51 @@ jobs:
artifact-bin-name: cargo-nextest
artifact-upload-name: ${{ runner.os }}-cargo-nextest

- name: Prepare system
run: ${{ matrix.os == 'windows-latest' && 'internal\scripts\ci_prepare_windows.bat' || ( matrix.os == 'ubuntu-latest' && './internal/scripts/ci_prepare_ubuntu.sh' || 'uname -a' ) }}
- if: ${{ matrix.os == 'windows-latest' }}
name: Prepare Windows
run: internal\scripts\ci_prepare_windows.bat
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Prepare Linux
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 --no-fail-fast ${{ matrix.mode.arg }} --target i686-unknown-linux-gnu

- name: Build language bindings
run: |
cmake -B target/ffi/build -H. -DCMAKE_INSTALL_PREFIX=target/ffi/install -DEXAMPLES=ON -DCMAKE_BUILD_TYPE=${{ matrix.mode.cmake_build_type }} -DRUST_TARGET_TRIPLET="i686-unknown-linux-gnu" -DCMAKE_C_FLAGS="-m32"
cmake --build target/ffi/build
cmake --install target/ffi/build
- name: Build language binding examples in out-of-tree configuration
if: false # out-of-tree cross-compilation is currently not supported
run: |
rm -rf target/ffi/build
cmake -B target/ffi/out-of-tree -Hexamples/c/ -DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install -DCMAKE_BUILD_TYPE=${{ matrix.mode.cmake_build_type }} -DCMAKE_C_FLAGS="-m32"
cmake --build target/ffi/out-of-tree
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]
toolchain: [stable, 1.75.0]
mode:
toolchain: [stable, stable-gnu, 1.75.0]
mode:
- name: "release"
arg: "--release"
cmake_build_type: "Release"
- name: "debug"
arg: ""
cmake_build_type: "Debug"
timeout-minutes: 60
runs-on: ${{ matrix.os }}
if: ${{ matrix.os == 'windows-latest' }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
Expand All @@ -164,8 +188,14 @@ jobs:
artifact-bin-name: cargo-nextest
artifact-upload-name: ${{ runner.os }}-cargo-nextest

- name: Prepare system
run: ${{ matrix.os == 'windows-latest' && 'internal\scripts\ci_prepare_windows.bat' || ( matrix.os == 'ubuntu-latest' && './internal/scripts/ci_prepare_ubuntu.sh' || 'uname -a' ) }}
- if: ${{ matrix.os == 'windows-latest' }}
name: Prepare Windows
run: internal\scripts\ci_prepare_windows.bat
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Prepare Linux
run: |
internal/scripts/ci_prepare_ubuntu.sh
uname -a
- name: Run cargo build
run: cargo build --workspace --all-targets ${{ matrix.mode.arg }}
Expand All @@ -175,13 +205,14 @@ jobs:

- name: Build language bindings
run: |
cmake -B target/ffi/build -DCMAKE_INSTALL_PREFIX=target/ffi/install -DEXAMPLES=ON .
cmake -B target/ffi/build -H. -DCMAKE_INSTALL_PREFIX=target/ffi/install -DEXAMPLES=ON -DCMAKE_BUILD_TYPE=${{ matrix.mode.cmake_build_type }}
cmake --build target/ffi/build
cmake --install target/ffi/build
- name: Build language binding examples in out-of-tree configuration
run: |
cmake -B target/ffi/out-of-tree -Hexamples/c/ -DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install
rm -rf target/ffi/build
cmake -B target/ffi/out-of-tree -Hexamples/c/ -DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install -DCMAKE_BUILD_TYPE=${{ matrix.mode.cmake_build_type }}
cmake --build target/ffi/out-of-tree
x86_64_unstable:
Expand Down Expand Up @@ -215,8 +246,14 @@ jobs:
artifact-bin-name: cargo-nextest
artifact-upload-name: ${{ runner.os }}-cargo-nextest

- name: Prepare system
run: ${{ matrix.os == 'windows-latest' && 'internal\scripts\ci_prepare_windows.bat' || ( matrix.os == 'ubuntu-latest' && './internal/scripts/ci_prepare_ubuntu.sh' || 'uname -a' ) }}
- if: ${{ matrix.os == 'windows-latest' }}
name: Prepare Windows
run: internal\scripts\ci_prepare_windows.bat
- if: ${{ matrix.os == 'ubuntu-latest' }}
name: Prepare Linux
run: |
internal/scripts/ci_prepare_ubuntu.sh
uname -a
- name: Run cargo build
run: cargo build --workspace --all-targets ${{ matrix.mode.arg }}
Expand Down Expand Up @@ -275,8 +312,26 @@ jobs:
export RUSTFLAGS="-C debug-assertions"
cargo fmt --all -- --check
cargo clippy -- -D warnings
echo "###################"
echo "# Run cargo build #"
echo "###################"
cargo build --workspace --all-targets ${{ matrix.mode }}
echo "######################"
echo "# Run cargo nextest #"
echo "#####################"
cargo nextest run --workspace --no-fail-fast ${{ matrix.mode }}
echo "###########################"
echo "# Build language bindings #"
echo "###########################"
cmake -B target/ffi/build -H. -DCMAKE_INSTALL_PREFIX=target/ffi/install -DEXAMPLES=ON
cmake --build target/ffi/build
cmake --install target/ffi/build
echo "################################################################"
echo "# Build language binding examples in out-of-tree configuration #"
echo "################################################################"
rm -rf target/ffi/build
cmake -B target/ffi/out-of-tree -Hexamples/c/ -DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install
cmake --build target/ffi/out-of-tree
grcov:
needs: [preflight-check, static-code-analysis]
Expand Down
2 changes: 2 additions & 0 deletions examples/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

# elfenpiff is stupid

cmake_minimum_required(VERSION 3.28)
project(examples_c LANGUAGES C)

Expand Down
2 changes: 2 additions & 0 deletions internal/docker/archlinux-base-devel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ENV PATH="/root/.cargo/bin:$PATH"
RUN echo "#### Installing dependencies" \
&& pacman -Syu --noconfirm \
clang \
cmake \
gcc \
git \
&& pacman -Scc --noconfirm \
&& echo "#### Install minimal Rust toolchain" \
Expand Down
3 changes: 3 additions & 0 deletions internal/docker/ubuntu-22.04
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ ENV PATH="/root/.cargo/bin:$PATH"
RUN echo "#### Installing dependencies" \
&& apt update && apt install -y \
clang \
cmake \
curl \
gcc \
g++ \
git \
libacl1-dev \
&& rm -rf /var/lib/apt/lists/* \
Expand Down
2 changes: 1 addition & 1 deletion internal/scripts/ci_prepare_archlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#!/bin/bash

pacman -Syu --noconfirm clang git rustup
pacman -Syu --noconfirm clang cmake gcc git rustup
pacman -Scc --noconfirm
rustup toolchain add beta nightly stable 1.75.0
rustup component add clippy llvm-tools-preview rustfmt
Expand Down
2 changes: 1 addition & 1 deletion internal/scripts/ci_prepare_freebsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
export ASSUME_ALWAYS_YES=yes

pkg update
pkg install -y curl git llvm
pkg install -y cmake curl gcc g++ git llvm
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --no-modify-path
export PATH=$PATH:$HOME/.cargo/bin
rustup toolchain add beta nightly 1.75.0 stable
Expand Down
2 changes: 1 addition & 1 deletion internal/scripts/ci_prepare_ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#!/bin/bash

sudo apt-get update
sudo apt-get install -y clang curl git libacl1-dev build-essential flex libelf-dev binutils-dev libdwarf-dev libc6-dev libc6-dev-i386 gcc-multilib-i686-linux-gnu libc6-dev-i386-cross
sudo apt-get install -y clang cmake curl gcc g++ git libacl1-dev build-essential flex libelf-dev binutils-dev libdwarf-dev libc6-dev libc6-dev-i386 gcc-multilib-i686-linux-gnu libc6-dev-i386-cross
sudo useradd testuser1
sudo useradd testuser2
sudo groupadd testgroup1
Expand Down

0 comments on commit 2de2757

Please sign in to comment.