From c9cd0bc450ce80d4d2c7146394c05a232682423a Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Thu, 13 Nov 2025 13:17:12 -0800 Subject: [PATCH 01/11] add musl instead of glibc --- .github/workflows/build.yml | 62 +++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa55fdf..3ccfa9c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,9 @@ jobs: - os: linux runs-on: ubuntu-latest arch: x86_64 + - os: linux-musl + runs-on: ubuntu-latest + arch: x86_64 steps: - name: Checkout code uses: actions/checkout@v4 @@ -53,6 +56,15 @@ jobs: sudo apt-get update sudo apt-get install -y sqlite3 libsqlite3-dev build-essential + - name: Install dependencies (Alpine/musl) + if: matrix.os == 'linux-musl' + run: | + # Use Alpine container for musl builds + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + apk add --no-cache build-base sqlite-dev go curl git && + echo 'Alpine dependencies installed' + " + - name: Install dependencies (macOS) if: matrix.os == 'darwin' run: | @@ -64,7 +76,7 @@ jobs: choco install sqlite - name: Build SQLite (Unix) - if: matrix.os != 'windows' + if: matrix.os != 'windows' && matrix.os != 'linux-musl' run: | cd sqlite if [ ! -d "sqlite-latest" ]; then @@ -78,6 +90,24 @@ jobs: make make install + - name: Build SQLite (Alpine/musl) + if: matrix.os == 'linux-musl' + run: | + # Build SQLite in Alpine container for musl compatibility + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + apk add --no-cache build-base curl && + cd sqlite && + if [ ! -d 'sqlite-latest' ]; then + curl -O https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz + tar xzf sqlite-autoconf-3450100.tar.gz + mv sqlite-autoconf-3450100 sqlite-latest + fi && + cd sqlite-latest && + ./configure --prefix=\$(pwd)/../install --enable-static --disable-shared 'CFLAGS=-DSQLITE_ENABLE_DBPAGE_VTAB=1 -O2' && + make && + make install + " + - name: Build SQLite (Windows) if: matrix.os == 'windows' run: | @@ -94,10 +124,21 @@ jobs: bash -c "make install" - name: Build Bridge + if: matrix.os != 'linux-musl' run: | cd bridge make + - name: Build Bridge (Alpine/musl) + if: matrix.os == 'linux-musl' + run: | + # Build bridge in Alpine container + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + apk add --no-cache build-base go && + cd bridge && + make + " + - name: Set build environment (Darwin ARM64) if: matrix.os == 'darwin' && matrix.arch == 'arm64' run: | @@ -119,6 +160,13 @@ jobs: echo "GOARCH=amd64" >> $GITHUB_ENV echo "CGO_ENABLED=1" >> $GITHUB_ENV + - name: Set build environment (Linux musl x86_64) + if: matrix.os == 'linux-musl' && matrix.arch == 'x86_64' + run: | + echo "GOOS=linux" >> $GITHUB_ENV + echo "GOARCH=amd64" >> $GITHUB_ENV + echo "CGO_ENABLED=1" >> $GITHUB_ENV + - name: Set build environment (Windows) if: matrix.os == 'windows' run: | @@ -127,11 +175,21 @@ jobs: echo "CGO_ENABLED=1" >> $env:GITHUB_ENV - name: Build Client (Unix) - if: matrix.os != 'windows' + if: matrix.os != 'windows' && matrix.os != 'linux-musl' run: | cd client make build + - name: Build Client (Alpine/musl) + if: matrix.os == 'linux-musl' + run: | + # Build client in Alpine container + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + apk add --no-cache build-base go git && + cd client && + make build + " + - name: Build Client (Windows) if: matrix.os == 'windows' run: | From 62571cdf8128c7c0cbdf7d9f60fb0707bc59cfa0 Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Thu, 13 Nov 2025 13:19:07 -0800 Subject: [PATCH 02/11] 0.0.8 --- client/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/main.go b/client/main.go index a264a0a..6c71614 100644 --- a/client/main.go +++ b/client/main.go @@ -15,7 +15,7 @@ import ( "github.com/sqlrsync/sqlrsync.com/sync" ) -var VERSION = "0.0.7" +var VERSION = "0.0.8" var ( serverURL string verbose bool From bc681ba8492f5e063a7553f8148bface61a6d72c Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:22:52 -0800 Subject: [PATCH 03/11] make git dir safe --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ccfa9c..c0faf51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,8 @@ jobs: uses: actions/setup-go@v4 with: go-version: "1.21" - + - name: Add safe Git directory + run: git config --global --add safe.directory /workspace - name: Install dependencies (Ubuntu) if: matrix.os == 'linux' run: | From 57c810f337639de8dedfc4e6e782e3f8790197ca Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:27:35 -0800 Subject: [PATCH 04/11] move safe directory call to inside docker container --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0faf51..be4f0da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,8 +49,6 @@ jobs: uses: actions/setup-go@v4 with: go-version: "1.21" - - name: Add safe Git directory - run: git config --global --add safe.directory /workspace - name: Install dependencies (Ubuntu) if: matrix.os == 'linux' run: | @@ -186,6 +184,7 @@ jobs: run: | # Build client in Alpine container docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + git config --global --add safe.directory /workspace apk add --no-cache build-base go git && cd client && make build From 8a8193be6af76af30c6fa26ed57a54d91344a393 Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:33:16 -0800 Subject: [PATCH 05/11] use git command after installing git --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index be4f0da..152c5e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,8 +184,8 @@ jobs: run: | # Build client in Alpine container docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " - git config --global --add safe.directory /workspace apk add --no-cache build-base go git && + git config --global --add safe.directory /workspace && cd client && make build " From a7a84c8ba4ba12406cfac7df2128f29160769301 Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:39:53 -0800 Subject: [PATCH 06/11] try adding binutils --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 152c5e6..5c709ec 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,7 +184,7 @@ jobs: run: | # Build client in Alpine container docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " - apk add --no-cache build-base go git && + apk add --no-cache build-base go git binutils && git config --global --add safe.directory /workspace && cd client && make build From 9cff498a0b0ad3e465fb45c11561581e349fbfc9 Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:41:34 -0800 Subject: [PATCH 07/11] zlib-dev --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c709ec..bc31b70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -184,7 +184,7 @@ jobs: run: | # Build client in Alpine container docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " - apk add --no-cache build-base go git binutils && + apk add --no-cache zlib-dev build-base go git && git config --global --add safe.directory /workspace && cd client && make build From e49e5c67f82b684109a2a3169c9f9113e42b813e Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 11:53:03 -0800 Subject: [PATCH 08/11] ldd the binary --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc31b70..25ddd9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -189,6 +189,14 @@ jobs: cd client && make build " + # Verify binary was created + if [ ! -f ./client/bin/sqlrsync ]; then + echo "ERROR: Binary not found at ./client/bin/sqlrsync" + exit 1 + fi + echo "✓ Binary built successfully at ./client/bin/sqlrsync" + file ./client/bin/sqlrsync + ldd ./client/bin/sqlrsync || true - name: Build Client (Windows) if: matrix.os == 'windows' From 181ee8b51878044a03552fa43b4fc27c192b3f94 Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 12:00:12 -0800 Subject: [PATCH 09/11] test inside docker --- .github/workflows/build.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25ddd9f..b87e858 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -197,6 +197,15 @@ jobs: echo "✓ Binary built successfully at ./client/bin/sqlrsync" file ./client/bin/sqlrsync ldd ./client/bin/sqlrsync || true + - name: Docker based test (Alpine/musl) + if: matrix.os == 'linux-musl' + run: | + docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + ./client/bin/sqlrsync --version && + ./client/bin/sqlrsync usgs.gov/earthquakes.db && + + + " - name: Build Client (Windows) if: matrix.os == 'windows' @@ -206,16 +215,19 @@ jobs: bash -c "make build" - name: Test sqlrsync --version + if: matrix.os != 'linux-musl' run: | echo "Testing sqlrsync --version..." ./client/bin/sqlrsync --version - name: Test sqlrsync help + if: matrix.os != 'linux-musl' run: | echo "Testing sqlrsync help..." ./client/bin/sqlrsync || true - name: Test sqlrsync with usgs.gov/earthquakes.db + if: matrix.os != 'linux-musl' run: | echo "Testing sqlrsync usgs.gov/earthquakes.db..." ./client/bin/sqlrsync usgs.gov/earthquakes.db @@ -253,7 +265,7 @@ jobs: Receive-Job $job > subscribe_output.log 2>&1 || $true - name: Verify subscribe output (Unix) - if: matrix.os != 'windows' + if: matrix.os != 'windows' && matrix.os != 'linux-musl' run: | echo "Checking for 'Sync complete' in output..." cat subscribe_output.log From ce4a0d8c2a6d72e38688ef03f5dc5b7a249332fe Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 12:04:35 -0800 Subject: [PATCH 10/11] you have to test the linker from inside the container --- .github/workflows/build.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b87e858..dec7650 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -196,15 +196,14 @@ jobs: fi echo "✓ Binary built successfully at ./client/bin/sqlrsync" file ./client/bin/sqlrsync - ldd ./client/bin/sqlrsync || true + - name: Docker based test (Alpine/musl) if: matrix.os == 'linux-musl' run: | docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " + ldd ./client/bin/sqlrsync && ./client/bin/sqlrsync --version && ./client/bin/sqlrsync usgs.gov/earthquakes.db && - - " - name: Build Client (Windows) From c4a7334417e09fba39281eb3c1c39f88ccf90506 Mon Sep 17 00:00:00 2001 From: pnwmatt <180812017+pnwmatt@users.noreply.github.com> Date: Fri, 14 Nov 2025 12:07:41 -0800 Subject: [PATCH 11/11] too many ands --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dec7650..70f7938 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -203,7 +203,7 @@ jobs: docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c " ldd ./client/bin/sqlrsync && ./client/bin/sqlrsync --version && - ./client/bin/sqlrsync usgs.gov/earthquakes.db && + ./client/bin/sqlrsync usgs.gov/earthquakes.db " - name: Build Client (Windows)