Skip to content

Commit

Permalink
Merge pull request #371 from mass-matrix/mm/modac-tests
Browse files Browse the repository at this point in the history
Ensure modac tests are run
  • Loading branch information
mauvais2 authored Sep 16, 2024
2 parents 9d21c4a + 4903890 commit 969bc5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
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
ifeq ($(ENV), prod)
TAG = v$(VERSION)-$(SUBTAG)
else
TAG = $(PLATFORM)-$(ENV)
TAG = $(ENV)-$(PLATFORM)
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

0 comments on commit 969bc5f

Please sign in to comment.