-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
266 lines (237 loc) · 11 KB
/
Copy pathcppcmake-windows.yml
File metadata and controls
266 lines (237 loc) · 11 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
name: Build (Windows)
on:
workflow_call:
inputs:
NIGHTLY:
default: false
type: boolean
CONSOLIDATE_DEPENDENCY_SUMMARY:
default: false
type: boolean
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.os }}
permissions:
actions: read
contents: read
strategy:
fail-fast: false
matrix:
arch: [x86, x64]
os: [windows-2022]
env:
GH_TOKEN: ${{ github.token }}
OPENSSL_VERSION: 1.1.1.2100
steps:
- name: Checkout
uses: actions/checkout@v7
- 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: 5.15.2
- 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: |
Set-Location "${{ github.workspace }}\tools\windows"
$SQLiteArchiveFileName = (python download_latest_sqlite.py).Trim()
Expand-Archive -Path $SQLiteArchiveFileName -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" -DENABLE_TESTING=ON ..\
- name: Build (SQLite)
run: |
cd release-sqlite
cmake --build . --config Release
- name: Tests (SQLite)
run: |
cd release-sqlite
ctest -C Release --output-on-failure
- 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" -DENABLE_TESTING=ON ..\
- name: Build (SQLCipher)
run: |
cd release-sqlcipher
cmake --build . --config Release
- name: Tests (SQLCipher)
run: |
cd release-sqlcipher
ctest -C Release --output-on-failure
- 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 }}
$DATE=$(Get-Date -Format "yyyyMMdd")
if ("${{ inputs.NIGHTLY }}" -eq "true") {
mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-$DATE-win-${{ matrix.arch }}.msi"
} else {
mv DB.Browser.for.SQLite-*.msi "DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-win-${{ 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 }}-win-${{ matrix.arch }}-unsigned
path: installer\windows\DB.Browser.for.SQLite-*.msi
retention-days: 1
# 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-win-${{ matrix.arch }}.zip"
} else {
$FILENAME_FORMAT="DB.Browser.for.SQLite-dev-$(git rev-parse --short HEAD)-win-${{ 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'
name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: build-artifacts-win-${{ matrix.arch }}
path: |
installer\windows\DB.Browser.for.SQLite-*.msi
DB.Browser.for.SQLite-*.zip
retention-days: 1
- 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]
}
New-Item -ItemType Directory -Force -Path dependency-summary | Out-Null
$SUMMARY_ROW = "| Build (Windows) | ${{ matrix.os }} / ${{ matrix.arch }} | $OPENSSL_VERSION | $QT_VERSION | $SQLCIPHER_VERSION | $SQLITE_VERSION |"
Set-Content -Path "dependency-summary/dependencies-windows-${{ matrix.os }}-${{ matrix.arch }}.md" -Value $SUMMARY_ROW
- name: Upload dependency summary
uses: actions/upload-artifact@v7
with:
name: dependency-summary-windows-${{ matrix.os }}-${{ matrix.arch }}
path: dependency-summary/*.md
retention-days: 1
summarize-dependencies:
if: always() && inputs.CONSOLIDATE_DEPENDENCY_SUMMARY != true && !cancelled()
needs: build
name: Summarize Dependencies
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
steps:
- name: Download dependency summaries
uses: actions/download-artifact@v8
continue-on-error: true
with:
pattern: dependency-summary-*
path: dependency-summary
merge-multiple: true
- name: Summary
run: |
{
echo "## Dependencies used"
echo ""
echo "| Workflow | Target | OpenSSL | Qt | SQLCipher | SQLite |"
echo "| :---: | :---: | :---: | :---: | :---: | :---: |"
} >> "$GITHUB_STEP_SUMMARY"
if [ -d dependency-summary ] && find dependency-summary -type f -name '*.md' | grep -q .; then
find dependency-summary -type f -name '*.md' -print | sort | while IFS= read -r file; do
cat "$file" >> "$GITHUB_STEP_SUMMARY"
done
else
echo "| Not available | No dependency summaries were uploaded. | - | - | - | - |" >> "$GITHUB_STEP_SUMMARY"
fi
release:
if: github.event_name == 'workflow_dispatch' && github.workflow == 'Build (Windows)'
needs: build
name: Release
permissions:
actions: read
contents: write
uses: ./.github/workflows/release.yml