37 lines
788 B
Bash
Executable File
37 lines
788 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Test build script for apskel-pos-backend
|
|
|
|
set -e
|
|
|
|
echo "๐จ Testing Go build..."
|
|
|
|
# Check Go version
|
|
echo "Go version:"
|
|
go version
|
|
|
|
# Clean previous builds
|
|
echo "๐งน Cleaning previous builds..."
|
|
rm -f server
|
|
rm -rf tmp/
|
|
|
|
# Test local build
|
|
echo "๐๏ธ Building application..."
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o server cmd/server/main.go
|
|
|
|
if [ -f "server" ]; then
|
|
echo "โ
Build successful! Binary created: server"
|
|
ls -la server
|
|
|
|
# Test if binary can run (quick test)
|
|
echo "๐งช Testing binary..."
|
|
timeout 5s ./server || true
|
|
|
|
echo "๐งน Cleaning up..."
|
|
rm -f server
|
|
|
|
echo "โ
All tests passed! Docker build should work."
|
|
else
|
|
echo "โ Build failed! Binary not created."
|
|
exit 1
|
|
fi |