Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/actions/install_sfml/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: "Setup SFML"
description: "Setup SFML"
inputs:
sfml_version:
description: "SFML version"
required: true
used_env:
description: "Environment used with runs-on"
required: true
outputs:
sfml_install_dir:
description: "SFML install path"
value: ${{steps.configure.outputs.sfml_install_dir}}
runs:
using: "composite"
steps:
- name: Install SFML dependencies
shell: cmake -P {0}
run: |
if ("${{ runner.os }}" STREQUAL "Linux")
execute_process(COMMAND sudo apt-get update)
execute_process(
COMMAND sudo apt-get -y install mesa-common-dev libx11-dev libxcursor-dev libsfml-dev libudev-dev libopenal-dev libvorbis-dev libflac-dev libxrandr-dev freeglut3-dev libjpeg-dev libfreetype6-dev libxrandr-dev libglew-dev libsndfile1-dev libopenal-dev libfreetype6-dev
)
endif()

- name: Cache SFML install
id: cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/SFML
key: SFML-${{inputs.sfml_version}}-${{inputs.used_env}}

- name: Checkout SFML
if: ${{steps.cache.outputs.cache-hit != 'true'}}
uses: actions/checkout@v2
with:
repository: SFML/SFML
submodules: recursive
path: SFML_repo
ref: ${{inputs.sfml_version}}

