Update Makefile for multi-platform builds and remove obsolete test scripts

- Added new build targets in the Makefile for macOS (Intel and Apple Silicon) and a target to build for all platforms.
- Removed outdated test scripts for server and Swagger documentation testing that are no longer needed.
- Cleaned up the project structure by deleting unnecessary files to streamline the build process.
This commit is contained in:
n.nakhostin
2025-08-10 17:02:10 +03:30
parent 98f581ec97
commit 5f38c8e787
5 changed files with 21 additions and 92 deletions
+21
View File
@@ -6,6 +6,9 @@
help:
@echo "Available targets:"
@echo " build - Build the web server"
@echo " build-mac - Build for macOS (Intel)"
@echo " build-mac-arm64 - Build for macOS (Apple Silicon)"
@echo " build-all - Build for all platforms"
@echo " run - Run the web server"
@echo " test - Run tests"
@echo " clean - Clean build artifacts"
@@ -19,6 +22,24 @@ build:
@go build -o bin/web ./cmd/web
@echo "Build completed successfully!"
# Build for macOS (Intel)
build-mac:
@echo "Building web server for macOS (Intel)..."
@mkdir -p bin
@GOOS=darwin GOARCH=amd64 go build -o bin/web-mac ./cmd/web
@echo "macOS Intel build completed successfully!"
# Build for macOS (Apple Silicon)
build-mac-arm64:
@echo "Building web server for macOS (Apple Silicon)..."
@mkdir -p bin
@GOOS=darwin GOARCH=arm64 go build -o bin/web-mac-arm64 ./cmd/web
@echo "macOS ARM64 build completed successfully!"
# Build for all platforms
build-all: build build-mac build-mac-arm64
@echo "All platform builds completed successfully!"
# Run the web server
run: build
@echo "Starting web server..."
Binary file not shown.
-26
View File
@@ -1,26 +0,0 @@
#!/bin/bash
echo "Testing Tender Management API Server..."
# Check if MongoDB is running
if ! pgrep -x "mongod" > /dev/null; then
echo "Warning: MongoDB is not running. Starting server may fail."
echo "To start MongoDB: sudo systemctl start mongod"
fi
# Build the server
echo "Building server..."
go build -o bin/web ./cmd/web
if [ $? -ne 0 ]; then
echo "Build failed!"
exit 1
fi
echo "Build successful!"
# Test the health endpoint (if server starts)
echo "Testing health endpoint..."
timeout 5s curl -s http://localhost:8081/health || echo "Server not responding (expected if MongoDB is not running)"
echo "Test completed!"
-66
View File
@@ -1,66 +0,0 @@
#!/bin/bash
# Test Swagger Documentation Script
echo "🚀 Starting Tender Management API Server with Swagger Documentation..."
echo ""
# Build the application
echo "📦 Building application..."
make build
if [ $? -ne 0 ]; then
echo "❌ Build failed!"
exit 1
fi
echo ""
echo "✅ Build successful!"
echo ""
# Start the server in background
echo "🌐 Starting server..."
./bin/web &
SERVER_PID=$!
# Wait for server to start
echo "⏳ Waiting for server to start..."
sleep 3
# Check if server is running
if curl -s http://localhost:8081/health > /dev/null; then
echo "✅ Server is running!"
echo ""
echo "📚 Swagger Documentation is available at:"
echo " 🌐 http://localhost:8081/swagger/index.html"
echo ""
echo "🔍 Health Check endpoint:"
echo " 🌐 http://localhost:8081/health"
echo ""
echo "📋 Available API endpoints:"
echo " 🔐 Authentication:"
echo " POST /api/customers/login"
echo " POST /api/customers/refresh-token"
echo " 👤 Customer Profile:"
echo " GET /api/customers/profile"
echo " PUT /api/customers/profile"
echo " PUT /api/customers/change-password"
echo " 📱 Device Management:"
echo " POST /api/customers/device-token"
echo " DELETE /api/customers/device-token"
echo " 👥 Admin Operations:"
echo " POST /api/admin/customers/register"
echo " GET /api/admin/customers"
echo " GET /api/admin/customers/{id}"
echo " PUT /api/admin/customers/{id}/status"
echo ""
echo "🛑 To stop the server, press Ctrl+C or run: kill $SERVER_PID"
echo ""
# Keep the script running
wait $SERVER_PID
else
echo "❌ Server failed to start!"
kill $SERVER_PID 2>/dev/null
exit 1
fi
BIN
View File
Binary file not shown.