From 7a49e22c5aa8f6f0d716437ba617972e1ce3d9d3 Mon Sep 17 00:00:00 2001 From: Jerboa-app Date: Sun, 24 Nov 2024 10:51:42 +0000 Subject: [PATCH] Split workflows and add regressions --- .github/workflows/android.yml | 85 ++++++++++++++++++++++ .github/workflows/linux.yml | 114 +++++++++++++++++++++++++++++ .github/workflows/macos.yml | 87 +++++++++++++++++++++++ .github/workflows/run-tests.yml | 82 --------------------- .github/workflows/windows.yml | 122 ++++++++++++++++++++++++++++++++ 5 files changed, 408 insertions(+), 82 deletions(-) create mode 100644 .github/workflows/android.yml create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml delete mode 100644 .github/workflows/run-tests.yml create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 00000000..9ba2b5b7 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,85 @@ +name: Hop android tests + +on: + pull_request: + workflow_dispatch: + +jobs: + androidBuild: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: pack headers + run: | + mkdir headers + for inc in include/jGL/include/jGL \ + include/jGL/include/*.h \ + include/jGL/include/vendored/freetype/include/* \ + include/jGL/include/vendored/glew/include/GL \ + include/jGL/include/vendored/glfw/include/GLFW \ + include/jGL/include/vendored/glm/glm \ + include/jGL/include/vendored/stduuid/include/uuid.h \ + include/jGL/include/vendored/stduuid/gsl \ + include/jGL/include/vendored/stb_image.h \ + include/jLog \ + include/jThread \ + include/Collision \ + include/Component \ + include/Console \ + include/Debug \ + include/Maths \ + include/Object \ + include/Shader \ + include/System \ + include/Util \ + include/World \ + include/vendored/lua/src/lauxlib.h \ + include/vendored/lua/src/lua.h \ + include/vendored/lua/src/luaconf.h \ + include/vendored/lua/src/lualib.h \ + include/vendored/miniaudio \ + include/vendored/json.hpp \ + include/*.h \ + include/vendored/vorbis/include/vorbis \ + include/vendored/ogg/include/ogg \ + include/vendored/sparsehash; + do cp -r $inc headers; done + + - name: Install dependencies + run: | + sudo apt-get update && sudo apt-get install -y build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools + wget https://dl.google.com/android/repository/android-ndk-r25c-linux.zip + unzip android-ndk-r25c-linux.zip + wget https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip + unzip commandlinetools-linux-9477386_latest.zip + export ANDROID_SDK_ROOT=~/ + mv cmdline-tools latest + mkdir cmdline-tools + mv latest cmdline-tools + yes | ./cmdline-tools/latest/bin/sdkmanager --licenses + ./cmdline-tools/latest/bin/sdkmanager --channel=3 emulator + ./cmdline-tools/latest/bin/sdkmanager --install "system-images;android-34;google_apis;x86_64" + ./cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-34" + echo no | ./cmdline-tools/latest/bin/avdmanager create avd --name android34 --package "system-images;android-34;google_apis;x86_64" + + - name: build hop + run: | + ./build.sh -r --android android-ndk-r25c + + - name: buildArtifact + uses: actions/upload-artifact@v4 + with: + name: androidbuild + path: androidbuild + + - name: build demo + run: | + cp -r headers/ demo/android/perlinWorld/app/src/main/cpp/include/ + cp -r build/*.a demo/android/perlinWorld/app/src/main/cpp/include/ + cd demo/android/perlinWorld + ./gradlew assembleDebug + cd ~/ \ No newline at end of file diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..b0dde9a2 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,114 @@ +name: Hop linux + +on: + pull_request: + workflow_dispatch: + +jobs: + + linuxBuild: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y build-essential xorg-dev mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev libxinerama-dev libxcursor-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools + + - name: pack headers + run: | + mkdir headers + for inc in include/jGL/include/jGL \ + include/jGL/include/*.h \ + include/jGL/include/vendored/freetype/include/* \ + include/jGL/include/vendored/glew/include/GL \ + include/jGL/include/vendored/glfw/include/GLFW \ + include/jGL/include/vendored/glm/glm \ + include/jGL/include/vendored/stduuid/include/uuid.h \ + include/jGL/include/vendored/stduuid/gsl \ + include/jGL/include/vendored/stb_image.h \ + include/jLog \ + include/jThread \ + include/Collision \ + include/Component \ + include/Console \ + include/Debug \ + include/Maths \ + include/Object \ + include/Shader \ + include/System \ + include/Util \ + include/World \ + include/vendored/lua/src/lauxlib.h \ + include/vendored/lua/src/lua.h \ + include/vendored/lua/src/luaconf.h \ + include/vendored/lua/src/lualib.h \ + include/vendored/miniaudio \ + include/vendored/json.hpp \ + include/*.h \ + include/vendored/vorbis/include/vorbis \ + include/vendored/ogg/include/ogg \ + include/vendored/sparsehash; + do cp -r $inc headers; done + + - name: linux-linux + run: ./build.sh -t -d -r + + - name: Tests + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + export DISPLAY=:99 + sudo Xvfb :99 -screen 0 800x600x24 & + sleep 5 + MESA_GL_VERSION_OVERRIDE=3.3 ctest --output-on-failure --verbose + + linuxBuildAndRun: + runs-on: ubuntu-22.04 + + strategy: + matrix: + example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor] + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y build-essential xorg-dev mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev libxinerama-dev libxcursor-dev xvfb x11-apps vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools + + - name: linux-linux + run: | + ./build.sh -t -r -d + + - name: run ${{ matrix.example }} + run: | + cd build/${{ matrix.example }} + chmod +x ${{ matrix.example }} + export DISPLAY=:99 + sudo Xvfb :99 -screen 0 800x600x24 & + sleep 5 + MESA_GL_VERSION_OVERRIDE=3.3 ./${{ matrix.example }} & + export PID=$! + sleep 10 + xwd -root -silent | convert xwd:- png:screenshot.png + sleep 5 && kill $PID + + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.example }}.png + path: build/${{ matrix.example }}/screenshot.png + + - name: regression + run: | + mkdir tests/regression/user/include/ + cp build/*.a tests/regression/user/ + cp -r headers/* tests/regression/user/include/ + cd tests/regression/user + mkdir build && cd build + cmake .. && make \ No newline at end of file diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 00000000..d890108e --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,87 @@ +name: Hop macOS tests + +on: + pull_request: + workflow_dispatch: + +jobs: + macosBuild: + runs-on: macos-13 + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Install dependencies + run: | + wget https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip -O vulkan-sdk.zip + unzip vulkan-sdk.zip + sudo ./InstallVulkan.app/Contents/macOS/InstallVulkan --root ~/vulkan --accept-licenses --default-answer --confirm-command install + ls ~/vulkan + cd ~/vulkan/ + python install_vulkan.py + + - name: pack headers + run: | + mkdir headers + for inc in include/jGL/include/jGL \ + include/jGL/include/*.h \ + include/jGL/include/vendored/freetype/include/* \ + include/jGL/include/vendored/glew/include/GL \ + include/jGL/include/vendored/glfw/include/GLFW \ + include/jGL/include/vendored/glm/glm \ + include/jGL/include/vendored/stduuid/include/uuid.h \ + include/jGL/include/vendored/stduuid/gsl \ + include/jGL/include/vendored/stb_image.h \ + include/jLog \ + include/jThread \ + include/Collision \ + include/Component \ + include/Console \ + include/Debug \ + include/Maths \ + include/Object \ + include/Shader \ + include/System \ + include/Util \ + include/World \ + include/vendored/lua/src/lauxlib.h \ + include/vendored/lua/src/lua.h \ + include/vendored/lua/src/luaconf.h \ + include/vendored/lua/src/lualib.h \ + include/vendored/miniaudio \ + include/vendored/json.hpp \ + include/*.h \ + include/vendored/vorbis/include/vorbis \ + include/vendored/ogg/include/ogg \ + include/vendored/sparsehash; + do cp -r $inc headers; done + + - name: macos build + run: | + git submodule update --recursive + ./build.sh -o -d -r -t + mkdir macosbuild + cp build/libHop.a macosbuild/libHop-macos.a + cp build/libjGL.a macosbuild/libjGL-macos.a + cp LICENSE* macosbuild/ + + mkdir demos + cp -r build/PerlinWorld demos/ + cd demos && zip -r ../demos.zip * && cd .. + + - name: Tests + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: MESA_GL_VERSION_OVERRIDE=3.3 ctest --output-on-failure --verbose --exclude-regex Vulkan --exclude-regex assetStore + + - name: regression + run: | + mkdir tests/regression/user-macos/include/ + cp build/*.a tests/regression/user-macos/ + cp -r headers/* tests/regression/user-macos/include/ + cd tests/regression/user-macos + mkdir build && cd build + cmake .. -DCMAKE_TOOLCHAIN_FILE=../osx.cmake && make diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml deleted file mode 100644 index c5ee85a6..00000000 --- a/.github/workflows/run-tests.yml +++ /dev/null @@ -1,82 +0,0 @@ -name: Hop demos - -on: - pull_request: - workflow_dispatch: - -jobs: - linuxRunTest: - runs-on: ubuntu-22.04 - - strategy: - matrix: - example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor] - - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y build-essential xorg-dev mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev libxinerama-dev libxcursor-dev xvfb x11-apps vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools - - - name: linux-linux - run: | - ./build.sh -r -d - - - name: run ${{ matrix.example }} - run: | - cd build/${{ matrix.example }} - chmod +x ${{ matrix.example }} - export DISPLAY=:99 - sudo Xvfb :99 -screen 0 800x600x24 & - sleep 5 - MESA_GL_VERSION_OVERRIDE=3.3 ./${{ matrix.example }} & - export PID=$! - sleep 10 - xwd -root -silent | convert xwd:- png:screenshot.png - sleep 5 && kill $PID - - - name: upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.example }}.png - path: build/${{ matrix.example }}/screenshot.png - - wineRunTest: - if: ${{ github.event_name == 'workflow_dispatch' }} - runs-on: ubuntu-22.04 - - strategy: - matrix: - example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor] - - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y xorg-dev build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix libxinerama-dev libxcursor-dev xvfb x11-apps vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools wine64 - - name: linux-windows - run: | - ./build.sh -r -w -d - - - name: run ${{ matrix.example }} - run: | - cd build/${{ matrix.example }} - chmod +x ${{ matrix.example }}.exe - export DISPLAY=:99 - sudo Xvfb :99 -screen 0 800x600x24 & - sleep 5 - MESA_GL_VERSION_OVERRIDE=3.3 wine64 ${{ matrix.example }}.exe & - export PID=$! - sleep 10 - xwd -root -silent | convert xwd:- png:screenshot.png - sleep 5 && kill $PID - - - name: upload artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.example }}-wine.png - path: build/${{ matrix.example }}/screenshot.png \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..8d25b93c --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,122 @@ +name: Hop wine tests + +on: + pull_request: + workflow_dispatch: + +jobs: + + wineBuild: + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: pack headers + run: | + mkdir headers + for inc in include/jGL/include/jGL \ + include/jGL/include/*.h \ + include/jGL/include/vendored/freetype/include/* \ + include/jGL/include/vendored/glew/include/GL \ + include/jGL/include/vendored/glfw/include/GLFW \ + include/jGL/include/vendored/glm/glm \ + include/jGL/include/vendored/stduuid/include/uuid.h \ + include/jGL/include/vendored/stduuid/gsl \ + include/jGL/include/vendored/stb_image.h \ + include/jLog \ + include/jThread \ + include/Collision \ + include/Component \ + include/Console \ + include/Debug \ + include/Maths \ + include/Object \ + include/Shader \ + include/System \ + include/Util \ + include/World \ + include/vendored/lua/src/lauxlib.h \ + include/vendored/lua/src/lua.h \ + include/vendored/lua/src/luaconf.h \ + include/vendored/lua/src/lualib.h \ + include/vendored/miniaudio \ + include/vendored/json.hpp \ + include/*.h \ + include/vendored/vorbis/include/vorbis \ + include/vendored/ogg/include/ogg \ + include/vendored/sparsehash; + do cp -r $inc headers; done + + - name: pack headers mingw + run: | + mkdir headers-mingw + cp -r headers/* headers-mingw + mkdir headers-mingw/VulkanSDK + cp -r include/jGL/include/vendored/VulkanSDK/Include headers-mingw/VulkanSDK/ + cp -r include/jGL/include/vendored/VulkanSDK/Windows headers-mingw/VulkanSDK/ + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y xorg-dev build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix libxinerama-dev libxcursor-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools wine64 + + - name: linux-X-windows + run: ./build.sh -w -d -r -t + + - name: Tests (wine64) + working-directory: ${{github.workspace}}/build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + cp *.dll TestAssetStore/ + export DISPLAY=:99 + sudo Xvfb :99 -screen 0 800x600x24 & + sleep 5 + MESA_GL_VERSION_OVERRIDE=3.3 ctest --output-on-failure --verbose --exclude-regex Vulkan + + wineBuildAndRun: + if: ${{ github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-22.04 + + strategy: + matrix: + example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor] + + steps: + - uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Install dependencies + run: sudo apt-get update && sudo apt-get install -y xorg-dev build-essential mesa-common-dev libx11-dev libxrandr-dev libgl1-mesa-dev libglu1-mesa-dev libfreetype6-dev libopenal-dev libsndfile1-dev libudev-dev g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix libxinerama-dev libxcursor-dev xvfb x11-apps vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools wine64 + - name: linux-windows + run: | + ./build.sh -r -w -d + + - name: run ${{ matrix.example }} + run: | + cd build/${{ matrix.example }} + chmod +x ${{ matrix.example }}.exe + export DISPLAY=:99 + sudo Xvfb :99 -screen 0 800x600x24 & + sleep 5 + MESA_GL_VERSION_OVERRIDE=3.3 wine64 ${{ matrix.example }}.exe & + export PID=$! + sleep 10 + xwd -root -silent | convert xwd:- png:screenshot.png + sleep 5 && kill $PID + + - name: upload artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.example }}-wine.png + path: build/${{ matrix.example }}/screenshot.png + + - name: regression + run: | + mkdir tests/regression/user-mingw/include/ + cp build/*.a tests/regression/user-mingw/ + cp -r headers-mingw/* tests/regression/user-mingw/include/ + cd tests/regression/user-mingw + ./build.sh \ No newline at end of file