Skip to content

Commit 9ea3856

Browse files
committed
Merge branch 'feature/docs_check_lang_folder_sync' into 'master'
Introduced a CI check if folders with localized documentation are in sync, i.e.… See merge request idf/esp-idf!2073
2 parents 4667d9c + 621076f commit 9ea3856

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.gitlab-ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ build_docs:
208208
- docs/zh_CN/_build/html
209209
expire_in: 1 mos
210210
script:
211-
- cd docs/en
211+
- cd docs
212+
- ./check_lang_folder_sync.sh
213+
- cd en
212214
- make gh-linkcheck
213215
- make html
214216
- ../check_doc_warnings.sh

docs/check_lang_folder_sync.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
#
3+
# Check if folders with localized documentation are in sync
4+
#
5+
# 1. Traverse each folder with language version and generate a sorted list
6+
# of all the files inside
7+
# 2. Compare the sorted lists of files and flag differences
8+
#
9+
# Note:
10+
# All differences between folders with language versions should be resolved
11+
# before releasing documentation
12+
#
13+
14+
RESULT=0
15+
STARS='***************************************************'
16+
17+
find en -type f | cut -d/ -f2- | sort > file_list_en
18+
find zh_CN -type f | cut -d/ -f2- | sort > file_list_zh_CN
19+
20+
# format is to display new or different filenames
21+
DIFF_FORMAT="--unchanged-line-format= --old-line-format=[en]:%L --new-line-format=[zh_CN]:%L"
22+
23+
FOLDER_DIFFERENCES=$(diff $DIFF_FORMAT file_list_en file_list_zh_CN)
24+
if ! [ -z "$FOLDER_DIFFERENCES" ]; then
25+
echo "$STARS"
26+
echo "Build failed due to the following differences in 'en' and 'zh_CN' folders:"
27+
echo "$FOLDER_DIFFERENCES"
28+
echo "$STARS"
29+
echo "Please synchronize contents of 'en' and 'zh_CN' folders to contain files with identical names"
30+
RESULT=1
31+
fi
32+
33+
# remove temporary files
34+
rm file_list_en file_list_zh_CN
35+
36+
exit $RESULT

0 commit comments

Comments
 (0)