From 5f8c7000813507cffa48c0535cca69396eddf8b6 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Tue, 26 Dec 2023 17:29:45 -0500 Subject: [PATCH] Fix CI --- .gitea/workflows/build.yml | 11 +++++- scripts/test.sh | 71 +++++++++++++++++--------------------- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index b94bc8983..72e00234e 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -47,6 +47,12 @@ jobs: path: ./out/*.AppImage* # Test Project test: + strategy: + fail-fast: false + matrix: + mode: + - Client + - Server name: Test runs-on: ubuntu-latest container: node:16-buster @@ -63,9 +69,12 @@ jobs: apt-get install --no-install-recommends -y -t buster-backports cmake - name: Install Dependencies run: ./scripts/install-dependencies.sh + - name: Install ARM Toolchain + if: ${{ matrix.mode == 'Client' }} + run: apt-get install --no-install-recommends -y g++-arm-linux-gnueabihf gcc-arm-linux-gnueabihf # Test - name: Test - run: ./scripts/test.sh + run: ./scripts/test.sh ${{ matrix.mode }} # Create Release release: if: startsWith(github.ref, 'refs/tags/') diff --git a/scripts/test.sh b/scripts/test.sh index 6b873a27f..009388f5e 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -2,50 +2,41 @@ set -e -## Server Test - -# Build Test +# Variables +MODE="$(echo "$1" | tr '[:upper:]' '[:lower:]')" ARCH="$(dpkg-architecture -qDEB_BUILD_ARCH)" -./scripts/setup.sh server "${ARCH}" -./scripts/build.sh server "${ARCH}" -# Add minecraft-pi-reborn-server To PATH -export PATH="$(pwd)/out/server-$(dpkg-architecture -qDEB_BUILD_ARCH)/usr/bin:${PATH}" +# Build +./scripts/setup.sh "${MODE}" "${ARCH}" -DMCPI_HEADLESS_MODE=ON +./scripts/build.sh "${MODE}" "${ARCH}" -# Create Test Directory +# Add To PATH +export PATH="$(pwd)/out/${MODE}-${ARCH}/usr/bin:${PATH}" + +# Make Test Directory rm -rf build/test mkdir -p build/test -# Run Test -cd build/test -minecraft-pi-reborn-server --only-generate -cd ../../ +# Run +if [ "${MODE}" = "server" ]; then + # Server Test + cd build/test + minecraft-pi-reborn-server --only-generate + cd ../../ +else + # Client Test + export _MCPI_SKIP_ROOT_CHECK=1 + export HOME="$(pwd)/build/test" + minecraft-pi-reborn-client --default --no-cache --benchmark -## Client Test - -# Build Benchmark -./scripts/setup.sh client "${ARCH}" -DMCPI_HEADLESS_MODE=ON -./scripts/build.sh client "${ARCH}" - -# Add minecraft-pi-reborn-client To PATH -export PATH="$(pwd)/out/client-$(dpkg-architecture -qDEB_BUILD_ARCH)/usr/bin:${PATH}" - -# Skip Root Check -export _MCPI_SKIP_ROOT_CHECK=1 - -# Run Benchmark -export HOME="$(pwd)/build/test" -minecraft-pi-reborn-client --default --no-cache --benchmark - -## Example Mods Test - -# Build -for project in example-mods/*/; do - cd "${project}" - rm -rf build - mkdir build - cd build - cmake -GNinja .. - cmake --build . - cd ../../../ -done + # Build Example Mods + for project in example-mods/*/; do + cd "${project}" + rm -rf build + mkdir build + cd build + cmake -GNinja .. + cmake --build . + cd ../../../ + done +fi