Skip to content

Commit

Permalink
Adjusting Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Leland Garofalo authored and Leland Garofalo committed Oct 11, 2024
1 parent 52d55bf commit 48f4db4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
5 changes: 0 additions & 5 deletions Dockerfile.hot.dev

This file was deleted.

53 changes: 39 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,51 @@ SHELL := /bin/bash

# go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
.PHONY: run test integration-test build ci-run fmt

.PHONY: fmt run
# Dev Commands

fmt:
@gofmt -l -w $(SRC)

run:
## Runs the api service in a way that depends on the database from the askdarcel-api project
run: docker-exists
docker compose -f docker-compose.dev.yml build && docker compose -f docker-compose.dev.yml up

hot-run:
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./tmp/sheltertech-go-hot ./cmd/sheltertech-go && DOCKER_DEFAULT_PLATFORM="linux/amd64" docker compose -f docker-compose.hot.dev.yml build && docker compose -f docker-compose.hot.dev.yml up
## Runs the api service in a way that brings up its own database and does not require anything from askdarcel-api running
run-standalone: docker-exists
docker compose -f docker-compose.ci.yml build && docker compose -f docker-compose.ci.yml up

ci-run:
docker compose -f docker-compose.ci.yml build && docker compose -f docker-compose.ci.yml up -d
# Test Commands

## Unit tests which require no other dependencies
test: go-exists
go test -v ./...

## Expects a server running on localhost:3001 from the dev flow
integration-test: go-exists
go test -v -tags=integration ./...

# CI Commands

build:
## Used in CI to do a quick compile check
build: go-exists
go build -v ./...

test:
go test -v ./...
## Used in CI to start a database in the background along with the api service
## Running this yourself allows you to create what happens in CI
ci-run: docker-exists
docker compose -f docker-compose.ci.yml build && docker compose -f docker-compose.ci.yml up -d

# Utility

## Format go files in repo
fmt: go-exists
@gofmt -l -w $(SRC)

go-exists:
ifeq (, $(shell which go))
$(error golang is not installed on this machine, you may use `brew install go` to install it.)
endif

integration-test:
go test -v -tags=integration ./...
docker-exists:
ifeq (, $(shell which docker))
$(error docker is not installed on this machine, you will need to install docker.)
endif
25 changes: 0 additions & 25 deletions docker-compose.hot.dev.yml

This file was deleted.

0 comments on commit 48f4db4

Please sign in to comment.