diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3e353c..83fabce 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,48 +11,57 @@ permissions: jobs: build: runs-on: ${{ matrix.os }} + container: ${{ matrix.container && matrix.container || '' }} name: ${{ matrix.name }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }} build${{ matrix.arch != 'arm64-v8a' && matrix.name != 'ios-sim' && matrix.name != 'ios' && matrix.name != 'wasm' && matrix.name != 'apple-xcframework' && ' + test' || ''}} timeout-minutes: 20 strategy: fail-fast: false matrix: include: - - os: ubuntu-latest + - os: ubuntu-22.04 arch: x86_64 name: linux - - os: LinuxARM64 + - os: ubuntu-22.04-arm arch: arm64 name: linux - - os: macos-latest + - os: ubuntu-22.04 + arch: x86_64 + name: linux-musl + container: alpine:latest + - os: ubuntu-22.04-arm + arch: arm64 + name: linux-musl + - os: macos-15 name: macos - - os: windows-latest + make: COVERAGE=ON + - os: windows-2022 arch: x86_64 name: windows - - os: ubuntu-latest + - os: ubuntu-22.04 arch: arm64-v8a name: android make: PLATFORM=android ARCH=arm64-v8a - - os: ubuntu-latest + - os: ubuntu-22.04 arch: x86_64 name: android make: PLATFORM=android ARCH=x86_64 sqlite-amalgamation-zip: https://sqlite.org/2025/sqlite-amalgamation-3490100.zip - - os: macos-latest + - os: macos-15 name: ios make: PLATFORM=ios - - os: macos-latest + - os: macos-15 name: ios-sim make: PLATFORM=ios-sim - - os: ubuntu-latest + - os: ubuntu-22.04 name: wasm make: PLATFORM=wasm - - os: macos-latest + - os: macos-15 name: apple-xcframework make: xcframework defaults: run: - shell: bash + shell: ${{ contains(matrix.container, 'alpine') && 'sh' || 'bash' }} env: CONNECTION_STRING: ${{ secrets.CONNECTION_STRING }} @@ -64,15 +73,39 @@ jobs: - uses: actions/checkout@v4.2.2 - uses: msys2/setup-msys2@v2.27.0 - if: matrix.os == 'windows-latest' + if: matrix.name == 'windows' with: msystem: mingw64 - install: >- - mingw-w64-x86_64-cc - make + install: mingw-w64-x86_64-cc make + + - name: windows install dependencies + if: matrix.name == 'windows' + run: choco install sqlite -y + + - name: macos install dependencies + if: matrix.name == 'macos' + run: brew link sqlite --force && brew install lcov + + - name: linux-musl x86_64 install dependencies + if: matrix.name == 'linux-musl' && matrix.arch == 'x86_64' + run: apk update && apk add --no-cache gcc make curl sqlite openssl-dev musl-dev linux-headers + + - name: linux-musl arm64 setup container + if: matrix.name == 'linux-musl' && matrix.arch == 'arm64' + run: | + docker run -d --name alpine \ + --platform linux/arm64 \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace \ + -e CONNECTION_STRING="${{ env.CONNECTION_STRING }}" \ + -e APIKEY="${{ env.APIKEY }}" \ + -e WEBLITE="${{ env.WEBLITE }}" \ + alpine:latest \ + tail -f /dev/null + docker exec alpine sh -c "apk update && apk add --no-cache gcc make curl sqlite openssl-dev musl-dev linux-headers" - name: windows build curl - if: matrix.os == 'windows-latest' + if: matrix.name == 'windows' run: make curl/windows/libcurl.a shell: msys2 {0} @@ -81,15 +114,7 @@ jobs: run: sudo apt install wabt - name: build sqlite-sync - run: make extension ${{ matrix.make && matrix.make || ''}} - - - name: windows install sqlite3 - if: matrix.os == 'windows-latest' - run: choco install sqlite -y - - - name: macos install sqlite3 without SQLITE_OMIT_LOAD_EXTENSION - if: matrix.name == 'macos' - run: brew link sqlite --force + run: ${{ matrix.name == 'linux-musl' && matrix.arch == 'arm64' && 'docker exec alpine' || '' }} make extension ${{ matrix.make && matrix.make || ''}} - name: android setup test environment if: matrix.name == 'android' && matrix.arch != 'arm64-v8a' @@ -135,12 +160,8 @@ jobs: adb shell "sh /data/local/tmp/commands.sh" - name: test sqlite-sync - if: matrix.name == 'linux' || matrix.name == 'windows' - run: make test - - - name: test sqlite-sync + coverage - if: matrix.name == 'macos' - run: brew install lcov && make test COVERAGE=true + if: contains(matrix.name, 'linux') || matrix.name == 'windows' || matrix.name == 'macos' + run: ${{ matrix.name == 'linux-musl' && matrix.arch == 'arm64' && 'docker exec alpine' || '' }} make test ${{ matrix.make && matrix.make || ''}} - uses: actions/upload-pages-artifact@v3.0.1 if: matrix.name == 'macos' @@ -155,7 +176,7 @@ jobs: if-no-files-found: error release: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 name: release needs: build if: github.ref == 'refs/heads/main' diff --git a/Makefile b/Makefile index de71fe1..c3ba6a2 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,6 @@ CC = gcc CFLAGS = -Wall -Wextra -Wno-unused-parameter -I$(SRC_DIR) -I$(SQLITE_DIR) -I$(CURL_DIR)/include T_CFLAGS = $(CFLAGS) -DSQLITE_CORE -DCLOUDSYNC_UNITTEST -DCLOUDSYNC_OMIT_NETWORK -DCLOUDSYNC_OMIT_PRINT_RESULT LDFLAGS = -L./$(CURL_DIR)/$(PLATFORM) -lcurl -COVERAGE = false # Directories SRC_DIR = src @@ -128,7 +127,7 @@ else # linux STRIP = strip --strip-unneeded $@ endif -ifneq ($(COVERAGE),false) +ifdef COVERAGE ifneq (,$(filter $(platform),linux windows)) T_LDFLAGS += -lgcov endif @@ -207,7 +206,7 @@ $(BUILD_TEST)/%.o: %.c test: $(TARGET) $(TEST_TARGET) $(SQLITE3) ":memory:" -cmd ".bail on" ".load ./$<" "SELECT cloudsync_version();" set -e; for t in $(TEST_TARGET); do ./$$t; done -ifneq ($(COVERAGE),false) +ifdef COVERAGE mkdir -p $(COV_DIR) lcov --capture --directory . --output-file $(COV_DIR)/coverage.info $(subst src, --include src,${COV_FILES}) genhtml $(COV_DIR)/coverage.info --output-directory $(COV_DIR) @@ -386,7 +385,7 @@ help: @echo "Targets:" @echo " all - Build the extension (default)" @echo " clean - Remove built files" - @echo " test [COVERAGE=true] - Test the extension with optional coverage output" + @echo " test [COVERAGE=ON] - Test the extension with optional coverage output" @echo " help - Display this help message" .PHONY: all clean test extension help xcframework diff --git a/src/cloudsync.h b/src/cloudsync.h index 4be26c0..23d34d0 100644 --- a/src/cloudsync.h +++ b/src/cloudsync.h @@ -16,7 +16,7 @@ #include "sqlite3.h" #endif -#define CLOUDSYNC_VERSION "0.8.21" +#define CLOUDSYNC_VERSION "0.8.22" int sqlite3_cloudsync_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);