From 15eb8a73e89838decbf917df102093bd6ecee3a3 Mon Sep 17 00:00:00 2001 From: chanhou Date: Sun, 18 Jun 2023 20:40:41 +0800 Subject: [PATCH 1/4] Add simple maven build --- .github/workflows/maven.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/maven.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 0000000..d03a39c --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,29 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Maven + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'zulu' + cache: maven + - name: Build with Maven + run: mvn -B package --file pom.xml From 65025124c66ac88fc5a76b956539c627547d808a Mon Sep 17 00:00:00 2001 From: chanhou Date: Sun, 18 Jun 2023 20:53:45 +0800 Subject: [PATCH 2/4] Fix path pom.xml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index d03a39c..a0413cf 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,4 +26,4 @@ jobs: distribution: 'zulu' cache: maven - name: Build with Maven - run: mvn -B package --file pom.xml + run: mvn -B package --file LegendsOfTheThreeKingdoms/pom.xml From 847aefa949bba9e0f10fe5cc81b2587915177edc Mon Sep 17 00:00:00 2001 From: chanhou Date: Sun, 18 Jun 2023 21:05:27 +0800 Subject: [PATCH 3/4] Move folder content to root --- .github/workflows/maven.yml | 2 +- .gitignore | 3 +- .../.mvn => .mvn}/wrapper/maven-wrapper.jar | Bin .../wrapper/maven-wrapper.properties | 0 LegendsOfTheThreeKingdoms/.gitignore | 33 ------------------ .../create_game.json => create_game.json | 0 .../get_generals.json => get_generals.json | 0 LegendsOfTheThreeKingdoms/mvnw => mvnw | 0 .../mvnw.cmd => mvnw.cmd | 0 LegendsOfTheThreeKingdoms/pom.xml => pom.xml | 0 .../LegendsOfTheThreeKingdomsApplication.java | 0 .../controller/GameController.java | 0 .../controller/HelloWorldController.java | 0 .../controller/dto/GameDto.java | 0 .../controller/dto/GeneralCardDto.java | 0 .../controller/dto/PlayerDto.java | 0 .../domain/Game.java | 0 .../domain/GeneralCard.java | 0 .../domain/GeneralCardDeck.java | 0 .../domain/Player.java | 0 .../domain/RoleCard.java | 0 .../repository/InMemoryGameRepository.java | 0 .../utils/GameRoleAssignment.java | 0 .../main/resources/application.properties | 0 .../controller/HelloWorldTest.java | 0 .../controller/TestGameBuilder.java | 0 26 files changed, 3 insertions(+), 35 deletions(-) rename {LegendsOfTheThreeKingdoms/.mvn => .mvn}/wrapper/maven-wrapper.jar (100%) rename {LegendsOfTheThreeKingdoms/.mvn => .mvn}/wrapper/maven-wrapper.properties (100%) delete mode 100644 LegendsOfTheThreeKingdoms/.gitignore rename LegendsOfTheThreeKingdoms/create_game.json => create_game.json (100%) rename LegendsOfTheThreeKingdoms/get_generals.json => get_generals.json (100%) rename LegendsOfTheThreeKingdoms/mvnw => mvnw (100%) rename LegendsOfTheThreeKingdoms/mvnw.cmd => mvnw.cmd (100%) rename LegendsOfTheThreeKingdoms/pom.xml => pom.xml (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/LegendsOfTheThreeKingdomsApplication.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/GameController.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldController.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GameDto.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GeneralCardDto.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/PlayerDto.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Game.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCard.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCardDeck.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Player.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/RoleCard.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/repository/InMemoryGameRepository.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/java/com/waterball/LegendsOfTheThreeKingdoms/utils/GameRoleAssignment.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/main/resources/application.properties (100%) rename {LegendsOfTheThreeKingdoms/src => src}/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java (100%) rename {LegendsOfTheThreeKingdoms/src => src}/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/TestGameBuilder.java (100%) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a0413cf..d03a39c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,4 +26,4 @@ jobs: distribution: 'zulu' cache: maven - name: Build with Maven - run: mvn -B package --file LegendsOfTheThreeKingdoms/pom.xml + run: mvn -B package --file pom.xml diff --git a/.gitignore b/.gitignore index 2109de6..4c70b70 100644 --- a/.gitignore +++ b/.gitignore @@ -115,7 +115,8 @@ buildNumber.properties .LSOverride # Icon must end with two \r -Icon +Icon + # Thumbnails ._* diff --git a/LegendsOfTheThreeKingdoms/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar similarity index 100% rename from LegendsOfTheThreeKingdoms/.mvn/wrapper/maven-wrapper.jar rename to .mvn/wrapper/maven-wrapper.jar diff --git a/LegendsOfTheThreeKingdoms/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties similarity index 100% rename from LegendsOfTheThreeKingdoms/.mvn/wrapper/maven-wrapper.properties rename to .mvn/wrapper/maven-wrapper.properties diff --git a/LegendsOfTheThreeKingdoms/.gitignore b/LegendsOfTheThreeKingdoms/.gitignore deleted file mode 100644 index 549e00a..0000000 --- a/LegendsOfTheThreeKingdoms/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -HELP.md -target/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/LegendsOfTheThreeKingdoms/create_game.json b/create_game.json similarity index 100% rename from LegendsOfTheThreeKingdoms/create_game.json rename to create_game.json diff --git a/LegendsOfTheThreeKingdoms/get_generals.json b/get_generals.json similarity index 100% rename from LegendsOfTheThreeKingdoms/get_generals.json rename to get_generals.json diff --git a/LegendsOfTheThreeKingdoms/mvnw b/mvnw similarity index 100% rename from LegendsOfTheThreeKingdoms/mvnw rename to mvnw diff --git a/LegendsOfTheThreeKingdoms/mvnw.cmd b/mvnw.cmd similarity index 100% rename from LegendsOfTheThreeKingdoms/mvnw.cmd rename to mvnw.cmd diff --git a/LegendsOfTheThreeKingdoms/pom.xml b/pom.xml similarity index 100% rename from LegendsOfTheThreeKingdoms/pom.xml rename to pom.xml diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/LegendsOfTheThreeKingdomsApplication.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/LegendsOfTheThreeKingdomsApplication.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/LegendsOfTheThreeKingdomsApplication.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/LegendsOfTheThreeKingdomsApplication.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/GameController.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/GameController.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/GameController.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/GameController.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldController.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldController.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldController.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldController.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GameDto.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GameDto.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GameDto.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GameDto.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GeneralCardDto.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GeneralCardDto.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GeneralCardDto.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/GeneralCardDto.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/PlayerDto.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/PlayerDto.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/PlayerDto.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/controller/dto/PlayerDto.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Game.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Game.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Game.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Game.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCard.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCard.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCard.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCard.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCardDeck.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCardDeck.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCardDeck.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/GeneralCardDeck.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Player.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Player.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Player.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/Player.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/RoleCard.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/RoleCard.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/RoleCard.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/domain/RoleCard.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/repository/InMemoryGameRepository.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/repository/InMemoryGameRepository.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/repository/InMemoryGameRepository.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/repository/InMemoryGameRepository.java diff --git a/LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/utils/GameRoleAssignment.java b/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/utils/GameRoleAssignment.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/java/com/waterball/LegendsOfTheThreeKingdoms/utils/GameRoleAssignment.java rename to src/main/java/com/waterball/LegendsOfTheThreeKingdoms/utils/GameRoleAssignment.java diff --git a/LegendsOfTheThreeKingdoms/src/main/resources/application.properties b/src/main/resources/application.properties similarity index 100% rename from LegendsOfTheThreeKingdoms/src/main/resources/application.properties rename to src/main/resources/application.properties diff --git a/LegendsOfTheThreeKingdoms/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java b/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java rename to src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java diff --git a/LegendsOfTheThreeKingdoms/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/TestGameBuilder.java b/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/TestGameBuilder.java similarity index 100% rename from LegendsOfTheThreeKingdoms/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/TestGameBuilder.java rename to src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/TestGameBuilder.java From 640dd2b635dab706be87d5d3f372c0886010232b Mon Sep 17 00:00:00 2001 From: chanhou Date: Mon, 19 Jun 2023 23:39:51 +0800 Subject: [PATCH 4/4] Use wrong test to check if it will fail --- .../LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java b/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java index 5991bb0..6ffa9d5 100644 --- a/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java +++ b/src/test/java/com/waterball/LegendsOfTheThreeKingdoms/controller/HelloWorldTest.java @@ -129,7 +129,7 @@ public void shouldChooseGeneralByMonarch() throws Exception { TestGameBuilder.newGame() .players(4) .withPlayerRoles("Monarch", "Minister", "Rebel", "Traitor") - .withPlayerGeneral("a") + .withPlayerGeneral("b") .build()); //產生遊戲