-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(make): encapsulate tasks in Make
Adds a Makefile for simplifying the use of potentially complicated commands in both CI and local development. Refs #390, #395
- Loading branch information
1 parent
b56c95a
commit 7021c95
Showing
7 changed files
with
92 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
function finish() { | ||
echo "Stopping all containers" | ||
make logs stop | ||
} | ||
|
||
trap finish EXIT | ||
|
||
export IMAGE_TAG="${IMAGE_TAG:-local}" | ||
export TARGET="${TARGET:-prod}" | ||
|
||
make start wait-healthy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.DEFAULT_GOAL: help | ||
.PHONY: help build run dev prod start logs stop wait-healthy lint test integration-test smoke-test | ||
|
||
ifeq (${TARGET},) | ||
TARGET := dev | ||
endif | ||
|
||
DOCKER_COMPOSE = docker-compose --file docker-compose.yml --file docker-compose.$(TARGET).yml | ||
IMAGE_TAG := local | ||
|
||
export IMAGE_TAG | ||
|
||
help: ## Display this help text | ||
@grep -E '^[a-zA-Z_\\:-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | sed 's/\\:/:/g' | awk 'BEGIN {FS = ":[^:]*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
.env: | ||
cp env.example .env | ||
|
||
build: | ||
$(DOCKER_COMPOSE) build | ||
|
||
run: .env build | ||
${DOCKER_COMPOSE} up --abort-on-container-exit --exit-code-from prereview | ||
|
||
dev: export TARGET = dev | ||
dev: run ## Run the dev image | ||
|
||
prod: export TARGET = prod | ||
prod: run ## Run the prod image | ||
|
||
start: .env build | ||
start: | ||
${DOCKER_COMPOSE} up --detach | ||
|
||
logs: | ||
${DOCKER_COMPOSE} logs | ||
|
||
stop: | ||
${DOCKER_COMPOSE} down | ||
|
||
wait-healthy: ## Wait for the app to be healthy | ||
.scripts/wait-healthy.sh prereview | ||
|
||
lint: export TARGET = dev | ||
lint: build ## Run the linter | ||
${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview lint | ||
|
||
test: export TARGET = dev | ||
test: build ## Run the tests | ||
${DOCKER_COMPOSE} run --rm --no-deps --entrypoint "npm run" prereview test | ||
|
||
integration-test: export TARGET = integration | ||
integration-test: build ## Run the integration tests | ||
rm -rf integration/results | ||
${DOCKER_COMPOSE} run --rm playwright | ||
|
||
smoke-test: build ## Run the smoke tests | ||
.scripts/smoke-test.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version: "3" | ||
services: | ||
prereview: | ||
image: prereview.azurecr.io/prereview:${IMAGE_TAG:-local} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters