-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy path.appveyor.yml
150 lines (113 loc) · 4.65 KB
/
.appveyor.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
# Notes:
# - Minimal appveyor.yml file is an empty file. All sections are optional.
# - Indent each level of configuration with 2 spaces. Do not use tabs!
# - All section names are case-sensitive.
# - Section names should be unique on each level.
#---------------------------------#
# general configuration #
#---------------------------------#
# version format
version: '{branch}-{build}'
# manual mode
branches:
except:
- /.*/
# Do not build on tags (GitHub only)
skip_tags: true
#---------------------------------#
# environment configuration #
#---------------------------------#
# environment variables
# build system info: https://www.appveyor.com/docs/windows-images-software/
os: Visual Studio 2022
environment:
PROJECT_DIR: &PROJECT_DIR c:\project
REPO_DIR: c:\project\windows-chewing-tsf # directory created by appveyor
BUILD_DIR: c:\build
INST_DIR: c:\build\installer
NSIS_EXE: c:\Program Files (x86)\NSIS\makensis.exe
SQLITE_URL: https://www.sqlite.org/2024/sqlite-amalgamation-3460000.zip
SQLITE_HASH: 1221eed70de626871912bfca144c00411f0c30d3c2b7935cff3963b63370ef7c
CMAKE_GEN_X86: -G "Visual Studio 17 2022" -A "Win32"
CMAKE_GEN_X64: -G "Visual Studio 17 2022" -A "x64"
RUSTUP_URL: https://win.rustup.rs/x86_64
SOL_FILE: windows-chewing-tsf.sln
MSBUILD_CMD_X86: /maxcpucount /property:Configuration=Release,Platform=Win32 /target:ChewingPreferences,ChewingTextService,all_static_data,data
MSBUILD_CMD_X64: /maxcpucount /property:Configuration=Release,Platform=x64 /target:ChewingTextService
# clone directory
clone_folder: *PROJECT_DIR
# set clone depth
clone_depth: 1
#---------------------------------#
# build configuration #
#---------------------------------#
# scripts to run before build
before_build:
# git submodules
- 'cd "%REPO_DIR%"'
- 'git submodule update --init --remote --recursive'
# use bleeding-edge libchewing
- 'cd "%REPO_DIR%"\libchewing'
- 'git checkout master'
- 'git log -1'
# update sqlite
- 'cd "%REPO_DIR%"'
- powershell -Command "& { (Get-Content 'CMakeLists.txt') | ForEach-Object { $_ -replace 'URL https://www.sqlite.org/.*$', 'URL %SQLITE_URL%' } | ForEach-Object { $_ -replace 'URL_HASH .*$', 'URL_HASH SHA3_256=%SQLITE_HASH%' } | Set-Content 'CMakeLists.txt' }"
# install Rust
- 'cd \'
- 'appveyor DownloadFile "%RUSTUP_URL%" -FileName "rustup-init.exe"'
- 'rustup-init.exe -y --default-toolchain stable-x86_64-pc-windows-msvc'
- 'set PATH=%PATH%;%USERPROFILE%\.cargo\bin'
- 'rustup target add i686-pc-windows-msvc'
- 'rustup show -v'
# to run your custom scripts instead of automatic MSBuild
build_script:
# build start
- 'mkdir "%BUILD_DIR%"'
# build x86
- 'cd "%BUILD_DIR%" && mkdir "x86" && cd "x86"'
- 'cmake %CMAKE_GEN_X86% "%REPO_DIR%"'
- 'msbuild %SOL_FILE% %MSBUILD_CMD_X86%'
# build x64
- 'cd "%BUILD_DIR%" && mkdir "x64" && cd "x64"'
- 'cmake %CMAKE_GEN_X64% "%REPO_DIR%"'
- 'msbuild %SOL_FILE% %MSBUILD_CMD_X64%'
# scripts to run before deployment
after_build:
# prepare for NSIS
- 'mkdir "%INST_DIR%" && cd "%INST_DIR%"'
- 'copy "%REPO_DIR%\installer\*" ".\"'
- 'copy "%REPO_DIR%\COPYING.txt" ".\..\"' # special case for LICENSE file
- 'cd "%INST_DIR%" && mkdir "Dictionary"'
- 'copy "%BUILD_DIR%\x86\libchewing\data\*.dat" ".\Dictionary"'
- 'copy "%BUILD_DIR%\x86\libchewing\data\*.tab" ".\Dictionary"'
- 'cd "%INST_DIR%" && mkdir "x86"'
- 'copy "%BUILD_DIR%\x86\ChewingTextService\Release\*.dll" ".\x86"'
- 'copy "%BUILD_DIR%\x86\libchewing\chewing-cli.exe" "."'
- 'copy "%BUILD_DIR%\x86\libchewing\Release\*.dll" ".\x86"'
- 'copy "%BUILD_DIR%\x86\ChewingPreferences\Release\*.exe" "."'
- 'cd "%INST_DIR%" && mkdir "x64"'
- 'copy "%BUILD_DIR%\x64\libchewing\Release\*.dll" ".\x64"'
- 'copy "%BUILD_DIR%\x64\ChewingTextService\Release\*.dll" ".\x64"'
# run NSIS
- 'cd "%INST_DIR%"'
- '"%NSIS_EXE%" "installer.nsi"'
# prepare for artifacts packaging
- 'cd "%INST_DIR%"'
- 'copy "windows-chewing-tsf.exe" "%PROJECT_DIR%"' # the artifact must reside at the source repo root
# generate hash
- 'cd "%PROJECT_DIR%"'
- 'powershell -Command "& { $hash = (Get-FileHash -Algorithm SHA256 "windows-chewing-tsf.exe").hash.ToString().toLower(); Write-Host $hash " *windows-chewing-tsf.exe"; }" > "windows-chewing-tsf.exe.sha256"'
#---------------------------------#
# tests configuration #
#---------------------------------#
# to disable automatic tests
test: off
#---------------------------------#
# artifacts configuration #
#---------------------------------#
artifacts:
- path: windows-chewing-tsf.exe
name: installer
- path: windows-chewing-tsf.exe.sha256
name: checksum