-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
216 lines (192 loc) · 9.81 KB
/
cppcmake-windows.yml
File metadata and controls
216 lines (192 loc) · 9.81 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Build (Windows)
on:
workflow_call:
inputs:
NIGHTLY:
default: false
type: boolean
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
arch: [x86, x64]
os: [windows-2022]
env:
GH_TOKEN: ${{ github.token }}
OPENSSL_VERSION: 1.1.1.2100
QT_VERSION: 5.15.2
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install dependencies
run: |
choco install --no-progress ninja
if ("${{ matrix.arch }}" -eq "x86") {
choco install --no-progress openssl --x86 --version=${{ env.OPENSSL_VERSION}}
} else {
choco install --no-progress openssl --version=${{ env.OPENSSL_VERSION}}
}
# When building SQLCipher, if we specify a path to OpenSSL and
# there are spaces in the path, an error will occur, so to
# avoid this, create the symlink.
New-Item -Path C:\dev -ItemType Directory
if ("${{ matrix.arch }}" -eq "x86") {
New-Item -Path "C:\dev\OpenSSL" -ItemType SymbolicLink -Value "C:\Program Files (x86)\OpenSSL-Win32\"
} else {
New-Item -Path "C:\dev\OpenSSL" -ItemType SymbolicLink -Value "C:\Program Files\OpenSSL"
}
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
arch: ${{ matrix.arch == 'x86' && 'win32_msvc2019' || matrix.arch == 'x64' && 'win64_msvc2019_64'}}
cache: true
cache-key-prefix: "cache"
version: ${{ env.QT_VERSION }}
- name: Install VS2019
run: choco install visualstudio2019community --package-parameters "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 --add Microsoft.VisualStudio.Component.VC.Redist.MSM"
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch == 'x86' && 'amd64_x86' || matrix.arch == 'x64' && 'amd64'}}
vsversion: 2019
- name: Build SQLite
run: |
$htmlContent = Invoke-WebRequest -Uri "https://sqlite.org/download.html" | Select-Object -ExpandProperty Content
$regex = [regex]::new('PRODUCT,(\d+\.\d+\.\d+),(\d+/sqlite-amalgamation-\d+\.zip),\d+,(.+)')
$match = $regex.Match($htmlContent)
$relativeUrl = $match.Groups[2].Value
$downloadLink = "https://sqlite.org/$relativeUrl"
Invoke-WebRequest -Uri $downloadLink -OutFile 'sqlite.zip'
Expand-Archive -Path sqlite.zip -DestinationPath C:\dev\
Move-Item -Path C:\dev\sqlite-amalgamation-* C:\dev\SQLite\
cd C:\dev\SQLite
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
- name: Download SQLean extension
run: |
if ("${{ matrix.arch }}" -eq "x86") {
# sqlean has discontinued x86 support starting from v0.28.0
gh release download 0.27.4 --pattern "sqlean-win-x86.zip" --repo "nalgeon/sqlean"
Expand-Archive -Path sqlean-win-x86.zip -DestinationPath .\sqlean
} else {
gh release download --pattern "sqlean-win-x64.zip" --repo "nalgeon/sqlean"
Expand-Archive -Path sqlean-win-x64.zip -DestinationPath .\sqlean
}
- name: Build 'formats' Extensions
run: |
cp .\src\extensions\extension-formats.c C:\dev\SQLite\
cp .\src\extensions\extension-formats.def C:\dev\SQLite\
cd C:\dev\SQLite
cl /MD extension-formats.c -link -dll -def:extension-formats.def -out:formats.dll
- name: Build SQLCipher
run: |
cd C:\dev
Invoke-WebRequest -Uri https://github.com/sqlcipher/sqlcipher/archive/refs/tags/v4.6.1.zip -OutFile 'sqlcipher.zip'
Expand-Archive -Path sqlcipher.zip -DestinationPath C:\dev\
Move-Item -Path C:\dev\sqlcipher-4.6.1 C:\dev\SQLCipher\
cd SQLCipher
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\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"
mkdir sqlcipher
copy sqlite3.h sqlcipher
- name: Configure build (SQLite)
run: |
mkdir release-sqlite && cd release-sqlite
cmake -G "Ninja Multi-Config" -DCMAKE_PREFIX_PATH="C:\dev\SQLite" ..\
- name: Build (SQLite)
run: |
cd release-sqlite
cmake --build . --config Release
- name: Configure build (SQLCipher)
run: |
mkdir release-sqlcipher && cd release-sqlcipher
cmake -G "Ninja Multi-Config" -Dsqlcipher=1 -DCMAKE_PREFIX_PATH="C:\dev\OpenSSL;C:\dev\SQLCipher" ..\
- name: Build (SQLCipher)
run: |
cd release-sqlcipher
cmake --build . --config Release
- if: github.event_name != 'pull_request'
name: Create MSI
env:
ExePath: ${{ github.workspace }}
OpenSSLPath: C:\dev\OpenSSL
SQLCipherPath: C:\dev\SQLCipher
SqleanPath: ${{ github.workspace }}\sqlean
SQLitePath: C:\dev\SQLite
run: |
cd installer/windows
./build.cmd "${{ matrix.arch }}".ToLower()
$DATE=$(Get-Date -Format "yyyyMMdd")
if ("${{ inputs.NIGHTLY }}" -eq "true") {
mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-$DATE-${{ matrix.arch }}.msi"
} else {
mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-${{ matrix.arch }}.msi"
}
- if: github.event_name != 'pull_request'
name: Upload artifacts for code signing with SignPath
id: unsigned-artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts-${{ matrix.os }}-${{ matrix.arch }}-unsigned
path: installer\windows\DB.Browser.for.SQLite-*.msi
# Change the signing-policy-slug when you release an RC, RTM or stable release.
- if: github.event_name != 'pull_request'
name: Code signing with SignPath
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
github-artifact-id: '${{ steps.unsigned-artifacts.outputs.artifact-id }}'
organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}'
output-artifact-directory: .\installer\windows
project-slug: 'sqlitebrowser'
signing-policy-slug: 'test-signing'
wait-for-completion: true
- if: github.event_name != 'pull_request'
name: Create ZIP
run: |
$DATE=$(Get-Date -Format "yyyyMMdd")
if ("${{ inputs.NIGHTLY }}" -eq "true") {
$FILENAME_FORMAT="DB.Browser.for.SQLite-$DATE-${{ matrix.arch }}.zip"
} else {
$FILENAME_FORMAT="DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-${{ matrix.arch }}.zip"
}
Start-Process msiexec.exe -ArgumentList "/a $(dir installer\windows\DB.Browser.for.SQLite-*.msi) /q TARGETDIR=$PWD\target\" -Wait
if ("${{ matrix.arch }}" -eq "x86") {
move target\System\* "target\DB Browser for SQLite\"
} else {
move target\System64\* "target\DB Browser for SQLite\"
}
Compress-Archive -Path "target\DB Browser for SQLite\*" -DestinationPath $FILENAME_FORMAT
- if: github.event_name != 'pull_request' && github.workflow != 'Build (Windows)'
name: Prepare artifacts
run: |
mkdir build-artifacts
move installer\windows\DB.Browser.for.SQLite-*.msi build-artifacts\
move DB.Browser.for.SQLite-*.zip build-artifacts\
Compress-Archive -Path build-artifacts\* -DestinationPath build-artifacts-${{ matrix.arch }}.zip
- if: github.event_name != 'pull_request' && github.workflow != 'Build (Windows)'
name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts-${{ matrix.os }}-${{ matrix.arch }}
path: build-artifacts-${{ matrix.arch }}.zip
- if: github.event_name == 'workflow_dispatch' && github.workflow == 'Build (Windows)'
name: Release
uses: softprops/action-gh-release@v2
with:
files: installer/windows/DB.Browser.for.SQLite-*.msi, DB.Browser.for.SQLite-*.zip
prerelease: true
tag_name: ${{ github.sha }}-windows
- name: Summary
run: |
$OPENSSL_VERSION=(C:\dev\OpenSSL\bin\openssl version) -replace "OpenSSL ([\d\.]+[a-z]+) .*", '$1'
$QT_VERSION = & "$env:QT_ROOT_DIR\bin\qmake.exe" --version | Select-String "Using Qt version" | ForEach-Object { $_.ToString().Split()[3] }
$SQLCIPHER_VERSION=(Get-Item "C:\dev\SQLCipher\sqlcipher.dll").VersionInfo.FileVersion
Select-String -Path "C:\dev\SQLite\sqlite3.h" -Pattern '#define SQLITE_VERSION\s+"([\d\.]+)"' | ForEach-Object {
($_ -match '"([\d\.]+)"') | Out-Null
$SQLITE_VERSION=$matches[1]
}
echo "## Libaries used" >> $env:GITHUB_STEP_SUMMARY
echo "OpenSSL: $OPENSSL_VERSION, Qt: $QT_VERSION, SQLCipher: $SQLCIPHER_VERSION, SQLite: $SQLITE_VERSION" >> $env:GITHUB_STEP_SUMMARY