Skip to content

Commit 27cc357

Browse files
authored
Merge pull request #33 from sqlrsync/musl
v0.0.8 adds Musl for alpine linux
2 parents 36ad53e + c4a7334 commit 27cc357

File tree

2 files changed

+82
-5
lines changed

2 files changed

+82
-5
lines changed

.github/workflows/build.yml

Lines changed: 81 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ jobs:
3838
- os: linux
3939
runs-on: ubuntu-latest
4040
arch: x86_64
41+
- os: linux-musl
42+
runs-on: ubuntu-latest
43+
arch: x86_64
4144
steps:
4245
- name: Checkout code
4346
uses: actions/checkout@v4
@@ -46,13 +49,21 @@ jobs:
4649
uses: actions/setup-go@v4
4750
with:
4851
go-version: "1.21"
49-
5052
- name: Install dependencies (Ubuntu)
5153
if: matrix.os == 'linux'
5254
run: |
5355
sudo apt-get update
5456
sudo apt-get install -y sqlite3 libsqlite3-dev build-essential
5557
58+
- name: Install dependencies (Alpine/musl)
59+
if: matrix.os == 'linux-musl'
60+
run: |
61+
# Use Alpine container for musl builds
62+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c "
63+
apk add --no-cache build-base sqlite-dev go curl git &&
64+
echo 'Alpine dependencies installed'
65+
"
66+
5667
- name: Install dependencies (macOS)
5768
if: matrix.os == 'darwin'
5869
run: |
@@ -64,7 +75,7 @@ jobs:
6475
choco install sqlite
6576
6677
- name: Build SQLite (Unix)
67-
if: matrix.os != 'windows'
78+
if: matrix.os != 'windows' && matrix.os != 'linux-musl'
6879
run: |
6980
cd sqlite
7081
if [ ! -d "sqlite-latest" ]; then
@@ -78,6 +89,24 @@ jobs:
7889
make
7990
make install
8091
92+
- name: Build SQLite (Alpine/musl)
93+
if: matrix.os == 'linux-musl'
94+
run: |
95+
# Build SQLite in Alpine container for musl compatibility
96+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c "
97+
apk add --no-cache build-base curl &&
98+
cd sqlite &&
99+
if [ ! -d 'sqlite-latest' ]; then
100+
curl -O https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz
101+
tar xzf sqlite-autoconf-3450100.tar.gz
102+
mv sqlite-autoconf-3450100 sqlite-latest
103+
fi &&
104+
cd sqlite-latest &&
105+
./configure --prefix=\$(pwd)/../install --enable-static --disable-shared 'CFLAGS=-DSQLITE_ENABLE_DBPAGE_VTAB=1 -O2' &&
106+
make &&
107+
make install
108+
"
109+
81110
- name: Build SQLite (Windows)
82111
if: matrix.os == 'windows'
83112
run: |
@@ -94,10 +123,21 @@ jobs:
94123
bash -c "make install"
95124
96125
- name: Build Bridge
126+
if: matrix.os != 'linux-musl'
97127
run: |
98128
cd bridge
99129
make
100130
131+
- name: Build Bridge (Alpine/musl)
132+
if: matrix.os == 'linux-musl'
133+
run: |
134+
# Build bridge in Alpine container
135+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c "
136+
apk add --no-cache build-base go &&
137+
cd bridge &&
138+
make
139+
"
140+
101141
- name: Set build environment (Darwin ARM64)
102142
if: matrix.os == 'darwin' && matrix.arch == 'arm64'
103143
run: |
@@ -119,6 +159,13 @@ jobs:
119159
echo "GOARCH=amd64" >> $GITHUB_ENV
120160
echo "CGO_ENABLED=1" >> $GITHUB_ENV
121161
162+
- name: Set build environment (Linux musl x86_64)
163+
if: matrix.os == 'linux-musl' && matrix.arch == 'x86_64'
164+
run: |
165+
echo "GOOS=linux" >> $GITHUB_ENV
166+
echo "GOARCH=amd64" >> $GITHUB_ENV
167+
echo "CGO_ENABLED=1" >> $GITHUB_ENV
168+
122169
- name: Set build environment (Windows)
123170
if: matrix.os == 'windows'
124171
run: |
@@ -127,11 +174,38 @@ jobs:
127174
echo "CGO_ENABLED=1" >> $env:GITHUB_ENV
128175
129176
- name: Build Client (Unix)
130-
if: matrix.os != 'windows'
177+
if: matrix.os != 'windows' && matrix.os != 'linux-musl'
131178
run: |
132179
cd client
133180
make build
134181
182+
- name: Build Client (Alpine/musl)
183+
if: matrix.os == 'linux-musl'
184+
run: |
185+
# Build client in Alpine container
186+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c "
187+
apk add --no-cache zlib-dev build-base go git &&
188+
git config --global --add safe.directory /workspace &&
189+
cd client &&
190+
make build
191+
"
192+
# Verify binary was created
193+
if [ ! -f ./client/bin/sqlrsync ]; then
194+
echo "ERROR: Binary not found at ./client/bin/sqlrsync"
195+
exit 1
196+
fi
197+
echo "✓ Binary built successfully at ./client/bin/sqlrsync"
198+
file ./client/bin/sqlrsync
199+
200+
- name: Docker based test (Alpine/musl)
201+
if: matrix.os == 'linux-musl'
202+
run: |
203+
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace alpine:latest sh -c "
204+
ldd ./client/bin/sqlrsync &&
205+
./client/bin/sqlrsync --version &&
206+
./client/bin/sqlrsync usgs.gov/earthquakes.db
207+
"
208+
135209
- name: Build Client (Windows)
136210
if: matrix.os == 'windows'
137211
run: |
@@ -140,16 +214,19 @@ jobs:
140214
bash -c "make build"
141215
142216
- name: Test sqlrsync --version
217+
if: matrix.os != 'linux-musl'
143218
run: |
144219
echo "Testing sqlrsync --version..."
145220
./client/bin/sqlrsync --version
146221
147222
- name: Test sqlrsync help
223+
if: matrix.os != 'linux-musl'
148224
run: |
149225
echo "Testing sqlrsync help..."
150226
./client/bin/sqlrsync || true
151227
152228
- name: Test sqlrsync with usgs.gov/earthquakes.db
229+
if: matrix.os != 'linux-musl'
153230
run: |
154231
echo "Testing sqlrsync usgs.gov/earthquakes.db..."
155232
./client/bin/sqlrsync usgs.gov/earthquakes.db
@@ -187,7 +264,7 @@ jobs:
187264
Receive-Job $job > subscribe_output.log 2>&1 || $true
188265
189266
- name: Verify subscribe output (Unix)
190-
if: matrix.os != 'windows'
267+
if: matrix.os != 'windows' && matrix.os != 'linux-musl'
191268
run: |
192269
echo "Checking for 'Sync complete' in output..."
193270
cat subscribe_output.log

client/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/sqlrsync/sqlrsync.com/sync"
1616
)
1717

18-
var VERSION = "0.0.7"
18+
var VERSION = "0.0.8"
1919
var (
2020
serverURL string
2121
verbose bool

0 commit comments

Comments
 (0)