diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 15e26db98..b39623741 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,28 +34,26 @@ Tests are stored in the [tests](/tests) directory. Running tests locally: -``` -make prepare-check && make check -``` - -The following packages are installed by 'make prepare-check' -if they are not installed already: +The following packages should be installed beforehand: python3-flexmock python3-requre -Or you can run tests in a container: - - make prepare-build - make build - make check-in-container +``` +make check +``` -The following packages are installed by 'make prepare-build' -if they are not installed already: +Or you can run tests in a container; the following packages should be +installed beforehand: podman ansible-bender +Then: + + make build + make check-in-container + The 'make build' command builds a local image with all the dependencies using [ansible-bender](https://github.com/ansible-community/ansible-bender); the 'make check-in-container' command runs the tests in a container created @@ -93,16 +91,9 @@ Here are some important and useful targets of [Makefile](/Makefile): Use [ansible-bender](https://pypi.org/project/ansible-bender) to build container image from [recipe.yaml](recipe.yaml): ``` -make prepare-build make build ``` -Install packages needed to run tests: - -``` -make prepare-check -``` - Run tests locally: ``` @@ -115,6 +106,12 @@ Start shell in a container from the image previously built with `make build`: make shell ``` +Run tests in a container: + +``` +make check-in-container +``` + In a container, do basic checks to verify that ogr can be distributed, installed and imported: ``` diff --git a/Makefile b/Makefile index 5be42d5aa..d05dac376 100644 --- a/Makefile +++ b/Makefile @@ -2,26 +2,10 @@ BASE_IMAGE := fedora:latest TEST_TARGET ?= ./tests/ PY_PACKAGE := ogr OGR_IMAGE := ogr -IS_FEDORA := $(shell uname -r | grep -c "\.fc[1-9]") -ifeq ($(IS_FEDORA), 1) - PACKAGE_CHECKER := rpm -q --quiet - PACKAGE_INSTALLER := dnf install -else - PACKAGE_CHECKER := : - PACKAGE_INSTALLER := : -endif - -prepare-build: - if ! $(PACKAGE_CHECKER) ansible-bender ; then sudo $(PACKAGE_INSTALLER) ansible-bender ; fi - if ! $(PACKAGE_CHECKER) podman ; then sudo $(PACKAGE_INSTALLER) podman ; fi build: recipe.yaml ansible-bender build --build-volumes $(CURDIR):/src:Z -- ./recipe.yaml $(BASE_IMAGE) $(OGR_IMAGE) -prepare-check: - if ! $(PACKAGE_CHECKER) python3-requre ; then sudo $(PACKAGE_INSTALLER) python3-requre ; fi - if ! $(PACKAGE_CHECKER) python3-flexmock ; then sudo $(PACKAGE_INSTALLER) python3-flexmock ; fi - check: @#`python3 -m pytest` doesn't work here b/c the way requre overrides import system: @#`AttributeError: module 'importlib_metadata' has no attribute 'distributions' diff --git a/README.md b/README.md index db94c0760..75f252f91 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,9 @@ $ pip3 install --user git+https://github.com/packit/ogr.git ### Tests -Run `make prepare-check` before first `make check`. +Make sure to install prerequisite packages before first `make check`, +`make build`, or `make check-in-container`. See CONTRIBUTING.md for +details. # Contribution notes