Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
849c61b
fix(minor): sqlitecloud to sqliteai
Gioee May 16, 2025
71d4b8a
update gitignore
Gioee May 16, 2025
f1e70e9
makefile refactor
Gioee May 16, 2025
f66c38e
update build workflow, with test and release of sqlite-sync
Gioee May 16, 2025
c9fa42b
fix(windows): choco not in msys2 path
Gioee May 16, 2025
b7c35cd
fix(linux): missing uuid
Gioee May 16, 2025
2c8ae2d
fix(linux): curl linking after other objects
Gioee May 16, 2025
a66125c
new curl.h include path
Gioee May 16, 2025
98f0a52
curl library name from libARCH.a to libcurl.a
Gioee May 16, 2025
9c7363c
fix(linux): link curl static lib
Gioee May 16, 2025
8a029e2
feat(apple): add fatlib curl
Gioee May 19, 2025
0cf75d9
gitignore add static libs
Gioee May 19, 2025
61cdbbd
fix(curl): include and link path
Gioee May 19, 2025
0aaf101
always upload artifacts to debug them
Gioee May 19, 2025
e906c1a
fix(apple): missing multiarch args in linker flags
Gioee May 19, 2025
f127f3c
rm macos specific libcurl.a
Gioee May 19, 2025
d55a3a4
test(linux): re-install sqlite3
Gioee May 19, 2025
c091f65
add ssl and crypto link
Gioee May 19, 2025
44e39ca
linking ssl and crypto only in android and linux
Gioee May 19, 2025
eb487cc
fix(apple): add link to secure transport
Gioee May 19, 2025
00b7dfe
fix(android): wrong boringssl build arch
Gioee May 19, 2025
9e9bef8
fix(windows): winsock instead of inet
Gioee May 19, 2025
8a39dcb
bzero is obsolete and not part of the C standard, making it unavailab…
Gioee May 19, 2025
a6ebf30
clean(linux): rm sqlite3 install
Gioee May 19, 2025
b8e5b0c
fix(windows): non existing htonll
Gioee May 19, 2025
f083346
windows force bash shell when msys2 is not necessary
Gioee May 19, 2025
4425dc5
windows missing import for STATUS_SUCCESS
Gioee May 19, 2025
ab9f8fd
windows missing O_WRONLY headers
Gioee May 19, 2025
e5b6ea6
fix(windows): def file exports
Gioee May 20, 2025
95fe177
windows debug curl build
Gioee May 20, 2025
61b2f92
windows debug curl build list winbuild
Gioee May 20, 2025
95c8c76
windows force curl static lib in the cflags
Gioee May 20, 2025
5e7d4fd
windows missing link against crypt and secur
Gioee May 20, 2025
5ffb191
windows missing winsock and bcrypt linker flags in the test executable
Gioee May 20, 2025
3b5b888
windows test executable linking linker flags after object files
Gioee May 20, 2025
0202ddb
fix(apple): do not use sys/random
Gioee May 20, 2025
459d1df
clean build curl workflow
Gioee May 20, 2025
8977709
remove uuid.h
Gioee May 20, 2025
a8b2d03
android include sys/random
Gioee May 20, 2025
ab65ab5
fix(linux): remove uuid-dev install from workflow
Gioee May 20, 2025
c2526cf
ios missing CoreFoundation framework link
Gioee May 20, 2025
a505c99
fix(apple): SecRandomCopyBytes instead of arc4random_buf
Gioee May 20, 2025
196a7ed
fix(apple): missing framework security link in test flags
Gioee May 20, 2025
549c3bf
fix(android): random and time
Gioee May 20, 2025
131d6b6
clean(ios): remove useless arm64 spec
Gioee May 20, 2025
94b12a1
fix(android): check for __ANDROID__ macro instead of __linux__ macro
Gioee May 20, 2025
aada1a3
fix typo
Gioee May 20, 2025
8f78357
fix(test): return n failed test
Gioee May 20, 2025
e916765
android emulator read only test
Gioee May 20, 2025
6aa115a
enable test coverage
Gioee May 21, 2025
8538f5c
android emu test save up space
Gioee May 21, 2025
cc0722c
install lcov for coverage
Gioee May 21, 2025
b51d9b3
run test coverage only on macos
Gioee May 21, 2025
6b606e1
android log file sizes
Gioee May 21, 2025
10bf69b
fix(android): workflow remove boringssl build files
Gioee May 21, 2025
c8e8088
add deploy to github pages
Gioee May 21, 2025
8ee54f9
android -fno-exceptions
Gioee May 21, 2025
a919c57
android rm useless flags
Gioee May 21, 2025
de9d94d
android link crypto
Gioee May 21, 2025
f579d28
android missing ssl flag
Gioee May 21, 2025
4b4e9fe
android link c++
Gioee May 21, 2025
dbcd6b8
android clean up
Gioee May 21, 2025
c518d2b
android test boringssl and curl without c++
Gioee May 21, 2025
7baa53a
android compile with clang++
Gioee May 21, 2025
b78815b
temp remove cc filter
Gioee May 21, 2025
6d6f376
android back to the ndk clang compiler
Gioee May 21, 2025
ec2def5
android emu push libc
Gioee May 21, 2025
e2f2162
test deploy coverage to gh pages
Gioee May 21, 2025
61c57f7
android fix libc path
Gioee May 21, 2025
3872dfe
force static build boringssl
Gioee May 21, 2025
b547b00
other force static lib flags
Gioee May 21, 2025
93be800
libc++ instead of libstdc++
Gioee May 21, 2025
df61b98
boringssl build not cxx flags
Gioee May 21, 2025
46e3bec
android openssl instead of boringssl for tls backend
Gioee May 21, 2025
826d91f
conditional cov flags
Gioee May 21, 2025
7bc3b04
link gcov only on linux and windows and clean workflow
Gioee May 21, 2025
df4575a
ghpages rm environment
Gioee May 21, 2025
04f6b05
android build openssl specify target
Gioee May 21, 2025
0d04ce4
android emu print free space
Gioee May 21, 2025
7879bcc
android build openssl with install_sw
Gioee May 21, 2025
0184beb
android not able to write in home
Gioee May 21, 2025
d3c3268
html coverage folder to src
Gioee May 21, 2025
046523a
cleanup
Gioee May 21, 2025
6ef55c9
rm coverage.info
Gioee May 21, 2025
4ee18c8
fix(workflow): use deploy-pages@v3
Gioee May 21, 2025
7506a26
fix(makefile): separate test cflags and test ldflags
Gioee May 21, 2025
30688a1
fix(unit): unused result
Gioee May 21, 2025
a1b4d9d
fix typo
Gioee May 21, 2025
19d3b13
fix test flags
Gioee May 21, 2025
76c58f9
deploy-pages missing gh token
Gioee May 21, 2025
b937272
Merge branch 'main' into update-build-pipeline
Gioee May 21, 2025
7e481a0
fix merge conflict
Gioee May 21, 2025
116d058
github pages test src folder
Gioee May 21, 2025
030c54a
deploy to github pages in the same job as upload artifact
Gioee May 21, 2025
d9c8132
deploy coverage in separate job
Gioee May 21, 2025
ca8b04a
default deploy gh pages artifact name
Gioee May 21, 2025
d952e8e
revert deploy pages action version
Gioee May 21, 2025
03a5a04
rm unused subdir
Gioee May 21, 2025
fcfc040
replace upload pages artifact action
Gioee May 21, 2025
365e5aa
remove separate deploy coverage job
Gioee May 21, 2025
b1fa49f
Merge branch 'main' into update-build-pipeline
Gioee May 21, 2025
f021dc6
coverage badge
Gioee May 21, 2025
2837a9a
tofix merge conflict
Gioee May 21, 2025
58db5d0
final workflow
Gioee May 21, 2025
1f78c53
fix cloudsync_payload_apply from main branch
Gioee May 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 171 additions & 47 deletions .github/workflows/main.yml
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated workflow with sqlite-sync build, test and release; the release process (which includes coverage website update) is made only in the main branch; build and tests are done also in other dev branches

Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: build sqlitesync
name: build, test and release sqlite-sync
on:
push:
branches:
- main

