-
Andrew Kapuscinski authored
- Added PATH_PREFIX variable to build stage to handle dockerfiles at paths other than /services - removed .unit-test template from .gitlab-ci.yml because it was duplicated
Andrew Kapuscinski authored- Added PATH_PREFIX variable to build stage to handle dockerfiles at paths other than /services - removed .unit-test template from .gitlab-ci.yml because it was duplicated
Makefile 2.72 KiB
SHELL := /bin/bash
.PHONY: check-build test-dev test dev setup alembic-update docker-base db build coverage clean
all: dev check-build
# Check if local code will pass CI build
check-build: docker-base docker-dev-images-locally test-dev
# Run tests on Dockerfile.dev images
test-dev:
docker run nrao:workflow ./bin/run-tests.sh
docker run nrao:capability ./bin/run-tests.sh
docker run nrao:notification ./bin/run-tests.sh
# Run tests on Dockerfile.local containers
test:
docker exec workspaces_workflow_1 ./bin/run-tests.sh
docker exec workspaces_capability_1 ./bin/run-tests.sh
docker exec workspaces_notification_1 ./bin/run-tests.sh
# Setup local development environment
dev: docker-base
setup:
docker exec workspaces_capability_1 /bin/bash -c 'python -m pip install -r requirements.txt'
docker exec workspaces_capability_1 /bin/bash -c 'python -m pip install -e .'
docker exec workspaces_workflow_1 /bin/bash -c 'python -m pip install -r requirements.txt'
docker exec workspaces_workflow_1 /bin/bash -c 'python -m pip install -e .'
docker exec workspaces_notification_1 /bin/bash -c 'python -m pip install -r requirements.txt'
docker exec workspaces_notification_1 /bin/bash -c 'python -m pip install -e .'
docker-compose restart
alembic-update:
cd schema; \
env CAPO_PROFILE=local alembic upgrade head
# Build images from Dockerfile.dev
docker-dev-images-locally:
docker build -t nrao:workflow -f services/workflow/Dockerfile.local . --build-arg capo_env=docker
docker build -t nrao:capability -f services/capability/Dockerfile.local . --build-arg capo_env=docker
docker build -t nrao:notification -f services/notification/Dockerfile.local . --build-arg capo_env=docker
# Build base image
docker-base: db
docker build -t marconi.aoc.nrao.edu/ops/base:workspaces -f Dockerfile.base .
docker build -t marconi.aoc.nrao.edu/ops/base:nodejs-14 -f apps/web/Dockerfile.base .
# Build DB image
db:
docker build -t marconi.aoc.nrao.edu/ops/ci/db:workspaces -f ./ci/psql/Dockerfile.db .
# Build docker images
build: docker-base db
docker-compose build --no-cache
# Generate HTML coverage report
coverage:
docker exec workspaces_workflow_1 ./bin/run-tests.sh -b
cp services/workflow/.coverage ./.coverage.wf
docker exec workspaces_capability_1 ./bin/run-tests.sh -b
cp services/capability/.coverage ./.coverage.cap
docker exec workspaces_notification_1 ./bin/run-tests.sh -b
cp services/notification/.coverage ./.coverage.no
coverage combine --append
coverage html
# Clean up environment
clean:
# Clean up Docker environment
docker-compose down
-docker images -aq | xargs docker rmi
docker system prune --volumes -af
docker volume prune -f
# Delete Python cache directories
find . \( -name "*.egg-info" -o -name ".pytest_cache" \) | xargs rm -r