From 136c74744bd1fcf047f8610832d3661bcc5c13f6 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 18:52:31 +0200 Subject: [PATCH 1/7] added build-check-sdk workflow --- .github/workflows/build-check-sdk.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/build-check-sdk.yaml diff --git a/.github/workflows/build-check-sdk.yaml b/.github/workflows/build-check-sdk.yaml new file mode 100644 index 0000000..2e03ce5 --- /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: + test-rust: + 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 -B release \ No newline at end of file From 0be5099c771558af4bd8bc3dc9dc7db643c6eaf9 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 18:54:20 +0200 Subject: [PATCH 2/7] fixed wrong job name --- .github/workflows/build-check-sdk.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-check-sdk.yaml b/.github/workflows/build-check-sdk.yaml index 2e03ce5..e20d49a 100644 --- a/.github/workflows/build-check-sdk.yaml +++ b/.github/workflows/build-check-sdk.yaml @@ -4,7 +4,7 @@ on: [push, pull_request] env: SDK: 0.1.0-alma-9.3 jobs: - test-rust: + build-check-sdk: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 0079de6faf389c3b91233f6012e2ab2f73e5af43 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 18:59:35 +0200 Subject: [PATCH 3/7] added compilation error for testing action --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 6b48e00..fd4abac 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ #include int main() { - yyparse(); + yypa rse(); return 0; } \ No newline at end of file From 98c69026baa241abd8cc1512e87e86b6e7f1dc65 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 22:51:56 +0200 Subject: [PATCH 4/7] fix intentional typo in main.c --- src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index fd4abac..dbd3b80 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,6 @@ #include int main() { - yypa rse(); + yyparse(); return 0; -} \ No newline at end of file +} From b0ecb5d4598237a424ab634efeec076a0424db69 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 22:52:32 +0200 Subject: [PATCH 5/7] disable generation of unput() and input() in lexer to avoid code check fail --- src/lex/lexer.l | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lex/lexer.l b/src/lex/lexer.l index a17888b..d491001 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 +%% From 376837d37c09f133e4360b0fb0dbafbed24f3027 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 22:55:03 +0200 Subject: [PATCH 6/7] fixed comment typ in lexer --- src/lex/lexer.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lex/lexer.l b/src/lex/lexer.l index d491001..c17fce5 100644 --- a/src/lex/lexer.l +++ b/src/lex/lexer.l @@ -6,8 +6,8 @@ int yylex(); %} -// disable the following functions -// to avoid failing code check +/* disable the following functions */ +/* to avoid failing code check */ %option nounput %option noinput From 81d0c6b48e145054391db7409e32ae0ae6813544 Mon Sep 17 00:00:00 2001 From: servostar Date: Fri, 12 Apr 2024 23:06:10 +0200 Subject: [PATCH 7/7] added target for code checking in CMakeLists.txt new target "check" uses same options as debug but will fail on warnings --- .github/workflows/build-check-sdk.yaml | 2 +- CMakeLists.txt | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-check-sdk.yaml b/.github/workflows/build-check-sdk.yaml index e20d49a..aed27d4 100644 --- a/.github/workflows/build-check-sdk.yaml +++ b/.github/workflows/build-check-sdk.yaml @@ -11,4 +11,4 @@ jobs: - 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 -B release \ No newline at end of file + 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) +