From fb671a065edfefa97dad57bdb1e84baae1dc9e1b Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Fri, 29 Nov 2019 13:20:40 +0100 Subject: [PATCH] Work on continuous integration. Changes in the main Makefile to include a "venv" and a "doc" targets The Jenkinsfile now uses only the Makefile. The CI/CI.bash shell script should not bu used anymore and will be deleted in a future commit. --- Jenkinsfile | 17 ++++++++--------- Makefile | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2ba7e97..e40ebd9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,24 +4,24 @@ pipeline { stage('Initial setup...') { steps { echo 'Create or update the virtual Python environment' - sh '/bin/bash ./CI/CI.bash -i ci_venv' + sh 'make venv' } } - stage('Testing the package...') { + stage('Build the code and generate tests results...') { steps { - sh '/bin/bash ./CI/CI.bash -t ci_venv' + sh '. ./ci_venv/bin/activate && make -C src results' } } - stage('Creating a setup file and test installation...') { + stage('Create a setup file and test installation...') { steps { - sh '/bin/bash ./CI/CI.bash -p ci_venv' - sh '/bin/bash ./package/MsSpec*.setup --accept -- -p ./ci_venv -y' + sh 'make selfex' + sh '. ./ci_venv/bin/activate && ./package/MsSpec*.setup --accept -- -y' } } stage('Building HTML documentation...') { steps { - sh '/bin/bash ./CI/CI.bash -d ci_venv' + sh '. ./ci_venv/bin/activate && make doc' } } stage('Syncing website...') { @@ -32,8 +32,7 @@ pipeline { stage('Cleaning up...') { steps { echo 'Cleaning artifacts...' - sh 'rm -rf ./package' - sh 'cd ./doc && make clean' + sh 'make clean' } } diff --git a/Makefile b/Makefile index e4fa355..c916d2a 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ else endif -.PHONY: clean version selfex +.PHONY: clean version selfex venv doc selfex: clean @@ -43,9 +43,11 @@ selfex: clean @mv ./src/msspec/version.py.bak ./src/msspec/version.py @rm ./msspec.lsm + version: @python ./CI/update_version.py + clean: @echo "Cleaning all..." @find ./src -type f -name '*.pyc' -exec rm -f {} + @@ -56,3 +58,15 @@ clean: @+$(MAKE) -C doc/ clean $(SUPPRESS_OUPUT) @rm -rf package + +venv: + @virtualenv --python=python3 --system-site-packages ci_venv + @. "./ci_venv/bin/activate" && pip install --upgrade pip numpy ase h5py lxml pint terminaltables pycairo sphinx + +doc: + @echo "Building pdf and html documentation..." + @mkdir -p package/ + @+$(MAKE) -C doc/ latexpdf $(SUPPRESS_OUPUT) + @rm -rf package/*.pdf + @cp "doc/build/latex/MsSpec-python.pdf" "./package/MsSpec-${VERSION}.pdf" + @+$(MAKE) -C doc/ html $(SUPPRESS_OUPUT)