mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-31 04:04:57 +08:00
Summary: This PR replaces the current auto-generated commit messages like pytorch/pytorch.github.io@fb217ab34a (currently includes no information) and pytorch/cppdocs@7efd67e8f1 (currently includes only a timestamp, which is redundant since it's a Git commit) with more descriptive ones that specify the pytorch/pytorch commit they originated from. This information would be useful for debugging issues such as https://github.com/pytorch/pytorch/issues/47462. GitHub will also [autolink](https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/autolinked-references-and-urls#commit-shas) these new messages (similar to ezyang/pytorch-ci-hud@bc25ae770d), and so they will now also mostly follow Git commit message conventions by starting with a capital letter, using the imperative voice, and (at least in the autolink-rendered form on GitHub, although not in the raw text) staying under 50 characters. **Question for reviewers:** Will my `export CIRCLE_SHA1="$CIRCLE_SHA1"` work here? Is it necessary? Pull Request resolved: https://github.com/pytorch/pytorch/pull/47694 Reviewed By: walterddr Differential Revision: D24868240 Pulled By: samestep fbshipit-source-id: 4907341e7b57ed6818ab550dc1ec423f2c2450c1
96 lines
2.4 KiB
Bash
Executable File
96 lines
2.4 KiB
Bash
Executable File
# =================== The following code **should** be executed inside Docker container ===================
|
|
|
|
# Install dependencies
|
|
sudo apt-get -y update
|
|
sudo apt-get -y install expect-dev
|
|
|
|
# This is where the local pytorch install in the docker image is located
|
|
pt_checkout="/var/lib/jenkins/workspace"
|
|
|
|
# Since we're cat-ing this file, we need to escape all $'s
|
|
echo "cpp_doc_push_script.sh: Invoked with $*"
|
|
|
|
# Argument 1: Where to copy the built documentation for Python API to
|
|
# (pytorch.github.io/$install_path)
|
|
install_path="$1"
|
|
if [ -z "$install_path" ]; then
|
|
echo "error: cpp_doc_push_script.sh: install_path (arg1) not specified"
|
|
exit 1
|
|
fi
|
|
|
|
# Argument 2: What version of the Python API docs we are building.
|
|
version="$2"
|
|
if [ -z "$version" ]; then
|
|
echo "error: cpp_doc_push_script.sh: version (arg2) not specified"
|
|
exit 1
|
|
fi
|
|
|
|
is_master_doc=false
|
|
if [ "$version" == "master" ]; then
|
|
is_master_doc=true
|
|
fi
|
|
|
|
echo "install_path: $install_path version: $version"
|
|
|
|
# ======================== Building PyTorch C++ API Docs ========================
|
|
|
|
echo "Building PyTorch C++ API docs..."
|
|
|
|
# Clone the cppdocs repo
|
|
rm -rf cppdocs
|
|
git clone https://github.com/pytorch/cppdocs
|
|
|
|
set -ex
|
|
|
|
sudo apt-get -y install doxygen
|
|
|
|
# Generate ATen files
|
|
pushd "${pt_checkout}"
|
|
pip install -r requirements.txt
|
|
time python -m tools.codegen.gen \
|
|
-s aten/src/ATen \
|
|
-d build/aten/src/ATen
|
|
|
|
# Copy some required files
|
|
cp torch/_utils_internal.py tools/shared
|
|
|
|
# Generate PyTorch files
|
|
time python tools/setup_helpers/generate_code.py \
|
|
--declarations-path build/aten/src/ATen/Declarations.yaml \
|
|
--native-functions-path aten/src/ATen/native/native_functions.yaml \
|
|
--nn-path aten/src/
|
|
|
|
# Build the docs
|
|
pushd docs/cpp
|
|
pip install -r requirements.txt
|
|
time make VERBOSE=1 html -j
|
|
|
|
popd
|
|
popd
|
|
|
|
pushd cppdocs
|
|
|
|
# Purge everything with some exceptions
|
|
mkdir /tmp/cppdocs-sync
|
|
mv _config.yml README.md /tmp/cppdocs-sync/
|
|
rm -rf *
|
|
|
|
# Copy over all the newly generated HTML
|
|
cp -r "${pt_checkout}"/docs/cpp/build/html/* .
|
|
|
|
# Copy back _config.yml
|
|
rm -rf _config.yml
|
|
mv /tmp/cppdocs-sync/* .
|
|
|
|
# Make a new commit
|
|
git add . || true
|
|
git status
|
|
git config user.email "soumith+bot@pytorch.org"
|
|
git config user.name "pytorchbot"
|
|
# If there aren't changes, don't make a commit; push is no-op
|
|
git commit -m "Generate C++ docs from pytorch/pytorch@$CIRCLE_SHA1" || true
|
|
git status
|
|
|
|
popd
|
|
# =================== The above code **should** be executed inside Docker container ===================
|