From dce326dfe094a5bc9749d4c003a2e0324424f145 Mon Sep 17 00:00:00 2001 From: Roberto Scolaro Date: Fri, 27 Oct 2023 15:21:19 +0200 Subject: [PATCH] wip Signed-off-by: Roberto Scolaro --- .github/workflows/reusable_build_dev.yaml | 41 +++++++++++++++++------ CMakeLists.txt | 2 +- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/.github/workflows/reusable_build_dev.yaml b/.github/workflows/reusable_build_dev.yaml index 1414c13eb3f..d08f2e11cbe 100644 --- a/.github/workflows/reusable_build_dev.yaml +++ b/.github/workflows/reusable_build_dev.yaml @@ -14,7 +14,7 @@ on: description: "Optional input to set a list of operating systems which the workflow uses. Defaults to ['ubuntu-22.04', 'windows-latest', 'macos-latest'] if not set" required: false type: string - default: "['ubuntu-latest', 'windows-latest', 'macos-latest']" + default: "['ubuntu-22.04', 'windows-latest', 'macos-latest']" minimal: description: Minimal build required: true @@ -36,12 +36,12 @@ on: jobs: build-and-test: # See https://github.com/actions/runner/issues/409#issuecomment-1158849936 - runs-on: ${{ (inputs.arch == 'aarch64' && fromJSON('[ "self-hosted", "linux", "ARM64" ]')) || '${{matrix.operating-systems}}' }} + runs-on: ${{ (inputs.arch == 'aarch64' && fromJSON('[ "self-hosted", "linux", "ARM64" ]')) || matrix.os }} container: ${{ (inputs.arch == 'aarch64' && 'ubuntu:22.04') || '' }} strategy: fail-fast: false matrix: - operating-systems: ${{fromJson(inputs.operating-systems)}} + os: ${{fromJson(inputs.operating-systems)}} outputs: cmdout: ${{ steps.run_cmd.outputs.out }} steps: @@ -52,18 +52,19 @@ jobs: ref: ${{ inputs.git_ref }} - name: Update base image - if: matrix.operating-systems == 'ubuntu:22.04' + if: matrix.os == 'ubuntu-22.04' run: sudo apt update -y - name: Install build dependencies - if: matrix.operating-systems == 'ubuntu:22.04' + if: matrix.os == 'ubuntu-22.04' run: sudo DEBIAN_FRONTEND=noninteractive apt install libjq-dev libelf-dev libyaml-cpp-dev cmake build-essential git -y - name: Install build dependencies (non-minimal) - if: inputs.minimal != true && matrix.operating-systems == 'ubuntu:22.04' + if: inputs.minimal != true && matrix.os == 'ubuntu-22.04' run: sudo DEBIAN_FRONTEND=noninteractive apt install libssl-dev libyaml-dev libc-ares-dev libprotobuf-dev protobuf-compiler libgrpc++-dev protobuf-compiler-grpc rpm libcurl4-openssl-dev linux-headers-$(uname -r) clang llvm -y - - name: Prepare project + - name: Prepare project (linux) + if: matrix.os == 'ubuntu-22.04' run: | mkdir build pushd build @@ -75,22 +76,42 @@ jobs: -DMINIMAL_BUILD=${{ inputs.minimal == true && 'ON' || 'OFF' }} \ .. popd + + - name: Prepare project (windows/macos) + if: matrix.os != 'ubuntu-22.04' + run: | + mkdir build + cd build + cmake -DBUILD_FALCO_UNIT_TESTS=On -DMINIMAL_BUILD=ON -DUSE_BUNDLED_DEPS=ON .. + cd .. - - name: Build + - name: Build (linux) + if: matrix.os == 'ubuntu-22.04' run: | pushd build KERNELDIR=/lib/modules/$(uname -r)/build make -j4 all popd + - name: Build (windows/macos) + if: matrix.os != 'ubuntu-22.04' + run: | + cmake --build build --config Release + - name: Run unit tests + if: matrix.os != 'windows-latest' run: | pushd build - sudo ./unit_tests/falco_unit_tests + sudo ./unit_tests/falco_unit_tests popd + - name: Run unit tests (windows) + if: matrix.os == 'windows-latest' + run: | + build/unit_tests/falco_unit_tests.exe + - name: Run command id: run_cmd - if: inputs.cmd != '' + if: inputs.cmd != '' && matrix.os != 'windows-latest' run: | OUT=$(${{ inputs.cmd }}) echo "out=${OUT}" >> $GITHUB_OUTPUT diff --git a/CMakeLists.txt b/CMakeLists.txt index bd68c697583..a13602713c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ else() endif() message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") -if(MINIMAL_BUILD) +if(MINIMAL_BUILD OR WIN32 OR APPLE) set(MINIMAL_BUILD_FLAGS "-DMINIMAL_BUILD") endif()