2021-02-21 12:57:38 +00:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
2021-03-03 18:05:47 +00:00
|
|
|
Build:
|
|
|
|
name: ${{ matrix.platform.name }}
|
|
|
|
runs-on: ${{ matrix.platform.os }}
|
2021-09-20 12:22:20 +00:00
|
|
|
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: ${{ matrix.platform.shell }}
|
|
|
|
|
2021-03-03 18:05:47 +00:00
|
|
|
strategy:
|
2021-11-09 02:14:08 +00:00
|
|
|
fail-fast: false
|
2021-03-03 18:05:47 +00:00
|
|
|
matrix:
|
|
|
|
platform:
|
2022-07-30 20:08:07 +00:00
|
|
|
- { name: Windows (mingw32), os: windows-latest, shell: 'msys2 {0}', msystem: mingw32, msys-env: mingw-w64-i686 }
|
|
|
|
- { name: Windows (mingw64), os: windows-latest, shell: 'msys2 {0}', msystem: mingw64, msys-env: mingw-w64-x86_64 }
|
|
|
|
- { name: Windows (clang32), os: windows-latest, shell: 'msys2 {0}', msystem: clang32, msys-env: mingw-w64-clang-i686 }
|
|
|
|
- { name: Windows (clang64), os: windows-latest, shell: 'msys2 {0}', msystem: clang64, msys-env: mingw-w64-clang-x86_64 }
|
|
|
|
- { name: Windows (ucrt64), os: windows-latest, shell: 'msys2 {0}', msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64 }
|
2022-07-30 18:41:48 +00:00
|
|
|
- { name: Ubuntu 20.04 (CMake), os: ubuntu-20.04, shell: sh }
|
|
|
|
- { name: Ubuntu 20.04 (autotools), os: ubuntu-20.04, shell: sh, autotools: true }
|
|
|
|
- { name: Ubuntu 22.04 (CMake), os: ubuntu-22.04, shell: sh }
|
|
|
|
- { name: Ubuntu 22.04 (autotools), os: ubuntu-22.04, shell: sh, autotools: true }
|
2022-07-26 19:42:01 +00:00
|
|
|
- { name: MacOS (CMake), os: macos-latest, shell: sh, cmake: '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"' }
|
2022-06-15 01:51:46 +00:00
|
|
|
- { name: MacOS (autotools), os: macos-latest, shell: sh, autotools: true }
|
2021-09-20 12:22:20 +00:00
|
|
|
|
2021-03-03 18:05:47 +00:00
|
|
|
steps:
|
2021-09-20 12:22:20 +00:00
|
|
|
- name: Set up MSYS2
|
|
|
|
if: matrix.platform.shell == 'msys2 {0}'
|
|
|
|
uses: msys2/setup-msys2@v2
|
|
|
|
with:
|
|
|
|
msystem: ${{ matrix.platform.msystem }}
|
|
|
|
install: >-
|
2022-07-30 20:08:07 +00:00
|
|
|
${{ matrix.platform.msys-env }}-cc
|
2021-09-20 12:22:20 +00:00
|
|
|
${{ matrix.platform.msys-env }}-cmake
|
|
|
|
${{ matrix.platform.msys-env }}-ninja
|
|
|
|
${{ matrix.platform.msys-env }}-pkg-config
|
|
|
|
|
2021-03-03 18:05:47 +00:00
|
|
|
- name: Setup Linux dependencies
|
|
|
|
if: runner.os == 'Linux'
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2022-07-30 18:41:48 +00:00
|
|
|
sudo apt-get install build-essential git make autoconf automake libtool \
|
|
|
|
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
|
|
|
|
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
|
|
|
|
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
|
|
|
|
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
|
|
|
|
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
|
|
|
|
|
|
|
|
- name: Setup extra Ubuntu 22.04 dependencies
|
|
|
|
if: matrix.platform.os == 'ubuntu-22.04'
|
|
|
|
run: |
|
|
|
|
sudo apt-get install libpipewire-0.3-dev libdecor-0-dev
|
|
|
|
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Setup Macos dependencies
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
|
|
|
brew install \
|
2023-02-16 19:56:51 +00:00
|
|
|
ninja \
|
|
|
|
pkg-config
|
2022-10-12 22:51:59 +00:00
|
|
|
- uses: actions/checkout@v3
|
2022-05-04 15:43:59 +00:00
|
|
|
- name: Check that versioning is consistent
|
2022-05-04 18:31:11 +00:00
|
|
|
# We only need to run this once: arbitrarily use the Linux/CMake build
|
|
|
|
if: "runner.os == 'Linux' && ! matrix.platform.autotools"
|
2022-09-28 13:37:21 +00:00
|
|
|
run: ./build-scripts/test-versioning.sh
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Configure (CMake)
|
2022-05-04 18:31:11 +00:00
|
|
|
if: "! matrix.platform.autotools"
|
2022-06-03 17:24:20 +00:00
|
|
|
run: |
|
|
|
|
cmake -S . -B build -G Ninja \
|
|
|
|
-DSDL_TESTS=ON \
|
2022-10-06 03:27:37 +00:00
|
|
|
-DSDL_WERROR=ON \
|
2022-06-03 17:24:20 +00:00
|
|
|
-DSDL_INSTALL_TESTS=ON \
|
2022-10-20 19:02:21 +00:00
|
|
|
-DSDL_VENDOR_INFO="Github Workflow" \
|
2022-06-03 17:24:20 +00:00
|
|
|
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
|
2022-07-26 19:24:38 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2022-07-26 19:42:01 +00:00
|
|
|
${{ matrix.platform.cmake }}
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Build (CMake)
|
2022-05-04 18:31:11 +00:00
|
|
|
if: "! matrix.platform.autotools"
|
2022-06-03 17:24:20 +00:00
|
|
|
run: |
|
|
|
|
cmake --build build/ --config Release --verbose --parallel
|
|
|
|
- name: Run build-time tests (CMake)
|
2022-05-08 16:08:41 +00:00
|
|
|
if: "! matrix.platform.autotools"
|
2022-05-04 12:57:30 +00:00
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
export SDL_TESTS_QUICK=1
|
|
|
|
ctest -VV --test-dir build/
|
2022-10-21 11:19:59 +00:00
|
|
|
if test "${{ runner.os }}" = "Linux"; then
|
|
|
|
# This should show us the SDL_REVISION
|
|
|
|
strings build/libSDL2-2.0.so.0 | grep SDL-
|
|
|
|
fi
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Install (CMake)
|
|
|
|
if: "! matrix.platform.autotools"
|
2022-05-03 19:22:48 +00:00
|
|
|
run: |
|
|
|
|
set -eu
|
2022-06-03 17:24:20 +00:00
|
|
|
cmake --install build/ --config Release
|
|
|
|
echo "SDL2_DIR=$(pwd)/cmake_prefix" >> $GITHUB_ENV
|
|
|
|
( cd cmake_prefix; find ) | LC_ALL=C sort -u
|
|
|
|
- name: Configure (Autotools)
|
2022-05-04 18:31:11 +00:00
|
|
|
if: matrix.platform.autotools
|
2022-04-12 13:54:24 +00:00
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
rm -fr build-autotools
|
|
|
|
mkdir build-autotools
|
|
|
|
./autogen.sh
|
|
|
|
(
|
2022-06-03 17:24:20 +00:00
|
|
|
cd build-autotools
|
|
|
|
${{ github.workspace }}/configure \
|
2022-10-20 19:02:21 +00:00
|
|
|
--enable-vendor-info="Github Workflow" \
|
2022-10-06 03:27:37 +00:00
|
|
|
--enable-werror \
|
2022-06-03 17:24:20 +00:00
|
|
|
--prefix=${{ github.workspace }}/autotools_prefix \
|
2022-04-12 13:54:24 +00:00
|
|
|
)
|
2022-06-03 17:24:20 +00:00
|
|
|
if test "${{ runner.os }}" != "macOS" ; then
|
|
|
|
curdir="$(pwd)"
|
|
|
|
multiarch="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
|
|
|
|
(
|
|
|
|
mkdir -p build-autotools/test
|
|
|
|
cd build-autotools/test
|
|
|
|
${{ github.workspace }}/test/configure \
|
2022-10-06 03:27:37 +00:00
|
|
|
--enable-werror \
|
2022-06-03 17:24:20 +00:00
|
|
|
--x-includes=/usr/include \
|
|
|
|
--x-libraries="/usr/lib/${multiarch}" \
|
|
|
|
--prefix=${{ github.workspace }}/autotools_prefix \
|
|
|
|
SDL_CFLAGS="-I${curdir}/include" \
|
|
|
|
SDL_LIBS="-L${curdir}/build-autotools/build/.libs -lSDL2" \
|
|
|
|
ac_cv_lib_SDL2_ttf_TTF_Init=no \
|
|
|
|
${NULL+}
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
- name: Build (Autotools)
|
2022-05-04 18:31:11 +00:00
|
|
|
if: matrix.platform.autotools
|
2022-04-12 13:54:24 +00:00
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
parallel="$(getconf _NPROCESSORS_ONLN)"
|
2022-05-04 16:45:26 +00:00
|
|
|
make -j"${parallel}" -C build-autotools V=1
|
2022-06-03 17:24:20 +00:00
|
|
|
if test "${{ runner.os }}" != "macOS" ; then
|
|
|
|
make -j"${parallel}" -C build-autotools/test V=1
|
|
|
|
fi
|
|
|
|
- name: Run build-time tests (Autotools)
|
|
|
|
if: ${{ matrix.platform.autotools && (runner.os != 'macOS') }}
|
2022-05-04 12:57:30 +00:00
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
curdir="$(pwd)"
|
|
|
|
parallel="$(getconf _NPROCESSORS_ONLN)"
|
|
|
|
export SDL_TESTS_QUICK=1
|
|
|
|
make -j"${parallel}" -C build-autotools/test check LD_LIBRARY_PATH="${curdir}/build-autotools/build/.libs"
|
2022-10-21 11:19:59 +00:00
|
|
|
if test "${{ runner.os }}" = "Linux"; then
|
|
|
|
# This should show us the SDL_REVISION
|
|
|
|
strings "${curdir}/build-autotools/build/.libs/libSDL2-2.0.so.0" | grep SDL-
|
|
|
|
fi
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Install (Autotools)
|
2022-05-04 18:31:11 +00:00
|
|
|
if: matrix.platform.autotools
|
2022-05-04 12:57:30 +00:00
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
curdir="$(pwd)"
|
|
|
|
parallel="$(getconf _NPROCESSORS_ONLN)"
|
2022-06-03 17:24:20 +00:00
|
|
|
make -j"${parallel}" -C build-autotools install V=1
|
|
|
|
if test "${{ runner.os }}" != "macOS" ; then
|
|
|
|
make -j"${parallel}" -C build-autotools/test install V=1
|
|
|
|
fi
|
|
|
|
( cd autotools_prefix; find . ) | LC_ALL=C sort -u
|
|
|
|
echo "SDL2_DIR=$(pwd)/autotools_prefix" >> $GITHUB_ENV
|
|
|
|
- name: Verify CMake configuration files
|
|
|
|
run: |
|
|
|
|
cmake -S cmake/test -B cmake_config_build -G Ninja \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_PREFIX_PATH=${{ env.SDL2_DIR }}
|
|
|
|
cmake --build cmake_config_build --verbose
|
2022-06-16 14:38:58 +00:00
|
|
|
- name: Verify sdl2-config
|
|
|
|
run: |
|
|
|
|
export PATH=${{ env.SDL2_DIR }}/bin:$PATH
|
|
|
|
cmake/test/test_sdlconfig.sh
|
|
|
|
- name: Verify sdl2.pc
|
|
|
|
run: |
|
|
|
|
export PKG_CONFIG_PATH=${{ env.SDL2_DIR }}/lib/pkgconfig
|
|
|
|
cmake/test/test_pkgconfig.sh
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Distcheck (Autotools)
|
2022-05-05 16:50:28 +00:00
|
|
|
if: matrix.platform.autotools
|
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
parallel="$(getconf _NPROCESSORS_ONLN)"
|
2022-05-04 16:45:26 +00:00
|
|
|
make -j"${parallel}" -C build-autotools dist V=1
|
2022-05-05 16:50:28 +00:00
|
|
|
# Similar to Automake `make distcheck`: check that the tarball
|
|
|
|
# release is sufficient to do a new build
|
|
|
|
mkdir distcheck
|
|
|
|
tar -C distcheck -zxf build-autotools/SDL2-*.tar.gz
|
|
|
|
( cd distcheck/SDL2-* && ./configure )
|
|
|
|
make -j"${parallel}" -C distcheck/SDL2-*
|
2022-06-03 17:24:20 +00:00
|
|
|
- name: Run installed-tests (Autotools)
|
2022-05-04 16:50:44 +00:00
|
|
|
if: "runner.os == 'Linux' && matrix.platform.autotools"
|
|
|
|
run: |
|
|
|
|
set -eu
|
|
|
|
parallel="$(getconf _NPROCESSORS_ONLN)"
|
|
|
|
sudo make -j"${parallel}" -C build-autotools install
|
|
|
|
sudo make -j"${parallel}" -C build-autotools/test install
|
|
|
|
export SDL_TESTS_QUICK=1
|
|
|
|
# We need to set LD_LIBRARY_PATH because it isn't in the default
|
|
|
|
# linker search path. We don't need to set XDG_DATA_DIRS for
|
|
|
|
# ginsttest-runner, because /usr/local/share *is* in the default
|
|
|
|
# search path for that.
|
|
|
|
env --chdir=/ \
|
|
|
|
LD_LIBRARY_PATH=/usr/local/lib \
|
|
|
|
SDL_AUDIODRIVER=dummy \
|
|
|
|
SDL_VIDEODRIVER=dummy \
|
|
|
|
ginsttest-runner --tap SDL2
|