-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
141 lines (113 loc) · 2.74 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Loading environment variables
ifneq (,$(wildcard ./.env))
include .env
export
endif
# Aliases
PYTHON := .venv/bin/python
DJANGO_ADMIN := $(PYTHON) manage.py
PYTEST := $(PYTHON) -m pytest
# Makefile config
.PHONY: check
check:
@source .venv/bin/activate; python --version; pip --version
@npm --version
@node --version
# Setup development environment
.PHONY: update-requirements
update-requirements:
$(PYTHON) -m pip install --no-deps -r requirements.txt -r dev-requirements.txt
.PHONY: init-venv
init-venv:
python -m venv .venv --prompt $(basename $(CURDIR)) --clear
.PHONY: init-dev
init-dev:
# git
git config blame.ignoreRevsFile .git-blame-ignore-revs
pre-commit install
# python
make init-venv
$(PYTHON) -m pip install pip-tools
$(PYTHON) -m pip install --no-deps -r requirements.txt -r dev-requirements.txt
# javascript
npm install
npx playwright install --with-deps
# environment
cp .env.template .env
cp ./dags/.env.template ./dags/.env
# prepare django
make migrate
make createcachetable
make createsuperuser
.PHONY: fix
fix:
$(PYTHON) -m ruff check . --fix
$(PYTHON) -m black --exclude=.venv .
# Run development servers
.PHONY: run-airflow
run-airflow:
docker compose --profile airflow up -d
.PHONY: run-django
run-django:
rm -rf .parcel-cache
honcho start -f Procfile.dev
# Local django operations
.PHONY: migrate
migrate:
$(DJANGO_ADMIN) migrate
.PHONY: makemigrations
makemigrations:
$(DJANGO_ADMIN) makemigrations
.PHONY: merge-migrations
merge-migrations:
$(DJANGO_ADMIN) makemigrations --merge
.PHONY: createcachetable
createcachetable:
$(DJANGO_ADMIN) createcachetable
.PHONY: createsuperuser
createsuperuser:
$(DJANGO_ADMIN) createsuperuser
.PHONY: seed-database
seed-database:
$(DJANGO_ADMIN) loaddata categories actions acteur_services acteur_types acteurs objets
.PHONY: drop-db
drop-db:
docker compose exec lvao-db dropdb -f -i -U qfdmo -e qfdmo
.PHONY: create-db
create-db:
docker compose exec lvao-db createdb -U qfdmo -e qfdmo
.PHONY: restore-prod
restore-prod:
./scripts/restore_prod_locally.sh
.PHONY: clear-cache
clear-cache:
$(DJANGO_ADMIN) clear_cache --all
# Dependencies management
.PHONY: pip-update
pip-update:
$(PYTHON) -m pip-compile dev-requirements.in --generate-hashes
$(PYTHON) -m pip-compile requirements.in --generate-hashes
.PHONY: npm-upgrade
npm-upgrade:
npx npm-upgrade
# Happy testing
.PHONY: unit-test
unit-test:
$(PYTEST) ./unit_tests
.PHONY: e2e-test
e2e-test:
npx playwright test
$(PYTEST) ./integration_tests
.PHONY: js-test
js-test:
npm run test
.PHONY: test
test:
@make unit-test
@make e2e-test
# DSFR
.PHONY: extract-dsfr
extract-dsfr:
$(PYTHON) ./dsfr_hacks/extract_dsfr_colors.py
$(PYTHON) ./dsfr_hacks/extract_used_colors.py
$(PYTHON) ./dsfr_hacks/extract_used_icons.py