Skip to content

Commit

Permalink
[eclipse-iceoryx#264] Move FreeBSD CI build steps to script
Browse files Browse the repository at this point in the history
  • Loading branch information
elBoberido committed Jul 4, 2024
1 parent 39511c1 commit 41dcd94
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 31 deletions.
33 changes: 2 additions & 31 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ jobs:
matrix:
freebsd_version: [ "14.0" ]
toolchain: [ "stable", "1.75.0" ] # [stable, 1.75.0, beta, nightly]
mode: [""] # ["--release", ""]
mode: ["debug"] # ["release", "debug"]
steps:
- uses: actions/checkout@v4
- uses: vmactions/freebsd-vm@v1
Expand All @@ -355,36 +355,7 @@ jobs:
copyback: false
run: |
./internal/scripts/ci_prepare_freebsd.sh
export PATH=$PATH:$HOME/.cargo/bin
export LIBCLANG_PATH=/usr/local/llvm15/lib/
rustup default ${{ matrix.toolchain }}
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 -S . -B target/ffi/build -DCMAKE_INSTALL_PREFIX=target/ffi/install -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON
cmake --build target/ffi/build
cmake --install target/ffi/build
echo "#############################"
echo "# Run language binding tests #"
echo "#############################"
target/ffi/build/tests/iceoryx2-c-tests
echo "################################################################"
echo "# Build language binding examples in out-of-tree configuration #"
echo "################################################################"
rm -rf target/ffi/build
cmake -S examples/c -B target/ffi/out-of-tree -DCMAKE_PREFIX_PATH=${{ github.workspace }}/target/ffi/install -DCMAKE_BUILD_TYPE=Release
cmake --build target/ffi/out-of-tree
./internal/scripts/ci_build_and_test_freebsd.sh --toolchain ${{ matrix.toolchain }} --mode ${{ matrix.mode }}
grcov:
needs: [preflight-check, static-code-analysis]
Expand Down
92 changes: 92 additions & 0 deletions internal/scripts/ci_build_and_test_freebsd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache Software License 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0, or the MIT license
# which is available at https://opensource.org/licenses/MIT.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT

#!/bin/sh

set -e

RUST_TOOLCHAIN="stable"
RUST_BUILD_TYPE_FLAG=""
CMAKE_BUILD_TYPE_FLAG="-DCMAKE_BUILD_TYPE=Debug"

while (( "$#" )); do
case "$1" in
--mode)
if [[ "$2" == "release" ]]; then
RUST_BUILD_TYPE_FLAG="--release"
CMAKE_BUILD_TYPE_FLAG="-DCMAKE_BUILD_TYPE=Release"
fi
shift 2
;;
--toolchain)
RUST_TOOLCHAIN="$2"
shift 2
;;
"help")
echo "Build script for the 32-64 bit mixed mode PoC."
echo ""
echo "Options:"
echo " --mode Specify the build type. Either 'release' or 'debug'"
echo " --mode Specify the rust toolchain, e.g. 'stable' or 'beta'"
echo "Args:"
echo " help Print this help"
echo ""
exit 0
;;
*)
echo "Invalid argument '$1'. Try 'help' for options."
exit 1
;;
esac
done


export PATH=$PATH:$HOME/.cargo/bin
export LIBCLANG_PATH=/usr/local/llvm15/lib/
rustup default $RUST_TOOLCHAIN
export RUSTFLAGS="-C debug-assertions"
cargo fmt --all -- --check
cargo clippy -- -D warnings

echo "###################"
echo "# Run cargo build #"
echo "###################"

cargo build --workspace --all-targets $RUST_BUILD_TYPE_FLAG

echo "######################"
echo "# Run cargo nextest #"
echo "#####################"

cargo nextest run --workspace --no-fail-fast $RUST_BUILD_TYPE_FLAG

echo "###########################"
echo "# Build language bindings #"
echo "###########################"

cmake -S . -B target/ffi/build -DCMAKE_INSTALL_PREFIX=target/ffi/install $CMAKE_BUILD_TYPE_FLAG -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON
cmake --build target/ffi/build
cmake --install target/ffi/build

echo "#############################"
echo "# Run language binding tests #"
echo "#############################"

target/ffi/build/tests/iceoryx2-c-tests

echo "################################################################"
echo "# Build language binding examples in out-of-tree configuration #"
echo "################################################################"

rm -rf target/ffi/build
cmake -S examples/c -B target/ffi/out-of-tree -DCMAKE_PREFIX_PATH=$( pwd )/target/ffi/install $CMAKE_BUILD_TYPE_FLAG
cmake --build target/ffi/out-of-tree

0 comments on commit 41dcd94

Please sign in to comment.