From 930d0120f3b2d3f69a58a4c9afa3d7fbf61d17ef Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sun, 4 Feb 2024 00:43:25 -0500 Subject: [PATCH] More CI Improvements --- .gitea/workflows/build.yml | 6 ++++-- .gitignore | 2 ++ .../build-example-mods.sh => example-mods/build.sh | 11 +++++++---- scripts/test.sh | 13 ++++++++----- 4 files changed, 21 insertions(+), 11 deletions(-) rename scripts/build-example-mods.sh => example-mods/build.sh (69%) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index f863d5cfd..223b8dda6 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -85,12 +85,14 @@ jobs: ./out/client/host/usr/bin/minecraft-pi-reborn-client --copy-sdk # Build Example Mods - name: Build Example Mods - run: ./scripts/build-example-mods.sh + run: | + cd example-mods + ./build.sh - name: Upload Artifacts uses: actions/upload-artifact@v3 with: name: Example Mods - path: ./out/example-mods/* + path: ./example-mods/out/* if-no-files-found: error # Create Release release: diff --git a/.gitignore b/.gitignore index 05aa6e2c5..d241a275b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ /*.AppImage /core* /qemu_* +/example-mods/out +/.testing-tmp diff --git a/scripts/build-example-mods.sh b/example-mods/build.sh similarity index 69% rename from scripts/build-example-mods.sh rename to example-mods/build.sh index 8bd6e96d4..2fc61e649 100755 --- a/scripts/build-example-mods.sh +++ b/example-mods/build.sh @@ -4,13 +4,13 @@ set -e # Create Output Directory ROOT="$(pwd)" -OUT="${ROOT}/out/example-mods" +OUT="${ROOT}/out" rm -rf "${OUT}" mkdir -p "${OUT}" # Build -for MOD in example-mods/*/; do - cd "${ROOT}/${MOD}" +build() { + cd "${ROOT}/$1" # Build rm -rf build mkdir build @@ -19,4 +19,7 @@ for MOD in example-mods/*/; do cmake --build . # Copy Result cp lib*.so "${OUT}" -done +} +build chat-commands +build expanded-creative +build recipes diff --git a/scripts/test.sh b/scripts/test.sh index bb01250c0..8f208fa5c 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -13,18 +13,21 @@ ARCH='host' export PATH="$(pwd)/out/${MODE}/${ARCH}/usr/bin:${PATH}" # Make Test Directory -rm -rf build/test -mkdir -p build/test +TEST_WORKING_DIR="$(pwd)/.testing-tmp" +rm -rf "${TEST_WORKING_DIR}" +mkdir -p "${TEST_WORKING_DIR}" # Run if [ "${MODE}" = "server" ]; then # Server Test - cd build/test + cd "${TEST_WORKING_DIR}" minecraft-pi-reborn-server --only-generate - cd ../../ else # Client Test export _MCPI_SKIP_ROOT_CHECK=1 - export HOME="$(pwd)/build/test" + export HOME="${TEST_WORKING_DIR}" minecraft-pi-reborn-client --default --no-cache --benchmark fi + +# Clean Up +rm -rf "${TEST_WORKING_DIR}"