forked from openfoodfacts/taxonomy-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (46 loc) · 1.44 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
SHELL := /bin/bash
ENV_FILE ?= .env
# load env variables
# also takes into account envrc (direnv file)
ifneq (,$(wildcard ./${ENV_FILE}))
-include ${ENV_FILE}
-include .envrc
export
endif
export DOCKER_BUILDKIT=1
export COMPOSE_DOCKER_CLI_BUILD=1
DOCKER_COMPOSE=docker-compose --env-file=${ENV_FILE}
DOCKER_COMPOSE_TEST=COMPOSE_PROJECT_NAME=test_taxonomy docker-compose --env-file=${ENV_FILE}
.PHONY: tests
#-----------#
# dev tools #
#-----------#
# lint code
lint: backend_lint
backend_lint:
@echo "🍜 Linting python code"
${DOCKER_COMPOSE} run --rm taxonomy_api isort .
${DOCKER_COMPOSE} run --rm taxonomy_api black .
# check code quality
quality: backend_quality frontend_quality
backend_quality:
@echo "🍜 Quality checks python"
${DOCKER_COMPOSE} run --rm taxonomy_api flake8 .
${DOCKER_COMPOSE} run --rm taxonomy_api isort --check-only .
${DOCKER_COMPOSE} run --rm taxonomy_api black --check .
frontend_quality:
@echo "🍜 Quality checks JS"
${DOCKER_COMPOSE} run --rm -e CI=true taxonomy_node npm run build
tests: backend_tests
backend_tests:
@echo "🍜 Running python tests"
${DOCKER_COMPOSE_TEST} up -d neo4j
${DOCKER_COMPOSE_TEST} run --rm taxonomy_api pytest . /parser
${DOCKER_COMPOSE_TEST} stop neo4j
checks: quality tests
#------------#
# production #
#------------#
create_external_volumes:
@echo "🍜 Creating external volumes (production only) …"
docker volume create ${COMPOSE_PROJECT_NAME}_neo4j-data