|
| 1 | +# NOTES: This CI workflow is scheduled to be integrated with the existing Windows CI workflow in the future. |
| 2 | + |
| 3 | +name: Build (Windows on ARM) |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_call: |
| 7 | + inputs: |
| 8 | + NIGHTLY: |
| 9 | + default: false |
| 10 | + type: boolean |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: ${{ matrix.os }}-arm64 |
| 16 | + runs-on: ${{ matrix.os }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + os: [windows-11-arm] |
| 21 | + env: |
| 22 | + GH_TOKEN: ${{ github.token }} |
| 23 | + QT_VERSION: 6.8.3 |
| 24 | + steps: |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v6 |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: | |
| 30 | + choco install --no-progress ninja wixtoolset |
| 31 | + |
| 32 | + Invoke-WebRequest -Uri "https://slproweb.com/download/WinUniversalOpenSSL-3_6_1.exe" -OutFile WinUniversalOpenSSL-3_6_1.exe |
| 33 | + Start-Process -FilePath .\WinUniversalOpenSSL-3_6_1.exe -ArgumentList '/ALLUSERS /verysilent /dir="C:\dev\OpenSSL"' -Wait |
| 34 | +
|
| 35 | + # Invoke-WebRequest -Uri "https://github.com/wixtoolset/wix/releases/download/v6.0.2/wix-cli-x64.msi" -OutFile wix-cli-x64.msi |
| 36 | + # Start-Process msiexec.exe -ArgumentList "/i wix-cli-x64.msi /qn" -Wait |
| 37 | +
|
| 38 | + # & "C:\Program Files\WiX Toolset v6.0\bin\wix.exe" extension add WixToolset.UI.wixext/6.0.2 |
| 39 | + # & "C:\Program Files\WiX Toolset v6.0\bin\wix.exe" extension list |
| 40 | +
|
| 41 | + - name: Install Qt |
| 42 | + uses: jurplel/install-qt-action@v4 |
| 43 | + with: |
| 44 | + arch: 'win64_msvc2022_arm64' |
| 45 | + cache: true |
| 46 | + cache-key-prefix: 'cache' |
| 47 | + modules: 'debug_info qt5compat qtactiveqt qtcharts qtconnectivity qtgraphs qtgrpc qthttpserver qtimageformats qtlanguageserver qtlocation qtlottie qtmultimedia qtnetworkauth qtpositioning qtquick3d qtquick3dphysics qtquicktimeline qtremoteobjects qtscxml qtsensors qtserialbus qtserialport qtshadertools qtspeech qtvirtualkeyboard qtwebchannel qtwebsockets' |
| 48 | + version: ${{ env.QT_VERSION }} |
| 49 | + |
| 50 | + - name: Setup MSVC |
| 51 | + uses: ilammy/msvc-dev-cmd@v1 |
| 52 | + with: |
| 53 | + arch: arm64 |
| 54 | + vsversion: 2022 |
| 55 | + |
| 56 | + - name: Setup MSYS2 |
| 57 | + uses: msys2/setup-msys2@v2 |
| 58 | + with: |
| 59 | + msystem: CLANGARM64 |
| 60 | + update: true |
| 61 | + install: >- |
| 62 | + curl |
| 63 | + git |
| 64 | + make |
| 65 | + mingw-w64-clang-aarch64-clang |
| 66 | + unzip |
| 67 | +
|
| 68 | + - name: Verify |
| 69 | + run: clang -dumpmachine |
| 70 | + |
| 71 | + - name: Build SQLite |
| 72 | + run: | |
| 73 | + $htmlContent = Invoke-WebRequest -Uri "https://sqlite.org/download.html" | Select-Object -ExpandProperty Content |
| 74 | + $regex = [regex]::new('PRODUCT,(\d+\.\d+\.\d+),(\d+/sqlite-amalgamation-\d+\.zip),\d+,(.+)') |
| 75 | + $match = $regex.Match($htmlContent) |
| 76 | + $relativeUrl = $match.Groups[2].Value |
| 77 | + $downloadLink = "https://sqlite.org/$relativeUrl" |
| 78 | + Invoke-WebRequest -Uri $downloadLink -OutFile 'sqlite.zip' |
| 79 | + Expand-Archive -Path sqlite.zip -DestinationPath C:\dev\ |
| 80 | + Move-Item -Path C:\dev\sqlite-amalgamation-* C:\dev\SQLite\ |
| 81 | + cd C:\dev\SQLite |
| 82 | + cl sqlite3.c -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_STAT4 -DSQLITE_SOUNDEX -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_MAX_ATTACHED=125 -DSQLITE_API="__declspec(dllexport)" -link -dll -out:sqlite3.dll |
| 83 | +
|
| 84 | + - name: Build SQLean extension |
| 85 | + shell: msys2 {0} |
| 86 | + run: | |
| 87 | + pwd |
| 88 | + git clone https://www.github.com/nalgeon/sqlean /c/dev/sqlean |
| 89 | + cd /c/dev/sqlean |
| 90 | + cp /c/a/sqlitebrowser/sqlitebrowser/installer/windows_on_arm/add_sqlean_arm64_target.patch . |
| 91 | + git apply --ignore-space-change --ignore-whitespace add_sqlean_arm64_target.patch |
| 92 | + make prepare-dist |
| 93 | + make download-sqlite |
| 94 | + make download-external |
| 95 | + make compile-windows-arm64 |
| 96 | + dir dist/ |
| 97 | +
|
| 98 | + - name: Build 'formats' Extensions |
| 99 | + run: | |
| 100 | + cp .\src\extensions\extension-formats.c C:\dev\SQLite\ |
| 101 | + cp .\src\extensions\extension-formats.def C:\dev\SQLite\ |
| 102 | + cd C:\dev\SQLite |
| 103 | + cl /MD extension-formats.c -link -dll -def:extension-formats.def -out:formats.dll |
| 104 | +
|
| 105 | + - name: Setup MSVC |
| 106 | + uses: ilammy/msvc-dev-cmd@v1 |
| 107 | + with: |
| 108 | + arch: x64 |
| 109 | + vsversion: 2022 |
| 110 | + |
| 111 | + - name: Build x64 binaries for build SQLCipher |
| 112 | + run: | |
| 113 | + git clone https://www.github.com/sqlcipher/sqlcipher C:\dev\SQLCipher --branch v4.6.1 |
| 114 | + cd C:\dev\SQLCipher |
| 115 | + nmake /f Makefile.msc lemon.exe mkkeywordhash.exe mksourceid.exe src-verify.exe USE_AMALGAMATION=1 NO_TCL=1 SQLITE3DLL=sqlcipher.dll SQLITE3LIB=sqlcipher.lib SQLITE3EXE=sqlcipher.exe LTLINKOPTS="C:\dev\OpenSSL\lib\VC\x64\MD\libcrypto.lib" OPT_FEATURE_FLAGS="-DSQLITE_TEMP_STORE=2 -DSQLITE_HAS_CODEC=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_RTREE=1 -DSQLCIPHER_CRYPTO_OPENSSL=1 -DSQLITE_MAX_ATTACHED=125 -IC:\dev\OpenSSL\include\x64" |
| 116 | +
|
| 117 | + - name: Setup MSVC |
| 118 | + uses: ilammy/msvc-dev-cmd@v1 |
| 119 | + with: |
| 120 | + arch: arm64 |
| 121 | + vsversion: 2022 |
| 122 | + |
| 123 | + - name: Build SQLCipher |
| 124 | + run: | |
| 125 | + cd C:\dev\SQLCipher |
| 126 | + nmake /f Makefile.msc sqlcipher.dll USE_AMALGAMATION=1 NO_TCL=1 SQLITE3DLL=sqlcipher.dll SQLITE3LIB=sqlcipher.lib SQLITE3EXE=sqlcipher.exe LTLINKOPTS="C:\dev\OpenSSL\lib\VC\arm64\MD\libcrypto.lib" OPT_FEATURE_FLAGS="-DSQLITE_TEMP_STORE=2 -DSQLITE_HAS_CODEC=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_RTREE=1 -DSQLCIPHER_CRYPTO_OPENSSL=1 -DSQLITE_MAX_ATTACHED=125 -IC:\dev\OpenSSL\include\arm64" |
| 127 | + mkdir sqlcipher |
| 128 | + copy sqlite3.h sqlcipher |
| 129 | + mv VERSION VERSION.txt |
| 130 | +
|
| 131 | + - name: Configure build (SQLite) |
| 132 | + run: | |
| 133 | + mkdir release-sqlite && cd release-sqlite |
| 134 | + cmake -G "Ninja Multi-Config" -DCMAKE_PREFIX_PATH="C:\dev\SQLite" -DQT_MAJOR=Qt6 ..\ |
| 135 | +
|
| 136 | + - name: Build (SQLite) |
| 137 | + run: | |
| 138 | + cd release-sqlite |
| 139 | + cmake --build . --config Release |
| 140 | +
|
| 141 | + - name: Configure build (SQLCipher) |
| 142 | + run: | |
| 143 | + mkdir release-sqlcipher && cd release-sqlcipher |
| 144 | + cmake -G "Ninja Multi-Config" -Dsqlcipher=1 -DCMAKE_PREFIX_PATH="C:\dev\OpenSSL;C:\dev\SQLCipher" -DQT_MAJOR=Qt6 ..\ |
| 145 | +
|
| 146 | + - name: Build (SQLCipher) |
| 147 | + run: | |
| 148 | + cd release-sqlcipher |
| 149 | + cmake --build . --config Release |
| 150 | +
|
| 151 | + |
| 152 | + - if: github.event_name != 'pull_request' |
| 153 | + name: Create MSI |
| 154 | + env: |
| 155 | + ExePath: ${{ github.workspace }} |
| 156 | + OpenSSLPath: C:\dev\OpenSSL |
| 157 | + SQLCipherPath: C:\dev\SQLCipher |
| 158 | + SqleanPath: C:\dev\sqlean |
| 159 | + SQLitePath: C:\dev\SQLite |
| 160 | + run: | |
| 161 | + cd installer\windows_on_arm |
| 162 | + ./build.cmd |
| 163 | + $DATE=$(Get-Date -Format "yyyyMMdd") |
| 164 | + if ("${{ inputs.NIGHTLY }}" -eq "true") { |
| 165 | + mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-$DATE-arm64.msi" |
| 166 | + } else { |
| 167 | + mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-arm64.msi" |
| 168 | + } |
| 169 | +
|
| 170 | + - if: github.event_name != 'pull_request' |
| 171 | + name: Upload artifacts for code signing with SignPath |
| 172 | + id: unsigned-artifacts |
| 173 | + uses: actions/upload-artifact@v7 |
| 174 | + with: |
| 175 | + name: build-artifacts-${{ matrix.os }}-arm64-unsigned |
| 176 | + path: installer\windows_on_arm\DB.Browser.for.SQLite-*.msi |
| 177 | + |
| 178 | + # Change the signing-policy-slug when you release an RC, RTM or stable release. |
| 179 | + - if: github.event_name != 'pull_request' |
| 180 | + name: Code signing with SignPath |
| 181 | + uses: signpath/github-action-submit-signing-request@v2 |
| 182 | + with: |
| 183 | + api-token: '${{ secrets.SIGNPATH_API_TOKEN }}' |
| 184 | + github-artifact-id: '${{ steps.unsigned-artifacts.outputs.artifact-id }}' |
| 185 | + organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}' |
| 186 | + output-artifact-directory: .\installer\windows |
| 187 | + project-slug: 'sqlitebrowser' |
| 188 | + signing-policy-slug: 'test-signing' |
| 189 | + wait-for-completion: true |
| 190 | + |
| 191 | + - if: github.event_name != 'pull_request' |
| 192 | + name: Create ZIP |
| 193 | + run: | |
| 194 | + $DATE=$(Get-Date -Format "yyyyMMdd") |
| 195 | + if ("${{ inputs.NIGHTLY }}" -eq "true") { |
| 196 | + $FILENAME_FORMAT="DB.Browser.for.SQLite-$DATE-arm64.zip" |
| 197 | + } else { |
| 198 | + $FILENAME_FORMAT="DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-arm64.zip" |
| 199 | + } |
| 200 | + Start-Process msiexec.exe -ArgumentList "/a $(dir installer\windows_on_arm\DB.Browser.for.SQLite-*.msi) /q TARGETDIR=$PWD\target\" -Wait |
| 201 | + Compress-Archive -Path "target\DB Browser for SQLite\*" -DestinationPath $FILENAME_FORMAT |
| 202 | +
|
| 203 | + - if: github.event_name != 'pull_request' && github.workflow != 'Build (Windows)' |
| 204 | + name: Prepare artifacts |
| 205 | + run: | |
| 206 | + mkdir build-artifacts |
| 207 | + move installer\windows_on_arm\DB.Browser.for.SQLite-*.msi build-artifacts\ |
| 208 | + move DB.Browser.for.SQLite-*.zip build-artifacts\ |
| 209 | + Compress-Archive -Path build-artifacts\* -DestinationPath build-artifacts-arm64.zip |
| 210 | +
|
| 211 | + - if: github.event_name != 'pull_request' && github.workflow != 'Build (Windows)' |
| 212 | + name: Upload artifacts |
| 213 | + uses: actions/upload-artifact@v7 |
| 214 | + with: |
| 215 | + name: build-artifacts-${{ matrix.os }}-arm64 |
| 216 | + path: build-artifacts-arm64.zip |
| 217 | + |
| 218 | + - if: github.event_name == 'workflow_dispatch' && github.workflow == 'Build (Windows)' |
| 219 | + name: Release |
| 220 | + uses: softprops/action-gh-release@v2 |
| 221 | + with: |
| 222 | + files: installer/windows_on_arm/DB.Browser.for.SQLite-*.msi, DB.Browser.for.SQLite-*.zip |
| 223 | + prerelease: true |
| 224 | + tag_name: ${{ github.sha }}-windows |
| 225 | + |
| 226 | + - name: Summary |
| 227 | + run: | |
| 228 | + $OPENSSL_VERSION=(C:\dev\OpenSSL\bin\arm64\openssl version) -replace "OpenSSL ([\d\.]+[a-z]+) .*", '$1' |
| 229 | + $QT_VERSION = & "$env:QT_ROOT_DIR\bin\qmake.exe" --version | Select-String "Using Qt version" | ForEach-Object { $_.ToString().Split()[3] } |
| 230 | + $SQLCIPHER_VERSION=(Get-Item "C:\dev\SQLCipher\sqlcipher.dll").VersionInfo.FileVersion |
| 231 | + Select-String -Path "C:\dev\SQLite\sqlite3.h" -Pattern '#define SQLITE_VERSION\s+"([\d\.]+)"' | ForEach-Object { |
| 232 | + ($_ -match '"([\d\.]+)"') | Out-Null |
| 233 | + $SQLITE_VERSION=$matches[1] |
| 234 | + } |
| 235 | +
|
| 236 | + echo "## Libaries used" >> $env:GITHUB_STEP_SUMMARY |
| 237 | + echo "OpenSSL: $OPENSSL_VERSION, Qt: $QT_VERSION, SQLCipher: $SQLCIPHER_VERSION, SQLite: $SQLITE_VERSION" >> $env:GITHUB_STEP_SUMMARY |
0 commit comments