Skip to content

Commit b841af4

Browse files
authored
Merge pull request #2059 from ccnmtl/update-makefiles
Update makefiles
2 parents 327f457 + 94bd50a commit b841af4

File tree

3 files changed

+37
-78
lines changed

3 files changed

+37
-78
lines changed

django.mk

Lines changed: 22 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,31 @@
22

33
# CHANGES:
44
# 1.10.0 - 2025-10-16 - Removed coverage, updated dependencies.
5-
# 1.9.0 - Use coverage tool directly to generate coverage
6-
# reports.
7-
# - wheel and pip updates
8-
# - Use pre-compiled binary wheel for cryptography
9-
# - Remove Travis references
10-
# 1.8.0 - 2019-10-21 - Don't run flake8 on local_settings.py
11-
# 1.7.0 - 2018-05-31 - Now using python 3 by default
12-
# - Removed virtualenv.py in favor of python 3's
13-
# builtin venv capability.
14-
# 1.6.0 - 2017-09-05 - add bandit secure analysis configuration
15-
# 1.5.0 - 2017-08-24 - remove jshint/jscs in favor of eslint
16-
# 1.4.0 - 2017-06-06 - backout the switch to eslint. that's not really ready yet.
17-
# 1.3.0 - 2017-06-05 - pypi location is not needed anymore
18-
# 1.2.0 - 2016-12-15 - bump wheel version to 0.29
19-
# 1.1.0 - 2016-11-08 - run flake8 tests before unit tests
20-
# 1.0.1 - 2016-05-02 - Remove deprecated syncdb command from make install
5+
# 1.9.0 - Use coverage tool directly to generate coverage
6+
# reports.
7+
# - wheel and pip updates
8+
# - Use pre-compiled binary wheel for cryptography
9+
# - Remove Travis references
10+
# 1.8.0 - 2019-10-21 - Don't run flake8 on local_settings.py
11+
# 1.7.0 - 2018-05-31 - Now using python 3 by default
12+
# - Removed virtualenv.py in favor of python 3's
13+
# builtin venv capability.
14+
# 1.6.0 - 2017-09-05 - add bandit secure analysis configuration
15+
# 1.5.0 - 2017-08-24 - remove jshint/jscs in favor of eslint
16+
# 1.4.0 - 2017-06-06 - backout the switch to eslint. that's not really ready yet.
17+
# 1.3.0 - 2017-06-05 - pypi location is not needed anymore
18+
# 1.2.0 - 2016-12-15 - bump wheel version to 0.29
19+
# 1.1.0 - 2016-11-08 - run flake8 tests before unit tests
20+
# 1.0.1 - 2016-05-02 - Remove deprecated syncdb command from make install
2121

2222
VE ?= ./ve
2323
MANAGE ?= ./manage.py
2424
REQUIREMENTS ?= requirements.txt
2525
SYS_PYTHON ?= python3
2626
PY_SENTINAL ?= $(VE)/sentinal
2727
WHEEL_VERSION ?= 0.45.1
28-
PIP_VERSION ?= 25.2
28+
PIP_VERSION ?= 25.3
29+
SETUPTOOLS_VERSION ?= 80.9.0
2930
MAX_COMPLEXITY ?= 10
3031
INTERFACE ?= localhost
3132
RUNSERVER_PORT ?= 8000
@@ -34,19 +35,19 @@ BANDIT ?= $(VE)/bin/bandit
3435
FLAKE8 ?= $(VE)/bin/flake8
3536
PIP ?= $(VE)/bin/pip
3637

37-
jenkins: check flake8 test eslint bandit
38+
jenkins: check flake8 test bandit
3839

3940
$(PY_SENTINAL): $(REQUIREMENTS)
4041
rm -rf $(VE)
4142
$(SYS_PYTHON) -m venv $(VE)
4243
$(PIP) install pip==$(PIP_VERSION)
43-
$(PIP) install --upgrade setuptools
44+
$(PIP) install setuptools==$(SETUPTOOLS_VERSION)
4445
$(PIP) install wheel==$(WHEEL_VERSION)
4546
$(PIP) install --no-deps --requirement $(REQUIREMENTS)
4647
touch $@
4748

