force static build boringssl #64
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build, test and release sqlite-sync | |
| on: | |
| push: | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| 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 | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| arch: x86_64 | |
| configure: --with-openssl | |
| name: linux | |
| - os: LinuxARM64 | |
| arch: arm64 | |
| configure: --with-openssl | |
| name: linux | |
| - os: macos-latest | |
| configure: | |
| --with-secure-transport | |
| CFLAGS="-arch x86_64 -arch arm64" | |
| name: macos | |
| - os: windows-latest | |
| arch: x86_64 | |
| configure: | |
| --with-schannel | |
| CFLAGS="-DCURL_STATICLIB" | |
| name: windows | |
| - os: ubuntu-latest | |
| 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++" | |
| 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 | |
| CXX=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang++ | |
| LD=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/ld | |
| 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++" | |
| 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 | |
| CXX=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang++ | |
| LD=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/ld | |
| 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 | |
| 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 | |
| configure: | |
| --host=arm64-apple-darwin | |
| --with-secure-transport | |
| 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: | |
| shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }} | |
| env: | |
| MAKEFLAGS: -j 8 | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: msys2/[email protected] | |
| if: matrix.os == 'windows-latest' | |
| with: | |
| msystem: mingw64 | |
| install: >- | |
| mingw-w64-x86_64-cc | |
| mingw-w64-x86_64-autotools make | |
| - uses: robinraju/[email protected] | |
| with: | |
| repository: curl/curl | |
| tag: 'curl-8_12_1' | |
| extract: true | |
| fileName: curl-*.tar.gz | |
| - name: build boringssl | |
| if: matrix.name == 'android' | |
| run: | | |
| git clone https://boringssl.googlesource.com/boringssl | |
| cd boringssl | |
| mkdir build | |
| cd build | |
| cmake \ | |
| -DANDROID_ABI=${{ matrix.arch }} \ | |
| -DANDROID_PLATFORM=android-26 \ | |
| -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake \ | |
| -DOPENSSL_SMALL=1 \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ | |
| -DBUILD_SHARED_LIBS=OFF \ | |
| .. | |
| make | |
| 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/ | |
| - name: build curl | |
| run: | | |
| folder=$(ls -d curl-*/ 2>/dev/null | head -n 1) | |
| cd $folder | |
| ./configure \ | |
| --without-libpsl \ | |
| --disable-alt-svc \ | |
| --disable-ares \ | |
| --disable-cookies \ | |
| --disable-basic-auth \ | |
| --disable-digest-auth \ | |
| --disable-kerberos-auth \ | |
| --disable-negotiate-auth \ | |
| --disable-aws \ | |
| --disable-dateparse \ | |
| --disable-dnsshuffle \ | |
| --disable-doh \ | |
| --disable-form-api \ | |
| --disable-hsts \ | |
| --disable-ipv6 \ | |
| --disable-libcurl-option \ | |
| --disable-manual \ | |
| --disable-mime \ | |
| --disable-netrc \ | |
| --disable-ntlm \ | |
| --disable-ntlm-wb \ | |
| --disable-progress-meter \ | |
| --disable-proxy \ | |
| --disable-pthreads \ | |
| --disable-socketpair \ | |
| --disable-threaded-resolver \ | |
| --disable-tls-srp \ | |
| --disable-verbose \ | |
| --disable-versioned-symbols \ | |
| --enable-symbol-hiding \ | |
| --without-brotli \ | |
| --without-zstd \ | |
| --without-libidn2 \ | |
| --without-librtmp \ | |
| --without-zlib \ | |
| --without-nghttp2 \ | |
| --without-ngtcp2 \ | |
| --disable-shared \ | |
| --disable-ftp \ | |
| --disable-file \ | |
| --disable-ipfs \ | |
| --disable-ldap \ | |
| --disable-ldaps \ | |
| --disable-rtsp \ | |
| --disable-dict \ | |
| --disable-telnet \ | |
| --disable-tftp \ | |
| --disable-pop3 \ | |
| --disable-imap \ | |
| --disable-smb \ | |
| --disable-smtp \ | |
| --disable-gopher \ | |
| --disable-mqtt \ | |
| --disable-docs \ | |
| --enable-static \ | |
| ${{matrix.configure}} | |
| make | |
| # save avg 1kb more with these options | |
| # --disable-debug \ | |
| # --enable-optimize \ | |
| # --disable-curldebug \ | |
| # --disable-get-easy-options \ | |
| # --without-fish-functions-dir \ | |
| # --without-zsh-functions-dir \ | |
| # --without-libgsasl \ | |
| cd .. | |
| mkdir -p network/curl/${{ matrix.name }} | |
| mv $folder/lib/.libs/libcurl.a network/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-* boringssl | |
| 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 | |
| sqlite3 ":memory:" -cmd ".bail on" ".load ./dist/cloudsync" "SELECT cloudsync_version();" | |
| $(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/[email protected] | |
| with: | |
| api-level: 26 | |
| arch: ${{ matrix.arch }} | |
| script: | | |
| adb root | |
| adb remount | |
| adb push ${{ github.workspace }}/. /data/local/tmp/ | |
| adb push $ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so /data/local/tmp/ | |
| adb shell "ls -lah /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/[email protected] | |
| if: matrix.name == 'macos' | |
| with: | |
| name: coverage | |
| path: coverage | |
| if-no-files-found: error | |
| - uses: actions/[email protected] | |
| if: always() | |
| with: | |
| name: cloudsync-${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} | |
| path: dist/cloudsync.* | |
| if-no-files-found: error | |
| release: | |
| runs-on: ubuntu-latest | |
| name: release | |
| needs: build | |
| #if: github.ref == 'refs/heads/main' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/[email protected] | |
| - uses: actions/[email protected] | |
| with: | |
| path: artifacts | |
| - 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: | | |
| for folder in "artifacts"/*; do | |
| if [ -d "$folder" ]; then | |
| name=$(basename "$folder") | |
| if [[ "$name" != "coverage" ]]; 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 | |
| - name: setup GitHub Pages | |
| uses: actions/configure-pages@v5 | |
| - name: deploy coverage to GitHub Pages | |
| uses: actions/[email protected] | |
| id: deployment | |
| with: | |
| artifact_name: coverage | |
| - uses: softprops/[email protected] | |
| if: false | |
| 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 |