permissions:
contents: write
pages: write
id-token: write

jobs:
build:
runs-on: ${{ matrix.os }}
name: build for ${{ matrix.name }}-${{ matrix.arch }}
name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'isim' && matrix.name != 'ios' && ' + test' || ''}}
timeout-minutes: 20
strategy:
fail-fast: false
Expand All @@ -22,23 +25,22 @@ jobs:
configure: --with-openssl
name: linux
- os: macos-latest
arch: arm64
configure: --with-secure-transport
name: macos
- os: macos-13
arch: x86_64
configure: --with-secure-transport
configure:
--with-secure-transport
CFLAGS="-arch x86_64 -arch arm64"
name: macos
- os: windows-latest
arch: x86_64
configure: --with-schannel
configure:
--with-schannel
CFLAGS="-DCURL_STATICLIB"
name: windows
- os: ubuntu-latest
arch: arm64
arch: arm64-v8a
configure:
--host aarch64-linux-android26
--with-openssl=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr
LIBS="-lssl -lcrypto -lc++"
LIBS="-lssl -lcrypto"
AR=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
AS=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as
CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang
Expand All @@ -47,12 +49,15 @@ jobs:
RANLIB=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
STRIP=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
name: android
make:
PLATFORM=android
CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang
- os: ubuntu-latest
arch: x86_64
configure:
--host x86_64-linux-android26
--with-openssl=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr
LIBS="-lssl -lcrypto -lc++"
LIBS="-lssl -lcrypto"
AR=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar
AS=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-as
CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang
Expand All @@ -61,27 +66,24 @@ jobs:
RANLIB=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ranlib
STRIP=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip
name: android
make:
PLATFORM=android
CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang
sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
- os: macos-latest
arch: arm64
configure:
--host=arm64-apple-darwin
--with-secure-transport
CFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -miphoneos-version-min=11.0"
name: ios
make: PLATFORM=ios
- os: macos-latest
arch: arm64
configure:
--host=arm64-apple-darwin
--with-secure-transport
CFLAGS="-arch arm64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -miphonesimulator-version-min=11.0"
name: isim
- os: macos-latest
arch: x86_64
configure:
--host=x86_64-apple-darwin
--with-secure-transport
CFLAGS="-arch x86_64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -miphonesimulator-version-min=11.0"
CFLAGS="-arch x86_64 -arch arm64 -isysroot $(xcrun --sdk iphonesimulator --show-sdk-path) -miphonesimulator-version-min=11.0"
name: isim
make: PLATFORM=isim