4849
test: $(PY_SENTINAL)
49-
$(MANAGE) test $(APP)
50+
$(MANAGE) test $(PY_DIRS)
5051

5152
parallel-tests: $(PY_SENTINAL)
5253
$(MANAGE) test --parallel
@@ -77,26 +78,4 @@ clean:
7778
rm -rf node_modules
7879
find . -name '*.pyc' -exec rm {} \;
7980

80-
pull:
81-
git pull
82-
make check
83-
make test
84-
make migrate
85-
make flake8
86-
87-
rebase:
88-
git pull --rebase
89-
make check
90-
make test
91-
make migrate
92-
make flake8
93-
94-
# run this one the very first time you check
95-
# this out on a new machine to set up dev
96-
# database, etc. You probably *DON'T* want
97-
# to run it after that, though.
98-
install: jenkins
99-
createdb $(APP)
100-
make migrate
101-
102-
.PHONY: jenkins test flake8 runserver migrate check shell clean pull rebase install
81+
.PHONY: jenkins test flake8 runserver migrate check shell clean

docker.mk

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,17 @@
1-
# VERSION=1.0.0
1+
# VERSION=2.0.0
22
# Docker related stuff
3-
# use wheelhouse/requirements.txt as the sentinal so make
4-
# knows whether it needs to rebuild the wheel directory or not
5-
# has the added advantage that it can just pip install
6-
# from that later on as well
73

8-
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
9-
WHEELHOUSE ?= wheelhouse
10-
ORG ?= ccnmtl
11-
BUILDER_IMAGE ?= ccnmtl/django.build
4+
# Start up docker dev server with docker-compose
5+
docker:
6+
docker compose up
127

13-
# make it easy to override the docker image created. eg:
14-
# REGISTRY=localhost:5000/ TAG=release-5 make build
15-
# to make an image 'localhost:5000/ccnmtl/app:release-5'
16-
# defaults to docker hub (ie, no registry specified) and no tag.
8+
# Enter a command-line shell in the web container
9+
docker-shell:
10+
docker compose run web bash
1711

18-
ifeq ($(origin TAG), undefined)
19-
IMAGE ?= $(REGISTRY)$(ORG)/$(APP)
20-
else
21-
IMAGE ?= $(REGISTRY)$(ORG)/$(APP):$(TAG)
22-
endif
12+
# Enter an interactive django shell
13+
docker-django-shell:
14+
docker compose run web python manage.py shell_plus \
15+
--settings=$(APP).settings_docker
2316

24-
$(WHEELHOUSE)/requirements.txt: $(REQUIREMENTS)
25-
mkdir -p $(WHEELHOUSE)
26-
docker run --rm \
27-
-v $(ROOT_DIR):/app \
28-
-v $(ROOT_DIR)/$(WHEELHOUSE):/wheelhouse \
29-
$(BUILDER_IMAGE)
30-
cp $(REQUIREMENTS) $@
31-
touch $@
32-
33-
# Run this target to rebuild the django image
34-
build: $(WHEELHOUSE)/requirements.txt
35-
docker build -t $(IMAGE) .
36-
37-
.PHONY: build
17+
.PHONY: docker docker-shell docker-django-shell

js.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ NODE_MODULES ?= ./node_modules
2323
JS_SENTINAL ?= $(NODE_MODULES)/sentinal
2424
ESLINT ?= $(NODE_MODULES)/.bin/eslint
2525

26-
NPM_OPTS = --also=dev
26+
NPM_OPTS = --include=dev
2727

2828
ifeq ($(ENVIRONMENT),production)
29-
NPM_OPTS = --only=prod
29+
NPM_OPTS = --omit=dev
3030
endif
3131
ifeq ($(ENVIRONMENT),staging)
32-
NPM_OPTS = --only=prod
32+
NPM_OPTS = --omit=dev
3333
endif
3434

3535
$(JS_SENTINAL): package.json

0 commit comments

Comments
 (0)