Тутор: Уменьшаем шанс промаха при делении | Синхронизировал тутор с б… #367
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
# Copyright (c) the Dviglo project | |
# License: MIT | |
name: Tester | |
on: | |
push: | |
pull_request: | |
jobs: | |
windows: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: [vs, mingw] | |
build_type: [debug, release] | |
name: windows-${{ matrix.compiler }}-${{ matrix.build_type }} | |
steps: | |
- name: Устанавливаем MinGW | |
if: matrix.compiler == 'mingw' | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
install: mingw-w64-x86_64-toolchain | |
- name: Добавляем в PATH путь к MinGW | |
if: matrix.compiler == 'mingw' | |
shell: bash | |
run: echo "${RUNNER_TEMP}/msys64/mingw64/bin" >> $GITHUB_PATH | |
- name: Скачиваем репозиторий | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: repo | |
- name: Генерируем проекты | |
shell: bash | |
run: | | |
args=(repo -B build) | |
if [ "${{ matrix.compiler }}" == "vs" ] | |
then | |
args+=(-G "Visual Studio 17 2022") | |
else | |
args+=(-G "MinGW Makefiles") | |
args+=(-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}) | |
fi | |
cmake "${args[@]}" | |
- name: Компилируем | |
shell: bash | |
run: | | |
args=(--build build) | |
if [ "${{ matrix.compiler }}" == "vs" ] | |
then | |
args+=(--config ${{ matrix.build_type }}) | |
fi | |
cmake "${args[@]}" | |
- name: CTest | |
shell: bash | |
run: | | |
args=(--verbose --test-dir build --timeout 60) | |
if [ "${{ matrix.compiler }}" == "vs" ] | |
then | |
args+=(-C ${{ matrix.build_type }}) | |
fi | |
ctest "${args[@]}" | |
linux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
compiler: | |
- { | |
id: gcc, | |
c: gcc-13, | |
cxx: g++-13, | |
} | |
- { | |
id: clang, | |
c: clang-13, | |
cxx: clang++-13, | |
} | |
build_type: [debug, release] | |
name: linux-${{ matrix.compiler.id }}-${{ matrix.build_type }} | |
steps: | |
- name: Скачиваем репозиторий | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: repo | |
- name: Генерируем проекты | |
run: | | |
cmake repo -B build -G "Unix Makefiles" \ | |
-D CMAKE_C_COMPILER=${{ matrix.compiler.c }} -D CMAKE_CXX_COMPILER=${{ matrix.compiler.cxx }} \ | |
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
- name: Компилируем | |
run: | | |
cmake --build build | |
- name: CTest | |
run: | | |
ctest --verbose --test-dir build --timeout 60 |