main.yml 4.1 KB

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