Skip to content

Commit bb59c06

Browse files
committed
Split updating submodules and building their content
* Add `make pull-modules` and `make build-modules` commands * Use these commands in GitHub Actions workflow * Update the building instructions in README.md * Update the documentation on adding new submodules
1 parent 3910124 commit bb59c06

File tree

7 files changed

+103
-118
lines changed

7 files changed

+103
-118
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ jobs:
1919
TARANTOOL_UPDATE_URL: ${{secrets.TARANTOOL_UPDATE_URL}}
2020
steps:
2121
- uses: actions/checkout@v2
22-
- run: bash update_submodules.sh
2322
- run: cmake .
23+
- run: make pull-modules
24+
- run: make build-modules
2425
- run: make json
2526
- run: make json-ru
2627
- run: make singlehtml

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,20 @@ add_custom_target(epub-ru ALL
298298
COMMENT "Building Russian epub with Sphinx"
299299
)
300300

301+
add_custom_target(pull-modules ALL
302+
COMMAND /usr/bin/env bash
303+
./pull_submodules.sh
304+
COMMENT "Update submodules to their latest commits"
305+
)
306+
307+
308+
add_custom_target(build-modules ALL
309+
COMMAND /usr/bin/env bash
310+
./build_submodules.sh
311+
COMMENT "Rebuild and copy content from submodules"
312+
)
313+
314+
301315

302316
if (LATEX_FOUND)
303317
add_custom_target(pdf-ru ALL COMMENT "PDF generation")

README.md

Lines changed: 73 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,68 @@ Tarantool documentation source, published at https://www.tarantool.io/doc/.
66

77
## How to build Tarantool documentation using [Docker](https://www.docker.com)
88

9-
### Build docker image
9+
### Prepare for work
1010

11-
```bash
12-
docker build -t tarantool-doc-builder .
13-
```
11+
First of all, pull the image for building the docs.
1412

15-
### Build Tarantool documentation using *tarantool-doc-builder* image
16-
## NOTE:
17-
> Run this command only if you don't have untracked files!
18-
check it by `git status`
19-
Also failures during git submodule update can be fixed by:
20-
```bash
21-
git submodule deinit -f .
22-
git submodule update --init
23-
```
24-
25-
Init and update submodules:
26-
```bash
27-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "./update_submodules.sh"
28-
```
29-
or do it manually:
3013
```bash
31-
git submodule init
32-
git submodule update
33-
git pull --recurse-submodules
34-
git submodule update --remote --merge
14+
docker pull tarantool/doc-builder
3515
```
3616

37-
Init make commands:
17+
Next, initialize a Makefile for your OS:
18+
3819
```bash
39-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "cmake ."
20+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "cmake ."
4021
```
4122

23+
### Update submodules and generate documentation sources from code
24+
25+
A big part of documentation sources comes from several other projects,
26+
connected as Git submodules.
27+
To include their latest contents in the docs, run these two steps.
28+
29+
1. Update the submodules:
30+
31+
```bash
32+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make pull-modules"
33+
```
34+
35+
This will initialize Git submodules and update them to the top of the stable
36+
branch in each repository.
37+
38+
You can also do without a Docker container:
39+
40+
```bash
41+
git submodule update --init
42+
git fetch --recurse-submodules
43+
git submodule update --remote --checkout
44+
```
45+
46+
`git submodule update` can sometimes fail, for example,
47+
when you have changes in submodules' files.
48+
You can reinitialize submodules to fix the problem.
49+
50+
**Caution:** all untracked changes in submodules will be lost!
51+
52+
```bash
53+
git submodule deinit -f .
54+
git submodule update --init
55+
```
56+
57+
2. Build the submodules content:
58+
59+
```bash
60+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make build-modules"
61+
```
62+
63+
This command will do two things:
64+
65+
1. Generate documentation source files from the source code
66+
2. Copy these files to the right places under the `./doc/` directory.
67+
68+
If you're editing submodules locally, repeat this step
69+
to view the updated results.
70+
4271
Now you're ready to build and preview the documentation locally.
4372
4473
### Build and run the documentation on your machine
@@ -49,7 +78,7 @@ Every time you make changes in the source files, it will rebuild the docs
4978
and refresh the browser page.
5079
5180
```bash
52-
docker run --rm -it -p 8000:8000 -v $(pwd):/doc tarantool-doc-builder sh -c "make autobuild"
81+
docker run --rm -it -p 8000:8000 -v $(pwd):/doc tarantool/doc-builder sh -c "make autobuild"
5382
```
5483
5584
First build will take some time.
@@ -60,8 +89,8 @@ and the browser tab with preview will reload automatically.
6089
You can also build the docs manually with `make html`,
6190
and then serve them using python3 built-in server:
6291
```bash
63-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make html"
64-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make html-ru"
92+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make html"
93+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make html-ru"
6594
python3 -m http.server --directory output/html
6695
```
6796

