Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure modac tests are run #371

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
- name: pytest
run: |
# python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/ddm/test/unit
python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv atomsci/modac/test/unit
cd atomsci/ddm/test/unit && python3.9 -m pytest -n 2 --capture=sys --capture=fd --cov=atomsci/ -vv
env:
ENV: test
Expand Down
26 changes: 13 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ endif
# Release version
VERSION=$(shell cat VERSION)

# If ENV is prod, we use VERSION for the tag, otherwise use PLATFORM
# If ENV is from master branch, we use VERSION for the tag, otherwise use PLATFORM
Kartstig marked this conversation as resolved.
Show resolved Hide resolved
ifeq ($(ENV), prod)
TAG = v$(VERSION)-$(SUBTAG)
else
TAG = $(PLATFORM)-$(ENV)
TAG = $(ENV)-$(PLATFORM)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to use $(ENV)-$(PLATFORM) because then you can just do:

ENV=v1.6.3 PLATFORM=cpu ...

This will be consistent with the way it looks when master is tagged v$(VERSION)-$(SUBTAG)

endif

# IMAGE REPOSITORY
Expand All @@ -51,7 +51,7 @@ WORK_DIR ?= work

# Load Docker image
load-docker:
docker load < ampl-$(PLATFORM)-$(ENV).tar.gz
docker load < ampl-$(TAG).tar.gz

# Pull Docker image
pull-docker:
Expand All @@ -63,12 +63,12 @@ push-docker:

# Save Docker image
save-docker:
docker save $(IMAGE_REPO):$(PLATFORM)-$(ENV) | gzip > ampl-$(PLATFORM)-$(ENV).tar.gz
docker save $(IMAGE_REPO):$(TAG) | gzip > ampl-$(TAG).tar.gz

# Build Docker image
build-docker:
@echo "Building Docker image for $(PLATFORM)"
docker buildx build -t $(IMAGE_REPO):$(PLATFORM)-$(ENV) --build-arg ENV=$(ENV) $(PLATFORM_ARG) --load -f Dockerfile.$(PLATFORM) .
docker buildx build -t $(IMAGE_REPO):$(TAG) --build-arg ENV=$(ENV) $(PLATFORM_ARG) --load -f Dockerfile.$(PLATFORM) .

install: install-system

Expand All @@ -95,12 +95,12 @@ ifdef host
$(GPU_ARG) \
--hostname $(host) \
--privileged \
-v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(PLATFORM)-$(ENV) \
-v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(TAG) \
/bin/bash -l -c "jupyter-notebook --ip=0.0.0.0 --no-browser --allow-root --port=$(JUPYTER_PORT)"
else
docker run -p $(JUPYTER_PORT):$(JUPYTER_PORT) \
$(GPU_ARG) \
-v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(PLATFORM)-$(ENV) \
-v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(TAG) \
/bin/bash -l -c "jupyter-notebook --ip=0.0.0.0 --no-browser --allow-root --port=$(JUPYTER_PORT)"
endif

Expand All @@ -109,34 +109,34 @@ endif
jupyter-lab:
@echo "Starting Jupyter Lab"
docker run -p $(JUPYTER_PORT):$(JUPYTER_PORT) \
-v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(PLATFORM)-$(ENV) \
-v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(TAG) \
/bin/bash -l -c "jupyter-lab --ip=0.0.0.0 --allow-root --port=$(JUPYTER_PORT)"

# Run pytest
pytest: pytest-unit pytest-integrative

pytest-integrative:
@echo "Running integrative tests"
docker run -v $(shell pwd)/$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(PLATFORM)-$(ENV) \
docker run -v $(shell pwd)/$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(TAG) \
/bin/bash -l -c "cd atomsci/ddm/test/integrative && ./integrative_batch_tests.sh"

pytest-unit:
@echo "Running unit tests"
docker run -v $(shell pwd)/$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(PLATFORM)-$(ENV) \
docker run -v $(shell pwd)/$(WORK_DIR):/$(WORK_DIR) $(IMAGE_REPO):$(TAG) \
/bin/bash -l -c "cd atomsci/ddm/test/unit && python3.9 -m pytest --capture=sys --capture=fd --cov=atomsci/ -vv"

# Run ruff linter
ruff:
@echo "Running ruff"
docker run -it $(IMAGE_REPO):$(PLATFORM)-$(ENV) /bin/bash -l -c "ruff check ."
docker run -it $(IMAGE_REPO):$(TAG) /bin/bash -l -c "ruff check ."

# Run ruff linter with fix
ruff-fix:
@echo "Running ruff with fix"
docker run -it $(IMAGE_REPO):$(PLATFORM)-$(ENV) /bin/bash -l -c "ruff check . --fix"
docker run -it $(IMAGE_REPO):$(TAG) /bin/bash -l -c "ruff check . --fix"

shell:
docker run -v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) -it $(IMAGE_REPO):$(PLATFORM)-$(ENV) /bin/bash
docker run -v $(shell pwd)/../$(WORK_DIR):/$(WORK_DIR) -it $(IMAGE_REPO):$(TAG) /bin/bash

# Setup virtual environment and install dependencies
setup:
Expand Down
Loading