-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild_website.sh
More file actions
executable file
·155 lines (137 loc) · 4.09 KB
/
build_website.sh
File metadata and controls
executable file
·155 lines (137 loc) · 4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/usr/bin/env bash
echo "Building website .."
# exit upon failed command and use of undeclared variables
set -e -u
function set_this_up {
if [ "$TRAVIS_BRANCH" != "master" ]
then
echo "This commit was made against the $TRAVIS_BRANCH branch and not the master branch. Exit."
exit 0
fi
if [ -z ${GH_TOKEN+x} ]
then
echo "GH_TOKEN was not set, so this is probably a fork. Exit."
exit 0
fi
}
function install_miniconda_with_jupyter {
# we need jupyter to convert the notebooks, therefore use miniconda
mkdir -p $HOME/conda_dl || true
cd $HOME/conda_dl
wget -nv https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
export MAMBA_ALWAYS_YES=true
conda config --env --add channels conda-forge
conda install mamba
mamba update --all -q
mamba install -q jupyter pip sphinx
cd -
}
function get_tutorials {
cd $HOME
git clone "https://github.com/readdy/readdy_tutorials.git"
}
# only to build the doxygen manual
function get_readdy {
cd $HOME
git clone "https://github.com/readdy/readdy.git"
}
function get_assets {
cd $TRAVIS_BUILD_DIR/readdy_documentation/assets
wget -nv -P ./videos/ https://userpage.fu-berlin.de/chrisfr/readdy_website/assets/videos/logo.webm
wget -nv -P ./videos/ https://userpage.fu-berlin.de/chrisfr/readdy_website/assets/videos/logo.mp4
cd -
}
function convert_tutorials {
cd $HOME/readdy_tutorials
# remove the github repo utils so they don't end up in the website output
rm .gitignore || true
rm README.md || true
rm -rf .git/ || true
rm -rf utils/ || true
cp $TRAVIS_BUILD_DIR/convert_tutorials.py "."
./convert_tutorials.py "./demonstration"
./convert_tutorials.py "./validation"
./convert_tutorials.py "./benchmark"
rm ./demonstration/*.ipynb
rm ./validation/*.ipynb
rm ./benchmark/*.ipynb
cd -
}
function make_reference_doc {
mkdir -p $HOME/reference || true
cd $HOME/readdy/docs/sphinx
make html
}
function make_doxygen_doc {
cd $HOME/reference
# cant reliably determine cpu count in a docker container,
# therefore fix this value.
CPU_COUNT=2
cmake $HOME/readdy -DREADDY_GENERATE_DOCUMENTATION_TARGET_ONLY:BOOL=ON
echo "making doc"
2>/dev/null 1>/dev/null make doc &
echo "done with exit code $?"
cd -
}
function make_website {
# setup jekyll via bundler
cd $TRAVIS_BUILD_DIR/readdy_documentation
bundle install
# insert the reference documentation
cp -r $HOME/readdy/docs/sphinx/build/html/* reference_manual/
# insert the converted tutorials
mkdir _demonstration || true
mkdir _validation || true
mkdir _benchmark || true
cp -r $HOME/readdy_tutorials/demonstration/* _demonstration/
cp -r $HOME/readdy_tutorials/validation/* _validation/
cp -r $HOME/readdy_tutorials/benchmark/* _benchmark/
# build
bundle exec jekyll build
cd _site
rm -f Gemfile Gemfile.lock
}
function setup_output_repo {
cd $TRAVIS_BUILD_DIR/readdy_documentation/_site
# this is already pure html, no further jekyll action needed by github
touch .nojekyll
git init
git config user.name "Christoph Froehner"
git config user.email "chrisfroe@users.noreply.github.com"
git remote add upstream "https://$GH_TOKEN@github.com/readdy/readdy.github.io.git" > /dev/null 2>&1
git fetch upstream
git checkout --orphan workbranch
git reset --hard
cd -
}
function deploy {
cd $TRAVIS_BUILD_DIR/readdy_documentation/_site/
touch .
git add -A .
git commit -m "github pages"
git push -q -f upstream workbranch:master > /dev/null 2>&1
}
function get_videos {
cd $TRAVIS_BUILD_DIR/readdy_documentation/assets
mkdir videos
cd ./videos
wget -nv http://clonker.userpage.fu-berlin.de/readdyvids/logo.mp4
wget -nv http://clonker.userpage.fu-berlin.de/readdyvids/logo.webm
wget -nv http://clonker.userpage.fu-berlin.de/readdyvids/logo.ogv
cd -
}
set_this_up
install_miniconda_with_jupyter
get_tutorials
convert_tutorials
get_readdy
# get_assets
make_reference_doc
get_videos
make_website
setup_output_repo
deploy