mirror of
https://github.com/SFML/SFML.git
synced 2024-12-01 15:51:04 +08:00
170 lines
8.9 KiB
YAML
170 lines
8.9 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
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: -A Win32 }
|
|
- { name: Windows VS2019 x64, os: windows-2019, flags: -A x64 }
|
|
- { name: Windows VS2022 x86, os: windows-2022, flags: -A Win32 }
|
|
- { name: Windows VS2022 x64, os: windows-2022, flags: -A x64 }
|
|
- { name: Windows VS2022 Clang, os: windows-2022, flags: -T ClangCL }
|
|
- { name: Linux GCC, os: ubuntu-latest }
|
|
- { name: Linux Clang, os: ubuntu-latest, flags: -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, gcovr_options: '--gcov-executable="llvm-cov-$CLANG_VERSION gcov"' }
|
|
- { name: MacOS, os: macos-latest }
|
|
- { name: MacOS Xcode, os: macos-latest, flags: -GXcode }
|
|
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 }
|
|
|
|
include:
|
|
- platform: { name: Windows VS2022, os: windows-2022 }
|
|
config: { name: Unity, flags: -DBUILD_SHARED_LIBS=TRUE -DCMAKE_UNITY_BUILD=ON }
|
|
type: { name: Release }
|
|
- platform: { name: Windows VS2022, os: windows-2022 }
|
|
config: { name: Unity, flags: -DBUILD_SHARED_LIBS=TRUE -DCMAKE_UNITY_BUILD=ON }
|
|
type: { name: Debug, flags: -DCMAKE_BUILD_TYPE=Debug -DSFML_ENABLE_COVERAGE=TRUE }
|
|
- platform: { name: MacOS, os: macos-latest }
|
|
config: { name: Frameworks, flags: -DSFML_BUILD_FRAMEWORKS=TRUE }
|
|
- platform: { name: MacOS, os: macos-latest }
|
|
config: { name: iOS, flags: -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/cmake/toolchains/iOS.toolchain.cmake -DIOS_PLATFORM=SIMULATOR }
|
|
- platform: { name: Android, os: ubuntu-latest }
|
|
config: { name: x86, 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 }
|
|
- platform: { name: Android, os: ubuntu-latest }
|
|
config: { name: armeabi-v7a, flags: -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: -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: -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: -DBUILD_SHARED_LIBS=FALSE -DSFML_USE_DRM=TRUE }
|
|
- platform: { name: Linux GCC, os: ubuntu-latest }
|
|
config: { name: Shared DRM, flags: -DBUILD_SHARED_LIBS=TRUE -DSFML_USE_DRM=TRUE }
|
|
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 libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev libdrm-dev libgbm-dev
|
|
|
|
- name: Install Android Components
|
|
if: matrix.platform.name == 'Android'
|
|
run: |
|
|
echo "y" | /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "cmake;3.10.2.4988404" --sdk_root=ANDROID_SDK_ROOT
|
|
sudo ln -sf /usr/local/lib/android/sdk/cmake/3.10.2.4988404/bin/cmake /usr/bin/cmake
|
|
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: matrix.type.name == 'Debug' && runner.os == 'macOS'
|
|
run: brew install gcovr
|
|
|
|
- name: Install OpenCppCoverage and add to PATH
|
|
if: matrix.type.name == 'Debug' && runner.os == 'Windows'
|
|
run: |
|
|
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: Generate Coverage Report
|
|
if: matrix.type.name == 'Debug' && runner.os != 'Windows' # Coverage is already generated on Windows when running tests.
|
|
run: gcovr -r $GITHUB_WORKSPACE -x $GITHUB_WORKSPACE/build/coverage.out -s -f 'src/SFML/.*' -f 'include/SFML/.*' ${{ matrix.platform.gcovr_options }} $GITHUB_WORKSPACE
|
|
|
|
- name: Upload Coverage Report to Codecov
|
|
if: matrix.type.name == 'Debug' && github.repository == 'SFML/SFML' # Disable upload in forks
|
|
uses: codecov/codecov-action@v3
|
|
with:
|
|
directory: ./build
|
|
files: ./build/coverage.out
|
|
fail_ci_if_error: true
|
|
|
|
- name: Test Install Interface
|
|
if: matrix.platform.name != 'Android' && matrix.config.name != 'Frameworks' && matrix.config.name != 'iOS' && matrix.config.name != 'Static DRM'
|
|
shell: bash
|
|
run: |
|
|
cmake -S $GITHUB_WORKSPACE/test/install -B $GITHUB_WORKSPACE/test/install/build -DSFML_ROOT=$GITHUB_WORKSPACE/install -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
|
|
cmake --build $GITHUB_WORKSPACE/test/install/build --config ${{ matrix.type.name == 'Debug' && 'Debug' || 'Release' }}
|
|
|
|
format:
|
|
name: Formatting on ${{ matrix.platform.name }}
|
|
runs-on: ${{ matrix.platform.os }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
platform:
|
|
- { name: Windows, os: windows-2022, executable: clang-format }
|
|
- { name: Linux, os: ubuntu-latest, executable: clang-format-12 }
|
|
- { name: macOS, os: macos-12, executable: clang-format }
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install macOS Dependencies
|
|
if: runner.os == 'macOS'
|
|
run: brew install clang-format
|
|
|
|
- name: Format Code
|
|
shell: bash
|
|
run: cmake -DCLANG_FORMAT_EXECUTABLE=${{ matrix.platform.executable }} -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: Linux, os: ubuntu-latest }
|
|
- { name: macOS, os: macos-12 }
|
|
|
|
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 libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev
|
|
|
|
- name: Install macOS Dependencies
|
|
if: runner.os == 'macOS'
|
|
run: |
|
|
brew install llvm
|
|
echo /usr/local/opt/llvm/bin >> $GITHUB_PATH
|
|
|
|
- name: Configure
|
|
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DSFML_BUILD_EXAMPLES=TRUE -DSFML_BUILD_TEST_SUITE=TRUE
|
|
|
|
- name: Analyze Code
|
|
run: cmake --build $GITHUB_WORKSPACE/build --target tidy
|