defaults:
run:
Expand All @@ -108,27 +110,27 @@ jobs:
extract: true
fileName: curl-*.tar.gz

- name: build boringssl
- name: build openssl
if: matrix.name == 'android'
run: |
git clone https://boringssl.googlesource.com/boringssl
cd boringssl
mkdir build
cd build
cmake \
-DANDROID_ABI=${{ matrix.arch == 'arm64' && 'arm64-v8a' || 'x86_64' }} \
-DANDROID_PLATFORM=android-26 \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \
-DOPENSSL_SMALL=1 \
-DCMAKE_BUILD_TYPE=Release \
..
git clone https://github.com/openssl/openssl.git
cd openssl
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
export ARCH=${{ matrix.arch }}
export PATH=$TOOLCHAIN/bin:$PATH

./Configure android-${{ matrix.arch == 'arm64-v8a' && 'arm64' || matrix.arch }} \
--prefix=$PWD/build \
--openssldir=$PWD/build/ssl \
no-shared \
no-unit-test \
-D__ANDROID_API__=26
make
make install_sw

cd ..
TOOLCHAIN="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64"
cp build/libssl.a $TOOLCHAIN/sysroot/usr/lib/
cp build/libcrypto.a $TOOLCHAIN/sysroot/usr/lib/
cp -r include/openssl $TOOLCHAIN/sysroot/usr/include/
cp build/lib/libssl.a $TOOLCHAIN/sysroot/usr/lib/
cp build/lib/libcrypto.a $TOOLCHAIN/sysroot/usr/lib/
cp -r build/include/openssl $TOOLCHAIN/sysroot/usr/include/

- name: build curl
run: |
Expand Down Expand Up @@ -205,15 +207,137 @@ jobs:
# --without-libgsasl \

cd ..
mkdir -p network/curl/${{ matrix.name }}
mv $folder/lib/.libs/libcurl.a network/curl/${{ matrix.name }}/lib${{matrix.arch}}.a
mkdir -p curl/${{ matrix.name }}
mv $folder/lib/.libs/libcurl.a curl/${{ matrix.name }}

- name: build sqlite-sync
run: make ${{ matrix.make && matrix.make || ''}}
shell: bash

- name: windows install sqlite3
if: matrix.os == 'windows-latest'
run: choco install sqlite -y
shell: bash

