add documents of inspect tools #546
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TDengine Doc Build and Check | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
- '3.0' | |
- 'docs-cloud' | |
paths: | |
- 'docs/**' | |
env: | |
DOC_WKC: '/root/doc_ci_work' | |
ZH_DOC_REPO: 'docs.taosdata.com' | |
EN_DOC_REPO: 'docs.tdengine.com' | |
TD_REPO: 'TDengine' | |
TOOLS_REPO: 'taos-tools' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-docs-typos: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Actions Repository | |
uses: actions/checkout@v4 | |
- name: Use custom zh config file | |
uses: crate-ci/[email protected] | |
with: | |
files: 'docs/zh/**/*.md' | |
config: docs/typos.toml | |
- name: Use custom en config file | |
uses: crate-ci/[email protected] | |
with: | |
files: 'docs/en/**/*.md' | |
config: docs/typos.toml | |
check-docs-linter-formatter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: AutoCorrect | |
uses: huacnlee/autocorrect-action@v2 | |
with: | |
args: --lint docs/zh/* docs/en/* | |
build-doc: | |
runs-on: | |
group: CI | |
labels: [self-hosted, doc-build] | |
needs: | |
- check-docs-typos | |
- check-docs-linter-formatter | |
steps: | |
- name: Get the latest document contents | |
run: | | |
set -e | |
cd ${{ env.DOC_WKC }}/${{ env.TD_REPO }} | |
git reset --hard | |
git clean -f | |
git remote prune origin | |
git fetch | |
git checkout ${{ github.event.pull_request.base.ref }} | |
git pull >/dev/null | |
git fetch origin +refs/pull/${{ github.event.pull_request.number }}/merge | |
git checkout -qf FETCH_HEAD | |
- name: Check document changes | |
id: changed-doc-files | |
uses: tj-actions/changed-files@v46 | |
with: | |
files: 'docs/**' | |
path: ${{ env.DOC_WKC }}/${{ env.TD_REPO }} | |
# settings for pull request event | |
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || '' }} | |
sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
- name: Check whether the chinese or english docment is built | |
id: check-doc-lang | |
env: | |
ALL_CHANGED_DOCS: ${{ steps.changed-doc-files.outputs.all_changed_files }} | |
run: | | |
zh_doc_changed=false | |
en_doc_changed=false | |
echo "All changed files: ${{ steps.changed-doc-files.outputs.all_changed_files }}" | |
echo "Added files: ${{ steps.changed-doc-files.outputs.added_files }}" | |
echo "Modified files: ${{ steps.changed-doc-files.outputs.modified_files }}" | |
echo "Deleted files: ${{ steps.changed-doc-files.outputs.deleted_files }}" | |
for file in $ALL_CHANGED_DOCS; do | |
case $file in | |
*docs/zh/*) | |
zh_doc_changed=true | |
;; | |
*docs/en/*) | |
en_doc_changed=true | |
;; | |
*docs/assets/* | *docs/doxgen/* | *docs/examples/*) | |
zh_doc_changed=true | |
en_doc_changed=true | |
;; | |
esac | |
done | |
echo "zh_doc_changed=$zh_doc_changed" | |
echo "en_doc_changed=$en_doc_changed" | |
echo "zh_doc_changed=$zh_doc_changed" >> $GITHUB_OUTPUT | |
echo "en_doc_changed=$en_doc_changed" >> $GITHUB_OUTPUT | |
- name: Build the chinese document | |
if: ${{ steps.check-doc-lang.outputs.zh_doc_changed == 'true'}} | |
run: | | |
cd ${{ env.DOC_WKC }}/${{ env.ZH_DOC_REPO }} | |
yarn ass local | |
yarn build | |
- name: Build the english document | |
if: ${{ steps.check-doc-lang.outputs.en_doc_changed == 'true'}} | |
run: | | |
cd ${{ env.DOC_WKC }}/${{ env.EN_DOC_REPO }} | |
yarn ass local | |
yarn build | |