11name : Multi-Platform Build
2-
32on :
4- push :
5- branches : [main, develop]
63 pull_request :
7- branches : [main]
4+ branches :
5+ - main
6+ - " v*"
87 release :
98 types : [published]
109
1110jobs :
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 :
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-*
0 commit comments