2020-11-07 04:09:46 +08:00
name : CI
2023-01-31 06:10:18 +08:00
on : [ push, pull_request, workflow_dispatch]
2020-11-07 04:09:46 +08:00
2023-07-09 10:53:32 +08:00
concurrency :
group : environment-${{github.ref}}
cancel-in-progress : true
2023-03-26 20:21:21 +08:00
env :
2023-04-12 07:37:05 +08:00
DISPLAY : ":99" # Display number to use for the X server
2023-03-26 20:21:21 +08:00
GALLIUM_DRIVER : llvmpipe # Use Mesa 3D software OpenGL renderer
2023-10-02 12:36:34 +08:00
defaults :
run :
shell : bash
2020-11-07 04:09:46 +08:00
jobs :
build :
2022-02-19 01:30:38 +08:00
name : ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}
2020-11-07 04:09:46 +08:00
runs-on : ${{ matrix.platform.os }}
strategy :
2021-02-19 18:04:28 +08:00
fail-fast : false
2020-11-07 04:09:46 +08:00
matrix :
platform :
2023-03-26 20:21:21 +08:00
- { name: Windows VS2019 x86, os: windows-2019, flags : -DSFML_USE_MESA3D=TRUE -A Win32 }
- { name: Windows VS2019 x64, os: windows-2019, flags : -DSFML_USE_MESA3D=TRUE -A x64 }
- { name: Windows VS2022 x86, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -A Win32 }
- { name: Windows VS2022 x64, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -A x64 }
- { name: Windows VS2022 ClangCL, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -T ClangCL }
2023-08-28 06:55:05 +08:00
- { name: Windows VS2022 Clang, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -GNinja }
2023-09-26 23:03:38 +08:00
- { name: Windows MinGW, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -GNinja }
2023-10-16 05:53:12 +08:00
- { name: Windows OpenGL ES, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -DSFML_OPENGL_ES=ON }
2023-10-16 06:04:05 +08:00
- { name: Windows Unity, os: windows-2022, flags : -DSFML_USE_MESA3D=TRUE -DCMAKE_UNITY_BUILD=ON }
2023-07-09 04:01:49 +08:00
- { name: Linux GCC, os: ubuntu-22.04, flags : -DSFML_RUN_DISPLAY_TESTS=ON -GNinja }
- { name: Linux Clang, os: ubuntu-22.04, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSFML_RUN_DISPLAY_TESTS=ON -GNinja , gcovr_options : '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' }
2023-10-16 05:49:05 +08:00
- { name: Linux GCC DRM, os: ubuntu-22.04, flags : -DSFML_USE_DRM=ON -DSFML_RUN_DISPLAY_TESTS=OFF -GNinja }
2023-10-16 05:51:38 +08:00
- { name: Linux GCC OpenGL ES, os: ubuntu-22.04, flags : -DSFML_OPENGL_ES=ON -DSFML_RUN_DISPLAY_TESTS=ON -GNinja }
2023-02-12 12:49:05 +08:00
- { name: macOS, os: macos-12, flags : -GNinja }
- { name: macOS Xcode, os: macos-12, flags : -GXcode }
2023-07-09 04:01:49 +08:00
- { name: iOS, os: macos-12, flags : -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 }
- { name: iOS Xcode, os: macos-12, flags : -DCMAKE_SYSTEM_NAME=iOS -GXcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO }
2020-11-07 04:09:46 +08:00
config :
2022-02-19 01:30:38 +08:00
- { name: Shared, flags : -DBUILD_SHARED_LIBS=TRUE }
- { name: Static, flags : -DBUILD_SHARED_LIBS=FALSE }
type :
- { name : Release }
- { name: Debug, flags : -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE }
2020-11-07 04:09:46 +08:00
include :
2023-09-26 23:03:38 +08:00
- platform : { name: Windows MinGW, os : windows-2022 }
config : { name: Static Standard Libraries, flags : -GNinja -DSFML_USE_MESA3D=TRUE -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DSFML_USE_STATIC_STD_LIBS=TRUE }
2023-02-12 12:49:05 +08:00
- platform : { name: macOS, os : macos-12 }
2023-02-17 04:11:51 +08:00
config : { name: Frameworks, flags : -GNinja -DSFML_BUILD_FRAMEWORKS=TRUE -DBUILD_SHARED_LIBS=TRUE }
2023-07-09 04:01:49 +08:00
- platform : { name: Android, os : ubuntu-22.04 }
2023-01-29 05:08:54 +08:00
config : { name: x86, flags : -GNinja -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
2023-07-09 04:01:49 +08:00
- platform : { name: Android, os : ubuntu-22.04 }
2023-01-29 05:08:54 +08:00
config : { name: armeabi-v7a, flags : -GNinja -DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
2023-07-09 04:01:49 +08:00
- platform : { name: Android, os : ubuntu-22.04 }
2023-01-29 05:08:54 +08:00
config : { name: arm64-v8a, flags : -GNinja -DCMAKE_ANDROID_ARCH_ABI=arm64-v8a -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 }
2023-07-09 04:01:49 +08:00
- platform : { name: Android, os : ubuntu-22.04 }
2023-01-29 05:08:54 +08:00
config : { name: x86_64, flags : -GNinja -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-ndk-r23b/build/cmake/android.toolchain.cmake -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 -DANDROID_PLATFORM=26 }
2023-02-12 12:49:05 +08:00
- platform : { name: macOS , os : macos-12 }
2023-07-10 13:46:56 +08:00
config : { name: System Deps, flags : -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_SYSTEM_DEPS=TRUE }
2020-11-07 04:09:46 +08:00
steps :
- name : Checkout Code
2022-10-12 12:45:37 +08:00
uses : actions/checkout@v3
2020-11-07 04:09:46 +08:00
2023-10-03 08:42:53 +08:00
- name : Get CMake and Ninja
uses : lukka/get-cmake@latest
with :
cmakeVersion : ${{ runner.os == 'Windows' && '3.24' || '3.22' }} # Set to minimum required version (3.24 on Windows and 3.22 elsewhere) as specified in CMakeLists.txt to test compatibility
ninjaVersion : latest
2022-02-19 01:30:38 +08:00
- name : Install Linux Dependencies
2022-02-06 12:38:28 +08:00
if : runner.os == 'Linux'
2023-10-03 08:42:53 +08:00
run : sudo apt-get update && sudo apt-get install xorg-dev libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev xvfb fluxbox
2020-11-07 04:09:46 +08:00
- name : Install Android Components
if : matrix.platform.name == 'Android'
run : |
2022-01-19 03:14:10 +08:00
wget -nv https://dl.google.com/android/repository/android-ndk-r23b-linux.zip -P $GITHUB_WORKSPACE
unzip -qq -d $GITHUB_WORKSPACE android-ndk-r23b-linux.zip
2020-11-07 04:09:46 +08:00
2022-02-19 01:30:38 +08:00
- name : Install Linux Tools
if : matrix.type.name == 'Debug' && runner.os == 'Linux'
run : |
CLANG_VERSION=$(clang++ --version | sed -n 's/.*version \([0-9]\+\)\..*/\1/p')
echo "CLANG_VERSION=$CLANG_VERSION" >> $GITHUB_ENV
sudo apt-get install gcovr ${{ matrix.platform.name == 'Linux Clang' && 'llvm-$CLANG_VERSION' || '' }}
2022-02-06 12:38:28 +08:00
2022-02-19 01:30:38 +08:00
- name : Install macOS Tools
2023-01-29 05:08:54 +08:00
if : runner.os == 'macOS'
2023-03-24 04:13:52 +08:00
run : |
2023-07-04 13:57:47 +08:00
# Do not run updates until GitHub has fixed all the issues: https://github.com/orgs/Homebrew/discussions/4612
# brew update
2023-10-03 08:42:53 +08:00
brew install gcovr || true
- name : Cache OpenCppCoverage
if : matrix.type.name == 'Debug' && runner.os == 'Windows'
id : opencppcoverage-cache
uses : actions/cache@v3
with :
path : C:\Program Files\OpenCppCoverage
key : opencppcoverage
2022-02-06 12:38:28 +08:00
2023-10-03 08:42:53 +08:00
- name : Install OpenCppCoverage
2022-11-23 15:35:31 +08:00
uses : nick-fields/retry@v2
2023-10-03 08:42:53 +08:00
if : matrix.type.name == 'Debug' && runner.os == 'Windows' && steps.opencppcoverage-cache.outputs.cache-hit != 'true'
2022-11-23 15:35:31 +08:00
with :
max_attempts : 10
timeout_minutes : 3
2023-10-03 08:42:53 +08:00
command : choco install OpenCppCoverage -y
2022-02-06 12:38:28 +08:00
2023-10-04 01:54:55 +08:00
- name : Cache MinGW
2023-10-02 13:17:36 +08:00
if : matrix.platform.name == 'Windows MinGW'
2023-10-04 01:54:55 +08:00
id : mingw-cache
uses : actions/cache@v3
with :
path : "C:\\Program Files\\mingw64"
key : winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-16.0.0-mingw-w64msvcrt-10.0.0-r5
- name : Install MinGW
if : matrix.platform.name == 'Windows MinGW' && steps.mingw-cache.outputs.cache-hit != 'true'
2023-10-02 13:17:36 +08:00
run : |
2023-10-04 01:54:55 +08:00
curl -Lo mingw64.zip https://github.com/brechtsanders/winlibs_mingw/releases/download/12.2.0-16.0.0-10.0.0-msvcrt-r5/winlibs-x86_64-posix-seh-gcc-12.2.0-llvm-16.0.0-mingw-w64msvcrt-10.0.0-r5.zip
unzip -qq -d "C:\Program Files" mingw64.zip
2023-10-02 13:17:36 +08:00
2023-10-03 08:42:53 +08:00
- name : Add OpenCppCoverage and MinGW to PATH
if : runner.os == 'Windows'
run : |
2023-10-02 12:36:34 +08:00
echo "C:\Program Files\OpenCppCoverage" >> $GITHUB_PATH
echo "C:\Program Files\mingw64\bin" >> $GITHUB_PATH
2023-10-03 08:42:53 +08:00
2022-02-19 01:30:38 +08:00
- name : Configure CMake
2023-02-22 07:25:55 +08:00
run : cmake --preset dev -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
2022-02-06 12:38:28 +08:00
2022-02-19 01:30:38 +08:00
- name : Build
2023-08-10 10:29:42 +08:00
run : cmake --build build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --target install
2023-09-20 01:17:29 +08:00
2023-04-12 07:37:05 +08:00
- name : Prepare Test
run : |
set -e
# Start up Xvfb and fluxbox to host display tests
if [ "${{ runner.os }}" == "Linux" ]; then
Xvfb $DISPLAY -screen 0 1920x1080x24 &
sleep 5
fluxbox > /dev/null 2>&1 &
sleep 5
fi
# Make sure the build/bin directory exists so that the find command does not fail if no executables are built
2023-08-10 10:29:42 +08:00
mkdir -p build/bin
2023-09-19 10:51:33 +08:00
# Make use of a test to print OpenGL vendor/renderer/version info to the console
find build/bin -name test-sfml-window -or -name test-sfml-window.exe -exec sh -c "{} *sf::Context* --section=\"Version String\" --success | grep OpenGL" \;
2023-03-15 01:51:22 +08:00
- name : Test
2023-09-19 10:51:33 +08:00
if : runner.os == 'Windows'
run : cmake --build build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
- name : Test
if : runner.os != 'Windows'
run : |
ctest --test-dir build --output-on-failure -C ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --repeat until-pass:3
# Run gcovr to extract coverage information from the test run
if [ "${{ matrix.type.name }}" == "Debug" ]; then
gcovr -r $GITHUB_WORKSPACE -x build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE
fi
2022-02-06 12:38:28 +08:00
2023-03-16 11:02:39 +08:00
- name : Download Codecov Uploader
2023-03-24 09:18:46 +08:00
if : matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
2023-03-16 11:02:39 +08:00
run : |
platform=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]')
if [ "$platform" == "windows" ]; then CODECOV_BINARY="codecov.exe"; else CODECOV_BINARY="codecov"; fi
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
curl -s --remote-name-all "https://uploader.codecov.io/latest/$platform/{$CODECOV_BINARY,$CODECOV_BINARY.SHA256SUM,$CODECOV_BINARY.SHA256SUM.sig}"
if [ "$platform" == "windows" ]; then powershell 'If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) {echo "codecov: OK"} Else {exit 1}';
else shasum -a 256 -c codecov.SHA256SUM; fi
chmod +x "$CODECOV_BINARY"
echo "CODECOV_BINARY=$CODECOV_BINARY" >> $GITHUB_ENV
2022-02-06 12:38:28 +08:00
- name : Upload Coverage Report to Codecov
2023-03-24 09:18:46 +08:00
if : matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
2023-03-16 11:02:39 +08:00
uses : nick-fields/retry@v2
2022-02-06 12:38:28 +08:00
with :
2023-03-16 11:02:39 +08:00
timeout_seconds : 30
max_attempts : 10
retry_wait_seconds : 60
warning_on_retry : false
shell : bash
2023-03-23 09:25:36 +08:00
command : |
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then COMMIT_OVERRIDE="-C ${{ github.event.pull_request.head.sha }}"; fi
2023-03-24 09:18:46 +08:00
./${{ env.CODECOV_BINARY }} -n "${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}" -Z -f ./build/coverage.out $COMMIT_OVERRIDE -s ./build -e GITHUB_ACTION,GITHUB_RUN_ID,GITHUB_REF,GITHUB_REPOSITORY,GITHUB_SHA,GITHUB_HEAD_REF
2022-02-18 03:32:28 +08:00
2022-09-19 05:24:42 +08:00
- name : Test Install Interface
2023-04-04 05:36:33 +08:00
if : matrix.platform.name != 'Android'
2022-09-19 05:24:42 +08:00
run : |
2023-08-10 10:29:42 +08:00
cmake -S test/install -B test/install/build -DSFML_ROOT=build/install -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
cmake --build test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
2022-09-19 05:24:42 +08:00
2022-02-18 03:32:28 +08:00
format :
2023-05-21 05:46:47 +08:00
name : Formatting
2022-11-26 02:39:06 +08:00
runs-on : ubuntu-22.04
2022-02-18 03:32:28 +08:00
strategy :
fail-fast : false
steps :
- name : Checkout Code
2022-10-12 12:45:37 +08:00
uses : actions/checkout@v3
2022-02-18 03:32:28 +08:00
- name : Format Code
2023-08-10 10:29:42 +08:00
run : cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-14 -P cmake/Format.cmake
2022-02-18 03:32:28 +08:00
- name : Check Formatting
run : git diff --exit-code
2022-10-17 04:30:13 +08:00
tidy :
name : Analyzing on ${{ matrix.platform.name }}
runs-on : ${{ matrix.platform.os }}
strategy :
fail-fast : false
matrix :
platform :
2023-10-27 05:21:10 +08:00
- { name: Windows, os: windows-2022, flags : -GNinja }
- { name: Linux, os : ubuntu-22.04 }
- { name: Linux DRM, os: ubuntu-22.04, flags : -DSFML_USE_DRM=TRUE }
- { name: Linux OpenGL ES, os: ubuntu-22.04, flags : -DSFML_OPENGL_ES=ON }
- { name: macOS, os : macos-12 }
- { name: iOS, os: macos-12, flags : -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 }
- { name: Android, os: ubuntu-22.04, flags : -DCMAKE_ANDROID_ARCH_ABI=x86 -DCMAKE_SYSTEM_NAME=Android -DSFML_BUILD_TEST_SUITE=FALSE -DCMAKE_ANDROID_NDK=$GITHUB_WORKSPACE/android-ndk-r23b -DCMAKE_ANDROID_NDK_TOOLCHAIN_VERSION=clang -DCMAKE_ANDROID_STL_TYPE=c++_shared -DCMAKE_ANDROID_API=26 }
2022-10-17 04:30:13 +08:00
steps :
- name : Checkout Code
uses : actions/checkout@v3
2023-10-03 08:42:53 +08:00
- name : Get CMake and Ninja
uses : lukka/get-cmake@latest
with :
cmakeVersion : latest
ninjaVersion : latest
2023-01-14 06:56:42 +08:00
- name : Install Windows Dependencies
if : runner.os == 'Windows'
2023-09-21 07:28:30 +08:00
run : |
curl.exe -o run-clang-tidy https://raw.githubusercontent.com/llvm/llvm-project/llvmorg-15.0.7/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
2023-01-14 06:56:42 +08:00
2022-10-17 04:30:13 +08:00
- name : Install Linux Dependencies
if : runner.os == 'Linux'
2023-01-13 12:49:10 +08:00
run : sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
2022-10-17 04:30:13 +08:00
- name : Install macOS Dependencies
if : runner.os == 'macOS'
run : |
2023-07-04 13:57:47 +08:00
# Do not run updates until GitHub has fixed all the issues: https://github.com/orgs/Homebrew/discussions/4612
# brew update
2023-04-09 05:22:38 +08:00
brew install llvm || true
2022-10-17 04:30:13 +08:00
echo /usr/local/opt/llvm/bin >> $GITHUB_PATH
2023-07-28 07:07:56 +08:00
- name : Install Android Components
if : matrix.platform.name == 'Android'
run : |
wget -nv https://dl.google.com/android/repository/android-ndk-r23b-linux.zip -P $GITHUB_WORKSPACE
unzip -qq -d $GITHUB_WORKSPACE android-ndk-r23b-linux.zip
2022-10-17 04:30:13 +08:00
- name : Configure
2023-08-14 07:50:13 +08:00
run : cmake --preset dev -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_UNITY_BUILD=ON ${{matrix.platform.flags}}
2022-10-17 04:30:13 +08:00
- name : Analyze Code
2023-08-10 10:29:42 +08:00
run : cmake --build build --target tidy