diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2bf5073..4e43d20 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,12 +68,17 @@ the extension) with `_cdb_`. Running just the Python tests: ``` -(cd python/crankdown && nosetests test) +(cd python && make test) ``` -Installing the Extension & Python package and running -the Python & PostgreSQL tests: +Installing the Extension and running just the PostgreSQL tests: ``` (cd pg && sudo make install && PGUSER=postgres make installcheck) ``` + +Installing and testing everything: + +``` +sudo make install && PGUSER=postgres make testinstalled +``` diff --git a/DEPLOYING.md b/DEPLOYING.md index c5026b2..5b21f30 100644 --- a/DEPLOYING.md +++ b/DEPLOYING.md @@ -6,10 +6,11 @@ ... -Deployment to db servers +Deployment to db servers: the next command will install both the Python +package and the extension. ``` -(cd pg && sudo PGUSER=postgres make all install) +sudo make install ``` Installing only the Python package: @@ -21,6 +22,22 @@ sudo pip install python/crankshaft --upgrade Caveat: note that `pip install ./crankshaft` will install from local files, but `pip install crankshaft` will not. -Installing the extension in user databases: +CI: Install and run the tests on the installed extension and package: -... +``` +(sudo make install && PGUSER=postgres make testinstalled) +``` + +Installing the extension in user databases: +Once installed in a server, the extension can be added +to a database with the next SQL command: + +``` +CREATE EXTENSION crankshaft; +``` + +To upgrade the extension to an specific version X.Y.Z: + +``` +ALTER EXTENSION crankshaft UPGRADE TO 'X.Y.Z'; +``` diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d1d9734 --- /dev/null +++ b/Makefile @@ -0,0 +1,13 @@ +EXT_DIR = pg +PYP_DIR = python + +.PHONY: install +.PHONY: run_tests + +install: + $(MAKE) -C $(PYP_DIR) install + $(MAKE) -C $(EXT_DIR) install + +testinstalled: + $(MAKE) -C $(PYP_DIR) testinstalled + $(MAKE) -C $(EXT_DIR) installcheck diff --git a/pg/Makefile b/pg/Makefile index eff62f0..34de170 100644 --- a/pg/Makefile +++ b/pg/Makefile @@ -28,15 +28,3 @@ REGRESS_OPTS = --inputdir='$(TEST_DIR)' --outputdir='$(TEST_DIR)' PG_CONFIG = pg_config PGXS := $(shell $(PG_CONFIG) --pgxs) include $(PGXS) - -# Install the Python package -install_py_package: - pip install ../python/crankshaft --upgrade - -install: install_py_package - -# Run the Python tests -test_py_package: - (cd ../python/crankshaft && nosetests test) - -installcheck: test_py_package diff --git a/python/Makefile b/python/Makefile new file mode 100644 index 0000000..07b41dd --- /dev/null +++ b/python/Makefile @@ -0,0 +1,11 @@ +# Install the package (needs root privileges) +install: + pip install ./crankshaft --upgrade + +# Test from source code +test: + (cd crankshaft && nosetests test/) + +# Test currently installed package +testinstalled: + nosetests crankshaft/test/