-
-
Notifications
You must be signed in to change notification settings - Fork 102
1407 lines (1220 loc) · 48.4 KB
/
Copy pathbuild-release.yml
File metadata and controls
1407 lines (1220 loc) · 48.4 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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
name: Build and Release (Manual)
# Notes:
# - All release artifact names must start with "sqlite3mc-".
# Intermediate or temporary artifacts must not use this prefix.
on:
workflow_dispatch:
inputs:
mode:
description: "Release mode"
required: true
type: choice
default: dry-run
options:
- sanity
- dry-run
- release
permissions:
contents: read
concurrency:
group: build-release-${{ github.ref }}
cancel-in-progress: false
env:
AMALGAMATION: amalgamation
ARCHIVES: archives
RELEASE: release
SQLITE_PATH: sqlite3
ICU_PATH: icu_precompiled
jobs:
#########################################################
# Job for building binaries for Win32 and Win64
#########################################################
build-windows:
name: Build Windows binaries
runs-on: windows-2022
timeout-minutes: 90
env:
MODE: ${{ github.event.inputs.mode }}
steps:
# -------------------------------------------------
# Checkout repository
# -------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v7
# -------------------------------------------------
# Create environment variables
# -------------------------------------------------
- name: Build context
shell: pwsh
run: |
python scripts/build_context.py
# -------------------------------------------------
# Display environment variables
# -------------------------------------------------
- name: Show environment
shell: pwsh
run: |
echo "SQLite Version: $env:SQLITE_VERSION"
echo "SQLite Version Raw: $env:SQLITE_VERSION_RAW"
echo "SQLite URL Official: $env:SQLITE_URL_OFFICIAL"
echo "SQLite URL GitHub: $env:SQLITE_URL_GITHUB"
echo "SQLite URL Android: $env:SQLITE_URL_ANDROID"
echo ""
echo "ICU Version: $env:ICU_VERSION"
echo "ICU URL Win32: $env:ICU_URL_WIN32"
echo "ICU URL Win64: $env:ICU_URL_WIN64"
# -------------------------------------------------
# Create directories for intermediate results
# -------------------------------------------------
- name: Create working directories
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path ${{ env.SQLITE_PATH }}
New-Item -ItemType Directory -Force -Path ${{ env.ICU_PATH }}
New-Item -ItemType Directory -Force -Path ${{ env.AMALGAMATION }}
New-Item -ItemType Directory -Force -Path ${{ env.ARCHIVES }}
# -------------------------------------------------
# Download ICU binary releases for Win32 and Win64
# -------------------------------------------------
- name: Download ICU binary releases for Windows
shell: pwsh
run: |
$win32Url = "${{ env.ICU_URL_WIN32 }}"
$win64Url = "${{ env.ICU_URL_WIN64 }}"
$win32File = ($win32Url -split "/")[-1]
$win64File = ($win64Url -split "/")[-1]
Invoke-WebRequest `
-Uri "$win32Url" `
-OutFile "${{ env.ICU_PATH }}\icu-precompiled-win32.zip"
Invoke-WebRequest `
-Uri "$win64Url" `
-OutFile "${{ env.ICU_PATH }}\icu-precompiled-win64.zip"
# Export canonical mapping for verifier step
@"
$win32File=icu-precompiled-win32.zip
$win64File=icu-precompiled-win64.zip
"@ | Out-File "${{ env.ICU_PATH }}\icu-mapping.txt"
Invoke-WebRequest `
-Uri "${{ env.ICU_URL_RELEASE }}/SHASUM512.txt" `
-OutFile "${{ env.ICU_PATH }}\SHASUM512.txt"
Invoke-WebRequest `
-Uri "${{ env.ICU_URL_RELEASE }}/SHASUM512.txt.asc" `
-OutFile "${{ env.ICU_PATH }}\SHASUM512.txt.asc"
# -------------------------------------------------
# Import ICU signing key
# -------------------------------------------------
- name: Import ICU signing key
shell: pwsh
run: |
gpg --batch --import "${{ github.workspace }}/scripts/ICU_KEYS.txt"
# -------------------------------------------------
# Verify ICU checksum sugnature
# -------------------------------------------------
- name: Verify ICU checksum signature
shell: pwsh
run: |
gpg --batch --verify `
"${{ env.ICU_PATH }}\SHASUM512.txt.asc" `
"${{ env.ICU_PATH }}\SHASUM512.txt"
# -------------------------------------------------
# Verify ICU artifacts
# -------------------------------------------------
- name: Verify ICU artifacts
shell: pwsh
run: |
pwsh scripts/verify_icu.ps1 `
-ChecksumFile "${{ env.ICU_PATH }}\SHASUM512.txt" `
-ArtifactDir "${{ env.ICU_PATH }}" `
-MappingFile "${{ env.ICU_PATH }}\icu-mapping.txt"
# -------------------------------------------------
# Extract ICU binaries
# -------------------------------------------------
- name: Extract ICU archives
shell: pwsh
run: |
Expand-Archive `
-Path "${{ env.ICU_PATH }}/icu-precompiled-win32.zip" `
-DestinationPath "${{ env.ICU_PATH }}/win32"
Expand-Archive `
-Path "${{ env.ICU_PATH }}/icu-precompiled-win64.zip" `
-DestinationPath "${{ env.ICU_PATH }}/win64"
$path = "${{ env.ICU_PATH }}/win64"
if (!(Test-Path "$path/include")) {
throw "ICU headers missing: $path/include"
}
Write-Host "ICU extraction OK"
python --version
# -------------------------------------------------
# Setup MSBuild environment
# -------------------------------------------------
- name: Setup MSBuild environment
uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # v3
# -------------------------------------------------
# Build Win32 binaries
# -------------------------------------------------
- name: Build Win32
shell: pwsh
env:
LIBICU_PATH: ${{ github.workspace }}\icu_precompiled\win32
run: |
echo $env:LIBICU_PATH
msbuild build\sqlite3mc_vc17.sln `
/m `
/p:Configuration=Release `
/p:Platform=Win32
# -------------------------------------------------
# Build Win64 binaries
# -------------------------------------------------
- name: Build x64
shell: pwsh
env:
LIBICU_PATH: ${{ github.workspace }}\icu_precompiled\win64
run: |
echo $env:LIBICU_PATH
msbuild build\sqlite3mc_vc17.sln `
/m `
/p:Configuration=Release `
/p:Platform=x64
# -------------------------------------------------
# Stage Windows PE files for signing
# -------------------------------------------------
- name: Stage Windows PE files for signing
if: ${{ env.MODE != 'sanity' }}
shell: pwsh
run: |
New-Item -ItemType Directory -Force to-sign | Out-Null
# All signable DLLs are produced in dll/release, the shell EXEs in
# lib/release (same paths package-windows collects from). Names are
# unique across the variants, so a flat staging dir is collision-free.
Copy-Item bin/vc17/dll/release/sqlite3mc*.dll to-sign/ -ErrorAction SilentlyContinue
Copy-Item bin/vc17/lib/release/sqlite3mc_shell*.exe to-sign/ -ErrorAction SilentlyContinue
Get-ChildItem to-sign
# -------------------------------------------------
# Upload unsigned PE files
# -------------------------------------------------
- name: Upload unsigned PE files
id: upload-unsigned-pe
if: ${{ env.MODE != 'sanity' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: unsigned-windows-pe # must NOT start with sqlite3mc- (intermediate)
path: to-sign
if-no-files-found: error
# -------------------------------------------------
# Submit signing request (SignPath)
# -------------------------------------------------
- name: Submit signing request (SignPath)
if: ${{ env.MODE != 'sanity' }}
uses: signpath/github-action-submit-signing-request@b9d91eadd323de506c0c81cf0c7fe7438f3360fd # v2.2
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ vars.SIGNPATH_ORGANIZATION_ID }}'
project-slug: 'SQLite3MultipleCiphers'
artifact-configuration-slug: 'windows-binaries'
signing-policy-slug: ${{ env.MODE == 'release' && 'release-signing' || 'test-signing' }}
github-artifact-id: '${{ steps.upload-unsigned-pe.outputs.artifact-id }}'
wait-for-completion: true
# release-signing typically requires manual approval -> wait longer
wait-for-completion-timeout-in-seconds: 1800
output-artifact-directory: 'signed'
# -------------------------------------------------
# Restore signed PE files
# -------------------------------------------------
- name: Restore signed PE files
if: ${{ env.MODE != 'sanity' }}
shell: pwsh
run: |
# SignPath returns the same file names; put the signed DLLs/EXEs back
# exactly where package-windows picks them up.
Copy-Item signed/sqlite3mc*.dll bin/vc17/dll/release/ -Force
Copy-Item signed/sqlite3mc_shell*.exe bin/vc17/lib/release/ -Force
# -------------------------------------------------
# Upload Win32 and Win64 binaries
# -------------------------------------------------
- name: Upload build output
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-output
path: |
bin/vc17/**
icu_precompiled/win32/bin/icu*.dll
icu_precompiled/win64/bin64/icu*.dll
retention-days: 1
#########################################################
# Job for generating the SQLite3MC amalgamation
#########################################################
amalgamate:
name: Generate source amalgamation
runs-on: ubuntu-latest
timeout-minutes: 30
env:
MODE: ${{ github.event.inputs.mode }}
steps:
# -------------------------------------------------
# Checkout repository
# -------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
# -------------------------------------------------
# Setup Python
# -------------------------------------------------
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
# -------------------------------------------------
# Create environment variables
# -------------------------------------------------
- name: Build context
shell: bash
run: |
set -euo pipefail
python scripts/build_context.py
# -------------------------------------------------
# Display environment variables
# -------------------------------------------------
- name: Show environment
shell: bash
run: |
set -euo pipefail
echo "SQLite Version: $SQLITE_VERSION"
echo "SQLite Version Raw: $SQLITE_VERSION_RAW"
echo "SQLite URL Official: $SQLITE_URL_OFFICIAL"
echo "SQLite URL GitHub: $SQLITE_URL_GITHUB"
echo "SQLite URL Android: $SQLITE_URL_ANDROID"
# -------------------------------------------------
# Create directories for intermediate files
# -------------------------------------------------
- name: Create directories
shell: bash
run: |
set -euo pipefail
: "${AMALGAMATION:?missing}"
: "${ARCHIVES:?missing}"
mkdir -p "$AMALGAMATION"
mkdir -p "$ARCHIVES"
# -------------------------------------------------
# Generate source amalgamation
# -------------------------------------------------
- name: Generate amalgamation
shell: bash
working-directory: ${{ env.AMALGAMATION }}
run: |
set -euo pipefail
python ../scripts/amalgamate.py -v yes -c ../scripts/sqlite3mc.c.json -s ../src
python ../scripts/amalgamate.py -v yes -c ../scripts/sqlite3mc.h.json -s ../src
python ../scripts/amalgamate.py -v yes -c ../scripts/shell3mc.c.json -s ../src
ls -l
test -f sqlite3mc_amalgamation.c
sed -i 's/[[:space:]]*$//' "sqlite3mc_amalgamation.c"
sed -i 's/[[:space:]]*$//' "sqlite3mc_amalgamation.h"
sed -i 's/[[:space:]]*$//' "shell3mc_amalgamation.c"
cp ../src/sqlite3ext.h .
cp ../src/sqlite3.h .
ls -l
# -------------------------------------------------
# Generate README for amalgamation
# -------------------------------------------------
- name: Generate README
shell: bash
run: |
set -euo pipefail
python scripts/render_template.py packaging/readme-amalgamation.md.in "$AMALGAMATION/README.md"
# -------------------------------------------------
# Create ZIP archive(s) for the source amalgamation
# -------------------------------------------------
- name: Create amalgamation ZIP archive
shell: bash
run: |
set -euo pipefail
DESTPATH="$ARCHIVES"
(
SOURCEPATH="$AMALGAMATION"
cd "$SOURCEPATH"
zip -r "../$DESTPATH/amalgamation.zip" .
)
ls -l "$DESTPATH"
# -------------------------------------------------
# Upload ZIP archive
# -------------------------------------------------
- name: Upload amalgamation
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sqlite3mc-amalgamation
if-no-files-found: error
path: |
${{ env.ARCHIVES }}/amalgamation.zip
#########################################################
# Job for building the binaries for Android
#########################################################
build-android:
name: Build Android binaries
needs: amalgamate
runs-on: ubuntu-latest
timeout-minutes: 60
env:
ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
ANDROID_HOME: /usr/local/lib/android/sdk
steps:
# -------------------------------------------------
# Checkout repository
# -------------------------------------------------
- name: Checkout Repository
uses: actions/checkout@v7
# -------------------------------------------------
# Setup Python
# -------------------------------------------------
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
# -------------------------------------------------
# Create environment variables
# -------------------------------------------------
- name: Build context
shell: bash
run: |
set -euo pipefail
python scripts/build_context.py
# -------------------------------------------------
# Set up Java environment
# -------------------------------------------------
- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '17'
# -------------------------------------------------
# Install Android SDK
# -------------------------------------------------
- name: Install Android SDK components
uses: android-actions/setup-android@40fd30fb8d7440372e1316f5d1809ec01dcd3699 # v4
# -------------------------------------------------
# Install Android NDK
# -------------------------------------------------
- name: Install NDK
run: |
set -euo pipefail
sdkmanager "ndk;26.3.11579264"
# -------------------------------------------------
# Download and verify Fossil
# --------------
# SHA3-256 checksum (retrieved from https://www3.fossil-scm.org/home/uvlist on 2026-06-08)
# fossil-linux-x64-2.28.tar.gz cbd89e653e1b797802f2ee5bb55d6ad4959291ec6d6eb192c79ff62d9a224c33
# -------------------------------------------------
- name: Download and verify Fossil
shell: bash
run: |
set -euo pipefail
FOSSIL_VERSION="2.28"
FOSSIL_SHA3="cbd89e653e1b797802f2ee5bb55d6ad4959291ec6d6eb192c79ff62d9a224c33"
curl -fL --retry 3 --retry-delay 5 -o fossil.tar.gz \
https://www.fossil-scm.org/home/uv/fossil-linux-x64-$FOSSIL_VERSION.tar.gz
python3 scripts/verify_sha3.py \
fossil.tar.gz \
"${FOSSIL_SHA3}"
# -------------------------------------------------
# Install Fossil
# -------------------------------------------------
- name: Install Fossil
shell: bash
run: |
set -euo pipefail
tar -xzf fossil.tar.gz
sudo mv fossil /usr/local/bin/
fossil version
# -------------------------------------------------
# Clone SQLite Android Fossil repo
# -------------------------------------------------
- name: Clone SQLite Android Fossil repo
shell: bash
run: |
set -euo pipefail
fossil clone https://www.sqlite.org/android android.fossil
# -------------------------------------------------
# Open Fossil repository
# -------------------------------------------------
- name: Open Fossil repository
shell: bash
run: |
set -euo pipefail
mkdir sqlite-src
cd sqlite-src
fossil open ../android.fossil
# -------------------------------------------------
# Checkout Android binding revision
# -------------------------------------------------
- name: Checkout Android binding revision
shell: bash
run: |
set -euo pipefail
cd sqlite-src
fossil update "${SQLITE_ANDROID_CHECK_IN}"
fossil info
# -------------------------------------------------
# Download SQLite3MC amalgamation
# -------------------------------------------------
- name: Download amalgamation
uses: actions/download-artifact@v8
with:
name: sqlite3mc-amalgamation
path: archives
# -------------------------------------------------
# Unpack SQLite3MC amalgamation
# -------------------------------------------------
- name: Unpack amalgamation
run: |
set -euo pipefail
mkdir amalgamation
unzip -q archives/amalgamation.zip -d amalgamation
# -------------------------------------------------
# Replace SQLite sources by own amalgamation
# -------------------------------------------------
- name: Replace SQLite sources by own amalgamation
run: |
set -euo pipefail
cp -fv amalgamation/sqlite3mc_amalgamation.c sqlite-src/sqlite3/src/main/jni/sqlite/sqlite3.c
cp -fv amalgamation/sqlite3mc_amalgamation.h sqlite-src/sqlite3/src/main/jni/sqlite/sqlite3.h
# -------------------------------------------------
# Replace Android.mk
# -------------------------------------------------
- name: Replace Android.mk
run: |
set -euo pipefail
cp -fv packaging/android/Android.mk sqlite-src/sqlite3/src/main/jni/sqlite/Android.mk
# -------------------------------------------------
# Make gradlew executable
# -------------------------------------------------
- name: Make gradlew executable
run: |
set -euo pipefail
chmod +x sqlite-src/gradlew
# -------------------------------------------------
# Build release AAR
# -------------------------------------------------
- name: Build Release AAR
working-directory: sqlite-src/sqlite3
run: |
set -euo pipefail
../gradlew assembleRelease
# -------------------------------------------------
# Collect AAR
# -------------------------------------------------
- name: Collect AAR
run: |
set -euo pipefail
mkdir -p staging
find sqlite-src -name "*.aar" -exec cp {} staging/ \;
aarsrc="staging/sqlite3-release.aar"
aardst="staging/sqlite3mc-${SQLITE3MC_VERSION}-sqlite-${SQLITE_VERSION}-android.aar"
mv "$aarsrc" "$aardst"
# -------------------------------------------------
# Upload AAR Artifact
# -------------------------------------------------
- name: Upload AAR Artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sqlite3mc-android-aar
if-no-files-found: error
path: staging/sqlite3mc*.aar
#########################################################
# Job for packaging the release archives for Win32/Win64
#########################################################
package-windows:
name: Assemble Windows release packages
needs: build-windows
runs-on: windows-2022
timeout-minutes: 60
env:
MODE: ${{ github.event.inputs.mode }}
strategy:
fail-fast: false
matrix:
include:
- sys: mingw32
id: win32
platform: Win32
dll_suffix: ""
exe_suffix: ""
icu: false
icu_path: ""
- sys: mingw32
id: icu-win32
platform: Win32
dll_suffix: "_icu"
exe_suffix: "icu"
icu: true
icu_path: "win32/bin"
- sys: mingw64
id: win64
platform: Win64
dll_suffix: "_x64"
exe_suffix: "_x64"
icu: false
icu_path: ""
- sys: mingw64
id: icu-win64
platform: Win64
dll_suffix: "_icu_x64"
exe_suffix: "icu_x64"
icu: true
icu_path: "win64/bin64"
steps:
# -------------------------------------------------
# Checkout repository
# -------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v7
# -------------------------------------------------
# Create environment variables
# -------------------------------------------------
- name: Build context
shell: pwsh
run: |
python scripts/build_context.py
# -------------------------------------------------
# Download build artifacts
# -------------------------------------------------
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
name: build-output
# -------------------------------------------------
# Prepare packaging directory
# -------------------------------------------------
- name: Prepare package
shell: pwsh
run: |
Remove-Item -Recurse -Force package -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force package/bin
New-Item -ItemType Directory -Force package/dll
New-Item -ItemType Directory -Force package/include
# -------------------------------------------------
# Set up MSYS2 for Win32
# -------------------------------------------------
- name: Setup MSYS2 for Win32
if: matrix.platform == 'Win32'
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2
with:
msystem: ${{matrix.sys}}
update: true
install: >
mingw-w64-i686-toolchain
# -------------------------------------------------
# Set up MSYS2 for Win64
# -------------------------------------------------
- name: Setup MSYS2 for Win64
if: matrix.platform == 'Win64'
uses: msys2/setup-msys2@66cd2cce69caa17b53920067426061ca1de3a884 # v2
with:
msystem: ${{matrix.sys}}
update: true
install: >
mingw-w64-x86_64-toolchain
# -------------------------------------------------
# Generate MinGW import library
# -------------------------------------------------
- name: Build import lib
shell: msys2 {0}
working-directory: bin/vc17/dll/release
run: |
base="sqlite3mc${{ matrix.dll_suffix }}"
dll="${base}.dll"
def="${base}.def"
lib="lib${base}.dll.a"
echo "DLL: $dll"
echo "DEF: $def"
echo "LIB: $lib"
gendef $dll
ls -l
echo "Call dlltool"
dlltool -d "$def" -l "$lib"
# -------------------------------------------------
# Collect all required files into staging
# -------------------------------------------------
- name: Collect files into staging
shell: pwsh
env:
MATRIX_ID: ${{ matrix.id }}
run: |
$dllbase = "sqlite3mc${{ matrix.dll_suffix }}"
$exebase = "sqlite3mc_shell${{ matrix.exe_suffix }}"
$files = @(
@{ src = "bin/vc17/dll/release/$dllbase.dll"; dst = "dll/$dllbase.dll" },
@{ src = "bin/vc17/dll/release/$dllbase.exp"; dst = "dll/$dllbase.exp" },
@{ src = "bin/vc17/dll/release/$dllbase.lib"; dst = "dll/$dllbase.lib" },
@{ src = "bin/vc17/dll/release/$dllbase.pdb"; dst = "dll/$dllbase.pdb" },
@{ src = "bin/vc17/dll/release/lib$dllbase.dll.a"; dst = "dll/lib$dllbase.dll.a" },
@{ src = "bin/vc17/lib/release/$exebase.exe"; dst = "bin/$exebase.exe" },
@{ src = "src/sqlite3.h"; dst = "include/sqlite3.h" },
@{ src = "src/sqlite3ext.h"; dst = "include/sqlite3ext.h" },
@{ src = "src/sqlite3mc.h"; dst = "include/sqlite3mc.h" },
@{ src = "src/sqlite3mc_version.h"; dst = "include/sqlite3mc_version.h" },
@{ src = "src/sqlite3mc_vfs.h"; dst = "include/sqlite3mc_vfs.h" },
@{ src = "LICENSE"; dst = "LICENSE" },
@{ src = "LICENSE.spdx"; dst = "LICENSE.spdx" }
)
foreach ($f in $files) {
if (Test-Path $f.src) {
$target = "package/$($f.dst)"
$dir = Split-Path $target
New-Item -ItemType Directory -Force $dir | Out-Null
Copy-Item $f.src $target
}
}
# -------------------------------------------------
# Copy ICU runtime for builds with ICU support
# -------------------------------------------------
- name: Copy ICU runtime
if: matrix.icu == true
shell: pwsh
run: |
$icu_path = "${{ env.ICU_PATH }}/${{ matrix.icu_path }}"
echo "ICU path: $icu_path"
Get-ChildItem $icu_path -Filter *.dll | Copy-Item -Destination package/bin/
# -------------------------------------------------
# Generate README for packaging
# -------------------------------------------------
- name: Generate README
shell: pwsh
run: |
$icuIncluded = if ("${{ matrix.icu }}" -eq "true") {
"${{ env.ICU_VERSION }}"
} else {
"not included"
}
$env:ICU_SUPPORT = $icuIncluded
python scripts/render_template.py packaging/readme.md.in package/README.md
# -------------------------------------------------
# Create ZIP archive with Windows binaries
# -------------------------------------------------
- name: Create ZIP archive
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist | Out-Null
$zipName = "sqlite3mc-${{ env.SQLITE3MC_VERSION }}-sqlite-${{ env.SQLITE_VERSION }}-${{ matrix.id }}.zip"
Compress-Archive `
-Path package/* `
-DestinationPath "dist/$zipName" `
-Force
# -------------------------------------------------
# Upload ZIP archive with Windows binaries
# -------------------------------------------------
- name: Upload ZIP artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sqlite3mc-${{ matrix.id }}
path: dist/*.zip
retention-days: 1
#########################################################
# Job for building WASM
#########################################################
build-wasm:
name: Build SQLite3MC WASM
needs: amalgamate
runs-on: ubuntu-latest
timeout-minutes: 90
outputs:
artifact-name: sqlite-wasm-binaries
steps:
# -------------------------------------------------
# Checkout repository
# -------------------------------------------------
- name: Checkout repository
uses: actions/checkout@v7
# -------------------------------------------------
# Create environment variables
# -------------------------------------------------
- name: Build context
shell: bash
run: |
set -euo pipefail
python scripts/build_context.py
# -------------------------------------------------
# Download and verify Fossil
# --------------
# SHA3-256 checksum (retrieved from https://www3.fossil-scm.org/home/uvlist on 2026-06-08)
# fossil-linux-x64-2.28.tar.gz cbd89e653e1b797802f2ee5bb55d6ad4959291ec6d6eb192c79ff62d9a224c33
# -------------------------------------------------
- name: Download and verify Fossil
shell: bash
run: |
set -euo pipefail
FOSSIL_VERSION="2.28"
FOSSIL_SHA3="cbd89e653e1b797802f2ee5bb55d6ad4959291ec6d6eb192c79ff62d9a224c33"
curl -fL --retry 3 --retry-delay 5 -o fossil.tar.gz \
https://www.fossil-scm.org/home/uv/fossil-linux-x64-$FOSSIL_VERSION.tar.gz
python3 scripts/verify_sha3.py \
fossil.tar.gz \
"${FOSSIL_SHA3}"
# -------------------------------------------------
# Install Fossil
# -------------------------------------------------
- name: Install Fossil
shell: bash
run: |
set -euo pipefail
tar -xzf fossil.tar.gz
sudo mv fossil /usr/local/bin/
fossil version
# -------------------------------------------------
# Clone SQLite Fossil repo
# -------------------------------------------------
- name: Clone SQLite Fossil repo
shell: bash
run: |
set -euo pipefail
fossil clone https://www.sqlite.org/src sqlite.fossil
# -------------------------------------------------
# Open Fossil repository
# -------------------------------------------------
- name: Open Fossil repository
shell: bash
run: |
set -euo pipefail
mkdir sqlite
cd sqlite
fossil open ../sqlite.fossil
# -------------------------------------------------
# Checkout selected SQLite version
# -------------------------------------------------
- name: Checkout selected SQLite version
shell: bash
run: |
set -euo pipefail
cd sqlite
fossil update "version-${SQLITE_VERSION}"
fossil info
# -------------------------------------------------
# Setup git for fossil repo
# -------------------------------------------------
- name: Setup git for fossil repo
shell: bash
run: |
set -euo pipefail
cd sqlite
rm -rf .git
git init
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
git add -A
git commit -m "SQLite ${SQLITE_VERSION} snapshot"
# -------------------------------------------------
# Set up Emscripten
# -------------------------------------------------
- name: Setup Emscripten
uses: emscripten-core/setup-emsdk@4528d102f7230f0e7b276855c01ea1159be0e984 # v16
with:
version: latest
# -------------------------------------------------
# Install WABT tools
# -------------------------------------------------
- name: Install WABT tools
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y wabt
# -------------------------------------------------
# Verify Emscripten toochain
# -------------------------------------------------
- name: Verify toolchain
run: |
set -euo pipefail
emcc --version
wasm-strip --version
node --version
# -------------------------------------------------
# Configure SQLite
# -------------------------------------------------
- name: Configure SQLite
working-directory: sqlite
run: |
set -euo pipefail
./configure --enable-all
# -------------------------------------------------
# Generate SQLite amalgamation
# -------------------------------------------------
- name: Generate SQLite amalgamation
working-directory: sqlite
run: |
set -euo pipefail
make sqlite3.c
# -------------------------------------------------
# Upload SQLite amalgamation for comparison
# -------------------------------------------------
- name: Upload SQLite amalgamation for comparison
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sqlite-compare
path: |
src/sqlite3.c
sqlite/sqlite3.c
retention-days: 1
# -------------------------------------------------
# Verify SQLite amalgamation consistency
# -------------------------------------------------
- name: Verify SQLite amalgamation consistency
shell: bash
run: |
set -uo pipefail
set +e
echo "=== SHA256 comparison ==="
sha256sum src/sqlite3.c sqlite/sqlite3.c