init build workflow #26
Workflow file for this run
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: build & test | |
env: | |
IMAGE_PREFIX: "ghcr.io/dnkpp/" | |
on: | |
push: | |
branches: [master, dev] | |
pull_request: | |
branches: [master, dev] | |
jobs: | |
build: | |
name: | | |
${{ matrix.config.prefix }} | |
${{ matrix.config.compiler_name }}-${{ matrix.config.compiler_version }} | |
${{ matrix.config.suffix }} | |
(C++${{ matrix.cxx_standard }}, ${{ matrix.build_mode }}) | |
runs-on: ${{ matrix.config.os }} | |
container: ${{ matrix.config.container }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_mode: [Debug, Release] | |
cxx_standard: [20, 23] | |
config: | |
#clang-18 | |
- { | |
prefix: "Linux", | |
suffix: "/libc++", | |
os: ubuntu-latest, | |
container: { image: "ghcr.io/dnkpp/clang:18" }, | |
compiler_name: "clang", | |
compiler_version: 18, | |
libcxx: true, | |
sanitize: true | |
} | |
- { | |
prefix: "Linux", | |
os: ubuntu-latest, | |
container: { image: "ghcr.io/dnkpp/clang:18" }, | |
compiler_name: "clang", | |
compiler_version: 18, | |
libcxx: false, | |
sanitize: true | |
} | |
#clang-17 | |
- { | |
prefix: "Linux", | |
suffix: "/libc++", | |
os: ubuntu-latest, | |
container: { image: "ghcr.io/dnkpp/clang:17" }, | |
compiler_name: "clang", | |
compiler_version: 17, | |
libcxx: true, | |
sanitize: true | |
} | |
- { | |
prefix: "Linux", | |
os: ubuntu-latest, | |
container: { image: "ghcr.io/dnkpp/clang:17" }, | |
compiler_name: "clang", | |
compiler_version: 17, | |
libcxx: false, | |
sanitize: true | |
} | |
#gcc-14 | |
- { | |
prefix: "Linux", | |
os: ubuntu-latest, | |
container: { image: "ghcr.io/dnkpp/gcc:14" }, | |
compiler_name: "gcc", | |
compiler_version: 14, | |
libcxx: false, | |
sanitize: true | |
} | |
#gcc-13 | |
- { | |
prefix: "Linux", | |
os: ubuntu-latest, | |
container: { image: "ghcr.io/dnkpp/gcc:13" }, | |
compiler_name: "gcc", | |
compiler_version: 13, | |
libcxx: false, | |
sanitize: true | |
} | |
# msvc v143 | |
- { | |
prefix: "Windows 2022", | |
os: windows_2022, | |
compiler_name: "msvc", | |
compiler_version: "v143", | |
cmake_generator: "Visual Studio 17 2022", | |
libcxx: false, | |
sanitize: true | |
} | |
# msvc v142 | |
- { | |
prefix: "Windows 2022", | |
os: windows_2022, | |
compiler_name: "msvc", | |
compiler_version: "v142", | |
cmake_generator: "Visual Studio 17 2022", | |
libcxx: false, | |
sanitize: true | |
} | |
- { | |
prefix: "Windows 2019", | |
os: windows_2019, | |
compiler_name: "msvc", | |
compiler_version: "v142", | |
cmake_generator: "Visual Studio 16 2019", | |
libcxx: false, | |
sanitize: true | |
} | |
# msvc ClangCl | |
- { | |
prefix: "Windows 2022", | |
os: windows_2022, | |
compiler_name: "msvc", | |
compiler_version: "ClangCl", | |
cmake_generator: "Visual Studio 17 2022", | |
libcxx: false, | |
sanitize: true | |
} | |
- { | |
prefix: "Windows 2019", | |
os: windows_2019, | |
compiler_name: "msvc", | |
compiler_version: "ClangCl", | |
cmake_generator: "Visual Studio 16 2019", | |
libcxx: false, | |
sanitize: true | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clang libc++ setup | |
if: ${{ matrix.config.compiler_name == 'clang' && matrix.config.libcxx == true }} | |
run: | | |
echo "CXX_FLAGS=$(echo $CXX_FLAGS -stdlib=libc++)" >> $GITHUB_ENV | |
echo "LINK_FLAGS=$(echo $LINK_FLAGS -lc++abi)" >> $GITHUB_ENV | |
- name: Setup msvc flags | |
if: ${{ matrix.config.compiler_name == 'msvc' }} | |
run: | | |
echo "CMAKE_EXTRA=$(echo CMAKE_EXTRA -G'${{ matrix.config.cmake_generator }} -T'${{ matrix.config.compiler_version }} -Ax64')" >> $GITHUB_ENV | |
- name: Enable Address and Undefined Sanitizer | |
if: ${{ matrix.config.sanitize == true }} | |
run: | | |
echo "CMAKE_EXTRA=$(echo CMAKE_EXTRA -DSANITIZE_ADDRESS=YES -DSANITIZE_UNDEFINED=YES)" >> $GITHUB_ENV | |
- name: Configure | |
run: | | |
cmake \ | |
-S . \ | |
-B build \ | |
-D CMAKE_BUILD_TYPE=${{ matrix.build_mode }} \ | |
-D CMAKE_VERBOSE_MAKEFILE=yes \ | |
-D CMAKE_CXX_FLAGS:STRING="${{ env.CXX_FLAGS }}" \ | |
-D CMAKE_EXE_LINKER_FLAGS:STRING="${{ env.LINK_FLAGS }}" \ | |
-D MIMICPP_FORCED_CXX_STANDARD="${{ matrix.cxx_standard }}" \ | |
${{ env.CMAKE_EXTRA }} | |
- name: Build | |
run: | | |
cmake --build build -j4 | |
- name: Run tests | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
run: ctest --test-dir build/test -C ${{ matrix.build_mode }} -j4 |