This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathappveyor.yml
162 lines (137 loc) · 9.43 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
151
152
153
154
155
156
157
158
159
160
161
162
version: 1.0.{build}
clone_folder: c:\projects\kiwix-hotspot
image: Visual Studio 2017
build: off
environment:
kiwix_certificate_secret:
secure: 5NoKiSa8D/4H1mZDpW/QvQ==
platform:
- x64
- x86
install:
- set PATH=C:\Program Files (x86)\Windows Kits\10\bin\%platform%\;%PATH%
# send all non-release build to tmp.kiwix.org except cron to nightly folder
- ps: if ($env:APPVEYOR_SCHEDULED_BUILD -eq "true") { "/data/download/nightly/" | Out-File C:\destination-ps.txt -NoNewline -Encoding ASCII; Get-Date -UFormat "%Y-%m-%d" | Out-File C:\destination-ps.txt -Append -NoNewline -Encoding ASCII; "ci" | Out-File C:\user-ps.txt -NoNewline -Encoding ASCII; "download.kiwix.org" | Out-File C:\host-ps.txt -NoNewline -Encoding ASCII } else { "/data/tmp/ci" | Out-File C:\destination-ps.txt -NoNewline -Encoding ASCII; "ci" | Out-File C:\user-ps.txt -NoNewline -Encoding ASCII; "tmp.kiwix.org" | Out-File C:\host-ps.txt -NoNewline -Encoding ASCII; }
# store branch name
- if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (echo %APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% > branch.txt) else (echo %APPVEYOR_REPO_BRANCH% > branch.txt)
- move branch.txt C:\msys64\home\appveyor\
# store tag name
- if defined APPVEYOR_REPO_TAG_NAME (echo %APPVEYOR_REPO_TAG_NAME% > C:\msys64\home\appveyor\tag.txt)
# build-up version
- ps: |
$scommit = (git rev-parse --short $env:APPVEYOR_REPO_COMMIT) | Out-String
$scommit = $scommit.Trim()
If ($env:APPVEYOR_REPO_TAG_NAME) {
$version = $env:APPVEYOR_REPO_TAG_NAME.Substring(1)
} Elseif ($env:APPVEYOR_SCHEDULED_BUILD -eq "true") {
$version="nightly (" + $scommit + ")"
} Else {
$version="CI (" + $scommit + ")"
}
(Get-Content kiwix-hotspot\data.py).replace('devel', $version) | Set-Content kiwix-hotspot\data.py
# decrypt certificates
- C:\OpenSSL-v111-Win32\bin\openssl.exe enc -d -aes-256-cbc -md sha256 -pass pass:%win_certificate_secret% -in kiwix.p12.enc -out kiwix.pfx
- nuget install secure-file -ExcludeVersion
- choco install reshack.portable -y
- secure-file\tools\secure-file -decrypt pibox_installer_ci_rsa.appveyor_enc -secret %certificate_secret% -out pibox_installer_ci_rsa
# Download vexpress-boot
- appveyor DownloadFile "http://mirror.download.kiwix.org/dev/vexpress-boot.zip"
- 7z.exe x vexpress-boot.zip
# Install pygobject
# pygi-aio provides a way to install from cmd even if it is not documented
# the only package to install is GTK with GIR
# note: we don't use msys2 because pyinstaller fails to install on msys2
- appveyor DownloadFile "http://mirror.download.kiwix.org/dev/pygi-aio-3.18.2_rev12-setup_549872deadabb77a91efbc56c50fe15f969e5681.exe" -FileName "pygi-aio-setup.exe"
- mkdir pygi-aio-setup
- cd pygi-aio-setup
- set SOURCEPATH=%cd%
- 7z.exe x ..\pygi-aio-setup.exe
- cd setup
- del 7zr.exe
- 7z.exe x ..\setup.exe
- set GIR=True
# note: we use python34 because it is the last supported by pygi-aio
- if %platform%==x86 rcmd.exe /c setup.bat C:\Python34 GTK
- if %platform%==x64 rcmd.exe /c setup.bat C:\Python34-x64 GTK
# note: we create a symbolic link for pyinstaller
- if %platform%==x86 mklink /D C:\Python34\share C:\Python34\Lib\site-packages\gnome\share
- if %platform%==x64 mklink /D C:\Python34-x64\share C:\Python34-x64\Lib\site-packages\gnome\share
- cd ..\..
- if %platform%==x86 dir C:\Python34\Lib\site-packages\gi
- if %platform%==x64 dir C:\Python34-x64\Lib\site-packages\gi
# Install gdk-pixbuf and add it to PATH because it is needed by pyinstaller
- if %platform%==x86 C:\msys64\usr\bin\bash --login -c "pacman -S mingw-w64-i686-gdk-pixbuf2 --noconfirm"
- if %platform%==x86 set PATH=%PATH%;C:\msys64\mingw32\bin
- if %platform%==x64 C:\msys64\usr\bin\bash --login -c "pacman -S mingw-w64-x86_64-gdk-pixbuf2 --noconfirm"
- if %platform%==x64 set PATH=%PATH%;C:\msys64\mingw64\bin
# Install pyinstaller and requirements
- cd C:\projects\kiwix-hotspot
- if %platform%==x86 C:\Python34\python.exe -m pip install pypiwin32==219 pyinstaller==3.2.1 -r requirements-windows.txt
- if %platform%==x64 C:\Python34-x64\python.exe -m pip install pypiwin32==219 pyinstaller==3.2.1 -r requirements-windows.txt
# Install qemu
- mkdir "C:\Program Files\qemu"
- cd "C:\Program Files\qemu"
- if %platform%==x86 appveyor DownloadFile "http://mirror.download.kiwix.org/dev/qemu-w32-setup-20190218.exe" -FileName "qemu-setup.exe"
- if %platform%==x64 appveyor DownloadFile "http://mirror.download.kiwix.org/dev/qemu-w64-setup-20190218.exe" -FileName "qemu-setup.exe"
- 7z x qemu-setup.exe
- del qemu-setup.exe
- move qemu-system-arm.exe qemu-arm.exe
- rmdir /S /Q keymaps lib share $PLUGINSDIR
- del qemu-system-*
- move qemu-arm.exe qemu-system-arm.exe
- dir "C:\Program Files\qemu"
# bundle 7zip
- mkdir "C:\Program Files\7zextra"
- cd "C:\Program Files\7zextra"
- appveyor DownloadFile "http://mirror.download.kiwix.org/dev/7z920_extra.7z"
- 7z.exe x 7z920_extra.7z
- appveyor DownloadFile "http://mirror.download.kiwix.org/dev/7z1805-extra.7z"
- 7z.exe -y x 7z1805-extra.7z
# Copy Imdisk Installer
- mkdir "C:\Program Files\imdiskinst"
- cd "C:\Program Files\imdiskinst"
- appveyor DownloadFile "http://mirror.download.kiwix.org/dev/imdiskinst.exe" -FileName "imdiskinst.exe"
- 7z x imdiskinst.exe
- del imdiskinst.exe
- dir "C:\Program Files\imdiskinst"
# Download Etcher-cli
- mkdir "C:\Program Files\etcher-cli"
- cd "C:\Program Files\etcher-cli"
- if %platform%==x86 appveyor DownloadFile "http://mirror.download.kiwix.org/dev/Etcher-cli-1.1.2-win32-x86.zip" -FileName "etcher-cli.zip"
- if %platform%==x64 appveyor DownloadFile "http://mirror.download.kiwix.org/dev/Etcher-cli-1.1.2-win32-x64.zip" -FileName "etcher-cli.zip"
- 7z.exe x etcher-cli.zip
- del etcher-cli.zip
# Download aria2
- cd C:\projects\kiwix-hotspot
- if %platform%==x86 appveyor DownloadFile "http://mirror.download.kiwix.org/dev/aria2c-win32.zip" -FileName "aria2c.zip"
- if %platform%==x64 appveyor DownloadFile "http://mirror.download.kiwix.org/dev/aria2c-win64.zip" -FileName "aria2c.zip"
- 7z.exe x aria2c.zip
- del aria2c.zip
- appveyor DownloadFile "http://mirror.download.kiwix.org/dev/ca-certificates.crt" -FileName "ca-certificates.crt"
# Run pyinstaller and show warning
- cd C:\projects\kiwix-hotspot
- if %platform%==x86 C:\Python34\python.exe C:\Python34\Scripts\pyinstaller-script.py --log-level=DEBUG kiwix-hotspot-win32.spec
- if %platform%==x64 C:\Python34-x64\python.exe C:\Python34-x64\Scripts\pyinstaller-script.py --log-level=DEBUG kiwix-hotspot-win64.spec
# Deploy
- cd C:\projects\kiwix-hotspot\dist\kiwix-hotspot
- 7z.exe a -m0=Copy C:\projects\kiwix-hotspot\windows_bundle\kiwix-hotspot.7z *
# download tools
- cd C:\projects\kiwix-hotspot\windows_bundle\
# create SFX exe from 7z archive
- copy /b "C:\Program Files\7zextra\7zS.sfx" + sfxconfig.txt + kiwix-hotspot.7z kiwix-hotspot.exe
# change icon and add version info to exe
- copy ..\kiwix-hotspot-logo.ico icon.ico
- C:\ProgramData\chocolatey\lib\reshack.portable\tools\ResourceHacker.exe -open resources.rc -save resources.res -action compile -log CONSOLE
# not changing version info due to a bug in Appveyor/ResourceHacker
#- C:\ProgramData\chocolatey\lib\reshack.portable\tools\ResourceHacker.exe -open kiwix-hotspot.exe -save kiwix-hotspot.exe -action addoverwrite -res resources.res -mask VERSIONINFO,1, -log CONSOLE
- C:\ProgramData\chocolatey\lib\reshack.portable\tools\ResourceHacker.exe -open kiwix-hotspot.exe -save kiwix-hotspot.exe -action addoverwrite -res icon.ico -mask ICONGROUP,MAINICON, -log CONSOLE
- timeout 10
- cd C:\projects\kiwix-hotspot\dist\kiwix-hotspot
# sign the build
- signtool.exe sign /f C:\projects\kiwix-hotspot\kiwix.pfx /p %win_certificate_password% /t http://timestamp.verisign.com/scripts/timstamp.dll /d "Kiwix Hotspot" C:\projects\kiwix-hotspot\windows_bundle\kiwix-hotspot.exe
- if %platform%==x86 move C:\projects\kiwix-hotspot\windows_bundle\kiwix-hotspot.exe C:\msys64\home\appveyor\kiwix-hotspot-win32.exe
- if %platform%==x64 move C:\projects\kiwix-hotspot\windows_bundle\kiwix-hotspot.exe C:\msys64\home\appveyor\kiwix-hotspot-win64.exe
- move C:\projects\kiwix-hotspot\pibox_installer_ci_rsa C:\msys64\home\appveyor\
- if %platform%==x86 C:\msys64\usr\bin\bash --login -c "DESTINATION=$(cat /c/destination-ps.txt | tr -d '\r' | tr -d '\n') ; USER=$(cat /c/user-ps.txt | tr -d '\r' | tr -d '\n') ; HOST=$(cat /c/host-ps.txt | tr -d '\r' | tr -d '\n') ; scp -r -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa kiwix-hotspot-win32.exe $USER@$HOST:$DESTINATION/kiwix-hotspot-win32-$(cat branch.txt | sed 's/ //g').exe"
- if %platform%==x64 C:\msys64\usr\bin\bash --login -c "DESTINATION=$(cat /c/destination-ps.txt | tr -d '\r' | tr -d '\n') ; USER=$(cat /c/user-ps.txt | tr -d '\r' | tr -d '\n') ; HOST=$(cat /c/host-ps.txt | tr -d '\r' | tr -d '\n') ; scp -r -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa kiwix-hotspot-win64.exe $USER@$HOST:$DESTINATION/kiwix-hotspot-win64-$(cat branch.txt | sed 's/ //g').exe"
- C:\msys64\usr\bin\bash --login -c "PIBOX_RELEASE=$(cat tag.txt | sed 's/ //g' | grep -x 'v[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)*\(-rc[[:digit:]]\+\)\?') || true; if [ $PIBOX_RELEASE ]; then mkdir -p releases/$PIBOX_RELEASE/; cp kiwix-hotspot-win*.exe releases/$PIBOX_RELEASE/; scp -r -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa releases/$PIBOX_RELEASE [email protected]:/data/download/release/kiwix-hotspot/; fi"