Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
71fce67
changed url references from dmlc to apache/incubator-mxnet
aaronmarkham Oct 4, 2017
2f76524
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Oct 5, 2017
6165973
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
Oct 17, 2017
c5325e6
Merge remote-tracking branch 'upstream/master'
aaronmarkham Nov 21, 2017
38e4132
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Dec 5, 2017
3718550
Merge remote-tracking branch 'upstream/master'
aaronmarkham Dec 18, 2017
28a12ef
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Dec 19, 2017
9d0a13e
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Dec 20, 2017
7cfe599
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Jan 9, 2018
469c414
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Jan 18, 2018
9688cd2
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Jan 22, 2018
34e1f8e
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Jan 29, 2018
9d6f2ad
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Feb 2, 2018
98527a2
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Feb 6, 2018
e035bcb
Merge branch 'master' of https://github.com/aaronmarkham/incubator-mxnet
aaronmarkham Feb 24, 2018
84393ef
refactored build all docs
Feb 24, 2018
a22955f
Created dockerfile and modified scripts to support it.
aaronmarkham Feb 26, 2018
5d6e098
add license header
aaronmarkham Feb 26, 2018
02e09d4
used license header tool this time
aaronmarkham Feb 26, 2018
f1ed43d
updated scripts to take arguments for flexible use
aaronmarkham Feb 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions docs/build_version_doc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM ubuntu:16.04
LABEL maintainer="markhama@amazon.com"

# Install dependencies
RUN apt-get update && apt-get install -y \
apt-transport-https \
build-essential \
ca-certificates \
curl \
doxygen \
git \
libatlas-base-dev \
liblapack-dev \
libopenblas-dev \
libopencv-dev \
pandoc \
python-numpy \
python-pip \
software-properties-common \
unzip \
wget

# Setup Scala
RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
RUN apt-get update && apt-get install -y \
sbt \
scala

RUN pip install --upgrade pip && pip install \
beautifulsoup4 \
breathe \
CommonMark==0.5.4 \
h5py \
mock==1.0.1 \
pypandoc \
recommonmark==0.4.0 \
sphinx==1.5.6


COPY *.sh /
COPY *.py /
RUN /build_all_version.sh "1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master"
RUN /update_all_version.sh "1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" 1.1.0 http://mxnet.incubator.apache.org/
86 changes: 42 additions & 44 deletions docs/build_version_doc/build_all_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,65 @@

# This script is for locally building website for all versions
# Built files are stored in $built
# Version numbers are stored in $tag_list.
# Version numbers are ordered from latest to old and final one is master.

# Takes one argument:
# * tag list - space delimited list of Github tags; Example: "1.1.0 1.0.0 master"
# Example Usage:
# ./build_all_version.sh "1.1.0 1.0.0 master"

set -e
set -x

tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master"
if [ -z "$1" ]
then
echo "Please provide a list of version tags you wish to run."
exit 1
else
tag_list="$1"
echo "Using these tags: $1"
fi

mxnet_url="https://github.com/apache/incubator-mxnet.git"
mxnet_folder="apache_mxnet"
built="VersionedWeb"
mkdir $built
mkdir "$built/versions"

git clone $mxnet_url $mxnet_folder --recursive
cd "$mxnet_folder/docs"
tag_file="tag_list.txt"
if [ ! -d "$mxnet_folder" ]; then
mkdir $mxnet_folder
git clone $mxnet_url $mxnet_folder --recursive
fi

# Write all version numbers into $tag_file
for tag in $tag_list; do
if [ $tag != 'master' ]
then
echo "$tag" >> "$tag_file"
fi
done
if [ ! -d "$built" ]; then
mkdir $built
mkdir "$built/versions"
fi

# Build all versions and use latest version(First version number in $tag_list) as landing page.
version_num=0
for tag in $tag_list; do
cd "$mxnet_folder"
git fetch
if [ $tag == 'master' ]
then
git checkout master
else
git checkout "tags/$tag"
then
git checkout master
git pull
else
git checkout "tags/$tag"
fi
if [ $tag == '0.11.0' ]
then
git checkout master -- docs/mxdoc.py
fi

git submodule update || exit 1
cd ..
make clean
cd docs
make clean
make html USE_OPENMP=0 || exit 1
python build_version_doc/AddVersion.py --file_path "_build/html/" --current_version "$tag" || exit 1

if [ $tag != 'master' ]
then
python build_version_doc/AddPackageLink.py --file_path "_build/html/get_started/install.html" \
--current_version "$tag" || exit 1
fi

if [ $version_num == 0 ]
then
cp -a _build/html/. "../../$built"
else
file_loc="../../$built/versions/$tag"
mkdir "$file_loc"
cp -a _build/html/. "$file_loc"
make html USE_OPENMP=1 || exit 1
cd ../../
file_loc="$built/versions/$tag"
if [ -d "$file_loc" ] ; then
rm -rf "$file_loc"
fi

((++version_num))
mkdir "$file_loc"
cp -a "$mxnet_folder/docs/_build/html/." "$file_loc"
done

mv "$tag_file" "../../$built/tag.txt"
cd ../..
rm -rf "$mxnet_folder"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment that update_all_versions.sh should be run afterwards. Maybe even print it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

