8
8
pull_request :
9
9
env :
10
10
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
11
- BUILD_TYPE : Release
11
+ BUILD_TYPE : RelWithDebInfo
12
12
13
13
jobs :
14
14
build :
@@ -17,22 +17,18 @@ jobs:
17
17
include :
18
18
- platform : linux
19
19
os : ubuntu-20.04
20
- cc : clang-10
21
- cxx : clang++-10
22
20
test : 0
23
- cmake_args : -G Ninja
21
+ preset : linux-clang-release
24
22
- platform : linux
25
23
os : ubuntu-20.04
26
- cc : gcc-9
27
- cxx : g++-9
28
24
test : 0
29
- cmake_args : -G Ninja
25
+ preset : linux-gcc-release
30
26
- platform : mac
31
27
os : macos-latest
32
28
test : 0
33
29
pack : 1
34
30
extension : dmg
35
- cmake_args : -G Ninja
31
+ preset : macos-ninja-release
36
32
- platform : mxe
37
33
os : ubuntu-20.04
38
34
mxe : i686-w64-mingw32.shared
@@ -46,15 +42,14 @@ jobs:
46
42
test : 0
47
43
pack : 1
48
44
extension : exe
49
- cmake_args : -G "Visual Studio 17 2022" -A x64 '-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake'
50
-
45
+ preset : windows-msvc-release
51
46
runs-on : ${{ matrix.os }}
52
47
defaults :
53
48
run :
54
49
shell : bash
55
50
56
51
steps :
57
- - uses : actions/checkout@v2
52
+ - uses : actions/checkout@v3
58
53
with :
59
54
submodules : recursive
60
55
63
58
env :
64
59
MXE_TARGET : ${{ matrix.mxe }}
65
60
VCMI_BUILD_PLATFORM : x64
66
-
61
+
67
62
- name : Git branch name
68
63
id : git-branch-name
69
64
uses : EthanSK/git-branch-name-action@v1
@@ -77,73 +72,80 @@ jobs:
77
72
PULL_REQUEST : ${{ github.event.pull_request.number }}
78
73
79
74
- name : Configure CMake
75
+ if : " ${{ matrix.preset == '' }}"
80
76
run : |
81
- mkdir '${{github.workspace}}/build'
82
- cd '${{github.workspace}}/build'
83
- cmake ${{matrix.cmake_args}} .. -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
77
+ mkdir -p '${{github.workspace}}/out/build/${{matrix.preset}}'
78
+ cd '${{github.workspace}}/out/build/${{matrix.preset}}'
79
+ cmake \
80
+ ../.. -GNinja \
81
+ ${{matrix.cmake_args}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
84
82
-DENABLE_TEST=${{matrix.test}} \
85
83
-DPACKAGE_NAME_SUFFIX:STRING="$VCMI_PACKAGE_NAME_SUFFIX" \
86
84
-DPACKAGE_FILE_NAME:STRING="$VCMI_PACKAGE_FILE_NAME"
87
85
env :
88
86
CC : ${{ matrix.cc }}
89
87
CXX : ${{ matrix.cxx }}
90
88
89
+ - name : CMake Preset
90
+ if : " ${{ matrix.preset != '' }}"
91
+ run : |
92
+ cmake --preset ${{ matrix.preset }}
93
+
91
94
- name : Build
92
- if : ${{ matrix.platform != 'msvc ' }}
95
+ if : " ${{ matrix.preset == ' ' }}"
93
96
run : |
94
- cd '${{github.workspace}}/build'
95
- ninja
96
-
97
- - name : Build MSVC
98
- if : ${{ matrix.platform == 'msvc' }}
97
+ cmake --build '${{github.workspace}}/out/build/${{matrix.preset}}'
98
+
99
+ - name : Build Preset
100
+ if : " ${{ matrix.preset != '' }}"
99
101
run : |
100
- cd '${{github.workspace}}/build'
101
- cmake --build . --config ${{env.BUILD_TYPE}}
102
+ cmake --build --preset ${{matrix.preset}}
102
103
103
104
- name : Test
104
- if : ${{ matrix.test == 1 }}
105
+ if : ${{ matrix.test == 1 && matrix.preset != '' }}
105
106
run : |
106
- cd '${{github.workspace}}/build'
107
- ctest -C Release -V
108
-
107
+ ctest --preset ${{matrix.preset}}
108
+
109
109
- name : Pack
110
110
id : cpack
111
111
if : ${{ matrix.pack == 1 }}
112
112
run : |
113
- cd '${{github.workspace}}/build'
113
+ cd '${{github.workspace}}/out/ build/${{matrix.preset}} '
114
114
CPACK_PATH=`which -a cpack | grep -m1 -v -i chocolatey`
115
- "$CPACK_PATH" -C Release ${{ matrix.cpack_args }}
116
-
115
+ "$CPACK_PATH" -C ${{env.BUILD_TYPE}} ${{ matrix.cpack_args }}
116
+ rm -rf _CPack_Packages
117
+
117
118
- name : Additional logs
118
119
if : ${{ failure() && steps.cpack.outcome == 'failure' && matrix.platform == 'mxe' }}
119
120
run : |
120
- cat '${{github.workspace}}/build/_CPack_Packages/win32/NSIS/project.nsi'
121
- cat '${{github.workspace}}/build/_CPack_Packages/win32/NSIS/NSISOutput.log'
122
-
121
+ cat '${{github.workspace}}/out/ build/${{matrix.preset}} /_CPack_Packages/win32/NSIS/project.nsi'
122
+ cat '${{github.workspace}}/out/ build/${{matrix.preset}} /_CPack_Packages/win32/NSIS/NSISOutput.log'
123
+
123
124
- name : Artifacts
124
125
if : ${{ matrix.pack == 1 }}
125
- uses : actions/upload-artifact@v2
126
+ uses : actions/upload-artifact@v3
126
127
with :
127
128
name : ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }}
128
- path : ${{github.workspace}}/build/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
129
-
129
+ path : |
130
+ ${{github.workspace}}/**/${{ env.VCMI_PACKAGE_FILE_NAME }}.${{ matrix.extension }}
131
+
130
132
- name : Upload build
131
133
if : ${{ matrix.pack == 1 && github.ref == 'refs/heads/develop' && matrix.platform != 'msvc' }}
132
134
run : |
133
- cd '${{github.workspace}}/build'
135
+ cd '${{github.workspace}}/out/ build/${{matrix.preset}} '
134
136
source '${{github.workspace}}/CI/upload_package.sh'
135
137
env :
136
138
DEPLOY_RSA : ${{ secrets.DEPLOY_RSA }}
137
139
PACKAGE_EXTENSION : ${{ matrix.extension }}
138
-
140
+
139
141
- uses : act10ns/slack@v1
140
142
with :
141
143
status : ${{ job.status }}
142
144
channel : ' #notifications'
143
145
env :
144
146
SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
145
147
if : always()
146
-
148
+
147
149
- name : Trigger Android
148
150
uses : peter-evans/repository-dispatch@v1
149
151
if : ${{ github.ref == 'refs/heads/develop' && matrix.platform == 'mxe' }}
0 commit comments