-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (110 loc) · 3.07 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright (c) the Dviglo project
# Copyright (c) 2008-2023 the Urho3D project
# License: MIT
name: CI/CD
on:
push:
pull_request:
jobs:
windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
compiler: [vs, mingw]
build_type: [debug, release]
name: 🔲-${{ 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 {0}
run: |
args=(--test-dir build --timeout 60)
if [ "${{ matrix.compiler }}" == "vs" ]
then
args+=(-C ${{ matrix.build_type }})
fi
ctest "${args[@]}"
exit_code=$?
if (( $exit_code != 0 ))
then
echo "$(cat ${GITHUB_WORKSPACE}/build/Testing/Temporary/LastTest.log)"
exit $exit_code
fi
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: 🐧-${{ 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
shell: bash {0}
run: |
ctest --test-dir build --timeout 60
exit_code=$?
if (( $exit_code != 0 ))
then
echo "$(cat ${GITHUB_WORKSPACE}/build/Testing/Temporary/LastTest.log)"
exit $exit_code
fi