2021-02-21 05:57:38 -07:00
name : Build
on : [ push, pull_request]
2022-12-04 10:06:06 -07:00
concurrency :
2022-12-28 14:06:46 -07:00
group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
2022-12-04 10:06:06 -07:00
cancel-in-progress : true
2021-02-21 05:57:38 -07:00
jobs :
2021-03-03 11:05:47 -07:00
Build :
name : ${{ matrix.platform.name }}
runs-on : ${{ matrix.platform.os }}
2021-09-20 06:22:20 -06:00
defaults :
run :
shell : ${{ matrix.platform.shell }}
2021-03-03 11:05:47 -07:00
strategy :
2021-11-08 19:14:08 -07:00
fail-fast : false
2021-03-03 11:05:47 -07:00
matrix :
platform :
2023-03-21 13:38:57 -06:00
- { name: Windows (mingw32), os: windows-latest, shell : 'msys2 {0}' , msystem: mingw32, msys-env: mingw-w64-i686, artifact : 'SDL-mingw32' }
- { name: Windows (mingw64), os: windows-latest, shell : 'msys2 {0}' , msystem: mingw64, msys-env: mingw-w64-x86_64, artifact : 'SDL-mingw64' }
- { name: Windows (clang32), os: windows-latest, shell : 'msys2 {0}' , msystem: clang32, msys-env: mingw-w64-clang-i686, artifact : 'SDL-msys2-clang32' }
- { name: Windows (clang64), os: windows-latest, shell : 'msys2 {0}' , msystem: clang64, msys-env: mingw-w64-clang-x86_64, artifact : 'SDL-msys2-clang64' }
- { name: Windows (ucrt64), os: windows-latest, shell : 'msys2 {0}' , msystem: ucrt64, msys-env: mingw-w64-ucrt-x86_64, artifact : 'SDL-msys2-ucrt64' }
- { name: Ubuntu 20.04, os: ubuntu-20.04, shell: sh, artifact : 'SDL-ubuntu20.04' }
2023-11-09 09:37:36 -07:00
- { name: Intel oneAPI (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-oneapi', intel : true ,
source_cmd : 'source /opt/intel/oneapi/setvars.sh; export CC=icx; export CXX=icx;' }
- { name: Intel Compiler (Ubuntu 20.04), os: ubuntu-20.04, shell: bash, artifact: 'SDL-ubuntu20.04-icc', intel: true, cmake : '-DSDL_CLANG_TIDY=OFF' ,
source_cmd : 'source /opt/intel/oneapi/setvars.sh; export CC=icc; export CXX=icpc; export CFLAGS=-diag-disable=10441; export CXXFLAGS=-diag-disable=10441; ' }
2023-03-21 13:38:57 -06:00
- { name: Ubuntu 22.04, os: ubuntu-22.04, shell: sh, artifact : 'SDL-ubuntu22.04' }
2023-07-31 19:35:57 -06:00
- { name: MacOS (Framework), os: macos-latest, shell: sh, cmake : '-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DSDL_FRAMEWORK=ON -DSDL_CLANG_TIDY=OFF' , skip_test_pkgconfig: true, artifact: 'SDL-macos-framework', no-static : true }
2023-03-21 13:38:57 -06:00
- { name: MacOS (GNU prefix), os: macos-latest, shell: sh, cmake : '-DCMAKE_OSX_ARCHITECTURES="x86_64" -DCLANG_TIDY_BINARY="$(brew --prefix llvm)/bin/clang-tidy"' , artifact : 'SDL-macos-gnu' }
2021-09-20 06:22:20 -06:00
2021-03-03 11:05:47 -07:00
steps :
2021-09-20 06:22:20 -06: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 14:08:07 -06:00
${{ matrix.platform.msys-env }}-cc
2021-09-20 06:22:20 -06:00
${{ matrix.platform.msys-env }}-cmake
${{ matrix.platform.msys-env }}-ninja
2023-09-28 15:32:35 -06:00
${{ matrix.platform.msys-env }}-perl
2021-09-20 06:22:20 -06:00
${{ matrix.platform.msys-env }}-pkg-config
2022-10-25 21:26:42 -06:00
${{ matrix.platform.msys-env }}-clang-tools-extra
2021-09-20 06:22:20 -06:00
2021-03-03 11:05:47 -07:00
- name : Setup Linux dependencies
if : runner.os == 'Linux'
run : |
sudo apt-get update
2022-11-24 21:01:49 -07:00
sudo apt-get install build-essential git \
2022-07-30 12:41:48 -06:00
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
2023-08-14 07:48:14 -06:00
libaudio-dev libjack-dev libsndio-dev libusb-1.0-0-dev libx11-dev libxext-dev \
2022-07-30 12:41:48 -06:00
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 11:24:20 -06:00
- name : Setup Macos dependencies
if : runner.os == 'macOS'
run : |
brew install \
2022-10-25 21:26:42 -06:00
ninja \
2023-02-16 12:56:51 -07:00
pkg-config \
2022-10-25 21:26:42 -06:00
llvm
2023-03-21 13:38:57 -06:00
- name : Setup Intel oneAPI
if : matrix.platform.intel
run : |
2023-11-09 09:37:36 -07:00
# Download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# Add signed entry to apt sources and configure the APT client to use Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Update package list
2023-03-21 13:38:57 -06:00
sudo apt-get update -y
2023-11-09 09:37:36 -07:00
2023-03-21 13:38:57 -06:00
# Install oneAPI
sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
2022-10-12 16:51:59 -06:00
- uses : actions/checkout@v3
2022-05-04 09:43:59 -06:00
- name : Check that versioning is consistent
2022-05-04 12:31:11 -06:00
# We only need to run this once: arbitrarily use the Linux/CMake build
2022-11-24 07:50:00 -07:00
if : "runner.os == 'Linux'"
2022-09-28 07:37:21 -06:00
run : ./build-scripts/test-versioning.sh
2022-06-03 11:24:20 -06:00
- name : Configure (CMake)
run : |
2023-03-21 13:38:57 -06:00
${{ matrix.platform.source_cmd }}
2022-06-03 11:24:20 -06:00
cmake -S . -B build -G Ninja \
2023-01-23 21:30:24 -07:00
-Wdeprecated -Wdev -Werror \
2023-02-16 12:15:59 -07:00
-DSDL_SHARED=ON \
-DSDL_STATIC=ON \
2023-01-20 17:08:32 -07:00
-DSDL_TESTS=ON \
-DSDL_WERROR=ON \
-DSDL_INSTALL_TESTS=ON \
-DSDL_VENDOR_INFO="Github Workflow" \
2022-10-25 21:26:42 -06:00
-DSDL_CLANG_TIDY=ON \
2023-01-20 17:08:32 -07:00
-DCMAKE_INSTALL_PREFIX=cmake_prefix \
-DCMAKE_BUILD_TYPE=Release \
${{ matrix.platform.cmake }}
2022-06-03 11:24:20 -06:00
- name : Build (CMake)
2023-08-27 08:25:55 -06:00
id : build
2022-06-03 11:24:20 -06:00
run : |
2023-03-21 13:38:57 -06:00
${{ matrix.platform.source_cmd }}
2022-06-03 11:24:20 -06:00
cmake --build build/ --config Release --verbose --parallel
- name : Run build-time tests (CMake)
2022-05-04 06:57:30 -06:00
run : |
2023-03-21 13:38:57 -06:00
${{ matrix.platform.source_cmd }}
2023-07-14 07:00:52 -06:00
set -eu
2022-05-04 06:57:30 -06:00
export SDL_TESTS_QUICK=1
2023-09-07 19:24:47 -06:00
ctest -VV --test-dir build/ -j2
2022-10-21 05:19:59 -06:00
if test "${{ runner.os }}" = "Linux"; then
# This should show us the SDL_REVISION
2022-11-23 09:33:38 -07:00
strings build/libSDL3.so.0 | grep SDL-
2022-10-21 05:19:59 -06:00
fi
2022-06-03 11:24:20 -06:00
- name : Install (CMake)
2022-05-03 13:22:48 -06:00
run : |
2023-03-21 13:38:57 -06:00
${{ matrix.platform.source_cmd }}
2023-07-14 07:00:52 -06:00
set -eu
2022-06-03 11:24:20 -06:00
cmake --install build/ --config Release
2022-11-23 11:18:26 -07:00
( cd cmake_prefix; find . ) | LC_ALL=C sort -u
2023-01-28 22:12:40 -07:00
- name : Package (CPack)
2023-08-27 08:25:55 -06:00
if : ${{ always() && steps.build.outcome == 'success' }}
2023-01-28 22:12:40 -07:00
run : |
cmake --build build/ --config Release --target package
2022-06-03 11:24:20 -06:00
- name : Verify CMake configuration files
run : |
2023-03-21 13:38:57 -06:00
${{ matrix.platform.source_cmd }}
2022-06-03 11:24:20 -06:00
cmake -S cmake/test -B cmake_config_build -G Ninja \
2023-01-20 17:08:32 -07:00
-DTEST_SHARED=ON \
2023-07-31 19:35:57 -06:00
-DTEST_STATIC=${{ !matrix.platform.no-static }} \
2022-06-03 11:24:20 -06:00
-DCMAKE_BUILD_TYPE=Release \
2023-01-20 17:08:32 -07:00
-DCMAKE_PREFIX_PATH=$(echo "${{ github.workspace }}/cmake_prefix" | sed -e 's#\\#/#g')
2022-06-03 11:24:20 -06:00
cmake --build cmake_config_build --verbose
2022-11-21 22:36:19 -07:00
- name : Verify sdl3.pc
2023-01-20 17:08:32 -07:00
if : ${{ !matrix.platform.skip_test_pkgconfig }}
2022-06-16 08:38:58 -06:00
run : |
2023-03-21 13:38:57 -06:00
${{ matrix.platform.source_cmd }}
2023-01-20 17:08:32 -07:00
export PKG_CONFIG_PATH=$(echo "${{ github.workspace }}/cmake_prefix/lib/pkgconfig" | sed -e 's#\\#/#g')
2022-06-16 08:38:58 -06:00
cmake/test/test_pkgconfig.sh
2023-01-20 17:13:58 -07:00
- uses : actions/upload-artifact@v3
2023-08-27 08:25:55 -06:00
if : ${{ always() && steps.build.outcome == 'success' }}
2023-01-20 17:13:58 -07:00
with :
2023-01-28 22:12:40 -07:00
if-no-files-found : error
2023-01-20 17:13:58 -07:00
name : ${{ matrix.platform.artifact }}
2023-01-28 22:12:40 -07:00
path : build/dist/SDL3*