|
| 1 | +# swy: some useful references; the MSVC part of the CI script is based on the one from bind9, by Michał Kępień: |
| 2 | +# https://gitlab.com/gitlab-org/ci-cd/shared-runners/images/gcp/windows-containers/blob/master/cookbooks/preinstalled-software/README.md |
| 3 | +# https://gitlab.isc.org/isc-projects/bind9/commit/facc6a051fcac70fbbc61cb92a37be8c3e4db5ec#587d266bb27a4dc3022bbed44dfa19849df3044c_718_731 |
| 4 | +# https://www.kittell.net/code/powershell-unix-sed-equivalent-change-text-file/ |
| 5 | +# https://powershell.org/forums/topic/how-to-use-ansi-vt100-formatting-in-powershell-ooh-pretty-colors/ |
| 6 | + |
| 7 | +#-----------------------------------------------------------------------# |
| 8 | +# OpenRGB GitLab CI Configuration # |
| 9 | +#-----------------------------------------------------------------------# |
| 10 | +variables: |
| 11 | + GIT_SUBMODULE_STRATEGY: recursive |
| 12 | + |
| 13 | +.shared_windows_runners: |
| 14 | + tags: |
| 15 | + - shared-windows |
| 16 | + - windows |
| 17 | + - windows-1809 |
| 18 | + |
| 19 | +stages: |
| 20 | + - build |
| 21 | + |
| 22 | +before_script: |
| 23 | + - echo "started by ${GITLAB_USER_NAME}" |
| 24 | + |
| 25 | +#-----------------------------------------------------------------------# |
| 26 | +# Linux (AppImage) Build Target # |
| 27 | +#-----------------------------------------------------------------------# |
| 28 | +# build_linux: |
| 29 | +# image: ubuntu:bionic |
| 30 | +# stage: build |
| 31 | +# script: |
| 32 | +# - apt update |
| 33 | +# - apt install -y build-essential qtcreator qt5-default libusb-1.0-0-dev libhidapi-dev pkgconf wget git |
| 34 | +# - ./scripts/build-appimage.sh |
| 35 | + |
| 36 | +# artifacts: |
| 37 | +# paths: |
| 38 | +# - OpenRGB-x86_64.AppImage |
| 39 | +# expire_in: 1337 years |
| 40 | + |
| 41 | +#-----------------------------------------------------------------------# |
| 42 | +# Windows (32-bit) Build Target # |
| 43 | +#-----------------------------------------------------------------------# |
| 44 | +build_windows_32: |
| 45 | + extends: |
| 46 | + - .shared_windows_runners |
| 47 | + stage: build |
| 48 | + script: |
| 49 | + - $esc = "$([char]27)" |
| 50 | + - $count = 0 |
| 51 | + - function _unix_tmsec_ { [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds } |
| 52 | + - function _fold_start_ { param( [string]$TEXT_TAG ) $t=_unix_tmsec_; $global:count += 1; Write-Host -NoNewLine "`r`n`r`nsection_start:${t}:sect_${count}`r${esc}[0K${esc}[33m${TEXT_TAG}${esc}[39m`r`n"; } |
| 53 | + - function _fold_final_ { $t=_unix_tmsec_; Write-Host -NoNewLine "`r`n`r`nsection_end:${t}:sect_${count}`r${esc}[0K`r`n" ; } |
| 54 | + |
| 55 | + |
| 56 | + - _fold_start_ 'configuring the msvc environment variables' |
| 57 | + - Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Auxiliary/Build" |
| 58 | + - '& cmd.exe /C "vcvarsall.bat x86 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }' |
| 59 | + - Pop-Location |
| 60 | + - _fold_final_ |
| 61 | + |
| 62 | + - _fold_start_ 'downloading precompiled versions of qtbase, qttools (for windeployqt) and jom (for a more parallel nmake)' |
| 63 | + - mkdir _qt |
| 64 | + - mkdir _qt_download |
| 65 | + - Push-Location _qt_download |
| 66 | + - curl.exe -LJ -o qt-base.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win32_msvc2019/5.15.0-0-202005150700qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86.7z' |
| 67 | + - curl.exe -LJ -o qt-tools.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win32_msvc2019/5.15.0-0-202005150700qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86.7z' |
| 68 | + - curl.exe -LJ -o qt-jom.zip 'https://download.qt.io/official_releases/jom/jom.zip' |
| 69 | + - _fold_final_ |
| 70 | + |
| 71 | + - _fold_start_ 'extracting the downloaded qt binaries' |
| 72 | + - 7z x qt-base.7z '-o../_qt' -y |
| 73 | + - 7z x qt-tools.7z '-o../_qt' -y |
| 74 | + - 7z x qt-jom.zip '-o../_qt' -y |
| 75 | + - _fold_final_ |
| 76 | + |
| 77 | + - _fold_start_ 'turn the qt install from enterprise to foss; remove the licensing checks' |
| 78 | + - ${qconfig-pri-folder} = '..\_qt\5.15.0\msvc2019\mkspecs\qconfig.pri' |
| 79 | + - (Get-Content ${qconfig-pri-folder}).replace('QT_EDITION = Enterprise', 'QT_EDITION = OpenSource') | Set-Content ${qconfig-pri-folder} |
| 80 | + - (Get-Content ${qconfig-pri-folder}).replace('QT_LICHECK = licheck.exe', '') | Set-Content ${qconfig-pri-folder} |
| 81 | + - Pop-Location |
| 82 | + - _fold_final_ |
| 83 | + |
| 84 | + - _fold_start_ 'run qmake and generate the msvc nmake makefile' |
| 85 | + - mkdir _build; cd _build |
| 86 | + - ..\_qt\5.15.0\msvc2019\bin\qmake ..\KeyboardVisualizer.pro |
| 87 | + - _fold_final_ |
| 88 | + |
| 89 | + - _fold_start_ 'start the actual build with jom instead of nmake; for speed' |
| 90 | + - ..\_qt\jom |
| 91 | + - _fold_final_ |
| 92 | + |
| 93 | + - _fold_start_ 'run windeployqt to automatically copy the needed dll files' |
| 94 | + - ..\_qt\5.15.0\msvc2019\bin\windeployqt --no-angle --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime --no-webkit2 .\release\ |
| 95 | + - _fold_final_ |
| 96 | + |
| 97 | + - _fold_start_ 'compressing the release folder so that we can upload it as artifact' |
| 98 | + - mv release 'Keyboard Visualizer Windows 32-bit' |
| 99 | + - ${datetime} = Get-Date ([datetime]::UtcNow) -Format "yyyy-MM-ddTHH-mm-ss" |
| 100 | + - ${revision} = ((git rev-parse --short HEAD) | Out-String).Trim() |
| 101 | + - ${rversion} = (((Get-Content '..\KeyboardVisualizer.pro' | Select-String -Pattern "VERSION =") | Out-String).Trim().Split("="))[1].Trim() |
| 102 | + - 7z a -mx9 -r -y "KeyboardVisualizer_${rversion}_32_${revision}_nightly_${datetime}.7z" 'Keyboard Visualizer Windows 32-bit' |
| 103 | + - _fold_final_ |
| 104 | +# cache: |
| 105 | +# key: same-key |
| 106 | +# paths: |
| 107 | +# - C:\vcpkg\installed\ |
| 108 | + artifacts: |
| 109 | + paths: |
| 110 | + - _build/*.7z |
| 111 | + expire_in: 1337 years |
| 112 | + |
| 113 | +#-----------------------------------------------------------------------# |
| 114 | +# Windows (64-bit) Build Target # |
| 115 | +#-----------------------------------------------------------------------# |
| 116 | +build_windows_64: |
| 117 | + extends: |
| 118 | + - .shared_windows_runners |
| 119 | + stage: build |
| 120 | + script: |
| 121 | + - $esc = "$([char]27)" |
| 122 | + - $count = 0 |
| 123 | + - function _unix_tmsec_ { [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds } |
| 124 | + - function _fold_start_ { param( [string]$TEXT_TAG ) $t=_unix_tmsec_; $global:count += 1; Write-Host -NoNewLine "`r`n`r`nsection_start:${t}:sect_${count}`r${esc}[0K${esc}[33m${TEXT_TAG}${esc}[39m`r`n"; } |
| 125 | + - function _fold_final_ { $t=_unix_tmsec_; Write-Host -NoNewLine "`r`n`r`nsection_end:${t}:sect_${count}`r${esc}[0K`r`n" ; } |
| 126 | + |
| 127 | + |
| 128 | + - _fold_start_ 'configuring the msvc environment variables' |
| 129 | + - Push-Location "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Auxiliary/Build" |
| 130 | + - '& cmd.exe /C "vcvarsall.bat x64 & set" | Foreach-Object { if ($_ -match "(.*?)=(.*)") { Set-Item -force -path "Env:\$($matches[1])" -value "$($matches[2])" } }' |
| 131 | + - Pop-Location |
| 132 | + - _fold_final_ |
| 133 | + |
| 134 | + - _fold_start_ 'downloading precompiled versions of qtbase, qttools (for windeployqt) and jom (for a more parallel nmake)' |
| 135 | + - mkdir _qt |
| 136 | + - mkdir _qt_download |
| 137 | + - Push-Location _qt_download |
| 138 | + - curl.exe -LJ -o qt-base.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win64_msvc2019_64/5.15.0-0-202005150700qtbase-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z' |
| 139 | + - curl.exe -LJ -o qt-tools.7z 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/qt5_5150/qt.qt5.5150.win64_msvc2019_64/5.15.0-0-202005150700qttools-Windows-Windows_10-MSVC2019-Windows-Windows_10-X86_64.7z' |
| 140 | + - curl.exe -LJ -o qt-jom.zip 'https://download.qt.io/official_releases/jom/jom.zip' |
| 141 | + - _fold_final_ |
| 142 | + |
| 143 | + - _fold_start_ 'extracting the downloaded qt binaries' |
| 144 | + - 7z x qt-base.7z '-o../_qt' -y |
| 145 | + - 7z x qt-tools.7z '-o../_qt' -y |
| 146 | + - 7z x qt-jom.zip '-o../_qt' -y |
| 147 | + - _fold_final_ |
| 148 | + |
| 149 | + - _fold_start_ 'turn the qt install from enterprise to foss; remove the licensing checks' |
| 150 | + - ${qconfig-pri-folder} = '..\_qt\5.15.0\msvc2019_64\mkspecs\qconfig.pri' |
| 151 | + - (Get-Content ${qconfig-pri-folder}).replace('QT_EDITION = Enterprise', 'QT_EDITION = OpenSource') | Set-Content ${qconfig-pri-folder} |
| 152 | + - (Get-Content ${qconfig-pri-folder}).replace('QT_LICHECK = licheck.exe', '') | Set-Content ${qconfig-pri-folder} |
| 153 | + - Pop-Location |
| 154 | + - _fold_final_ |
| 155 | + |
| 156 | + - _fold_start_ 'run qmake and generate the msvc nmake makefile' |
| 157 | + - mkdir _build; cd _build |
| 158 | + - ..\_qt\5.15.0\msvc2019_64\bin\qmake ..\KeyboardVisualizer.pro |
| 159 | + - _fold_final_ |
| 160 | + |
| 161 | + - _fold_start_ 'start the actual build with jom instead of nmake; for speed' |
| 162 | + - ..\_qt\jom |
| 163 | + - _fold_final_ |
| 164 | + |
| 165 | + - _fold_start_ 'run windeployqt to automatically copy the needed dll files' |
| 166 | + - ..\_qt\5.15.0\msvc2019_64\bin\windeployqt --no-angle --no-translations --no-opengl-sw --no-system-d3d-compiler --no-compiler-runtime --no-webkit2 .\release\ |
| 167 | + - _fold_final_ |
| 168 | + |
| 169 | + - _fold_start_ 'compressing the release folder so that we can upload it as artifact' |
| 170 | + - mv release 'Keyboard Visualizer Windows 64-bit' |
| 171 | + - ${datetime} = Get-Date ([datetime]::UtcNow) -Format "yyyy-MM-ddTHH-mm-ss" |
| 172 | + - ${revision} = ((git rev-parse --short HEAD) | Out-String).Trim() |
| 173 | + - ${rversion} = (((Get-Content '..\KeyboardVisualizer.pro' | Select-String -Pattern "VERSION =") | Out-String).Trim().Split("="))[1].Trim() |
| 174 | + - 7z a -mx9 -r -y "KeyboardVisualizer_${rversion}_64_${revision}_nightly_${datetime}.7z" 'Keyboard Visualizer Windows 64-bit' |
| 175 | + - _fold_final_ |
| 176 | +# cache: |
| 177 | +# key: same-key |
| 178 | +# paths: |
| 179 | +# - C:\vcpkg\installed\ |
| 180 | + artifacts: |
| 181 | + paths: |
| 182 | + - _build/*.7z |
| 183 | + expire_in: 1337 years |
0 commit comments