@@ -73,24 +102,23 @@ python -m SimpleHTTPServer
73102

74103
then go to [localhost:8000](http://localhost:8000) in your browser.
75104

76-
77105
There are other commands which can run
78-
in the *tarantool-doc-builder* container:
106+
in the *tarantool/doc-builder* container:
79107

80108
```bash
81-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make html"
82-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make html-ru"
83-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make singlehtml"
84-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make singlehtml-ru"
85-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make pdf"
86-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make pdf-ru"
87-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make json"
88-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make json-ru"
89-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make epub"
90-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make epub-ru"
91-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make update-pot"
92-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make update-po"
93-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make update-po-force"
109+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make html"
110+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make html-ru"
111+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make singlehtml"
112+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make singlehtml-ru"
113+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make pdf"
114+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make pdf-ru"
115+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make json"
116+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make json-ru"
117+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make epub"
118+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make epub-ru"
119+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make update-pot"
120+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make update-po"
121+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make update-po-force"
94122
```
95123

96124
## Localization
@@ -119,7 +147,7 @@ Upload translation sources any time when they have changed:
119147
120148
```bash
121149
# first, update the translation sources
122-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make update-pot"
150+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make update-pot"
123151
124152
# next, upload them to Crowdin
125153
crowdin upload
@@ -138,7 +166,7 @@ Then reformat them to see the real changes.
138166

139167
```bash
140168
crowdin download
141-
docker run --rm -it -v $(pwd):/doc tarantool-doc-builder sh -c "make reformat-po"
169+
docker run --rm -it -v $(pwd):/doc tarantool/doc-builder sh -c "make reformat-po"
142170
```
143171
## How to contribute
144172

build_submodules.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22

33
set -x
44

5-
mkdir -p ~/.ssh/
6-
ssh-keyscan github.com >> ~/.ssh/known_hosts
7-
git submodule init
8-
git submodule update
9-
git pull --recurse-submodules
10-
git submodule update --remote --merge
11-
125
project_root=$(pwd)
136
echo "${project_root}"
147
cartridge_root="${project_root}/modules/cartridge"

doc/contributing/docs/infra.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ a submodule.
5959
6060
.. _guidelines_doc_submodules_update:
6161

62-
2. Update update_submodule.sh
62+
2. Update build_submodules.sh
6363
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6464

6565
Next, we should define what directories and files are to be copied from
6666
the submodule repository into the documentation one before building
67-
documentation. These settings are defined in the ``update_submodule.sh`` file
67+
documentation. These settings are defined in the ``build_submodules.sh`` file
6868
which is in the root directory of the documentation repository.
6969

7070
We can take examples of the already existing submodules to show the logic of
@@ -85,7 +85,7 @@ So, we need to:
8585
* copy the entire content of the ``./modules/metrics/doc/monitoring/`` directory to
8686
``./doc/book/monitoring/``.
8787

88-
The corresponding lines in the ``update_submodule.sh`` file are the following:
88+
The corresponding lines in the ``build_submodules.sh`` file are the following:
8989

9090
.. code-block:: bash
9191
@@ -113,7 +113,7 @@ So, we need to:
113113
* copy ``./modules/cartridge_cli/README.rst`` to
114114
``./doc/book/cartridge/cartridge_cli/index.rst``.
115115

116-
The corresponding settings in the ``update_submodule.sh`` file are the following:
116+
The corresponding settings in the ``build_submodules.st`` file are the following:
117117

118118
.. code-block:: bash
119119

pull_submodules.sh

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,6 @@ set -x
44

55
mkdir -p ~/.ssh/
66
ssh-keyscan github.com >> ~/.ssh/known_hosts
7-
git submodule init
8-
git submodule update
9-
git pull --recurse-submodules
10-
git submodule update --remote --merge
11-
12-
project_root=$(pwd)
13-
echo "${project_root}"
14-
cartridge_root="${project_root}/modules/cartridge"
15-
rst_src="${project_root}/modules/cartridge/build.luarocks/build.rst"
16-
rst_dest="${project_root}/doc/book/cartridge"
17-
pot_src="${project_root}/modules/cartridge/build.luarocks/build.rst/locale"
18-
pot_dest="${project_root}/locale/book/cartridge"
19-
po_src="${project_root}/modules/cartridge/build.luarocks/build.rst/locale/ru/LC_MESSAGES"
20-
po_dest="${project_root}/locale/ru/LC_MESSAGES/book/cartridge"
21-
cartridge_cli_root="${project_root}/modules/cartridge-cli"
22-
cartridge_cli_dest="${rst_dest}/cartridge_cli"
23-
cartridge_cli_index_dest="${cartridge_cli_dest}/index.rst"
24-
monitoring_root="${project_root}/modules/metrics/doc/monitoring"
25-
monitoring_dest="${project_root}/doc/book"
26-
monitoring_grafana_root="${project_root}/modules/grafana-dashboard/doc/monitoring"
27-
luatest_root="${project_root}/modules/luatest/"
28-
luatest_dest="${project_root}/doc/reference/reference_rock/luatest"
29-
30-
cartridge_kubernetes_root="${project_root}/modules/tarantool-operator/doc/cartridge_kubernetes_guide"
31-
cartridge_kubernetes_dest="${rst_dest}/"
32-
33-
cd "${luatest_root}"
34-
ldoc --ext=rst --dir=rst --toctree="API" .
35-
cd "${luatest_dest}"
36-
yes | cp -fa "${luatest_root}/rst/." "${luatest_dest}"
37-
yes | cp "${luatest_root}/README.rst" "${luatest_dest}"
38-
39-
mkdir -p "${monitoring_dest}"
40-
yes | cp -rf "${monitoring_root}" "${monitoring_dest}/"
41-
yes | cp -rf "${monitoring_grafana_root}" "${monitoring_dest}/"
42-
43-
mkdir -p "${cartridge_cli_dest}"
44-
yes | cp -rf "${cartridge_cli_root}/README.rst" "${cartridge_cli_index_dest}"
45-
46-
mkdir -p "${cartridge_kubernetes_dest}"
47-
yes | cp -rf "${cartridge_kubernetes_root}" "${cartridge_kubernetes_dest}"
48-
49-
cd "${cartridge_root}" || exit
50-
tarantoolctl rocks install \
51-
https://raw.githubusercontent.com/tarantool/LDoc/tarantool/ldoc-scm-2.rockspec \
52-
--server=http://rocks.moonscript.org
53-
CMAKE_DUMMY_WEBUI=true tarantoolctl rocks make
54-
55-
cd "${rst_src}" || exit
56-
mkdir -p "${rst_dest}"
57-
find . -iregex '.*\.\(rst\|png\)$' -exec cp -r --parents {} "${rst_dest}" \;
58-
59-
cd "${pot_src}" || exit
60-
mkdir -p "${pot_dest}"
61-
find . -name '*.pot' -exec cp -r --parents {} "${pot_dest}" \;
62-
63-
cd "${po_src}" || exit
64-
mkdir -p "${po_dest}"
65-
find . -name '*.po' -exec cp -r --parents {} "${po_dest}" \;
66-
67-
sed -i -e '/Cartridge CLI<cartridge_cli\/index>/a\' -e '\ \ \ Cartridge Kubernetes guide<cartridge_kubernetes_guide/index>' "${rst_dest}/index.rst"
7+
git submodule update --init
8+
git fetch --recurse-submodules
9+
git submodule update --remote --checkout

update_submodules.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
# This file is kept for compatibility.
4+
# Run `make pull-modules build-modules` instead
5+
6+
. ./pull_submodules.sh
7+
. ./build_submodules.sh

0 commit comments

Comments
 (0)