mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Added support for running the GitHub actions workflow using CCache.
This commit is contained in:
parent
4faff85629
commit
ea6cf002b6
33
.github/workflows/ci.yml
vendored
33
.github/workflows/ci.yml
vendored
@ -19,6 +19,10 @@ jobs:
|
||||
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} ${{ matrix.type.name }}
|
||||
runs-on: ${{ matrix.platform.os }}
|
||||
|
||||
env:
|
||||
CMAKE_C_COMPILER_LAUNCHER: ccache # Use ccache to cache C compiler output
|
||||
CMAKE_CXX_COMPILER_LAUNCHER: ccache # Use ccache to cache C++ compiler output
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
@ -72,9 +76,12 @@ jobs:
|
||||
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
|
||||
|
||||
- name: Install Linux Dependencies
|
||||
- name: Install Linux Dependencies and Tools
|
||||
if: runner.os == 'Linux'
|
||||
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
|
||||
run: |
|
||||
CLANG_VERSION=$(clang++ --version | sed -n 's/.*version \([0-9]\+\)\..*/\1/p')
|
||||
echo "CLANG_VERSION=$CLANG_VERSION" >> $GITHUB_ENV
|
||||
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 ccache gcovr ${{ matrix.platform.name == 'Linux Clang' && 'llvm-$CLANG_VERSION' || '' }}
|
||||
|
||||
- name: Install Android Components
|
||||
if: matrix.platform.name == 'Android'
|
||||
@ -82,19 +89,20 @@ jobs:
|
||||
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: |
|
||||
# Do not run updates until GitHub has fixed all the issues: https://github.com/orgs/Homebrew/discussions/4612
|
||||
# brew update
|
||||
brew install gcovr || true
|
||||
brew install gcovr ccache || true
|
||||
|
||||
# In addition to installing a known working version of CCache, this action also takes care of saving and restoring the cache for us
|
||||
# Additionally it outputs information at the end of each job that helps us to verify if the cache is working properly
|
||||
- name: Setup CCache
|
||||
uses: hendrikmuhs/ccache-action@v1.2.10
|
||||
with:
|
||||
verbose: 2
|
||||
key: ${{ matrix.platform.name }}-${{ matrix.config.name }}-${{ matrix.type.name }}
|
||||
|
||||
- name: Cache OpenCppCoverage
|
||||
if: matrix.type.name == 'Debug' && runner.os == 'Windows'
|
||||
@ -126,11 +134,14 @@ jobs:
|
||||
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
|
||||
|
||||
- name: Add OpenCppCoverage and MinGW to PATH
|
||||
- name: Add OpenCppCoverage and MinGW to PATH and remove MinGW-supplied CCache
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
echo "C:\Program Files\OpenCppCoverage" >> $GITHUB_PATH
|
||||
echo "C:\Program Files\mingw64\bin" >> $GITHUB_PATH
|
||||
rm -f "C:\Program Files\mingw64\bin\ccache.exe"
|
||||
echo "Using $(which ccache)"
|
||||
ccache --version
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake --preset dev -DCMAKE_VERBOSE_MAKEFILE=ON ${{matrix.platform.flags}} ${{matrix.config.flags}} ${{matrix.type.flags}}
|
||||
|
@ -27,13 +27,6 @@ project(SFML VERSION 3.0.0)
|
||||
|
||||
set(VERSION_IS_RELEASE OFF)
|
||||
|
||||
# use ccache if available
|
||||
find_program(CCACHE_PROGRAM ccache)
|
||||
if(CCACHE_PROGRAM)
|
||||
message(STATUS "Found ccache in ${CCACHE_PROGRAM}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||
endif()
|
||||
|
||||
# include the configuration file
|
||||
include(cmake/Config.cmake)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user