forked from ihhub/fheroes2
-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (174 loc) · 8.8 KB
/
msvc.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: MSVC
on:
workflow_call:
permissions:
contents: write
jobs:
msvc:
strategy:
matrix:
config:
- name: SDL2 x86
platform: x86
build_config: Release-SDL2
deploy_config: SDL2
installer_package_name: fheroes2_windows_x86_SDL2_installer.exe
zip_package_name: fheroes2_windows_x86_SDL2.zip
tools_package_name: fheroes2_tools_windows_x86_SDL2.zip
release_name: Windows x86 build with SDL2 (latest commit)
release_tag: fheroes2-windows-x86-SDL2
- name: SDL2 x64
platform: x64
build_config: Release-SDL2
deploy_config: SDL2
installer_package_name: fheroes2_windows_x64_SDL2_installer.exe
zip_package_name: fheroes2_windows_x64_SDL2.zip
tools_package_name: fheroes2_tools_windows_x64_SDL2.zip
release_name: Windows x64 build with SDL2 (latest commit)
release_tag: fheroes2-windows-x64-SDL2
name: MSVC (${{ matrix.config.name }})
runs-on: windows-2019
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
script/windows/install_packages.bat
- name: Install MSYS2 tools
run: |
C:\msys64\usr\bin\pacman.exe -S --noconfirm --noprogressbar gettext-devel
shell: cmd
- name: Download MSVC Redistributable package
run: |
mkdir .vcredist && ^
C:\msys64\usr\bin\wget.exe -O .vcredist/vcredist.exe "%VCREDIST_URL%"
shell: cmd
env:
# Permalink URL from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170
VCREDIST_URL: https://aka.ms/vs/17/release/vc_redist.${{ matrix.config.platform }}.exe
- name: Verify MSVC Redistributable package
run: |
"%SIGNTOOL_DIR%\signtool.exe" verify /v /d /all /pa /r "Microsoft Root Certificate Authority" .vcredist\vcredist.exe
shell: cmd
env:
SIGNTOOL_DIR: C:\Program Files (x86)\Windows Kits\10\bin\x64
- name: Generate version information
run: |
echo "FHEROES2_APP_VERSION=$(cat version.txt)" >> "$GITHUB_ENV"
- uses: microsoft/setup-msbuild@v2
- name: Build
run: |
MSBuild.exe fheroes2-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
- name: Build tools
run: |
cd src/tools
MSBuild.exe 82m2wav-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe bin2txt-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe extractor-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe h2dmgr-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe icn2img-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe pal2img-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe til2img-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
MSBuild.exe xmi2midi-vs2019.vcxproj /property:Platform=${{ matrix.config.platform }} /property:Configuration=${{ matrix.config.build_config }}
- name: Generate translations
run: |
set PATH=C:\msys64\usr\bin;%PATH%
C:\msys64\usr\bin\make.exe -C files/lang -j 2
shell: cmd
- name: Create Inno Setup package
run: |
iscc.exe script\windows\fheroes2.iss /DAppVersion="%FHEROES2_APP_VERSION%" /DBuildDir="..\..\%BUILD_DIR%" ^
/DPlatform=${{ matrix.config.platform }} /DDeployConfName=${{ matrix.config.deploy_config }}
shell: cmd
env:
BUILD_DIR: build\${{ matrix.config.platform }}\${{ matrix.config.build_config }}
- name: Create ZIP package
run: |
7z.exe a -bb1 -tzip -- "$BUILD_DIR"\\${{ matrix.config.zip_package_name }} \
.\\"$BUILD_DIR"\\fheroes2.exe \
.\\"$BUILD_DIR"\\*.dll \
LICENSE \
changelog.txt \
.\\docs\\README.txt \
files\\data\\*.h2d \
files\\lang\\*.mo \
files\\soundfonts\\* \
.\\script\\demo\\*.bat \
.\\script\\demo\\*.ps1 \
.\\script\\homm2\\*.bat \
.\\script\\homm2\\*.ps1
env:
BUILD_DIR: build\${{ matrix.config.platform }}\${{ matrix.config.build_config }}
- name: Create tools package
if: ${{ matrix.config.tools_package_name != '' }}
run: |
7z.exe a -bb1 -tzip -- "$BUILD_DIR"\\${{ matrix.config.tools_package_name }} \
.\\"$BUILD_DIR"\\82m2wav.exe \
.\\"$BUILD_DIR"\\bin2txt.exe \
.\\"$BUILD_DIR"\\extractor.exe \
.\\"$BUILD_DIR"\\h2dmgr.exe \
.\\"$BUILD_DIR"\\icn2img.exe \
.\\"$BUILD_DIR"\\pal2img.exe \
.\\"$BUILD_DIR"\\til2img.exe \
.\\"$BUILD_DIR"\\xmi2midi.exe \
.\\"$BUILD_DIR"\\zlib1.dll \
LICENSE \
.\\docs\\GRAPHICAL_ASSETS.md \
.\\script\\agg\\extract_agg.bat
if [[ ${{ matrix.config.deploy_config }} == SDL2 ]]; then
7z.exe a -bb1 -tzip -- "$BUILD_DIR"\\${{ matrix.config.tools_package_name }} \
.\\"$BUILD_DIR"\\SDL2.dll \
.\\"$BUILD_DIR"\\SDL2_image.dll
else
false
fi
env:
BUILD_DIR: build\${{ matrix.config.platform }}\${{ matrix.config.build_config }}
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: ${{ matrix.config.installer_package_name }}
path: build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.installer_package_name }}
if-no-files-found: error
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' }}
with:
name: ${{ matrix.config.zip_package_name }}
path: build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.zip_package_name }}
if-no-files-found: error
- uses: actions/upload-artifact@v4
if: ${{ github.event_name == 'pull_request' && matrix.config.tools_package_name != '' }}
with:
name: ${{ matrix.config.tools_package_name }}
path: build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.tools_package_name }}
if-no-files-found: error
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' && matrix.config.tools_package_name == '' }}
with:
artifacts: build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.installer_package_name }},
build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.zip_package_name }}
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.config.release_name }}
tag: ${{ matrix.config.release_tag }}
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true
- uses: ncipollo/release-action@v1
if: ${{ github.event_name == 'push' && matrix.config.tools_package_name != '' }}
with:
artifacts: build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.installer_package_name }},
build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.zip_package_name }},
build/${{ matrix.config.platform }}/${{ matrix.config.build_config }}/${{ matrix.config.tools_package_name }}
body: ${{ github.event.head_commit.message }}
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.config.release_name }}
tag: ${{ matrix.config.release_tag }}
allowUpdates: true
artifactErrorsFailBuild: true
prerelease: true
replacesArtifacts: true