From b0f6b66d4e7e2211929210f95089dfb47f5d23be Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Tue, 2 Mar 2021 11:32:56 +0100 Subject: [BUILD] Add build support for Github actions --- .github/workflows/build.yml | 65 +++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 2 +- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..7c61fb3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build dnbd3 + +on: + push: + branches: + - master + pull_request: + release: + +jobs: + build: + strategy: + fail-fast: false + matrix: + config: + - name: debug [default] on Ubuntu 20.04 + build-os: ubuntu-20.04 + build-type: "Debug" + build-cfg-server-fuse: "OFF" + build-cfg-harden: "OFF" + - name: debug [server with fuse support] on Ubuntu 20.04 + build-os: ubuntu-20.04 + build-type: "Debug" + build-cfg-server-fuse: "ON" + build-cfg-harden: "OFF" + - name: release [default] on Ubuntu 20.04 + build-os: ubuntu-20.04 + build-type: "Release" + build-cfg-server-fuse: "OFF" + build-cfg-harden: "OFF" + - name: release [server with fuse support] on Ubuntu 20.04 + build-os: ubuntu-20.04 + build-type: "Release" + build-cfg-server-fuse: "ON" + build-cfg-harden: "OFF" + - name: release [default hardening] on Ubuntu 20.04 + build-os: ubuntu-20.04 + build-type: "Release" + build-cfg-server-fuse: "OFF" + build-cfg-harden: "ON" + name: Build dnbd3 ${{ matrix.config.name }} + runs-on: ${{ matrix.config.build-os }} + steps: + - name: Install dnbd3 dependencies + run: | + sudo apt-get update -y -qq + sudo apt-get install -y -qq make \ + linux-headers-generic \ + libfuse-dev \ + libjansson-dev \ + rpm + - name: Checkout dnbd3 repository + uses: actions/checkout@v2 + - name: Fetch dnbd3 repository tags + run: git fetch --prune --unshallow + - name: Configure dnbd3 build + run: | + cmake -B ${{ github.workspace }}/build \ + -S ${{ github.workspace }} \ + -D CMAKE_BUILD_TYPE=${{ matrix.config.build-type }} \ + -D DNBD3_SERVER_FUSE=${{ matrix.config.build-cfg-server-fuse }} \ + -D DNBD3_RELEASE_HARDEN=${{ matrix.config.build-cfg-harden }} + - name: Build dnbd3 artifacts + working-directory: ${{ github.workspace }}/build + run: make diff --git a/CMakeLists.txt b/CMakeLists.txt index 65b9ebb..7c104a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,7 +89,7 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG") if(DNBD3_RELEASE_HARDEN AND CMAKE_BUILD_TYPE MATCHES "Release") # harden builds with specific C flags - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_FORTIFY_SOURCE=2 -fstack-protector-all -fstack-clash-protection -mfunction-return=thunk -mindirect-branch=thunk") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_FORTIFY_SOURCE=2 -fstack-protector-all -fstack-clash-protection") # set specific hardened linker flags set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro,-z,now,-z,defs -pie") # print status message of configuration -- cgit v1.2.3-55-g7522