echo "Now you may want to run update_all_version.sh to create the production layout with the versions dropdown and other per-version corrections."
65 changes: 65 additions & 0 deletions docs/build_version_doc/build_site_tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


# How this script works:
# 1. Receive tag list
# Looks like: tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master"
# 2. Receive default tag (for main website view)
# 3. Receive root URL
# 4. Call build and then update scripts

# Take user input or check env var for tag list
if [ -z "$1" ]
then
echo "No tag list supplied... trying environment variable $TAG_LIST"
else
tag_list="${TAG_LIST:-"$1"}"
echo "Using these tags: $1"
fi

if [ -z "$tag_list" ]
then
echo "No tags defined"
exit 1
fi

if [ -z "$2" ]
then
echo "Please pick a version to use as a default for the website. Ex: 1.1.0"
exit 1
else
tag_default=$2
fi

if [ -z "$3" ]
then
echo "Please provide the root url for the site. Ex: http://mxnet.incubator.apache.org/"
exit 1
else
root_url=$3
fi

# Pass params to build and update scripts
for tag in $tag_list; do
./build_all_version.sh $tag || exit 1
done

./update_all_version.sh "$tag_list" $tag_default $root_url || exit 1

62 changes: 62 additions & 0 deletions docs/build_version_doc/setup_docs_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.


# If you need to build <= v0.12.0 then use a Python 2 environment
# mxdoc.py - a sphinx extension, was not Python 3 compatible in the old versions
# source activate mxnet_p27

# Install dependencies
sudo apt-get update
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this code into a Dockerfile instead of a shell script. See https://github.com/apache/incubator-mxnet/blob/master/docs/Dockerfile for reference

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is taking a really long time to test, so that's why an update hasn't landed yet! I had the benefit of some deps handled by the DL AMI, but in a vanilla container I had a lot of troubleshooting to do. That being said, I'm hoping I'm near the end of testing the scripts inside a container for every tag we need.

I'm quite tempted to modify the scripts though so that they take in the tag as an input and we do a RUN for each, so we can use the docker cache for when the build steps are completed fine.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if the tag(s) can be passed as argument. E.g. "docker run Dockerfile_doc -e tags=1.1.0,1.0.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, please remove this file as it is no longer needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to keep it around... or maybe move the info to documentation since it is really helpful for installing outside of docker.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to move the instructions into a README.md.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file deprecated? Please remove

sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
doxygen \
software-properties-common

pip install --user \
beautifulsoup4 \
breathe \
CommonMark==0.5.4 \
h5py \
mock==1.0.1 \
pypandoc \
recommonmark==0.4.0 \
sphinx==1.5.6

# Recommonmark/Sphinx errors: https://github.com/sphinx-doc/sphinx/issues/3800


# Setup scala
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install -y \
sbt \
scala

# Cleanup
sudo apt autoremove -y

# Make docs using the manual way
# cd .. && make html USE_OPENMP=0
# using the docker way
# sudo make docs

100 changes: 100 additions & 0 deletions docs/build_version_doc/update_all_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# This script will update the html content from building
# different tags.
# It assumes you have already run build_all_version.sh for
# the tags you want to update.

# Takes three arguments:
# * tag list - space delimited list of Github tags; Example: "1.1.0 1.0.0 master"
# * default tag - which version should the site default to; Example: 1.0.0
# * root URL - for the versions dropdown to change to production or dev server; Example: http://mxnet.incubator.apache.org/

# Example Usage:
# ./update_all_version.sh "1.1.0 1.0.0 master" 1.0.0 http://mxnet.incubator.apache.org/

set -e
set -x

if [ -z "$1" ]
then
echo "Please provide a list of version tags you wish to run. Ex : \"1.1.0 1.0.0 master\""
exit 1
else
tag_list=$1
fi

if [ -z "$2" ]
then
echo "Please pick a version to use as a default for the website. Ex: 1.1.0"
exit 1
else
tag_default=$2
fi

if [ -z "$3" ]
then
echo "Please provide the root url for the site. Ex: http://mxnet.incubator.apache.org/"
exit 1
else
root_url=$3
fi

mxnet_folder="apache_mxnet"
built="VersionedWeb"
tag_file="tag_list.txt"

if [ -f "$tag_file" ]; then
rm $tag_file
fi

# Write all version numbers into $tag_file for AddVersion.py to use later
# Master is added by that script by default
for tag in $tag_list; do
if [ $tag != 'master' ]
then
echo "$tag" >> "$tag_file"
fi
done

# Update the specified tags with the Versions dropdown
for tag in $tag_list; do
# This Python script is expecting the tag_list.txt and it will use that as the entries to populate
python AddVersion.py --root_url "$root_url" --file_path "$built/versions/$tag" --current_version "$tag" || exit 1

if [ $tag != 'master' ]
then
python AddPackageLink.py --file_path "$built/versions/master/install/index.html" \
--current_version "$tag" || exit 1
fi

if [ $tag == $tag_default ]
then
cp -a "$built/versions/$tag/." "$built"
else
file_loc="$built/versions/$tag"
#rm -rf "$file_loc"
#mkdir "$file_loc"
#cp -a $mxnet_folder/docs/_build/html/. "$file_loc"
fi
done

echo "The output of this process can be found in the VersionedWeb folder."