in src/jobs/caffe2.groovy [256:326]
image: dockerImage('${DOCKER_IMAGE_TAG}'),
workspaceSource: "host-mount",
script: '''
set -ex
# Install documentation dependencies temporarily within this container
sudo apt-get update
sudo apt-get install -y doxygen graphviz
# Create folder to transfer docs
temp_dir=$(mktemp -d)
trap "rm -rf ${temp_dir}" EXIT
# Get all the documentation sources, put them in one place
rm -rf pytorch_source || true
git clone https://github.com/pytorch/pytorch pytorch_source
pushd pytorch_source
# Reinitialize submodules
git submodule update --init --recursive
# Do not need to go into the caffe2 directory within the PyTorch
# repo since the root CMakeLists.txt handles the process of making
# caffe2 and its docs. So do the below from the pytorch repo root.
# Make our build directory
mkdir -p build
# Build doxygen docs
cd build
time cmake -DBUILD_DOCS=ON .. && make
cd ..
# Move docs to the temp folder
mv build/docs/doxygen-c "${temp_dir}"
mv build/docs/doxygen-python "${temp_dir}"
# Generate operator catalog in the temp folder
export PYTHONPATH="build:$PYTHONPATH"
python caffe2/python/docs/github.py "${temp_dir}/operators-catalogue.md"
# Go up a level for the doc push
popd
# Remove source directory
rm -rf pytorch_source || true
# Copy docs from the temp folder and git add
git rm -rf doxygen-c || true
git rm -rf doxygen-python || true
mv "${temp_dir}/operators-catalogue.md" _docs/
mv "${temp_dir}/doxygen-c" .
mv "${temp_dir}/doxygen-python" .
git add _docs/operators-catalogue.md || true
git add -A doxygen-c || true
git add -A doxygen-python || true
git status
if [ "${DOC_PUSH:-true}" == "false" ]; then
echo "Skipping doc push..."
exit 0
fi
# If there aren't changes, don't make a commit; push is no-op
git config user.email "jenkins@ci.pytorch.org"
git config user.name "Jenkins"
git commit -m "Auto-generating doxygen and operator docs" || true
git status
'''
}
publishers {