From 9b2791a336f010f736705b96bcc8bc012e3e4478 Mon Sep 17 00:00:00 2001 From: Jerboa <84378622+Jerboa-app@users.noreply.github.com> Date: Sun, 24 Nov 2024 11:44:21 +0000 Subject: [PATCH] Split workflows and add regressions (#201) * add run windows runs test * one ci file --- .github/workflows/release.yml | 169 +++++++++++++++++++------------- .github/workflows/run-tests.yml | 82 ---------------- 2 files changed, 99 insertions(+), 152 deletions(-) delete mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 971530b4..32a05611 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Hop release +name: Hop CI on: push: @@ -81,7 +81,7 @@ jobs: name: headers-mingw path: headers-mingw - linuxNative: + linux: runs-on: ubuntu-20.04 steps: @@ -89,10 +89,10 @@ jobs: with: submodules: 'recursive' - - name: Install dependencies + - 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: linux-linux + - name: build run: | git submodule update --recursive ./build.sh -t -d -r @@ -105,7 +105,7 @@ jobs: cp -r build/PerlinWorld demos/ cd demos && zip -r ../demos.zip * && cd .. - - name: Tests + - name: unit 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 @@ -127,18 +127,54 @@ jobs: name: demoLinux path: demos.zip - linuxXwindows: + linuxBuildAndRun: runs-on: ubuntu-22.04 + strategy: + matrix: + example: [PerlinWorld, SoftBodyTetris, Sprites, MeshEditor] + steps: - uses: actions/checkout@v4 with: submodules: 'recursive' - - name: Install dependencies + - 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: build + 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 screenshot + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.example }}.png + path: build/${{ matrix.example }}/screenshot.png + + windows: + runs-on: ubuntu-22.04 + + 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 vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools wine64 - - name: linux-X-windows + - name: build run: | git submodule update --recursive ./build.sh -w -d -r -t @@ -154,7 +190,7 @@ jobs: cd demos && zip -r ../demos.zip * && cd .. cp build/*.dll build/TestScriptPack/ - - name: Tests (wine64) + - name: unit 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 @@ -177,7 +213,44 @@ jobs: name: demoWindows path: demos.zip - macosNative: + windowsBuildAndRun: + 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: build + run: | + ./build.sh -r -w -d + - name: run ${{ matrix.example }} + run: | + cd build/${{ matrix.example }} + cp ../*.dll . + 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 screenshots + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.example }}-wine.png + path: build/${{ matrix.example }}/screenshot.png + + macos: runs-on: macos-13 steps: @@ -185,7 +258,7 @@ jobs: with: submodules: 'recursive' - - name: Install dependencies + - name: install dependencies run: | wget https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip -O vulkan-sdk.zip unzip vulkan-sdk.zip @@ -194,7 +267,7 @@ jobs: cd ~/vulkan/ python install_vulkan.py - - name: macos build + - name: build run: | git submodule update --recursive ./build.sh -o -d -r -t @@ -207,7 +280,7 @@ jobs: cp -r build/PerlinWorld demos/ cd demos && zip -r ../demos.zip * && cd .. - - name: Tests + - name: unit 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 @@ -225,51 +298,7 @@ jobs: name: demomacos path: demos.zip - linuxRun: - needs: linuxNative - runs-on: ubuntu-20.04 - - steps: - - name: Install dependencies - run: sudo apt-get update && sudo apt-get install -y xvfb x11-apps imagemagick - - - name: get linux demos - uses: actions/download-artifact@v4 - with: - name: demoLinux - - - name: launch and screenshot - run: | - unzip demos.zip - cd PerlinWorld - chmod +x PerlinWorld - export DISPLAY=:99 - sudo Xvfb :99 -screen 0 800x600x24 & - sleep 5 - MESA_GL_VERSION_OVERRIDE=3.3 ./PerlinWorld & - export PID=$! - sleep 10 - xwd -root -silent | convert xwd:- png:screenshot.png - sleep 5 && kill $PID - MESA_GL_VERSION_OVERRIDE=3.3 ./PerlinWorld map & - export PID=$! - sleep 10 - xwd -root -silent | convert xwd:- png:screenshot-map.png - sleep 5 && kill $PID - - - name: upload artifact - uses: actions/upload-artifact@v4 - with: - name: screenshot - path: PerlinWorld/screenshot.png - - - name: upload artifact - uses: actions/upload-artifact@v4 - with: - name: screenshot-map - path: PerlinWorld/screenshot-map.png - - linuxXandroid: + android: needs: [headers] runs-on: ubuntu-20.04 @@ -278,7 +307,7 @@ jobs: with: submodules: 'recursive' - - name: Install dependencies + - 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 @@ -295,7 +324,7 @@ jobs: ./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 + - name: build run: | git submodule update --recursive ./build.sh -r --android android-ndk-r25c @@ -352,7 +381,7 @@ jobs: # path: screenshot-android.png test-release: - needs: [linuxNative, headers] + needs: [linux, headers] runs-on: ubuntu-22.04 steps: @@ -371,10 +400,10 @@ jobs: with: name: linuxbuild - - name: Install dependencies + - 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 xvfb x11-apps imagemagick - - name: linux lib test + - name: regression run: | ls mv libHop-linux-x86_64.a libHop.a @@ -388,7 +417,7 @@ jobs: cmake .. && make test-release-mingw: - needs: [linuxXwindows, headers] + needs: [windows, headers] runs-on: ubuntu-22.04 steps: @@ -407,10 +436,10 @@ jobs: with: name: windowsbuild - - name: Install dependencies + - 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 libz-mingw-w64-dev libxinerama-dev libxcursor-dev vulkan-tools libvulkan-dev vulkan-validationlayers-dev spirv-tools xvfb x11-apps imagemagick - - name: mingw lib test + - name: regression run: | ls mv libHop-windows.a libHop.a @@ -422,7 +451,7 @@ jobs: ./build.sh test-release-macos: - needs: [macosNative, headers] + needs: [macos, headers] runs-on: macos-13 steps: @@ -441,7 +470,7 @@ jobs: with: name: macosbuild - - name: Install dependencies + - name: install dependencies run: | wget https://sdk.lunarg.com/sdk/download/latest/mac/vulkan-sdk.zip -O vulkan-sdk.zip unzip vulkan-sdk.zip @@ -450,7 +479,7 @@ jobs: cd ~/vulkan/ python install_vulkan.py - - name: macos lib test + - name: regression run: | ls mv libHop-macos.a libHop.a @@ -463,7 +492,7 @@ jobs: cmake .. -DCMAKE_TOOLCHAIN_FILE=../osx.cmake && make release: - needs: [linuxNative, linuxXwindows, linuxXandroid, macosNative, headers] + needs: [linux, windows, android, macos, headers] if: github.ref_type == 'tag' runs-on: ubuntu-20.04 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