Skip to content

Commit 9034c37

Browse files
committed
Merge pull request #20 from sqlrsync/v0.0.6
Adds an experimental --subscribe with --maxIdle, --minInterval, --maxInterval. Adds automatic e2e testing in the build process Add Dependabot Add Integrity Check Add USGS Earthquakes Example
2 parents 26c67d7 + 000a4da commit 9034c37

3 files changed

Lines changed: 122 additions & 58 deletions

File tree

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "gomod" # See documentation for possible values
9+
directory: "/client" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 111 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
name: Multi-Platform Build
2-
32
on:
4-
push:
5-
branches: [main, develop]
63
pull_request:
7-
branches: [main]
4+
branches:
5+
- main
6+
- "v*"
87
release:
98
types: [published]
109

1110
jobs:
11+
securityIntention:
12+
name: Security Intention
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Security Intention
16+
run: |
17+
echo "This workflow is intended to build the project in a secure manner:"
18+
echo " - Only installs absolutely essential and trusted dependencies. (steps \"Install *\")"
19+
echo " - Uses HTTPS for direct package downloads"
20+
echo " - Only uses official Github Actions \"actions/*\""
1221
build:
13-
name: Build for ${{ matrix.os }}
22+
name: Build for ${{ matrix.os }}-${{matrix.arch}}
1423
runs-on: ${{ matrix.runs-on }}
1524
strategy:
1625
matrix:
@@ -24,15 +33,7 @@ jobs:
2433
- os: linux
2534
runs-on: ubuntu-latest
2635
arch: x86_64
27-
2836
steps:
29-
- name: Security Intention
30-
run: |
31-
echo "This workflow is intended to build the project in a secure manner:"
32-
echo " - Only installs absolutely essential and trusted dependencies. (steps \"Install *\")"
33-
echo " - Uses HTTPS for direct package downloads"
34-
echo " - Only uses official Github Actions \"actions/*\""
35-
3637
- name: Checkout code
3738
uses: actions/checkout@v4
3839

