mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
c45f6378d6
This started randomly failing on macOS one day. We're not sure why it started failing but we think it's relatively unimportant so we can get rid of it.
251 lines
14 KiB
YAML
251 lines
14 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request, workflow_dispatch]
|
|
|
|
env:
|
|
DISPLAY: ":99" # Display number to use for the X server
|
|
GALLIUM_DRIVER: llvmpipe # Use Mesa 3D software OpenGL renderer
|
|
|
|
jobs:
|
|
build:
|
|
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- { 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 }
|
|
- { name: Windows VS2022 Clang, os: windows-2022, flags: -DSFML_USE_MESA3D=TRUE -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -GNinja }
|
|
- { name: Linux GCC, os: ubuntu-latest, flags: -DSFML_RUN_DISPLAY_TESTS=ON -GNinja }
|
|
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DSFML_RUN_DISPLAY_TESTS=ON -GNinja , gcovr_options: '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' }
|
|
- { name: MacOS, os: macos-11, flags: -GNinja }
|
|
- { name: MacOS Xcode, os: macos-11, flags: -GXcode }
|
|
- { name: iOS, os: macos-11, flags: -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 }
|
|
- { name: iOS Xcode, os: macos-11, flags: -DCMAKE_SYSTEM_NAME=iOS -GXcode -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO }
|
|
config:
|
|
- { 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 }
|
|
|
|
exclude:
|
|
- platform: { name: iOS }
|
|
config: { name: Shared }
|
|
- platform: { name: iOS Xcode }
|
|
config: { name: Shared }
|
|
|
|
include:
|
|
- platform: { name: Windows VS2022, os: windows-2022 }
|
|
config: { name: Unity, flags: -DSFML_USE_MESA3D=TRUE -DBUILD_SHARED_LIBS=TRUE -DCMAKE_UNITY_BUILD=ON }
|
|
type: { name: Release }
|
|
- platform: { name: Windows VS2022, os: windows-2022 }
|
|
config: { name: Unity, flags: -DSFML_USE_MESA3D=TRUE -DBUILD_SHARED_LIBS=TRUE -DCMAKE_UNITY_BUILD=ON }
|
|
type: { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE }
|
|
- platform: { name: Windows VS2022, os: windows-2022 }
|
|
config: { name: OpenGL ES, flags: -DSFML_USE_MESA3D=TRUE -DBUILD_SHARED_LIBS=TRUE -DSFML_OPENGL_ES=ON }
|
|
type: { name: Release }
|
|
- platform: { name: Windows VS2022, os: windows-2022 }
|
|
config: { name: OpenGL ES, flags: -DSFML_USE_MESA3D=TRUE -DBUILD_SHARED_LIBS=TRUE -DSFML_OPENGL_ES=ON }
|
|
type: { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE }
|
|
- platform: { name: MacOS, os: macos-11 }
|
|
config: { name: Frameworks, flags: -GNinja -DSFML_BUILD_FRAMEWORKS=TRUE -DBUILD_SHARED_LIBS=TRUE }
|
|
- platform: { name: Android, os: ubuntu-latest }
|
|
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 }
|
|
- platform: { name: Android, os: ubuntu-latest }
|
|
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 }
|
|
- platform: { name: Android, os: ubuntu-latest }
|
|
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 }
|
|
- platform: { name: Android, os: ubuntu-latest }
|
|
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 }
|
|
- platform: { name: Linux GCC, os: ubuntu-latest }
|
|
config: { name: Static DRM, flags: -GNinja -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
|
|
- platform: { name: Linux GCC, os: ubuntu-latest }
|
|
config: { name: Shared DRM, flags: -GNinja -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE -DSFML_RUN_DISPLAY_TESTS=FALSE }
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Linux Dependencies
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get update && sudo apt-get install ninja-build 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
|
|
|
|
- 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
|
|
|
|
- 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' || '' }}
|
|
|
|
- name: Install macOS Tools
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew update
|
|
brew install gcovr ninja || true
|
|
|
|
- name: Install OpenCppCoverage and add to PATH
|
|
uses: nick-fields/retry@v2
|
|
if: matrix.type.name == 'Debug' && runner.os == 'Windows'
|
|
with:
|
|
max_attempts: 10
|
|
timeout_minutes: 3
|
|
command: |
|
|
choco install OpenCppCoverage -y
|
|
echo "C:\Program Files\OpenCppCoverage" >> $env:GITHUB_PATH
|
|
|
|
- name: Configure CMake
|
|
shell: bash
|
|
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/install -DSFML_BUILD_EXAMPLES=TRUE -DCMAKE_VERBOSE_MAKEFILE=ON -DSFML_BUILD_TEST_SUITE=TRUE ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: cmake --build $GITHUB_WORKSPACE/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} --target install
|
|
|
|
- name: Prepare Test
|
|
shell: bash
|
|
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
|
|
mkdir -p $GITHUB_WORKSPACE/build/bin
|
|
|
|
- name: Test
|
|
uses: nick-fields/retry@v2
|
|
with:
|
|
max_attempts: 10
|
|
timeout_minutes: 3
|
|
retry_wait_seconds: 5
|
|
warning_on_retry: false
|
|
shell: bash
|
|
command: |
|
|
set -e
|
|
if [ "${{ runner.os }}" == "Windows" ]; then
|
|
# Make use of a test to print OpenGL vendor/renderer/version info to the console
|
|
# We have to convert the backslashes in $GITHUB_WORKSPACE to (forward) slashes so bash doesn't try to escape them in the sh command
|
|
find $(echo $GITHUB_WORKSPACE | sed 's/\\\\/\\//g')/build/bin -name test-sfml-window.exe -exec sh -c "{} --test-case=\"[Window] sf::Context\" --subcase=\"Version String\" | grep OpenGL" \;
|
|
# Run the tests
|
|
cmake --build $GITHUB_WORKSPACE/build --target runtests --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
|
# Coverage is already generated on Windows when running tests.
|
|
else
|
|
# Make use of a test to print OpenGL vendor/renderer/version info to the console
|
|
find $GITHUB_WORKSPACE/build/bin -name test-sfml-window -exec sh -c "{} --test-case=\"[Window] sf::Context\" --subcase=\"Version String\" | grep OpenGL" \;
|
|
# Run the tests
|
|
ctest --test-dir $GITHUB_WORKSPACE/build --output-on-failure -C ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
|
# Run gcovr to extract coverage information from the test run
|
|
if [ "${{ matrix.type.name }}" == "Debug" ]; then
|
|
gcovr -r $GITHUB_WORKSPACE -x $GITHUB_WORKSPACE/build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE
|
|
fi
|
|
fi
|
|
|
|
- name: Download Codecov Uploader
|
|
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
|
|
shell: bash
|
|
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
|
|
|
|
- name: Upload Coverage Report to Codecov
|
|
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
|
|
uses: nick-fields/retry@v2
|
|
with:
|
|
timeout_seconds: 30
|
|
max_attempts: 10
|
|
retry_wait_seconds: 60
|
|
warning_on_retry: false
|
|
shell: bash
|
|
command: |
|
|
if [[ "${{ github.event_name }}" == "pull_request" || "${{ github.event_name }}" == "pull_request_target" ]]; then COMMIT_OVERRIDE="-C ${{ github.event.pull_request.head.sha }}"; fi
|
|
./${{ 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
|
|
|
|
- name: Test Install Interface
|
|
if: matrix.platform.name != 'Android'
|
|
shell: bash
|
|
run: |
|
|
cmake -S $GITHUB_WORKSPACE/test/install -B $GITHUB_WORKSPACE/test/install/build -DSFML_ROOT=$GITHUB_WORKSPACE/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 $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }} ${{matrix.platform.suffix}}
|
|
|
|
format:
|
|
name: Formatting with clang-format-${{ matrix.version }}
|
|
runs-on: ubuntu-22.04
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
version: [12, 13, 14]
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Dependencies
|
|
run: sudo apt-get install clang-format-${{ matrix.version }}
|
|
|
|
- name: Format Code
|
|
run: cmake -DCLANG_FORMAT_EXECUTABLE=clang-format-${{ matrix.version }} -P $GITHUB_WORKSPACE/cmake/Format.cmake
|
|
|
|
- name: Check Formatting
|
|
run: git diff --exit-code
|
|
|
|
tidy:
|
|
name: Analyzing on ${{ matrix.platform.name }}
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- { 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: macOS, os: macos-12 }
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install Windows Dependencies
|
|
if: runner.os == 'Windows'
|
|
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
|
|
|
|
- name: Install Linux Dependencies
|
|
if: runner.os == 'Linux'
|
|
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
|
|
|
|
- name: Install macOS Dependencies
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew update
|
|
brew install llvm || true
|
|
echo /usr/local/opt/llvm/bin >> $GITHUB_PATH
|
|
|
|
- name: Configure
|
|
shell: bash
|
|
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_UNITY_BUILD=ON -DSFML_BUILD_EXAMPLES=TRUE -DSFML_BUILD_TEST_SUITE=TRUE ${{matrix.platform.flags}}
|
|
|
|
- name: Analyze Code
|
|
shell: bash
|
|
run: cmake --build $GITHUB_WORKSPACE/build --target tidy
|