From 10d2a9b3ac9d0a9aba97c318566a72a0cac329a5 Mon Sep 17 00:00:00 2001 From: Paul Scott Date: Tue, 18 Apr 2023 09:37:01 +1000 Subject: [PATCH 1/2] Make CI more flexible, fixed string comparator, javafx doc --- .gitlab-ci.yml | 12 +++++++----- .idea/libraries/javafx.xml | 10 +++++++++- .../ass2/stringcomparator/StringComparator.java | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 53ae54a..462ee5f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,8 +9,10 @@ stages: before_script: - export PATH_TO_FX=/usr/share/openjfx/lib - export JAVAFX_OPTIONS="--module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml,javafx.media" - - export CP=src:/ass2/*:/shared/junit-platform-console-standalone-1.7.0.jar:$PATH_TO_FX/* - - export JUNIT="java $JAVAFX_OPTIONS -jar /shared/junit-platform-console-standalone-1.7.0.jar --class-path src:/ass2/comp1110-ass2.jar --disable-banner" + - export CP=src:src-dev:/ass2/*:/shared/junit-platform-console-standalone-1.7.0.jar:$PATH_TO_FX/* + - export JUNIT="java $JAVAFX_OPTIONS -jar /shared/junit-platform-console-standalone-1.7.0.jar --class-path src:src-dev:/ass2/comp1110-ass2.jar --disable-banner" + - export SRC_FILES=$(find src/ -type f -name '*.java') + - export SRC_DEV_FILES=$(if [ -d "src-dev/" ]; then find src-dev/ -type f -name '*.java'; fi) checksum: tags: @@ -38,11 +40,11 @@ build: - comp1110 stage: build script: - - javac -encoding utf-8 $JAVAFX_OPTIONS -cp $CP src/comp1110/ass2/*.java src/comp1110/ass2/*/*.java + - javac -encoding utf-8 $JAVAFX_OPTIONS -cp $CP $SRC_FILES $SRC_DEV_FILES artifacts: paths: - - src/comp1110/ass2/*.class - - src/comp1110/ass2/*/*.class + - src/ + - src-dev/ task3: tags: diff --git a/.idea/libraries/javafx.xml b/.idea/libraries/javafx.xml index db49101..b6558e5 100644 --- a/.idea/libraries/javafx.xml +++ b/.idea/libraries/javafx.xml @@ -7,7 +7,15 @@ - + + + + + + + + + \ No newline at end of file diff --git a/tests/comp1110/ass2/stringcomparator/StringComparator.java b/tests/comp1110/ass2/stringcomparator/StringComparator.java index 099a3c0..0df08bf 100644 --- a/tests/comp1110/ass2/stringcomparator/StringComparator.java +++ b/tests/comp1110/ass2/stringcomparator/StringComparator.java @@ -133,14 +133,14 @@ public class StringComparator { private void checkGeneralString(List statementsA, List statementsB, List errors) { // Check for the number of statements - if (checks.get(ResultType.General).contains("num_statements") && + if (checks.get(ResultType.General).contains("numStatements") && statementsA.size() != statementsB.size()) { errors.add("Strings contain different numbers of statements"); } // Check if there are any unrecognised statement IDs - if (checks.get(ResultType.General).contains("unrecognised_statements")) + if (checks.get(ResultType.General).contains("unrecognisedStatements")) { List unrecognised = statementsB .stream() From defab0924581cdefd8d0188d234d92e27c019f90 Mon Sep 17 00:00:00 2001 From: Paul Scott Date: Tue, 18 Apr 2023 16:26:31 +1000 Subject: [PATCH 2/2] Added junit xml reporting for CI --- .gitlab-ci.yml | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 462ee5f..c24d420 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,7 +10,7 @@ before_script: - export PATH_TO_FX=/usr/share/openjfx/lib - export JAVAFX_OPTIONS="--module-path $PATH_TO_FX --add-modules javafx.controls,javafx.fxml,javafx.media" - export CP=src:src-dev:/ass2/*:/shared/junit-platform-console-standalone-1.7.0.jar:$PATH_TO_FX/* - - export JUNIT="java $JAVAFX_OPTIONS -jar /shared/junit-platform-console-standalone-1.7.0.jar --class-path src:src-dev:/ass2/comp1110-ass2.jar --disable-banner" + - export JUNIT="java $JAVAFX_OPTIONS -jar /shared/junit-platform-console-standalone-1.7.0.jar --class-path src:src-dev:/ass2/comp1110-ass2.jar --disable-banner --reports-dir=junit-reports" - export SRC_FILES=$(find src/ -type f -name '*.java') - export SRC_DEV_FILES=$(if [ -d "src-dev/" ]; then find src-dev/ -type f -name '*.java'; fi) @@ -53,6 +53,9 @@ task3: script: - $JUNIT -c=comp1110.ass2.IsStateStringWellFormedTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task4: tags: @@ -61,6 +64,9 @@ task4: script: - $JUNIT -c=comp1110.ass2.IsMoveStringWellFormedTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task6: tags: @@ -69,6 +75,9 @@ task6: script: - $JUNIT -c=comp1110.ass2.DistributeResourcesTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task7: tags: @@ -77,6 +86,9 @@ task7: script: - $JUNIT -c=comp1110.ass2.IsMoveValidTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task8: tags: @@ -85,6 +97,9 @@ task8: script: - $JUNIT -c=comp1110.ass2.GenerateAllValidMovesTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task9: tags: @@ -93,6 +108,9 @@ task9: script: - $JUNIT -c=comp1110.ass2.IsPhaseOverTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task10: tags: @@ -101,6 +119,9 @@ task10: script: - $JUNIT -c=comp1110.ass2.PlacePieceTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task11: tags: @@ -109,6 +130,9 @@ task11: script: - $JUNIT -c=comp1110.ass2.CalculateIslandLinksScoreTest -c=comp1110.ass2.CalculateIslandMajoritiesScoreTest -c=comp1110.ass2.CalculateResourcesAndStatuettesScoreTest -c=comp1110.ass2.CalculateTotalIslandsScoreTest -c=comp1110.ass2.CalculateScoresTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task12: tags: @@ -117,6 +141,9 @@ task12: script: - $JUNIT -c=comp1110.ass2.EndPhaseTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task13: tags: @@ -125,6 +152,9 @@ task13: script: - $JUNIT -c=comp1110.ass2.ApplyMoveTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task16: tags: @@ -133,6 +163,9 @@ task16: script: - $JUNIT -c=comp1110.ass2.GenerateAIMoveTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml task17: tags: @@ -141,6 +174,9 @@ task17: script: - $JUNIT -c=comp1110.ass2.VariableBoardSizeTest -c=comp1110.ass2.ThreeFourPlayerTest -c=comp1110.ass2.VariableSizeThreeFourPlayerTest allow_failure: true + artifacts: + reports: + junit: junit-reports/TEST-junit-jupiter.xml ## Local Variables: ## mode: yaml