pipeline {
	agent none
	stages {
		stage("Setup") {
			agent any
			steps {
				sh '/home/patrick/.local/bin/pip3.8 install sphinx'
				sh '/home/patrick/.local/bin/pip3.8 install pydata-sphinx-theme'
				sh '/home/patrick/.local/bin/pip3.8 install -e .'
				sh 'mkdir -p docs/_build'
			}
		}
		stage("Build") {
			agent any
			steps {
                sh 'python3.8 tests.py'
				sh 'Xvfb :5 -screen 0 800x600x24 & DISPLAY=:5 make doc_images -j4'
				sh 'make -C docs html'
			}
		}
		stage("Deploy") {
			agent any
			steps {
				sh '/bin/rm -rf /var/www/html/docs/solidLib/* || echo ""'
				sh 'rsync -a ./docs/_build/html/* /var/www/html/docs/solidLib/'
			}
		}
	}
}
