Skip to content

Commit

Permalink
Update makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolas committed Aug 31, 2023
1 parent 2f6fa2a commit 39a5c3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 57 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Build with Makefile
run: make
- name: Install npm dependencies
run: npm install
- name: Run eslint
run: npm run eslint
cypress:
Expand Down
26 changes: 2 additions & 24 deletions django.mk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ FLAKE8 ?= $(VE)/bin/flake8
PIP ?= $(VE)/bin/pip
COVERAGE ?= $(VE)/bin/coverage

jenkins: check flake8 test bandit eslint
jenkins: check flake8 test bandit

$(PY_SENTINAL): $(REQUIREMENTS)
rm -rf $(VE)
Expand Down Expand Up @@ -79,26 +79,4 @@ clean:
rm -rf node_modules
find . -name '*.pyc' -exec rm {} \;

pull:
git pull
make check
make test
make migrate
make flake8

rebase:
git pull --rebase
make check
make test
make migrate
make flake8

# run this one the very first time you check
# this out on a new machine to set up dev
# database, etc. You probably *DON'T* want
# to run it after that, though.
install: jenkins
createdb $(APP)
make migrate

.PHONY: jenkins test flake8 runserver migrate check shell clean pull rebase install
.PHONY: jenkins test flake8 runserver migrate check shell clean
44 changes: 12 additions & 32 deletions docker.mk
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
# VERSION=1.0.0
# VERSION=2.0.0
# Docker related stuff
# use wheelhouse/requirements.txt as the sentinal so make
# knows whether it needs to rebuild the wheel directory or not
# has the added advantage that it can just pip install
# from that later on as well

ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
WHEELHOUSE ?= wheelhouse
ORG ?= ccnmtl
BUILDER_IMAGE ?= ccnmtl/django.build
# Start up docker dev server with docker-compose
docker:
docker compose up

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

ifeq ($(origin TAG), undefined)
IMAGE ?= $(REGISTRY)$(ORG)/$(APP)
else
IMAGE ?= $(REGISTRY)$(ORG)/$(APP):$(TAG)
endif
# Enter an interactive django shell
docker-django-shell:
docker compose run web python manage.py shell_plus \
--settings=$(APP).settings_docker

$(WHEELHOUSE)/requirements.txt: $(REQUIREMENTS)
mkdir -p $(WHEELHOUSE)
docker run --rm \
-v $(ROOT_DIR):/app \
-v $(ROOT_DIR)/$(WHEELHOUSE):/wheelhouse \
$(BUILDER_IMAGE)
cp $(REQUIREMENTS) $@
touch $@

# Run this target to rebuild the django image
build: $(WHEELHOUSE)/requirements.txt
docker build -t $(IMAGE) .

.PHONY: build
.PHONY: docker docker-shell docker-django-shell
2 changes: 1 addition & 1 deletion js.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ NODE_MODULES ?= ./node_modules
JS_SENTINAL ?= $(NODE_MODULES)/sentinal
ESLINT ?= $(NODE_MODULES)/.bin/eslint

NPM_OPTS = --also=dev
NPM_OPTS = --include=dev

ifeq ($(ENVIRONMENT),production)
NPM_OPTS = --only=prod
Expand Down

0 comments on commit 39a5c3c

Please sign in to comment.