All checks were successful
Build / build (push) Successful in 2m35s
#2 - Added request to download the newest version of the app #3 - Added request to check progress during sync #4 - Now blocking all request while sync is in progress #5 - Implemented ants for thread pooling #6 - Changed the sync request to now only start the sync
106 lines
2.5 KiB
Makefile
106 lines
2.5 KiB
Makefile
set dotenv-load
|
|
|
|
# Build the application
|
|
all: build test
|
|
|
|
templ-install:
|
|
@if ! command -v templ > /dev/null; then \
|
|
read -p "Go's 'templ' is not installed on your machine. Do you want to install it? [Y/n] " choice; \
|
|
if [ "$$choice" != "n" ] && [ "$$choice" != "N" ]; then \
|
|
go install github.com/a-h/templ/cmd/templ@latest; \
|
|
if [ ! -x "$$(command -v templ)" ]; then \
|
|
echo "templ installation failed. Exiting..."; \
|
|
exit 1; \
|
|
fi; \
|
|
else \
|
|
echo "You chose not to install templ. Exiting..."; \
|
|
exit 1; \
|
|
fi; \
|
|
fi
|
|
|
|
templ-build: templ-install
|
|
@echo "Building templ..."
|
|
@templ generate
|
|
|
|
tailwind-macos:
|
|
@if [ ! -f tailwindcss ]; then curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64 -o tailwindcss; fi
|
|
@chmod +x tailwindcss
|
|
|
|
tailwind-linux:
|
|
@if [ ! -f tailwindcss ]; then curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o tailwindcss; fi
|
|
@chmod +x tailwindcss
|
|
|
|
tailwind-build:
|
|
@echo "Building tailwind..."
|
|
@./tailwindcss -i cmd/web/assets/css/input.css -o cmd/web/assets/css/output.css
|
|
|
|
sqlc-generate:
|
|
@echo "Generating sqlc schema..."
|
|
@sqlc generate
|
|
|
|
migrate-create name:
|
|
@migrate create -ext sql -dir internal/db/migrations -seq {{name}}
|
|
|
|
[no-cd]
|
|
build: sqlc-generate templ-build tailwind-build
|
|
@echo "Building..."
|
|
@swag init -g routes.go -d ./internal/server/,./internal/backend/ -o ./cmd/docs
|
|
@go build -o main cmd/main.go
|
|
|
|
run:
|
|
@templ generate
|
|
@go run cmd/main.go
|
|
|
|
test: build
|
|
@echo "Testing..."
|
|
@go test ./... -v
|
|
|
|
# Clean the binary
|
|
clean:
|
|
@echo "Cleaning..."
|
|
@rm -f main
|
|
|
|
podman-run:
|
|
@podman-compose up --build
|
|
|
|
podman-down:
|
|
@podman-compose down
|
|
|
|
# Create DB container
|
|
docker-run:
|
|
@if docker compose up --build 2>/dev/null; then \
|
|
: ; \
|
|
else \
|
|
echo "Falling back to Docker Compose V1"; \
|
|
docker-compose up --build; \
|
|
fi
|
|
|
|
# Shutdown DB container
|
|
docker-down:
|
|
@if docker compose down 2>/dev/null; then \
|
|
: ; \
|
|
else \
|
|
echo "Falling back to Docker Compose V1"; \
|
|
docker-compose down; \
|
|
fi
|
|
|
|
watch-templ:
|
|
templ generate --watch --proxy="http://localhost:8080" --cmd="go run ."
|
|
|
|
# Live Reload
|
|
watch:
|
|
@if command -v air > /dev/null; then \
|
|
air; \
|
|
echo "Watching...";\
|
|
else \
|
|
read -p "Go's 'air' is not installed on your machine. Do you want to install it? [Y/n] " choice; \
|
|
if [ "$$choice" != "n" ] && [ "$$choice" != "N" ]; then \
|
|
go install github.com/air-verse/air@latest; \
|
|
air; \
|
|
echo "Watching...";\
|
|
else \
|
|
echo "You chose not to install air. Exiting..."; \
|
|
exit 1; \
|
|
fi; \
|
|
fi
|