appveyor.yml 9.32 KB
Newer Older
thiolliere's avatar
thiolliere committed
1
2
version: 1.0.{build}

3
clone_folder: c:\projects\kiwix-hotspot
thiolliere's avatar
thiolliere committed
4

5
image: Visual Studio 2017
thiolliere's avatar
thiolliere committed
6
7
8

build: off

9
10
11
12
environment:
  kiwix_certificate_secret:
    secure: 5NoKiSa8D/4H1mZDpW/QvQ==

thiolliere's avatar
thiolliere committed
13
14
platform:
  - x64
rgaudin's avatar
rgaudin committed
15
  - x86
thiolliere's avatar
thiolliere committed
16

thiolliere's avatar
thiolliere committed
17
install:
rgaudin's avatar
rgaudin committed
18
  - set PATH=C:\Program Files (x86)\Windows Kits\10\bin\%platform%\;%PATH%
19

20
  # send all non-release build to tmp.kiwix.org except cron to nightly folder
21
  - 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; }
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  # 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 + ")"
      }
39
      (Get-Content kiwix-hotspot\data.py).replace('devel', $version) | Set-Content kiwix-hotspot\data.py
40

rgaudin's avatar
rgaudin committed
41
  # decrypt certificates
42
  - 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
thiolliere's avatar
thiolliere committed
43
  - nuget install secure-file -ExcludeVersion
44
  - choco install reshack.portable -y
thiolliere's avatar
thiolliere committed
45
  - secure-file\tools\secure-file -decrypt pibox_installer_ci_rsa.appveyor_enc -secret %certificate_secret% -out pibox_installer_ci_rsa
thiolliere's avatar
thiolliere committed
46

47
  # Download vexpress-boot
rgaudin's avatar
rgaudin committed
48
  - appveyor DownloadFile "http://mirror.download.kiwix.org/dev/vexpress-boot.zip"
49
  - 7z.exe x vexpress-boot.zip
thiolliere's avatar
thiolliere committed
50

thiolliere's avatar
thiolliere committed
51
  # Install pygobject
thiolliere's avatar
README    
thiolliere committed
52
53
54
  # 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
rgaudin's avatar
rgaudin committed
55
  - appveyor DownloadFile "http://mirror.download.kiwix.org/dev/pygi-aio-3.18.2_rev12-setup_549872deadabb77a91efbc56c50fe15f969e5681.exe" -FileName "pygi-aio-setup.exe"
thiolliere's avatar
thiolliere committed
56
57
58
59
60
61
62
63
  - 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
thiolliere's avatar
README    
thiolliere committed
64
  # note: we use python34 because it is the last supported by pygi-aio
65
66
  - if %platform%==x86 rcmd.exe /c setup.bat C:\Python34 GTK
  - if %platform%==x64 rcmd.exe /c setup.bat C:\Python34-x64 GTK
thiolliere's avatar
README    
thiolliere committed
67
  # note: we create a symbolic link for pyinstaller
68
69
  - 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
thiolliere's avatar
thiolliere committed
70
  - cd ..\..
71
72
  - if %platform%==x86 dir C:\Python34\Lib\site-packages\gi
  - if %platform%==x64 dir C:\Python34-x64\Lib\site-packages\gi
thiolliere's avatar
thiolliere committed
73
74

  # Install gdk-pixbuf and add it to PATH because it is needed by pyinstaller
thiolliere's avatar
thiolliere committed
75
76
77
78
  - 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
thiolliere's avatar
thiolliere committed
79
80

  # Install pyinstaller and requirements
81
  - cd C:\projects\kiwix-hotspot
rgaudin's avatar
rgaudin committed
82
83
  - 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
thiolliere's avatar
thiolliere committed
84
85
86
87

  # Install qemu
  - mkdir "C:\Program Files\qemu"
  - cd "C:\Program Files\qemu"
88
89
  - 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"
thiolliere's avatar
thiolliere committed
90
  - 7z x qemu-setup.exe
rgaudin's avatar
rgaudin committed
91
92
93
94
95
  - 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
thiolliere's avatar
thiolliere committed
96
97
  - dir "C:\Program Files\qemu"

rgaudin's avatar
rgaudin committed
98
99
100
  # bundle 7zip
  - mkdir "C:\Program Files\7zextra"
  - cd "C:\Program Files\7zextra"
rgaudin's avatar
rgaudin committed
101
  - appveyor DownloadFile "http://mirror.download.kiwix.org/dev/7z920_extra.7z"
102
  - 7z.exe x 7z920_extra.7z
rgaudin's avatar
rgaudin committed
103
  - appveyor DownloadFile "http://mirror.download.kiwix.org/dev/7z1805-extra.7z"
104
  - 7z.exe -y x 7z1805-extra.7z
rgaudin's avatar
rgaudin committed
105
106
107
108

  # Copy Imdisk Installer
  - mkdir "C:\Program Files\imdiskinst"
  - cd "C:\Program Files\imdiskinst"
rgaudin's avatar
rgaudin committed
109
  - appveyor DownloadFile "http://mirror.download.kiwix.org/dev/imdiskinst.exe" -FileName "imdiskinst.exe"
rgaudin's avatar
rgaudin committed
110
111
112
113
  - 7z x imdiskinst.exe
  - del imdiskinst.exe
  - dir "C:\Program Files\imdiskinst"

114
115
116
  # Download Etcher-cli
  - mkdir "C:\Program Files\etcher-cli"
  - cd "C:\Program Files\etcher-cli"
rgaudin's avatar
rgaudin committed
117
118
  - 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"
119
120
121
  - 7z.exe x etcher-cli.zip
  - del etcher-cli.zip

122
123
124
125
126
127
128
  # 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

thiolliere's avatar
thiolliere committed
129
  # Run pyinstaller and show warning
130
131
132
  - 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
thiolliere's avatar
thiolliere committed
133

thiolliere's avatar
thiolliere committed
134
  # Deploy
135
136
  - cd C:\projects\kiwix-hotspot\dist\kiwix-hotspot
  - 7z.exe a -m0=Copy C:\projects\kiwix-hotspot\windows_bundle\kiwix-hotspot.7z *
137
138

  # download tools
139
  - cd C:\projects\kiwix-hotspot\windows_bundle\
140
  # create SFX exe from 7z archive
141
  - copy /b "C:\Program Files\7zextra\7zS.sfx" + sfxconfig.txt + kiwix-hotspot.7z kiwix-hotspot.exe
142
  # change icon and add version info to exe
143
  - copy ..\kiwix-hotspot-logo.ico icon.ico
144
145
146
147
148
  - 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
149
  - cd C:\projects\kiwix-hotspot\dist\kiwix-hotspot
thiolliere's avatar
thiolliere committed
150

rgaudin's avatar
rgaudin committed
151
  # sign the build
152
  - 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
rgaudin's avatar
rgaudin committed
153

154
155
156
  - 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\
thiolliere's avatar
thiolliere committed
157

158
159
  - 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"
thiolliere's avatar
thiolliere committed
160

161
  - 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 ci@download.kiwix.org:/data/download/release/kiwix-hotspot/; fi"