mirror of
				https://github.com/avatao-content/test-tutorial-framework
				synced 2025-11-04 06:12:54 +00:00 
			
		
		
		
	Implement in-container building of TFW sphinx documentation
This commit is contained in:
		
							
								
								
									
										27
									
								
								hack/tfw.sh
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								hack/tfw.sh
									
									
									
									
									
								
							@@ -5,6 +5,7 @@ set -o errtrace
 | 
				
			|||||||
shopt -s expand_aliases
 | 
					shopt -s expand_aliases
 | 
				
			||||||
[ "$(uname)" == "Darwin" ] && alias readlink="greadlink" || :
 | 
					[ "$(uname)" == "Darwin" ] && alias readlink="greadlink" || :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					here="$(pwd)"
 | 
				
			||||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
 | 
					SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
 | 
				
			||||||
TAO_PATH="${TAO_PATH:-$SCRIPT_DIR/../..}"
 | 
					TAO_PATH="${TAO_PATH:-$SCRIPT_DIR/../..}"
 | 
				
			||||||
BASEIMAGE_REPO="${BASEIMAGE_REPO:-baseimage-tutorial-framework}"
 | 
					BASEIMAGE_REPO="${BASEIMAGE_REPO:-baseimage-tutorial-framework}"
 | 
				
			||||||
@@ -150,6 +151,28 @@ start_test()
 | 
				
			|||||||
    wait
 | 
					    wait
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					build_docs()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    mount_point="/mnt/docs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    docker run --rm                                     \
 | 
				
			||||||
 | 
					               -ti                                      \
 | 
				
			||||||
 | 
					               -v "$BASEIMAGE_PATH"/docs:"$mount_point" \
 | 
				
			||||||
 | 
					               "$BASEIMAGE_NAME"                        \
 | 
				
			||||||
 | 
					               /bin/bash -c                             \
 | 
				
			||||||
 | 
					                    "cd $mount_point
 | 
				
			||||||
 | 
					                    pip3 install sphinx
 | 
				
			||||||
 | 
					                    make html
 | 
				
			||||||
 | 
					                    exit"                               \
 | 
				
			||||||
 | 
					               &> /dev/null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if [ "$?" == "0" ]; then
 | 
				
			||||||
 | 
					        echo "Built baseimage docs at ${BASEIMAGE_PATH}/docs/build/html!"
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        echo "Building baseimage docs failed!"
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
case ${1:-} in
 | 
					case ${1:-} in
 | 
				
			||||||
    start)
 | 
					    start)
 | 
				
			||||||
        RUN_FRONTEND=1 start_test ${@:2}
 | 
					        RUN_FRONTEND=1 start_test ${@:2}
 | 
				
			||||||
@@ -175,6 +198,9 @@ case ${1:-} in
 | 
				
			|||||||
    releasetfw)
 | 
					    releasetfw)
 | 
				
			||||||
        release_baseimage
 | 
					        release_baseimage
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
 | 
					    builddocs)
 | 
				
			||||||
 | 
					        build_docs
 | 
				
			||||||
 | 
					    ;;
 | 
				
			||||||
    *)
 | 
					    *)
 | 
				
			||||||
        echo "Usage: tfw.sh [start|buildtfw|build|buildwithfrontend|releasetfw]"
 | 
					        echo "Usage: tfw.sh [start|buildtfw|build|buildwithfrontend|releasetfw]"
 | 
				
			||||||
        echo "          |--- start:             build & run TFW test and Angular frontend"
 | 
					        echo "          |--- start:             build & run TFW test and Angular frontend"
 | 
				
			||||||
@@ -185,5 +211,6 @@ case ${1:-} in
 | 
				
			|||||||
        echo "          |--- build:             build TFW baseimage and test"
 | 
					        echo "          |--- build:             build TFW baseimage and test"
 | 
				
			||||||
        echo "          |--- buildwithfrontend: build TFW baseimage and test, include frontend in image"
 | 
					        echo "          |--- buildwithfrontend: build TFW baseimage and test, include frontend in image"
 | 
				
			||||||
        echo "          |--- releasetfw:        tag TFW baseimage and push to upstream"
 | 
					        echo "          |--- releasetfw:        tag TFW baseimage and push to upstream"
 | 
				
			||||||
 | 
					        echo "          |--- builddocs:         build baseimage documentation (in docs/build/html)"
 | 
				
			||||||
    ;;
 | 
					    ;;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user