diff --git a/Makefile b/Makefile index 7bd33b5..4948e11 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ help: @echo " - help : Print this help message." @echo " - clean : Remove generated files." @echo " - coding-style : Run coding style tools." - @echo " - publish : Publish package to PyPI." + @echo " - publish : Publish package to PyPI." @echo " - test : Run coding style tools and tests." .PHONY: all @@ -12,16 +12,17 @@ all: help .PHONY: clean clean: - rm -rf build dist editorconfig_checker.egg-info editorconfig_checker/bin + @rm -rf build dist editorconfig_checker.egg-info editorconfig_checker/bin tests/Dockerfile-* .PHONY: coding-style coding-style: - flake8 --ignore E501 setup.py + @flake8 --ignore E501 setup.py .PHONY: publish -publish: - bash publish.sh +publish: clean test + @python3 setup.py sdist + @twine upload dist/* .PHONY: test test: coding-style - bash test.sh + @bash run-tests.sh diff --git a/publish.sh b/publish.sh deleted file mode 100644 index 56121bd..0000000 --- a/publish.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -# Run tests & cleanup -make test -make clean - -# Build & publish (currently, we push the package under the username `mmicu_00`) -python3 setup.py sdist -twine upload dist/* diff --git a/test.sh b/run-tests.sh similarity index 79% rename from test.sh rename to run-tests.sh index 0116338..3003c01 100644 --- a/test.sh +++ b/run-tests.sh @@ -3,12 +3,16 @@ set -e PY_DOCKER_IMAGES=("2.7.16-slim" "3.7.4-slim") +DOCKERFILE_TEMPLATE="tests/Dockerfile.template" -# "." -> Local package -# "editorconfig-checker" -> PyPI package -PACKAGES=("." "editorconfig-checker") +PACKAGES=() -DOCKERFILE_TEMPLATE="tests/Dockerfile.template" +# Local package +PACKAGES+=(".") +# PyPI package +PACKAGES+=("editorconfig-checker") + +echo -e "Running tests...\n\n" for py_docker_image in "${PY_DOCKER_IMAGES[@]}"; do for package in "${PACKAGES[@]}"; do @@ -40,12 +44,15 @@ for py_docker_image in "${PY_DOCKER_IMAGES[@]}"; do # Run coding style tools if [[ "$is_local" == "1" ]]; then - docker run --rm "$docker_image" make coding_style + docker run --rm "$docker_image" make coding-style fi + # Run `editorconfig-checker` + docker run --rm "$docker_image" ec -version + # Remove the created image - docker image rm "$docker_image" > /dev/null + docker image rm "$docker_image" &> /dev/null - echo "" + echo -e "\n" done done diff --git a/setup.py b/setup.py index def4620..5e7fed2 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ from urllib2 import urlopen -WRAPPER_VERSION = '2.3.53' +WRAPPER_VERSION = '2.3.54' EDITORCONFIG_CHECKER_CORE_VERSION = '2.3.5' EDITORCONFIG_CHECKER_EXE_NAME = 'ec' diff --git a/tests/Dockerfile.template b/tests/Dockerfile.template index 846d158..0f69482 100644 --- a/tests/Dockerfile.template +++ b/tests/Dockerfile.template @@ -4,8 +4,10 @@ LABEL maintainer="Marco M. (mmicu) " COPY . /app WORKDIR /app -RUN set -x \ - && apt-get update \ - && apt-get install -y make \ - && pip install -r dev_requirements.txt \ +RUN bash + +RUN set -x \ + && apt-get update \ + && apt-get install -y make \ + && pip install -r tests/requirements.txt \ && pip install --no-cache-dir $PACKAGE diff --git a/dev_requirements.txt b/tests/requirements.txt similarity index 100% rename from dev_requirements.txt rename to tests/requirements.txt