This commit is contained in:
Imbus 2024-02-28 10:36:36 +01:00
commit 523a211933
24 changed files with 490 additions and 55 deletions

View file

@ -19,6 +19,9 @@ build:
run: build
./bin/server
watch: build
watchexec -w . -r make run
# Clean target
clean:
$(GOCLEAN)
@ -26,8 +29,8 @@ clean:
rm -f db.sqlite3
# Test target
test:
$(GOTEST) ./...
test: db.sqlite3
$(GOTEST) ./... -count=1 -v
# Get dependencies target
deps:
@ -46,9 +49,19 @@ migrate:
sqlite3 $(DB_FILE) < $$file; \
done
# Target added primarily for CI/CD to ensure that the database is created before running tests
db.sqlite3:
make migrate
backup:
mkdir -p backups
sqlite3 $(DB_FILE) .dump | gzip -9 > ./backups/BACKUP_$(DB_FILE)_$(shell date +"%Y-%m-%d_%H:%M:%S").sql.gz
# Restore with:
# gzip -cd BACKUP_FILE.sql.gz | sqlite3 $(DB_FILE)
# Format
fmt:
$(GOCMD) fmt ./...
# Default target
default: build
default: build