-
Notifications
You must be signed in to change notification settings - Fork 163
170 lines (147 loc) · 5.69 KB
/
build-sakura.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
name: build sakura
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
workflow_dispatch:
push:
paths-ignore:
- '**/*.md'
- .gitignore
- .editorconfig
- appveyor.yml
- 'azure-pipelines*.yml'
- 'ci/azure-pipelines/template*.yml'
pull_request:
paths-ignore:
- '**/*.md'
- .gitignore
- .editorconfig
- appveyor.yml
- 'azure-pipelines*.yml'
- 'ci/azure-pipelines/template*.yml'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
name: MSBuild
runs-on: windows-latest
strategy:
matrix:
config:
- Debug
- Release
platform:
- Win32
- x64
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
## see https://github.com/actions/checkout
- uses: actions/checkout@v3
with:
fetch-depth: 0
## see https://github.com/microsoft/setup-msbuild
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Setup environment variables
run: |
echo "CI_ACCOUNT_NAME=${{github.actor}}" >> $env:GITHUB_ENV
echo "CI_REPO_NAME=${{github.repository}}" >> $env:GITHUB_ENV
echo "CI_BUILD_VERSION=${{github.run_id}}" >> $env:GITHUB_ENV
echo "CI_BUILD_NUMBER=${{github.run_number}}" >> $env:GITHUB_ENV
echo("CI_BUILD_URL=" `
+ "${env:GITHUB_SERVER_URL}/${{github.repository}}/" `
+ "actions/runs/${{github.run_id}}") >> $env:GITHUB_ENV
echo("GITHUB_COMMIT_URL=" `
+ "${env:GITHUB_SERVER_URL}/${{github.repository}}/" `
+ "commit/${{github.sha}}") >> $env:GITHUB_ENV
if ('pull_request' -eq '${{github.event_name}}') {
echo("GITHUB_PR_NUMBER=" `
+ "${{github.event.pull_request.number}}") >> $env:GITHUB_ENV
echo("GITHUB_PR_HEAD_SHORT_COMMIT=" `
+ "${{github.event.pull_request.head.sha}}".SubString(0, 8)) >> $env:GITHUB_ENV
echo("GITHUB_PR_HEAD_COMMIT=" `
+ "${{github.event.pull_request.head.sha}}") >> $env:GITHUB_ENV
echo("GITHUB_PR_HEAD_URL=" `
+ "${env:GITHUB_SERVER_URL}/${{github.repository}}/" `
+ "pull/${{github.event.pull_request.number}}/" `
+ "commits/${{github.event.pull_request.head.sha}}") >> $env:GITHUB_ENV
}
shell: pwsh
- name: MSBuild
run: build-sln.bat ${{ matrix.platform }} ${{ matrix.config }}
shell: cmd
- name: Run unit tests
run: .\tests1.exe --gtest_output=xml:${{github.workspace}}\tests1.exe-googletest-${{matrix.platform}}-${{matrix.config}}.xml
working-directory: ${{github.workspace}}\${{matrix.platform}}\${{matrix.config}}
shell: pwsh
- name: Install Locale Emulator
run: |
choco install autohotkey.install --confirm
$LEExpandDir = "${{github.workspace}}\tools\locale-emulator"
$LEInitScript = "${{github.workspace}}\ci\init-locale-emulator.ahk"
New-Item "${LEExpandDir}" -ItemType Directory
Invoke-WebRequest `
"https://github.com/xupefei/Locale-Emulator/releases/download/v2.5.0.1/Locale.Emulator.2.5.0.1.zip" `
-OutFile "${LEExpandDir}\locale-emulator.zip"
Expand-Archive "${LEExpandDir}\locale-emulator.zip" "${LEExpandDir}"
Start-Process "AutoHotKey" "${LEInitScript}"
Start-Process "${LEExpandDir}\LEInstaller.exe"
echo "${LEExpandDir}" >> $env:GITHUB_PATH
shell: pwsh
- name: Build HTML Help
run: build-chm.bat
shell: cmd
- name: Update/Install Inno Setup
run: choco upgrade innosetup --confirm
shell: pwsh
- name: Build installer with Inno Setup
run: build-installer.bat ${{ matrix.platform }} ${{ matrix.config }}
shell: cmd
- name: zipArtifacts
run: zipArtifacts.bat ${{ matrix.platform }} ${{ matrix.config }}
if: ${{ matrix.config == 'Release' }}
shell: cmd
## see https://github.com/actions/upload-artifact
- name: Upload Installer
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Installer ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Installer.zip'
- name: Upload Installer MD5
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Installer MD5 ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Installer.zip.md5'
- name: Upload Exe
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Exe ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Exe.zip'
- name: Upload Exe MD5
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Exe MD5 ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Exe.zip.md5'
- name: Upload Log
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Log ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Log.zip'
- name: Upload Asm
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Asm ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Asm.zip'
- name: Upload Dev
uses: actions/upload-artifact@v3
if: ${{ matrix.config == 'Release' }}
with:
name: Dev ${{ matrix.platform }} ${{ matrix.config }}
path: 'sakura-*-Dev.zip'