CI: updated ccache to version 4.9 #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Windows MinGW | |
on: | |
- push | |
- pull_request | |
env: | |
CMAKE_VERSION: 3.22.2 | |
CCACHE_VERSION: 4.9 | |
jobs: | |
build: | |
name: ${{matrix.os}} - MinGW - ${{matrix.config.compiler_name}} - ${{matrix.build_type}} | |
runs-on: ${{matrix.os}} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019, windows-2022] | |
config: [ | |
{ | |
compiler_name: gcc, | |
c_compiler_path: "C:/msys64/mingw64/bin/gcc.exe", | |
cxx_compiler_path: "C:/msys64/mingw64/bin/g++.exe" | |
}, | |
{ | |
compiler_name: clang, | |
c_compiler_path: "C:/msys64/mingw64/bin/clang.exe", | |
cxx_compiler_path: "C:/msys64/mingw64/bin/clang++.exe" | |
} | |
] | |
build_type: [Debug, Release] | |
steps: | |
- name: Checkout dynamic_bitset | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
path: dynamic_bitset | |
- name: Setup build environment | |
shell: cmake -P {0} | |
run: | | |
execute_process( | |
COMMAND "C:\msys64\usr\bin\bash" | |
-lc 'pacman --noconfirm --needed -S mingw-w64-x86_64-${{matrix.config.compiler_name}}' | |
RESULT_VARIABLE result | |
) | |
if(NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
execute_process(COMMAND ${{matrix.config.c_compiler_path}} --version) | |
execute_process(COMMAND ${{matrix.config.cxx_compiler_path}} --version) | |
file(APPEND "$ENV{GITHUB_ENV}" "CMAKE_GENERATOR=MinGW Makefiles\n") | |
file(APPEND "$ENV{GITHUB_ENV}" "CC=${{matrix.config.c_compiler_path}}\n") | |
file(APPEND "$ENV{GITHUB_ENV}" "CXX=${{matrix.config.cxx_compiler_path}}\n") | |
- name: Setup CMake | |
id: cmake | |
uses: ./dynamic_bitset/.github/actions/setup_cmake | |
with: | |
cmake_version: ${{env.CMAKE_VERSION}} | |
used_env: ${{matrix.os}} | |
- name: Setup ccache | |
id: ccache | |
uses: ./dynamic_bitset/.github/actions/setup_ccache | |
with: | |
ccache_version: ${{env.CCACHE_VERSION}} | |
used_env: ${{matrix.os}} | |
cache_id: ${{matrix.os}}-mingw-${{matrix.config.compiler_name}}-${{matrix.build_type}} | |
- name: Configure | |
shell: cmake -P {0} | |
run: | | |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace) | |
execute_process( | |
COMMAND ${{steps.cmake.outputs.cmake_binary}} | |
-S "${workspace}/dynamic_bitset" | |
-B "${workspace}/dynamic_bitset/build" | |
-D CMAKE_CONFIGURATION_TYPES=${{matrix.build_type}} | |
-D CMAKE_BUILD_TYPE=${{matrix.build_type}} | |
-D CMAKE_C_COMPILER_LAUNCHER=${{steps.ccache.outputs.ccache_binary}} | |
-D CMAKE_CXX_COMPILER_LAUNCHER=${{steps.ccache.outputs.ccache_binary}} | |
RESULT_VARIABLE result | |
) | |
if(NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build | |
shell: cmake -P {0} | |
run: | | |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace) | |
include(ProcessorCount) | |
ProcessorCount(N) | |
execute_process( | |
COMMAND ${{steps.cmake.outputs.cmake_binary}} | |
--build "${workspace}/dynamic_bitset/build" | |
--config ${{matrix.build_type}} | |
--parallel ${N} | |
RESULT_VARIABLE result | |
) | |
if(NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
execute_process(COMMAND ${{steps.ccache.outputs.ccache_binary}} -s) | |
- name: Run tests | |
shell: cmake -P {0} | |
run: | | |
file(TO_CMAKE_PATH [=[${{github.workspace}}]=] workspace) | |
include(ProcessorCount) | |
ProcessorCount(N) | |
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") | |
execute_process( | |
COMMAND ${{steps.cmake.outputs.ctest_binary}} --output-on-failure --parallel ${N} | |
WORKING_DIRECTORY "${workspace}/dynamic_bitset/build" | |
RESULT_VARIABLE result | |
) | |
if(NOT result EQUAL 0) | |
message(FATAL_ERROR "Running tests failed!") | |
endif() |