Skip to content

Commit

Permalink
-Werror param support for CI building
Browse files Browse the repository at this point in the history
  • Loading branch information
qdrvm-ci committed Jul 28, 2024
1 parent fa28047 commit 20159b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/zombie-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@ on:
- Release
- Debug
- RelWithDebInfo
werror:
description: 'Enable -Werror'
required: true
default: 'OFF'
type: 'choice'
options:
- ON
- OFF

env:
DOCKER_REGISTRY_PATH: ${{ secrets.GCP_REGISTRY }}/${{ secrets.GCP_PROJECT }}/kagome-dev/
BUILD_DIR: build
CTEST_OUTPUT_ON_FAILURE: 1
CI: true

CACHE_VERSION: v01
CACHE_PATH: ./build/cache
Expand Down Expand Up @@ -85,7 +94,8 @@ jobs:
DOCKER_REGISTRY_PATH=${DOCKER_REGISTRY_PATH} \
GITHUB_HUNTER_USERNAME=${{ secrets.HUNTER_USERNAME }} \
GITHUB_HUNTER_TOKEN=${{ secrets.HUNTER_TOKEN }} \
BUILD_TYPE=${{ github.event.inputs.build_type }}
BUILD_TYPE=${{ github.event.inputs.build_type }} \
WERROR=${{ github.event.inputs.werror }}

- name: "Push Kagome APT Package"
if: env.package_exist == 'False'
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ option(EMBEDDINGS "Embed developers assets" ON)
option(PROFILING "Enable internal profiling instruments" OFF)
option(BACKWARD "Enable stacktrace logging instruments" ON)
option(CLEAR_OBJS "Clear object files" OFF)
option(WERROR "Turn all warnings into errors" OFF)

if (NOT ($ENV{CI}) OR NOT ($ENV{GITHUB_ACTIONS}))
set(_EXTERNAL_PROJECT_DEFAULT ON)
Expand Down Expand Up @@ -119,6 +120,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(AppleClang|Clang|GNU)$")
add_flag(-Wsign-compare)
add_flag(-Wtype-limits) # size_t - size_t >= 0 -> always true

if(WERROR)
add_flag(-Werror) # turn all warnings into errors
endif()

# disable those flags
add_flag(-Wno-unused-command-line-argument) # clang: warning: argument unused during compilation: '--coverage' [-Wunused-command-line-argument]
add_flag(-Wno-unused-parameter) # prints too many useless warnings
Expand Down
3 changes: 2 additions & 1 deletion housekeeping/docker/kagome-dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ DEPENDENCIES ?= libstdc++6, zlib1g, libgcc-s1, libc6, libtinfo6, libseccomp2, li
GITHUB_HUNTER_USERNAME ?=
GITHUB_HUNTER_TOKEN ?=
CTEST_OUTPUT_ON_FAILURE ?= 1
WERROR ?= OFF

# kagome_runtime_cache Variables
KAGOME_PACKAGE_VERSION ?=
Expand Down Expand Up @@ -94,7 +95,7 @@ kagome_dev_docker_build:
source /venv/bin/activate && \
git submodule update --init && \
echo \"Building in $$(pwd)\" && \
cmake . -B\"$(BUILD_DIR)\" -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=\"$(BUILD_TYPE)\" -DBACKWARD=OFF && \
cmake . -B\"$(BUILD_DIR)\" -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=\"$(BUILD_TYPE)\" -DBACKWARD=OFF -DWERROR=$(WERROR) && \
cmake --build \"$(BUILD_DIR)\" --target kagome -- -j${BUILD_THREADS} && \
mkdir -p /tmp/kagome && \
cp /opt/kagome/$(BUILD_DIR)/node/kagome /tmp/kagome/kagome && \
Expand Down

0 comments on commit 20159b1

Please sign in to comment.