- name: macos install sqlite3 without SQLITE_OMIT_LOAD_EXTENSION
if: matrix.name == 'macos'
run: brew link sqlite --force

- name: android setup test environment
if: matrix.name == 'android' && matrix.arch != 'arm64-v8a'
run: |

echo "::group::enable kvm group perms"
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
echo "::endgroup::"

echo "::group::download and build sqlite3 without SQLITE_OMIT_LOAD_EXTENSION"
curl -O ${{ matrix.sqlite-amalgamation-zip }}
unzip sqlite-amalgamation-*.zip
export ${{ matrix.make }}
$CC sqlite-amalgamation-*/shell.c sqlite-amalgamation-*/sqlite3.c -o sqlite3 -ldl
# remove unused folders to save up space
rm -rf sqlite-amalgamation-*.zip sqlite-amalgamation-* curl-* openssl
echo "::endgroup::"

echo "::group::prepare the test script"
make test CC=$CC PLATFORM=$PLATFORM || echo "It should fail. Running remaining commands in the emulator"
cat > commands.sh << EOF
mv -f /data/local/tmp/sqlite3 /system/xbin
cd /data/local/tmp
$(make test CC=$CC PLATFORM=$PLATFORM -n)
EOF
echo "::endgroup::"

- name: android test sqlite-sync
if: matrix.name == 'android' && matrix.arch != 'arm64-v8a'
uses: reactivecircus/android-emulator-runner@v2.34.0
with:
api-level: 26
arch: ${{ matrix.arch }}
script: |
adb root
adb remount
adb push ${{ github.workspace }}/. /data/local/tmp/
adb shell "sh /data/local/tmp/commands.sh"

- name: test sqlite-sync
if: matrix.name == 'linux' || matrix.name == 'windows'
run: make test
shell: bash

- name: test sqlite-sync + coverage
if: matrix.name == 'macos'
run: brew install lcov && make test COVERAGE=true

- uses: actions/upload-pages-artifact@v3.0.1
if: matrix.name == 'macos'
with:
path: coverage

- uses: actions/upload-artifact@v4.6.2
if: always()
with:
name: libcurl-${{ matrix.name }}-${{ matrix.arch }}
path: network/curl/${{ matrix.name }}/lib${{matrix.arch}}.a
name: cloudsync-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }}
path: dist/cloudsync.*
if-no-files-found: error

- name: build sqlitesync
release:
runs-on: ubuntu-latest
name: release
needs: build
if: github.ref == 'refs/heads/main'

env:
GH_TOKEN: ${{ github.token }}

steps:

- uses: actions/checkout@v4.2.2

- uses: actions/download-artifact@v4.2.1
with:
path: artifacts

- name: setup GitHub Pages
uses: actions/configure-pages@v5

- name: deploy coverage to GitHub Pages
uses: actions/deploy-pages@v4.0.5

- name: release tag version from cloudsync.h
id: tag
run: |
FILE="src/cloudsync.h"
VERSION=$(grep -oP '#define CLOUDSYNC_VERSION\s+"\K[^"]+' "$FILE")
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "version=$VERSION" >> $GITHUB_OUTPUT
exit 0
fi
echo "❌ CLOUDSYNC_VERSION not found in cloudsync.h"
exit 1

- name: zip artifacts
run: |
echo "TODO: build sqlitesync"
for folder in "artifacts"/*; do
if [ -d "$folder" ]; then
name=$(basename "$folder")
if [[ "$name" != "github-pages" ]]; then
zip -jq "${name}-${{ steps.tag.outputs.version }}.zip" "$folder"/*
tar -cJf "${name}-${{ steps.tag.outputs.version }}.tar.xz" -C "$folder" .
tar -czf "${name}-${{ steps.tag.outputs.version }}.tar.gz" -C "$folder" .
fi
fi
done

- uses: softprops/action-gh-release@v2.2.1
with:
generate_release_notes: true
tag_name: ${{ steps.tag.outputs.version }}
files: |
cloudsync-*-${{ steps.tag.outputs.version }}.zip
cloudsync-*-${{ steps.tag.outputs.version }}.tar.xz
cloudsync-*-${{ steps.tag.outputs.version }}.tar.gz
make_latest: true
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
.DS_Store
*.xcworkspacedata
*.xcuserstate
*.xcbkptlist
*.plist
/build
/dist
/coverage
*.sqlite
*.a
Loading