Skip to content

Commit fef2262

Browse files
committed
Workflow for ffi docs
1 parent 0b25fd8 commit fef2262

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Publish tvm-ffi docs
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build_wheels:
8+
name: Build docs
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: astral-sh/setup-uv@v4
12+
13+
- uses: actions/checkout@v4
14+
with:
15+
submodules: recursive
16+
path: tvm-site
17+
18+
- name: Checkout tvm
19+
uses: actions/checkout@v4
20+
with:
21+
repository: apache/tvm
22+
submodules: recursive
23+
path: tvm
24+
25+
- name: Install wheel and requirements
26+
working-directory: tvm/ffi
27+
run: |
28+
pip install .
29+
pip install -r docs/requirements.txt
30+
pip install linkify-it-py
31+
32+
- name: Build docs
33+
working-directory: tvm/ffi/docs
34+
run: |
35+
make html
36+
python ../../../tvm-site/scripts/download_3rdparty_embeds.py -v --path=_build/html
37+
38+
- name: Deploy docs
39+
working-directory: tvm-site
40+
run: |
41+
git fetch
42+
git checkout -B asf-site origin/asf-site
43+
git ls-tree HEAD ffi/ --name-only | grep -vP '^ffi/v\\d' | xargs rm -rf
44+
cp -r ../tvm/ffi/docs/_build/html ffi
45+
git config user.name tvm-bot
46+
git config user.email [email protected]
47+
git add ffi
48+
git commit -m"deploying ffi docs" ffi
49+
git status
50+
for i in {1..3}; do
51+
if git push origin asf-site; then
52+
echo "Push successful"
53+
break
54+
else
55+
echo "Push failed, retrying ($i)..."
56+
sleep 2
57+
git pull --rebase origin asf-site
58+
fi
59+
done
60+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build Jekyll Site
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: 3.4
20+
bundler-cache: true
21+
22+
- name: Install dependencies
23+
run: |
24+
bundle install
25+
26+
- name: Build website
27+
run: |
28+
./scripts/task_deploy_asf_site.sh

scripts/download_3rdparty_embeds.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,5 +310,9 @@ def download_and_replace_urls(files: Optional[List[str]] = None, verbose: bool =
310310
if __name__ == "__main__":
311311
args = argparse.ArgumentParser()
312312
args.add_argument("-v", "--verbose", action="store_true")
313+
args.add_argument("-p", "--path", type=str, default=None)
313314
args = args.parse_args()
315+
316+
if args.path is not None:
317+
HTML_DIR = args.path
314318
download_and_replace_urls(verbose=args.verbose)

scripts/task_deploy_asf_site.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ git ls-files | grep -v -e ^docs -e ^ffi | xargs rm -rf
1818
cp .gitignore.bak .gitignore
1919
cp .asf.yaml.bak .asf.yaml
2020

21+
if [ "$GITHUB_ACTIONS" = "true" ]; then
22+
git config user.name tvm-bot
23+
git config user.email [email protected]
24+
fi
25+
2126
cp -rf _site/* .
27+
rm -rf _site
2228
DATE=`date`
2329
git add --all && git commit -am "Build at ${DATE}"
2430
git push origin asf-site

0 commit comments

Comments
 (0)