-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
228 additions
and
156 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
external/** linguist-vendored | ||
|
||
# Автоматически нормализуем концы строк, если у пользователя не настроен параметр autocrlf | ||
# https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings | ||
# https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/ | ||
* text=auto | ||
|
||
# Батники с юниксовыми концами строк глючат | ||
*.bat text eol=crlf | ||
*.cmd text eol=crlf |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,215 +1,140 @@ | ||
# Copyright (c) the Dviglo project | ||
# Copyright (c) 2008-2023 the Urho3D project | ||
# License: MIT | ||
|
||
name: CI/CD | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Windows: | ||
# Job будет запущен на виртуальной машине с новейшей версией Windows | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on | ||
# https://github.com/actions/runner-images | ||
linux: | ||
runs-on: ubuntu-24.04 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
compiler: | ||
- { | ||
id: gcc, | ||
c: gcc-13, | ||
cxx: g++-13, | ||
} | ||
- { | ||
id: clang, | ||
c: clang-16, | ||
cxx: clang++-16, | ||
} | ||
build_type: [debug, release] | ||
|
||
name: 🐧-${{ matrix.compiler.id }}-${{ matrix.build_type }} | ||
|
||
steps: | ||
- name: Устанавливаем зависимости | ||
run: | | ||
sudo apt update | ||
sudo apt install libgl1-mesa-dev libxrandr-dev | ||
- name: Скачиваем репозиторий | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
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 }} \ | ||
-D DV_ALL_WARNINGS=1 -D DV_CTEST=1 | ||
- name: Компилируем | ||
run: | | ||
cmake --build build | ||
- name: CTest | ||
run: | | ||
xvfb-run ctest --verbose --test-dir build --timeout 60 | ||
windows: | ||
runs-on: windows-latest | ||
|
||
# Используем матрицу для параллельной сборки разных билдов | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategy | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
COMPILER: [vs, mingw] | ||
BUILD_TYPE: [debug, release] | ||
compiler: [vs, mingw] | ||
build_type: [debug, release] | ||
|
||
# Отображаемое имя job | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname | ||
name: 🔲-${{ matrix.COMPILER }}-${{ matrix.BUILD_TYPE }} | ||
name: 🔲-${{ matrix.compiler }}-${{ matrix.build_type }} | ||
|
||
steps: | ||
# Используем MSYS2 вместо устаревшего MinGW | ||
# https://github.com/urho3d/urho3D/issues/2887 | ||
- name: Устанавливаем MinGW | ||
if: matrix.COMPILER == 'mingw' | ||
# https://www.msys2.org/docs/ci/ | ||
# https://github.com/msys2/setup-msys2 | ||
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' | ||
if: matrix.compiler == 'mingw' | ||
shell: bash | ||
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path | ||
run: echo "${RUNNER_TEMP}/msys64/mingw64/bin" >> $GITHUB_PATH | ||
|
||
- name: Устанавливаем остальной софт | ||
shell: bash | ||
run: | | ||
choco install --no-progress graphviz.portable | ||
# choco качает Doxygen через раз. Качаем собственную сборку | ||
mkdir $GITHUB_WORKSPACE/programs | ||
cd $GITHUB_WORKSPACE/programs | ||
curl -Lso tmp.zip https://github.com/dviglo-tools/doxygen-builder/raw/main/doxygen_win64.zip && unzip tmp.zip && rm tmp.zip | ||
echo "$GITHUB_WORKSPACE/programs" >> $GITHUB_PATH | ||
echo "Собственная сборка Doxygen скачана в $GITHUB_WORKSPACE/programs" | ||
- name: Скачиваем репозиторий | ||
# https://github.com/actions/checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repo # Папка, в которую будет скачан репозиторий | ||
submodules: recursive # Движок тоже качаем | ||
fetch-depth: 0 | ||
submodules: recursive | ||
path: repo | ||
|
||
- name: Генерируем проекты | ||
shell: bash | ||
run: | | ||
ARGS=(repo -B build) # Массив аргументов | ||
args=(repo -B build) | ||
if [ "${{ matrix.COMPILER }}" == "vs" ] | ||
if [ "${{ matrix.compiler }}" == "vs" ] | ||
then | ||
ARGS+=(-G "Visual Studio 17 2022") | ||
args+=(-G "Visual Studio 17 2022") | ||
else | ||
ARGS+=(-G "MinGW Makefiles") | ||
# Для MinGW тип сборки задаётся при генерации проектов | ||
ARGS+=(-D CMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }}) | ||
args+=(-G "MinGW Makefiles") | ||
args+=(-D CMAKE_BUILD_TYPE=${{ matrix.build_type }}) | ||
fi | ||
ARGS+=(-D DV_CTEST=1) | ||
args+=(-D DV_ALL_WARNINGS=1 -D DV_CTEST=1) | ||
cmake "${ARGS[@]}" | ||
cmake "${args[@]}" | ||
- name: Компилируем | ||
shell: bash | ||
run: | | ||
ARGS=(--build build) # Массив аргументов | ||
args=(--build build) | ||
if [ "${{ matrix.COMPILER }}" == "vs" ] | ||
if [ "${{ matrix.compiler }}" == "vs" ] | ||
then | ||
# Для Visual Studio тип сборки задаётся при компиляции проектов | ||
ARGS+=(--config ${{ matrix.BUILD_TYPE }}) | ||
args+=(--config ${{ matrix.build_type }}) | ||
fi | ||
cmake "${ARGS[@]}" | ||
cmake "${args[@]}" | ||
# Виртуальная машина ГитХаба может запускать Direct3D-приложения, | ||
# но не может запускать OpenGL-приложения. Поэтому используем | ||
# предкомпилированный Mesa 3D for Windows | ||
- name: Качаем Mesa 3D | ||
- name: Качаем Mesa | ||
shell: bash | ||
run: | | ||
# Качаем и распаковываем Mesa 3D | ||
# https://curl.se/docs/manpage.html | ||
curl.exe --location --output mesa.7z --url https://github.com/pal1000/mesa-dist-win/releases/download/22.2.3/mesa3d-22.2.3-release-msvc.7z | ||
7z x mesa.7z -omesa | ||
rm mesa.7z | ||
# Перемещаем нужные dll в папку result | ||
#mv mesa/x64/dxil.dll build/result # Используется при эмуляции через DirectX | ||
mv mesa/x64/libgallium_wgl.dll build/result | ||
mv mesa/x64/libglapi.dll build/result | ||
mv mesa/x64/opengl32.dll build/result | ||
- name: CTest | ||
shell: bash {0} # Разрешаем перехват ошибок | ||
shell: bash | ||
run: | | ||
ARGS=(--test-dir build --timeout 60) # Массив аргументов | ||
args=(--verbose --test-dir build --timeout 60) | ||
if [ "${{ matrix.COMPILER }}" == "vs" ] | ||
if [ "${{ matrix.compiler }}" == "vs" ] | ||
then | ||
# Для Visual Studio нужно указывать тип сборки (конфигурацию) | ||
ARGS+=(-C ${{ matrix.BUILD_TYPE }}) | ||
args+=(-C ${{ matrix.build_type }}) | ||
fi | ||
# Настройка для Mesa (не используем DirectX для эмуляции). | ||
# Без этого не проходит тест примера pbr_materials. | ||
# https://docs.mesa3d.org/envvars.html | ||
export LIBGL_ALWAYS_SOFTWARE=true | ||
ctest "${ARGS[@]}" | ||
EXIT_CODE=$? # Код возврата предыдущей команды | ||
if (( $EXIT_CODE != 0 )) | ||
then | ||
echo "$(cat D:/a/minimal_app/minimal_app/build/Testing/Temporary/LastTest.log)" # Показываем содержимое лога | ||
exit $EXIT_CODE | ||
fi | ||
Linux_Native: | ||
runs-on: ubuntu-24.04 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
COMPILER: | ||
- { | ||
ID: gcc, | ||
#C: gcc, | ||
#CXX: g++, | ||
C: gcc-13, # Используем GCC 13, так как 12 не поддерживает std::format | ||
CXX: g++-13, | ||
} | ||
- { | ||
ID: clang, | ||
#C: clang, | ||
#CXX: clang++, | ||
C: clang-16, | ||
CXX: clang++-16, | ||
} | ||
BUILD_TYPE: | ||
- { | ||
ID: dbg, | ||
VALUE: Debug, | ||
} | ||
- { | ||
ID: rel, | ||
VALUE: Release, | ||
} | ||
|
||
name: 🐧-${{ matrix.COMPILER.ID }}-${{ matrix.BUILD_TYPE.ID }} | ||
|
||
steps: | ||
- name: Скачиваем репозиторий | ||
uses: actions/checkout@v4 | ||
with: | ||
path: repo # Папка, в которую будет скачан репозиторий | ||
submodules: recursive # Движок тоже качаем | ||
|
||
- name: Устанавливаем зависимости | ||
run: | | ||
sudo apt update | ||
# Без libxrandr-dev не получится узнать список поддерживаемых разрешений | ||
sudo apt install libgl1-mesa-dev libxrandr-dev | ||
# Репозиторий Ubuntu содержит устаревшую версию Doxygen 1.9.1. Качаем собственную сборку | ||
mkdir $HOME/programs | ||
cd $HOME/programs | ||
wget -q -O tmp.zip https://github.com/dviglo-tools/doxygen-builder/raw/main/doxygen_linux64.zip && unzip tmp.zip && rm tmp.zip | ||
echo "$HOME/programs" >> $GITHUB_PATH | ||
- name: Компилируем | ||
run: | | ||
#set -x # Echo commands | ||
echo "Current dir: $PWD" | ||
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.VALUE }} \ | ||
-D DV_CTEST=1 | ||
cmake --build build | ||
- name: CTest | ||
shell: bash {0} # Разрешаем перехват ошибок | ||
run: | | ||
xvfb-run ctest --test-dir build --timeout 60 | ||
EXIT_CODE=$? # Exit code of the previous command | ||
if (( $EXIT_CODE != 0 )) | ||
then | ||
echo "$(cat /home/runner/work/minimal_app/minimal_app/build/Testing/Temporary/LastTest.log)" | ||
exit $EXIT_CODE | ||
fi | ||
ctest "${args[@]}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "dviglo2d"] | ||
path = dviglo2d | ||
[submodule "external/dviglo2d"] | ||
path = external/dviglo2d | ||
url = https://github.com/dviglo2d/dviglo2d |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
set -x # Включаем эхо | ||
|
||
repo_dir=$(dirname "$0") | ||
|
||
git -C "$repo_dir" submodule add https://github.com/dviglo2d/dviglo2d external/dviglo2d | ||
|
||
git -C "$repo_dir" submodule update --init --recursive |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
build_type="-D CMAKE_BUILD_TYPE=Debug" | ||
#build_type="-D CMAKE_BUILD_TYPE=Release" | ||
#build_type="-D CMAKE_BUILD_TYPE=MinSizeRel" | ||
#build_type="-D CMAKE_BUILD_TYPE=RelWithDebInfo" | ||
|
||
compiler="-D CMAKE_C_COMPILER=gcc-13 -D CMAKE_CXX_COMPILER=g++-13" | ||
#compiler="-D CMAKE_C_COMPILER=clang-15 -D CMAKE_CXX_COMPILER=clang++-15" | ||
|
||
repo_dir=$(dirname "$0") | ||
|
||
# Генерируем проект | ||
cmake "$repo_dir" -B "$repo_dir/../build" -G "Unix Makefiles" $build_type $compiler | ||
|
||
# Компилируем проект | ||
cmake --build "$repo_dir/../build" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
:: Меняем кодировку консоли на UTF-8 | ||
chcp 65001 | ||
|
||
:: Указываем путь к cmake.exe и MinGW. Без system32 в PATH ссылки на папки не создаются | ||
set "PATH=%SystemRoot%\system32;c:\programs\cmake\bin;c:\msys64\ucrt64\bin" | ||
|
||
set build_type=Debug | ||
::set build_type=Release | ||
::set build_type=MinSizeRel | ||
::set build_type=RelWithDebInfo | ||
|
||
set "repo_dir=%~dp0" | ||
:: Удаляем обратный слэш в конце | ||
set "repo_dir=%repo_dir:~0,-1%" | ||
|
||
:: Генерируем проект | ||
cmake "%repo_dir%" -B "%repo_dir%/../build_mingw" -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE=%build_type% | ||
|
||
:: Компилируем проект | ||
cmake --build "%repo_dir%/../build_mingw" | ||
|
||
:: Ждём нажатие Enter перед закрытием консоли | ||
pause |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
:: Меняем кодировку консоли на UTF-8 | ||
chcp 65001 | ||
|
||
:: Указываем путь к cmake.exe. Без system32 в PATH ссылки на папки не создаются | ||
set "PATH=%SystemRoot%\system32;c:\programs\cmake\bin" | ||
|
||
set build_type=Debug | ||
::set build_type=Release | ||
::set build_type=MinSizeRel | ||
::set build_type=RelWithDebInfo | ||
|
||
set "generator=Visual Studio 17" | ||
|
||
set "repo_dir=%~dp0" | ||
:: Удаляем обратный слэш в конце | ||
set "repo_dir=%repo_dir:~0,-1%" | ||
|
||
:: Генерируем проект | ||
cmake "%repo_dir%" -B "%repo_dir%/../build_vs" -G "%generator%" -A x64 | ||
|
||
:: Компилируем проект | ||
cmake --build "%repo_dir%/../build_vs" --config %build_type% | ||
|
||
:: Ждём нажатие Enter перед закрытием консоли | ||
pause |
Submodule dviglo2d
deleted from
968d4e
Oops, something went wrong.