- name: Install SFML
id: install
if: ${{steps.cache.outputs.cache-hit != 'true'}}
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
message(STATUS "Using host CMake version: ${CMAKE_VERSION}")
message(STATUS "Build SFML")
execute_process(
COMMAND ${CMAKE_COMMAND}
-S "${workspace}/SFML_repo"
-B "${workspace}/SFML_repo/build"
-D CMAKE_CONFIGURATION_TYPES=Release
-D CMAKE_BUILD_TYPE=Release
-D ENABLE_TESTING=OFF
-D SFML_BUILD_EXAMPLES=OFF
-D SFML_BUILD_DOC=OFF
-D SFML_BUILD_FRAMEWORKS=OFF
-D SFML_INSTALL_XCODE_TEMPLATES=OFF
-D SFML_DEPENDENCIES_INSTALL_PREFIX=${workspace}/SFML
-D CMAKE_INSTALL_PREFIX=${workspace}/SFML
-D CMAKE_INSTALL_FRAMEWORK_PREFIX=${workspace}/SFML
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
message(FATAL_ERROR "project configuration failed")
endif()
include(ProcessorCount)
ProcessorCount(N)
execute_process(
COMMAND ${CMAKE_COMMAND}
--build "${workspace}/SFML_repo/build"
--config Release
--parallel ${N}
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
message(FATAL_ERROR "project build failed")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${workspace}/SFML")
execute_process(
COMMAND ${CMAKE_COMMAND}
--install "${workspace}/SFML_repo/build"
--prefix "${workspace}/SFML"
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
message(FATAL_ERROR "project installation failed")
endif()

- name: Configure SFML
id: configure
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
message("::set-output name=sfml_install_dir::${workspace}/SFML")
111 changes: 111 additions & 0 deletions .github/actions/setup_ccache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: "Setup ccache"
description: "Setup ccache"
inputs:
ccache_version:
description: "ccache version"
required: true
used_env:
description: "Environment used with runs-on"
required: true
cache_id:
description: "Cache id unique to the current config"
required: true
outputs:
ccache_binary:
description: "ccache binary path"
value: ${{steps.configure.outputs.ccache_binary}}
runs:
using: "composite"
steps:
- name: Cache ccache
id: cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/ccache
key: ccache-${{inputs.ccache_version}}-${{inputs.used_env}}

- name: Download and install ccache
id: download
if: ${{steps.cache.outputs.cache-hit != 'true'}}
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
message(STATUS "Using host CMake version: ${CMAKE_VERSION}")
set(ccache_url "https://github.com/ccache/ccache/releases/download/v${{inputs.ccache_version}}/ccache-${{inputs.ccache_version}}.tar.gz")
message(STATUS "Download from: ${ccache_url}")
file(DOWNLOAD "${ccache_url}" "${workspace}/ccache.tar.gz" SHOW_PROGRESS)
message(STATUS "Extract")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "${workspace}/ccache.tar.gz")
message(STATUS "Build ccache")
execute_process(
COMMAND ${CMAKE_COMMAND}
-S "${workspace}/ccache-${{inputs.ccache_version}}"
-B "${workspace}/ccache-${{inputs.ccache_version}}/build"
-D CMAKE_CONFIGURATION_TYPES=Release
-D CMAKE_BUILD_TYPE=Release
-D ZSTD_FROM_INTERNET=ON
-D REDIS_STORAGE_BACKEND=OFF
-D ENABLE_TESTING=OFF
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
message(FATAL_ERROR "project configuration failed")
endif()
include(ProcessorCount)
ProcessorCount(N)
execute_process(
COMMAND ${CMAKE_COMMAND}
--build "${workspace}/ccache-${{inputs.ccache_version}}/build"
--target ccache
--config Release
--parallel ${N}
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
message(FATAL_ERROR "project build failed")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory "${workspace}/ccache")
execute_process(
COMMAND ${CMAKE_COMMAND}
--install "${workspace}/ccache-${{inputs.ccache_version}}/build"
--prefix "${workspace}/ccache"
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
message(FATAL_ERROR "project installation failed")
endif()
if(NOT "${{runner.os}}" STREQUAL "Windows")
execute_process(COMMAND chmod +x "${workspace}/ccache/bin/ccache")
endif()

- name: Configure ccache
id: configure
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
file(APPEND "$ENV{GITHUB_ENV}" "CCACHE_BASEDIR=${workspace}\n")
file(APPEND "$ENV{GITHUB_ENV}" "CCACHE_DIR=${workspace}/.ccache\n")
file(APPEND "$ENV{GITHUB_ENV}" "CCACHE_COMPRESS=true\n")
file(APPEND "$ENV{GITHUB_ENV}" "CCACHE_COMPRESSLEVEL=6\n")
file(APPEND "$ENV{GITHUB_ENV}" "CCACHE_MAXSIZE=400M\n")
set(ccache_binary "${workspace}/ccache/bin/ccache")
message(STATUS "ccache binary: ${ccache_binary}")
message("::set-output name=ccache_binary::${ccache_binary}")
execute_process(COMMAND ${ccache_binary} --zero-stats)
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")

- name: Print ccache config
id: print
shell: cmake -P {0}
run: |
execute_process(COMMAND ${{steps.configure.outputs.ccache_binary}} --version)
execute_process(COMMAND ${{steps.configure.outputs.ccache_binary}} --show-config)

- name: Cache ccache files
uses: actions/cache@v2
with:
path: ${{env.CCACHE_DIR}}
key: ccache-cache-${{inputs.cache_id}}-${{steps.configure.outputs.timestamp}}
restore-keys: |
ccache-cache-${{inputs.cache_id}}-
88 changes: 88 additions & 0 deletions .github/actions/setup_cmake/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "Setup CMake"
description: "Setup CMake"
inputs:
cmake_version:
description: "CMake version"
required: true
used_env:
description: "Environment used with runs-on"
required: true
outputs:
cmake_binary:
description: "CMake binary path"
value: ${{steps.configure.outputs.cmake_binary}}
ctest_binary:
description: "CTest binary path"
value: ${{steps.configure.outputs.ctest_binary}}
runs:
using: "composite"
steps:
- name: Cache CMake
id: cache
uses: actions/cache@v2
with:
path: ${{github.workspace}}/cmake
key: cmake-${{inputs.cmake_version}}-${{inputs.used_env}}

- name: Download CMake
id: download
if: ${{steps.cache.outputs.cache-hit != 'true'}}
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
message(STATUS "Using host CMake version: ${CMAKE_VERSION}")
if("${{runner.os}}" STREQUAL "Windows")
set(cmake_suffix "windows-x86_64.zip")
set(cmake_dir "cmake-${{inputs.cmake_version}}-windows-x86_64")
set(cmake_bin_dir "cmake-${{inputs.cmake_version}}-windows-x86_64/bin")
elseif("${{runner.os}}" STREQUAL "Linux")
set(cmake_suffix "linux-x86_64.tar.gz")
set(cmake_dir "cmake-${{inputs.cmake_version}}-linux-x86_64")
set(cmake_bin_dir "cmake-${{inputs.cmake_version}}-linux-x86_64/bin")
elseif("${{runner.os}}" STREQUAL "macOS")
set(cmake_suffix "macos-universal.tar.gz")
set(cmake_dir "cmake-${{inputs.cmake_version}}-macos-universal")
set(cmake_bin_dir "cmake-${{inputs.cmake_version}}-macos-universal/CMake.app/Contents/bin")
endif()
set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${{inputs.cmake_version}}/cmake-${{inputs.cmake_version}}-${cmake_suffix}")
message(STATUS "Download from: ${cmake_url}")
file(DOWNLOAD "${cmake_url}" "${workspace}/cmake.zip" SHOW_PROGRESS)
message(STATUS "Extract")
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf "${workspace}/cmake.zip")
file(COPY "${workspace}/${cmake_dir}" DESTINATION "${workspace}/cmake")
if(NOT "${{runner.os}}" STREQUAL "Windows")
execute_process(COMMAND chmod +x "${workspace}/cmake/${cmake_bin_dir}/cmake")
execute_process(COMMAND chmod +x "${workspace}/cmake/${cmake_bin_dir}/ctest")
endif()

- name: Configure CMake
id: configure
shell: cmake -P {0}
run: |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace)
if("${{runner.os}}" STREQUAL "Windows")
set(cmake_bin_dir "cmake-${{inputs.cmake_version}}-windows-x86_64/bin")
elseif("${{runner.os}}" STREQUAL "Linux")
set(cmake_bin_dir "cmake-${{inputs.cmake_version}}-linux-x86_64/bin")
elseif("${{runner.os}}" STREQUAL "macOS")
set(cmake_bin_dir "cmake-${{inputs.cmake_version}}-macos-universal/CMake.app/Contents/bin")
endif()
set(cmake_binary "${workspace}/cmake/${cmake_bin_dir}/cmake")
set(ctest_binary "${workspace}/cmake/${cmake_bin_dir}/ctest")
message(STATUS "CMake binary: ${cmake_binary}")
message("::set-output name=cmake_binary::${cmake_binary}")
message(STATUS "CTest binary: ${ctest_binary}")
message("::set-output name=ctest_binary::${ctest_binary}")

- name: Print version
id: print
shell: cmake -P {0}
run: |
execute_process(COMMAND ${{steps.configure.outputs.cmake_binary}} --version RESULT_VARIABLE result)
if(NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
execute_process(COMMAND ${{steps.configure.outputs.ctest_binary}} --version RESULT_VARIABLE result)
if(NOT result EQUAL 0)
message(FATAL_ERROR "Bad exit status")
endif()
Loading