@@ -133,6 +134,66 @@ jobs:
133134
# Use make with MSYS2/MinGW
134135
bash -c "make build"
135136
137+
- name: Test sqlrsync --version
138+
run: |
139+
echo "Testing sqlrsync --version..."
140+
./client/bin/sqlrsync --version
141+
142+
- name: Test sqlrsync help
143+
run: |
144+
echo "Testing sqlrsync help..."
145+
./client/bin/sqlrsync || true
146+
147+
- name: Test sqlrsync with usgs.gov/earthquakes.db
148+
run: |
149+
echo "Testing sqlrsync usgs.gov/earthquakes.db..."
150+
./client/bin/sqlrsync usgs.gov/earthquakes.db
151+
152+
- name: Test sqlrsync with subscribe for 10 seconds (Linux)
153+
if: matrix.os == 'linux'
154+
run: |
155+
echo "Testing sqlrsync usgs.gov/earthquakes.db --subscribe for 10 seconds..."
156+
timeout 10s ./client/bin/sqlrsync usgs.gov/earthquakes.db --subscribe > subscribe_output.log 2>&1 || true
157+
158+
- name: Test sqlrsync with subscribe for 10 seconds (macOS)
159+
if: matrix.os == 'darwin'
160+
run: |
161+
echo "Testing sqlrsync usgs.gov/earthquakes.db --subscribe for 10 seconds..."
162+
# macOS doesn't have timeout, use gtimeout or alternative
163+
if command -v gtimeout &> /dev/null; then
164+
gtimeout 10s ./client/bin/sqlrsync usgs.gov/earthquakes.db --subscribe > subscribe_output.log 2>&1 || true
165+
else
166+
# Fallback: run in background and kill after 10 seconds
167+
./client/bin/sqlrsync usgs.gov/earthquakes.db --subscribe > subscribe_output.log 2>&1 &
168+
PID=$!
169+
sleep 10
170+
kill $PID 2>/dev/null || true
171+
wait $PID 2>/dev/null || true
172+
fi
173+
174+
- name: Test sqlrsync with subscribe for 10 seconds (Windows)
175+
if: matrix.os == 'windows'
176+
run: |
177+
echo "Testing sqlrsync usgs.gov/earthquakes.db --subscribe for 10 seconds..."
178+
# Windows doesn't have timeout, use PowerShell equivalent
179+
$job = Start-Job { ./client/bin/sqlrsync.exe usgs.gov/earthquakes.db --subscribe }
180+
Wait-Job $job -Timeout 10
181+
Stop-Job $job
182+
Receive-Job $job > subscribe_output.log 2>&1 || $true
183+
184+
- name: Verify subscribe output (Unix)
185+
if: matrix.os != 'windows'
186+
run: |
187+
echo "Checking for 'Sync complete' in output..."
188+
cat subscribe_output.log
189+
if grep -q "Sync complete" subscribe_output.log; then
190+
echo "✅ SUCCESS: Found 'Sync complete' in output"
191+
else
192+
echo "❌ FAILURE: 'Sync complete' not found in output"
193+
echo "Full output:"
194+
cat subscribe_output.log
195+
exit 1
196+
fi
136197
- name: Create release directory
137198
run: |
138199
mkdir -p release
@@ -162,47 +223,47 @@ jobs:
162223
release:
163224
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
164225
needs: build
165-
permissions:
226+
permissions:
166227
contents: write
167228
packages: write
168229
issues: write
169230
pull-requests: write
170231
actions: write
171232
runs-on: ubuntu-latest
172233
steps:
173-
- uses: actions/checkout@v5
174-
175-
- name: Extract version from main.go
176-
id: extract-version
177-
run: |
178-
VERSION=$(grep 'var VERSION = ' client/main.go | sed 's/var VERSION = "\(.*\)"/\1/')
179-
echo "version=$VERSION" >> $GITHUB_OUTPUT
180-
echo "Extracted version: $VERSION"
181-
182-
- name: Check if tag exists
183-
id: tag-check
184-
run: |
185-
VERSION=${{ steps.extract-version.outputs.version }}
186-
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
187-
echo "Tag v$VERSION already exists"
188-
echo "tag-created=false" >> $GITHUB_OUTPUT
189-
else
190-
echo "Tag v$VERSION does not exist, will create"
191-
echo "tag-created=true" >> $GITHUB_OUTPUT
192-
fi
193-
194-
- name: Download all release artifacts
195-
if: steps.tag-check.outputs.tag-created == 'true'
196-
uses: actions/download-artifact@v5
197-
198-
- name: Create tag and GitHub Release, attach artifact
199-
env:
200-
GH_TOKEN: ${{ github.token }}
201-
run: |
202-
TAG=v${{ steps.extract-version.outputs.version }}
203-
git config user.name "${{ github.actor }}"
204-
git config user.email "${{ github.actor }}@users.noreply.github.com"
205-
git tag -a $TAG -m "Release $TAG"
206-
git push origin $TAG
207-
# create the release and attach the artifact (gh CLI)
208-
gh release create $TAG --generate-notes sqlrsync-*/sqlrsync-*
234+
- uses: actions/checkout@v5
235+
236+
- name: Extract version from main.go
237+
id: extract-version
238+
run: |
239+
VERSION=$(grep 'var VERSION = ' client/main.go | sed 's/var VERSION = "\(.*\)"/\1/')
240+
echo "version=$VERSION" >> $GITHUB_OUTPUT
241+
echo "Extracted version: $VERSION"
242+
243+
- name: Check if tag exists
244+
id: tag-check
245+
run: |
246+
VERSION=${{ steps.extract-version.outputs.version }}
247+
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
248+
echo "Tag v$VERSION already exists"
249+
echo "tag-created=false" >> $GITHUB_OUTPUT
250+
else
251+
echo "Tag v$VERSION does not exist, will create"
252+
echo "tag-created=true" >> $GITHUB_OUTPUT
253+
fi
254+
255+
- name: Download all release artifacts
256+
if: steps.tag-check.outputs.tag-created == 'true'
257+
uses: actions/download-artifact@v5
258+
259+
- name: Create tag and GitHub Release, attach artifact
260+
env:
261+
GH_TOKEN: ${{ github.token }}
262+
run: |
263+
TAG=v${{ steps.extract-version.outputs.version }}
264+
git config user.name "${{ github.actor }}"
265+
git config user.email "${{ github.actor }}@users.noreply.github.com"
266+
git tag -a $TAG -m "Release $TAG"
267+
git push origin $TAG
268+
# create the release and attach the artifact (gh CLI)
269+
gh release create $TAG --generate-notes sqlrsync-*/sqlrsync-*

client/remote/client.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -703,14 +703,6 @@ func (c *Client) Connect() error {
703703
c.logger.Fatal("No wsID provided for X-ClientID header")
704704
}
705705

706-
headers.Set("X-ClientVersion", c.config.ClientVersion)
707-
708-
if c.config.WsID != "" {
709-
headers.Set("X-ClientID", c.config.WsID)
710-
} else {
711-
c.logger.Fatal("No wsID provided for X-ClientID header")
712-
}
713-
714706
if c.config.LocalHostname != "" {
715707
headers.Set("X-LocalHostname", c.config.LocalHostname)
716708
}

0 commit comments

Comments
 (0)