diff --git a/.github/workflows/build-check-sdk.yaml b/.github/workflows/build-check-sdk.yaml new file mode 100644 index 0000000..aed27d4 --- /dev/null +++ b/.github/workflows/build-check-sdk.yaml @@ -0,0 +1,14 @@ +name: "Build check gemstone in SDK" +run-name: SDK build check to ${{ inputs.deploy_target }} by @${{ github.actor }} +on: [push, pull_request] +env: + SDK: 0.1.0-alma-9.3 +jobs: + build-check-sdk: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup SDK + run: docker pull servostar/gemstone:sdk-"$SDK" && docker build --tag gemstone:devkit-"$SDK" . + - name: Compile + run: docker run gemstone:devkit-"$SDK" make check diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a4a211..31b5c87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,3 +102,28 @@ target_compile_options(debug PUBLIC ${FLAGS} -g) # add src directory as include path target_include_directories(debug PUBLIC src) + +# ------------------------------------------------ # +# Target Code Check # +# ------------------------------------------------ # + +# Same as debug but will fail on warnings +# use as check + +add_executable(check + ${SOURCE_FILES} + ${LEX_GENERATED_SOURCE_FILE} + ${YACC_GENERATED_SOURCE_FILE}) + +set_target_properties(check + PROPERTIES + OUTPUT_NAME "gsc" + RUNTIME_OUTPUT_DIRECTORY "bin/check") + +# compiler flags targeting a GCC debug environment +# extra -Werror flag to treat warnings as error to make github action fail on warning +target_compile_options(check PUBLIC ${FLAGS} -g -Werror) + +# add src directory as include path +target_include_directories(check PUBLIC src) + diff --git a/src/lex/lexer.l b/src/lex/lexer.l index a17888b..c17fce5 100644 --- a/src/lex/lexer.l +++ b/src/lex/lexer.l @@ -6,6 +6,11 @@ int yylex(); %} +/* disable the following functions */ +/* to avoid failing code check */ +%option nounput +%option noinput + %% .; -%% \ No newline at end of file +%%