forked from CryptoCoderz/DigitalNote
-
Notifications
You must be signed in to change notification settings - Fork 21
324 lines (300 loc) · 14.9 KB
/
Copy pathci-windows.yml
File metadata and controls
324 lines (300 loc) · 14.9 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: CI - Windows x64
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to build (leave empty / blank choice to use the branch from 'Use workflow from' above)"
required: false
type: choice
options:
- ""
- master
- 2.0.0.7-testing
- 2.0.0.8-testing
default: ""
workflow_call: # called by release.yml on tag push
inputs:
branch:
description: "Branch / ref to build (passed by release.yml)"
required: false
type: string
default: ""
env:
BUILDER_REPO: https://github.com/DigitalNoteXDN/DigitalNote-Builder.git
JOBS: 4
# Pre-built Qt 5.15.7 static for MinGW64 — published to GitHub Releases.
QT_RELEASE_URL_X64: https://github.com/DigitalNoteXDN/DigitalNote-Builder/releases/download/qt-static-5.15.7-mingw64/qt-5.15.7-static-mingw64.tar.gz
jobs:
build-windows-x64:
name: Windows x64 — Build + Test (MSYS2 MinGW64)
runs-on: windows-2022
timeout-minutes: 180
defaults:
run:
shell: msys2 {0}
steps:
# ── 1. Checkout ────────────────────────────────────────────────────────
- name: Checkout DigitalNote-2
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}
submodules: false
# ── 2. MSYS2 MinGW64 ───────────────────────────────────────────────────
- name: Set up MSYS2 MinGW64
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
git
base-devel
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-libs
mingw-w64-x86_64-make
mingw-w64-x86_64-pcre2
mingw-w64-x86_64-gmp
mingw-w64-x86_64-double-conversion
mingw-w64-x86_64-zstd
mingw-w64-x86_64-libwinpthread
mingw-w64-x86_64-md4c
perl
bzip2
libtool
make
autoconf
automake
automake-wrapper
pkg-config
# ── 3. Clone DigitalNote-Builder ───────────────────────────────────────
- name: Clone DigitalNote-Builder
run: |
cd ~
if [ ! -d DigitalNote-Builder ]; then
git clone https://github.com/DigitalNoteXDN/DigitalNote-Builder.git
else
cd DigitalNote-Builder && git pull origin master
fi
mkdir -p ~/DigitalNote-Builder/windows/x64/temp
mkdir -p ~/DigitalNote-Builder/windows/x64/libs
# ── 4. Qt — cached then downloaded from GitHub Release ─────────────────
- name: Cache Qt 5.15.7 static build
id: cache-qt
uses: actions/cache@v4
with:
path: ~/DigitalNote-Builder/windows/x64/libs/qt-5.15.7
key: qt-5.15.7-static-mingw64-v1
save-always: true
- name: Download pre-built Qt 5.15.7 (PowerShell)
if: steps.cache-qt.outputs.cache-hit != 'true'
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Write-Host "Downloading pre-built Qt 5.15.7..."
gh release download qt-static-5.15.7-mingw64 `
--repo DigitalNoteXDN/DigitalNote-Builder `
--pattern "qt-5.15.7-static-mingw64.tar.gz" `
--output "C:\\qt-prebuilt.tar.gz"
Write-Host "Download complete: $((Get-Item C:\qt-prebuilt.tar.gz).Length) bytes"
- name: Extract Qt 5.15.7
if: steps.cache-qt.outputs.cache-hit != 'true'
run: |
tar -xzf /c/qt-prebuilt.tar.gz \
-C ~/DigitalNote-Builder/windows/x64/
rm /c/qt-prebuilt.tar.gz
echo "Qt ready:"
ls ~/DigitalNote-Builder/windows/x64/libs/qt-5.15.7/bin/
# ── 5. Cache compiled libraries ────────────────────────────────────────
- name: Cache compiled libraries
uses: actions/cache@v4
id: libs-cache
with:
path: |
~/DigitalNote-Builder/windows/x64/libs/db-6.2.32.NC
~/DigitalNote-Builder/windows/x64/libs/boost_1_80_0
~/DigitalNote-Builder/windows/x64/libs/openssl-1.1.1w
~/DigitalNote-Builder/windows/x64/libs/libevent-2.1.12-stable
~/DigitalNote-Builder/windows/x64/libs/miniupnpc-2.2.8
~/DigitalNote-Builder/windows/x64/libs/qrencode-4.1.1
key: windows-x64-libs-${{ hashFiles('include/libs.pri', 'include/libs/bip39.pri') }}-v6
save-always: true
# ── 6. Download source archives ────────────────────────────────────────
- name: Download library source archives
if: steps.libs-cache.outputs.cache-hit != 'true'
run: |
mkdir -p ~/DigitalNote-Builder/download
cd ~/DigitalNote-Builder/download
wget -q https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz
wget -q https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz
wget -q http://download.oracle.com/berkeley-db/db-6.2.32.NC.tar.gz
wget -q https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
wget -q "http://miniupnp.free.fr/files/download.php?file=miniupnpc-2.2.8.tar.gz" \
-O miniupnpc-2.2.8.tar.gz
wget -q https://github.com/fukuchi/libqrencode/archive/refs/tags/v4.1.1.tar.gz
echo "Downloads complete:"
ls -lh ~/DigitalNote-Builder/download/
# ── 7. Compile static libraries ────────────────────────────────────────
# BIP39 is now compiled directly into the wallet via bip39.pri
# mnemonic.sh is no longer needed
- name: Compile static libraries
if: steps.libs-cache.outputs.cache-hit != 'true'
run: |
MSYS_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
mkdir -p ~/DigitalNote-Builder/download
ln -sfn "$MSYS_WORKSPACE" ~/DigitalNote-Builder/windows/x64/DigitalNote-2
cd ~/DigitalNote-Builder/windows/x64
export TARGET_OS=NATIVE_WINDOWS
J="${{ env.JOBS }}"
echo "=== BerkeleyDB ===" && ../../compile/berkeleydb.sh "build_windows" "--enable-mingw" "-j $J"
echo "=== Boost ===" && ../../compile/boost.sh "toolset=gcc address-model=64 -j $J"
echo "=== GMP ===" && bash gmp.sh
echo "=== LevelDB ===" && ../../compile/leveldb.sh "-j $J"
echo "=== libevent ===" && ../../compile/libevent.sh "" "-j $J"
echo "=== miniupnpc ===" && ../../compile/miniupnpc.sh "libminiupnpc.a" "-j $J"
echo "=== OpenSSL ===" && ../../compile/openssl.sh "mingw64" "-j $J"
echo "=== qrencode ===" && ../../compile/qrencode.sh "" "-j $J"
echo "=== secp256k1 ===" && ../../compile/secp256k1.sh "" "-j $J"
echo "=== All libraries built ==="
# ── 8. Link source tree ────────────────────────────────────────────────
- name: Link source tree into Builder
run: |
MSYS_WORKSPACE=$(cygpath -u '${{ github.workspace }}')
ln -sfn "$MSYS_WORKSPACE" ~/DigitalNote-Builder/windows/x64/DigitalNote-2
# ── 9. Compile daemon ──────────────────────────────────────────────────
# NB: use mingw32-make, not make. qmake's win32 generator emits
# Windows-style commands (del, copy, *.bat invocations) for things
# like build.h regeneration. mingw32-make runs them via cmd.exe;
# MSYS2 'make' runs them via /bin/sh, which has no 'del' and fails.
- name: Compile daemon (digitalnoted.exe)
run: |
cd ~/DigitalNote-Builder/windows/x64
export PATH="$PWD/libs/qt-5.15.7/bin:$PATH"
cd DigitalNote-2
rm -rf build Makefile
qmake DigitalNote.daemon.pro \
USE_UPNP=1 \
USE_BUILD_INFO=0 \
\
RELEASE=1
mingw32-make -j${{ env.JOBS }} 2>&1 | tee ~/build-daemon.log
exit ${PIPESTATUS[0]}
# ── 10. Compile Qt wallet ──────────────────────────────────────────────
# See note on step 9 — mingw32-make is required for Windows-style rules.
- name: Compile Qt wallet (DigitalNote-qt.exe)
run: |
cd ~/DigitalNote-Builder/windows/x64
export PATH="$PWD/libs/qt-5.15.7/bin:$PATH"
cd DigitalNote-2
rm -rf build Makefile
qmake DigitalNote.app.pro \
USE_UPNP=1 \
USE_DBUS=1 \
USE_QRCODE=1 \
USE_BUILD_INFO=0 \
\
RELEASE=1
mingw32-make -j${{ env.JOBS }} 2>&1 | tee ~/build-app.log
exit ${PIPESTATUS[0]}
# ── 11. Warning analysis ───────────────────────────────────────────────
- name: Analyse build warnings
if: always()
run: |
for log in ~/build-app.log ~/build-daemon.log; do
if [ -f "$log" ]; then
W=$(grep -c ": warning:" "$log" 2>/dev/null || echo 0)
E=$(grep -c ": error:" "$log" 2>/dev/null || echo 0)
echo "=== $(basename $log): $W warning(s), $E error(s) ==="
if [ "$W" -gt 0 ]; then
grep ": warning:" "$log" \
| sed 's|.*: warning:||' | sort | uniq -c | sort -rn | head -20
fi
fi
done
# ── 12. cppcheck static analysis ──────────────────────────────────────
- name: cppcheck — new Qt/BIP39 sources
run: |
pacman -S --noconfirm mingw-w64-x86_64-cppcheck 2>/dev/null || true
WS=$(cygpath -u '${{ github.workspace }}')
cppcheck \
--enable=warning,style,performance \
--suppress=missingIncludeSystem \
--suppress=unusedFunction \
--error-exitcode=0 \
--std=c++17 \
-I "$WS/src/bip39/include" \
-I "$WS/src" \
"$WS/src/qt/seedphrasedialog.cpp" \
"$WS/src/qt/decryptworker.cpp" \
"$WS/src/qt/walletmodel.cpp" \
"$WS/src/qt/askpassphrasedialog.cpp" \
"$WS/src/qt/coincontrolworker.cpp" \
"$WS/src/qt/sendcoinsworker.cpp" \
"$WS/src/qt/masternodeworker.cpp" \
"$WS/src/bip39/src/bip39_wallet.cpp" \
"$WS/src/bip39/src/bip39_passphrase.cpp" \
"$WS/src/rpcbip39.cpp" \
2>&1 || echo "⚠ cppcheck warnings present (non-fatal)"
# ── 13. Version assertions ─────────────────────────────────────────────
- name: Report version constants
run: |
# Extract the version constants from source and print them.
# No assertion — if the source is wrong, the binary will be
# wrong too, and that's a source-review problem, not a CI one.
BUILD=$(grep -oE 'CLIENT_VERSION_BUILD[[:space:]]+[0-9]+' src/clientversion.h | awk '{print $NF}')
PROTOCOL=$(grep -oE 'PROTOCOL_VERSION[[:space:]]*=[[:space:]]*[0-9]+' src/version.h | awk '{print $NF}')
MIN_PEER=$(grep -oE 'MIN_PEER_PROTO_VERSION[[:space:]]*=[[:space:]]*[0-9]+' src/version.h | awk '{print $NF}')
echo "Building with:"
echo " CLIENT_VERSION_BUILD = $BUILD"
echo " PROTOCOL_VERSION = $PROTOCOL"
echo " MIN_PEER_PROTO_VERSION = $MIN_PEER"
- name: Assert daemon was built
run: |
# NOTE: DigitalNoted has no --version flag — the source-header
# checks above prove the build is at version 2.0.0.7. This step
# is just a sanity check that the binary actually exists.
# The build writes to MSYS2 home, not github.workspace — same
# path the Collect step uses below.
SRC="$HOME/DigitalNote-Builder/windows/x64/DigitalNote-2"
DAEMON=$(find "$SRC" -iname 'DigitalNoted.exe' -type f | head -1)
if [ -z "$DAEMON" ]; then
echo "ERROR: DigitalNoted.exe not found under $SRC"
ls -la "$SRC" 2>/dev/null || echo "(directory does not exist)"
exit 1
fi
echo "OK: DigitalNoted.exe built at $DAEMON"
ls -lh "$DAEMON"
# ── 14. Collect and upload binaries ───────────────────────────────────
# NB: We run this step in MSYS2 bash, NOT pwsh, even though the rest of
# collect-and-upload looks Windows-y. Reason: the build steps run under
# MSYS2 and write to ~/DigitalNote-Builder/... where ~ resolves to
# D:\a\_temp\msys64\home\runneradmin\. PowerShell's $env:USERPROFILE
# resolves to C:\Users\runneradmin\ — a completely different directory
# that doesn't exist. Staying in MSYS2 bash here keeps paths consistent.
# The 'cygpath -w' calls convert MSYS2 paths to Windows form for the
# upload-artifact step that follows (which does run on the Windows
# filesystem and needs backslash paths).
- name: Collect Windows executables
run: |
SRC="$HOME/DigitalNote-Builder/windows/x64/DigitalNote-2"
DST="$(cygpath -u '${{ github.workspace }}')/artifacts"
mkdir -p "$DST"
# Copy every .exe produced by either build (daemon + Qt wallet)
find "$SRC" -name '*.exe' -type f -exec cp {} "$DST/" \;
# Logs — written to ~/build-*.log by steps 9/10
cp "$HOME/build-app.log" "$DST/" 2>/dev/null || true
cp "$HOME/build-daemon.log" "$DST/" 2>/dev/null || true
echo "=== Collected artefacts ==="
ls -lh "$DST/"
- name: Upload Windows x64 binaries
uses: actions/upload-artifact@v4
with:
name: digitalnote-windows-x64
path: ${{ github.workspace }}\artifacts\*.exe
retention-days: 14
- name: Upload build logs
uses: actions/upload-artifact@v4
if: always()
with:
name: build-logs-windows-x64-${{ github.sha }}
path: ${{ github.workspace }}\artifacts\*.log
retention-days: 14