tests.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: Unit tests
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - '.github/workflows/tests.yml'
  7. - '.github/workflows/cmake.yml'
  8. - 'src/**'
  9. - 'CMakeModules/**'
  10. - CMakeLists.txt
  11. - 'protocols/**'
  12. branches: [main]
  13. pull_request:
  14. paths:
  15. - '.github/workflows/tests.yml'
  16. - '.github/workflows/cmake.yml'
  17. - 'src/**'
  18. - 'CMakeModules/**'
  19. - CMakeLists.txt
  20. - 'protocols/**'
  21. branches: [main]
  22. env:
  23. # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  24. BUILD_TYPE: Release
  25. jobs:
  26. tests:
  27. strategy:
  28. matrix:
  29. os: [ubuntu-24.04]
  30. # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
  31. # You can convert this to a matrix build if you need cross-platform coverage.
  32. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
  33. runs-on: ${{ matrix.os }}
  34. steps:
  35. - uses: actions/checkout@v3
  36. with:
  37. submodules: true
  38. # cache some build information
  39. - name: ccache
  40. uses: hendrikmuhs/ccache-action@v1.2
  41. with:
  42. key: ${{ github.job }}-${{ matrix.os }} # Eg. "some_build-ubuntu-latest"
  43. - name: Install dependencies
  44. if: matrix.os == 'ubuntu-24.04'
  45. run: sudo apt-get update && sudo apt-get -y install libgl-dev libglew-dev freeglut3-dev libsdl2-dev liblz4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libglm-dev libglfw3-dev libmpv-dev mpv libmpv2 libfftw3-dev
  46. - name: Configure CMake
  47. # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
  48. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
  49. run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_TESTING=1
  50. - name: Build
  51. # Build your program with the given configuration
  52. run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
  53. - name: Run tests
  54. # Run the unit tests available
  55. run: ${{github.workspace}}/build/output/tests