Merge pull request #12 from Servostar/8-add-github-action-for-code-check

8 add GitHub action for code check (#12)
reviewed by @flixm16 @SirTalksalot75
This commit is contained in:
servostar 2024-04-14 13:54:33 +00:00 committed by GitHub
commit 8bd4898440
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 1 deletions

14
.github/workflows/build-check-sdk.yaml vendored Normal file
View File

@ -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

View File

@ -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)

View File

@ -6,6 +6,11 @@
int yylex();
%}
/* disable the following functions */
/* to avoid failing code check */
%option nounput
%option noinput
%%
.;
%%
%%