Skip to content

Commit

Permalink
Merge 9a62c48 into 69819ba
Browse files Browse the repository at this point in the history
  • Loading branch information
deathowl committed Jan 2, 2021
2 parents 69819ba + 9a62c48 commit e4d6de7
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 21 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# set base image (host OS)
FROM python:3.8

# set the working directory in the container
WORKDIR /code

# install make
RUN apt-get update && apt-get install -y \
make \
&& rm -rf /var/lib/apt/lists/*
# copy the dependencies file to the working directory
COPY requirements.txt .
# copy the dev-dependencies file to the working directory

COPY requirements-dev.txt .

# install dependencies
RUN pip install -r requirements.txt
# install dev dependencies
RUN pip install -r requirements-dev.txt


# copy the source to container working directory
COPY testslide ./testslide
COPY tests ./tests
COPY util ./util
COPY Makefile .
COPY mypy.ini .

# command to run on container start
CMD ["/usr/bin/make", "tests"]
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ include CODE_OF_CONDUCT.md
include CONTRIBUTING.md
include LICENSE
include README.md
include testslide/version
include testslide/version
include requirements.txt
include requirements-dev.txt
42 changes: 41 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,12 @@ coveralls: coverage_combine
.PHONY: install_build_deps
install_build_deps:
@printf "${TERM_BRIGHT}INSTALL BUILD DEPS\n${TERM_NONE}"
${Q} pip install -e .[test,build]
${Q} pip install -r requirements-dev.txt

.PHONY: install_deps
install_deps:
@printf "${TERM_BRIGHT}INSTALL DEPS\n${TERM_NONE}"
${Q} pip install -r requirements.txt

.PHONY: sdist
sdist:
Expand All @@ -193,8 +198,43 @@ install_local: sdist
${Q} pip install $(DIST_TAR_GZ)
${Q} testslide --help

.PHONY: build_dev_container
dev_container:
@printf "${TERM_BRIGHT}BUILDING DEV CONTAINER\n${TERM_NONE}"
${Q} docker build -t testslide-dev .

.PHONY: run_tests_in_container
run_tests_in_container:
@printf "${TERM_BRIGHT}RUNNING CI IN DEV CONTAINER\n${TERM_NONE}"
${Q} docker run testslide-dev

.PHONY: run_dev_container
run_dev_container: build_dev_container
@printf "${TERM_BRIGHT}STARTING DEV CONTAINER WITH BIND-MOUNTED SOURCES\n${TERM_NONE}"
@docker run --rm -d --name testslide -v ${CURDIR}/testslide:/code/testslide -v ${CURDIR}/tests:/code/tests testslide-dev bash -c "while true; do sleep 30; done"
@printf "${TERM_BRIGHT}Container testslide is running.\n${TERM_NONE}"
@printf "${TERM_BRIGHT}Use make enter_dev_container to exec into it.\n${TERM_NONE}"
@printf "${TERM_BRIGHT}Use make kill_dev_container to terminate it.\n${TERM_NONE}"

.PHONY: enter_dev_container
enter_dev_container:
@printf "${TERM_BRIGHT}ENTERING DEV CONTAINER\n${TERM_NONE}"
@docker exec -it testslide bash


.PHONY: kill_dev_container
kill_dev_container:
@printf "${TERM_BRIGHT}KILLING DEV CONTAINER\n${TERM_NONE}"
@docker kill testslide

.PHONY: clean_dev_container
clean_dev_container:
@printf "${TERM_BRIGHT}KILLING DEV CONTAINER\n${TERM_NONE}"
@docker kill testslide

.PHONY: ci
ci: \
install_deps \
install_build_deps \
tests \
coverage_report \
Expand Down
11 changes: 11 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
black
coverage
coveralls
flake8
isort~=5.1
mypy==0.782
ipython
sphinx
sphinx-autobuild
sphinx-kr-theme
twine
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
psutil>=5.6.7
Pygments>=2.6.1
typeguard>=2.10.0
dataclasses==0.6; python_version < "3.7"
23 changes: 4 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

version = open("testslide/version").read().rstrip()
readme = open("README.md", encoding="utf8").read()
requirements = open("requirements.txt", encoding="utf8").readlines()
requirements_build = open("requirements-dev.txt", encoding="utf8").readlines()

setup(
name="TestSlide",
Expand All @@ -20,29 +22,12 @@
long_description=readme,
long_description_content_type="text/markdown",
setup_requires=["setuptools>=38.6.0"],
install_requires=[
"psutil>=5.6.7",
"Pygments>=2.6.1",
"typeguard>=2.10.0",
'dataclasses==0.6; python_version < "3.7"',
],
install_requires=requirements,
package_data={
'testslide': ['py.typed'],
},
extras_require={
"build": [
"black",
"coverage",
"coveralls",
"flake8",
"isort~=5.1",
"mypy==0.782",
"ipython",
"sphinx",
"sphinx-autobuild",
"sphinx-kr-theme",
"twine",
]
"build": requirements_build
},
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down

0 comments on commit e4d6de7

Please sign in to comment.