Skip to content

Commit 5b9e381

Browse files
author
Datanoise
committed
CI: Add startup test for tinyice binary in release workflow
1 parent 39d0c7b commit 5b9e381

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,38 @@ jobs:
3838
fi
3939
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags="-s -w" -o dist/tinyice-${{ matrix.goos }}-${{ matrix.goarch }}${EXT} main.go
4040
41+
- name: Test TinyIce startup on Linux
42+
if: ${{ runner.os == 'Linux' && matrix.goos == 'linux' }}
43+
run: |
44+
BINARY_PATH="dist/tinyice-${{ matrix.goos }}-${{ matrix.goarch }}"
45+
46+
echo "Starting TinyIce in background for 5 seconds to check for startup errors..."
47+
# Use a non-default port and tmp config to avoid conflicts
48+
timeout 5s $BINARY_PATH -port 8080 -config /tmp/tinyice-test-${{ matrix.goos }}-${{ matrix.goarch }}.json &
49+
PID=$!
50+
51+
# Wait for the process to finish for up to 6 seconds (slightly more than timeout)
52+
if ! wait $PID; then
53+
EXIT_CODE=$?
54+
if [ $EXIT_CODE -eq 124 ]; then
55+
echo "TinyIce ran for more than 5 seconds or was killed by timeout. This is considered a pass (successful startup)."
56+
exit 0 # Treat timeout as success (program didn't crash immediately)
57+
else
58+
echo "TinyIce exited with an unexpected error code: $EXIT_CODE within 5 seconds. This indicates a startup failure."
59+
exit 1 # Treat any other non-zero exit code as failure
60+
fi
61+
else
62+
# Process exited naturally within 5 seconds
63+
EXIT_CODE=$?
64+
if [ $EXIT_CODE -eq 0 ]; then
65+
echo "TinyIce exited gracefully within 5 seconds. This is considered a pass (successful short-lived execution)."
66+
exit 0 # Treat graceful exit as success
67+
else
68+
echo "TinyIce exited with an error code: $EXIT_CODE within 5 seconds. This indicates a startup failure."
69+
exit 1 # Treat non-zero exit as failure
70+
fi
71+
fi
72+
4173
- name: Upload artifacts
4274
uses: actions/upload-artifact@v4
4375
with:

0 commit comments

Comments
 (0)