main.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. name: Build
  2. on: [push, pull_request]
  3. jobs:
  4. Build:
  5. name: ${{ matrix.platform.name }}
  6. runs-on: ${{ matrix.platform.os }}
  7. defaults:
  8. run:
  9. shell: ${{ matrix.platform.shell }}
  10. strategy:
  11. fail-fast: false
  12. matrix:
  13. platform:
  14. - { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
  15. - { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
  16. - { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
  17. - { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
  18. - { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
  19. - { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh }
  20. - { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh }
  21. - { name: MacOS, os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
  22. steps:
  23. - name: Set up MSYS2
  24. if: matrix.platform.shell == 'msys2 {0}'
  25. uses: msys2/setup-msys2@v2
  26. with:
  27. msystem: ${{ matrix.platform.msystem }}
  28. install: >-
  29. ${{ matrix.platform.msys-env }}-cc
  30. ${{ matrix.platform.msys-env }}-cmake
  31. ${{ matrix.platform.msys-env }}-ninja
  32. ${{ matrix.platform.msys-env }}-pkg-config
  33. - name: Setup Linux dependencies
  34. if: runner.os == 'Linux'
  35. run: |
  36. sudo apt-get update
  37. sudo apt-get install build-essential git \
  38. pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
  39. libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
  40. libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
  41. libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
  42. libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
  43. - name: Setup extra Ubuntu 22.04 dependencies
  44. if: matrix.platform.os == 'ubuntu-22.04'
  45. run: |
  46. sudo apt-get install libpipewire-0.3-dev libdecor-0-dev
  47. - name: Setup Macos dependencies
  48. if: runner.os == 'macOS'
  49. run: |
  50. brew install \
  51. ninja
  52. - uses: actions/checkout@v3
  53. - name: Check that versioning is consistent
  54. # We only need to run this once: arbitrarily use the Linux/CMake build
  55. if: "runner.os == 'Linux'"
  56. run: ./build-scripts/test-versioning.sh
  57. - name: Configure (CMake)
  58. run: |
  59. cmake -S . -B build -G Ninja \
  60. -DSDL_TESTS=ON \
  61. -DSDL_WERROR=ON \
  62. -DSDL_INSTALL_TESTS=ON \
  63. -DSDL_VENDOR_INFO="Github Workflow" \
  64. -DCMAKE_INSTALL_PREFIX=cmake_prefix \
  65. -DCMAKE_BUILD_TYPE=Release \
  66. ${{ matrix.platform.cmake }}
  67. - name: Build (CMake)
  68. run: |
  69. cmake --build build/ --config Release --verbose --parallel
  70. - name: Run build-time tests (CMake)
  71. run: |
  72. set -eu
  73. export SDL_TESTS_QUICK=1
  74. ctest -VV --test-dir build/
  75. if test "${{ runner.os }}" = "Linux"; then
  76. # This should show us the SDL_REVISION
  77. strings build/libSDL3.so.0 | grep SDL-
  78. fi
  79. - name: Install (CMake)
  80. run: |
  81. set -eu
  82. cmake --install build/ --config Release
  83. echo "SDL3_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
  84. ( cd cmake_prefix; find . ) | LC_ALL=C sort -u
  85. - name: Verify CMake configuration files
  86. run: |
  87. cmake -S cmake/test -B cmake_config_build -G Ninja \
  88. -DCMAKE_BUILD_TYPE=Release \
  89. -DCMAKE_PREFIX_PATH=${{ env.SDL3_DIR }}
  90. cmake --build cmake_config_build --verbose
  91. - name: Verify sdl3.pc
  92. run: |
  93. export PKG_CONFIG_PATH=${{ env.SDL3_DIR }}/lib/pkgconfig
  94. cmake/test/test_pkgconfig.sh