Skip to content

Commit c971d45

Browse files
authored
Gihhub actions for docs (#245)
This PR adds GH actions for docs
1 parent 86c593e commit c971d45

File tree

9 files changed

+134
-35
lines changed

9 files changed

+134
-35
lines changed

.github/workflows/documentation.yml

+31-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,39 @@
1-
name: Documentation
1+
name: Build Docs
2+
23
on:
34
push:
45
branches:
5-
- main
6-
paths:
7-
- “docs/”
6+
- main
7+
88
jobs:
9-
build:
9+
test_linux:
10+
name: Deploy Docs
1011
runs-on: ubuntu-latest
12+
1113
steps:
12-
- uses: actions/setup-python@v2
13-
- uses: actions/checkout@master
14+
- uses: actions/checkout@v2
1415
with:
15-
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
16-
- name: Build and Commit
17-
uses: sphinx-notes/pages@v3
18-
- name: Push changes
19-
uses: ad-m/github-push-action@master
16+
submodules: recursive
17+
18+
- name: Configuring build Environment
19+
run: |
20+
sudo apt-get update
21+
python -m pip install -U pip wheel
22+
23+
- name: Setup Ruby
24+
uses: ruby/setup-ruby@v1
2025
with:
21-
github_token: ${{ secrets.GITHUB_TOKEN }}
22-
branch: sphinx-gh-pages
26+
ruby-version: '3.0'
27+
28+
- name: Installing dependencies
29+
run: |
30+
python -m pip install -r docs/requirements.txt
31+
gem install jekyll jekyll-remote-theme
32+
33+
- name: Deploying on GitHub Pages
34+
if: github.ref == 'refs/heads/main'
35+
run: |
36+
git remote set-url origin https://x-access-token:${{ secrets.MLC_GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
37+
git config --global user.email "mlc-gh-actions-bot@nomail"
38+
git config --global user.name "mlc-gh-actions-bot"
39+
./scripts/gh_deploy_site.sh

CONTRIBUTORS.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
MLC LLM Contributors
2+
====================
3+
4+
5+
## List of Contributors
6+
- [Full List of Contributors](https://github.com/mlc-ai/mlc-llm/graphs/contributors)

docs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
66
SPHINXOPTS ?=
7-
SPHINXBUILD ?= sphinx-build
7+
SPHINXBUILD ?= python -m sphinx
88
SOURCEDIR = .
99
BUILDDIR = _build
1010

docs/contribute/community.rst

+55-18
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,24 @@ MLC-LLM Community Guidelines
77
:depth: 2
88
:local:
99

10-
Welcome to the MLC-LLM community! Just like you, all of us are in awe of the immense power of large language models. Our goal for MLC-LLM is to foster a project that is driven by an open-source community, working together to democratize this technology and make it accessible across various devices. We are thrilled to have you as part of our community and eagerly anticipate your valuable contributions.
10+
Welcome to the MLC-LLM community! Just like you, all of us are in awe of the immense power of large language models.
11+
Our goal for MLC-LLM is to foster a project that is driven by an open-source community, working together to democratize
12+
this technology and make it accessible across various devices. We are thrilled to have you as part of our
13+
community and eagerly anticipate your valuable contributions.
1114

1215

1316
.. _community_discussion:
1417

1518
Participate in Community Discussions
1619
------------------------------------
1720

18-
We encourage open discussions. If you encounter a bug or have a feature request, please file an issue in MLC-LLM's GitHub `issue tracker <https://github.com/mlc-ai/mlc-llm/issues>`__. You are encouraged to tag the issue with labels such as "bug," "feature request," or "iOS" so that the relevant developers can quickly notice your concern.
21+
We encourage open discussions. If you encounter a bug or have a feature request, please file an issue in MLC-LLM's
22+
GitHub `issue tracker <https://github.com/mlc-ai/mlc-llm/issues>`__. You are encouraged to tag the issue with labels
23+
such as "bug," "feature request," or "iOS" so that the relevant developers can quickly notice your concern.
1924

20-
Additionally, we have set up a `discord server <https://discord.gg/9Xpy2HGBuD>`__ for online discussions. While we encourage participation in the Discord server, we also recommend creating a GitHub issue even if the topic has been discussed there. This ensures that the discussion is archived and searchable for future reference.
25+
Additionally, we have set up a `discord server <https://discord.gg/9Xpy2HGBuD>`__ for online discussions.
26+
While we encourage participation in the Discord server, we also recommend creating a GitHub issue even if the
27+
topic has been discussed there. This ensures that the discussion is archived and searchable for future reference.
2128

2229
Before submitting an issue, we kindly ask you to check our `FAQ page :doc:/misc/` to see if your question has already been answered.
2330

@@ -31,11 +38,15 @@ Contribute to MLC-LLM
3138
Fork and Create Pull Requests
3239
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3340

34-
Ready to contribute to MLC-LLM? Awesome! We are excited to see you are ready to contribute your code. The standard way to make changes to MLC-LLM code base is through creating a `pull-request <https://github.com/mlc-ai/mlc-llm/pulls>`__, and we will review your code and merge it to the code base when it is ready.
41+
Ready to contribute to MLC-LLM? Awesome! We are excited to see you are ready to contribute your code.
42+
The standard way to make changes to MLC-LLM code base is through creating a `pull-request <https://github.com/mlc-ai/mlc-llm/pulls>`__,
43+
and we will review your code and merge it to the code base when it is ready.
3544

36-
The first step to become a developer is to `fork <https://github.com/mlc-ai/mlc-llm/fork>`__ the repository to your own github account, you will notice a repository under ``https://github.com/username/mlc-llm`` where ``username`` is your github user name.
45+
The first step to become a developer is to `fork <https://github.com/mlc-ai/mlc-llm/fork>`__ the repository to your own
46+
github account, you will notice a repository under ``https://github.com/username/mlc-llm`` where ``username`` is your github user name.
3747

38-
You can clone your fork to your local machine and commit changes, or edit the contents of your fork (in the case you are just fixing typos) on github directly. Once your update is complete, you can click the ``contribute`` button and open a pull request to the main repository.
48+
You can clone your fork to your local machine and commit changes, or edit the contents of your fork (in the case you are just fixing typos)
49+
on github directly. Once your update is complete, you can click the ``contribute`` button and open a pull request to the main repository.
3950

4051
.. _contribute-new-models:
4152

@@ -44,51 +55,77 @@ Contribute New Models to MLC-LLM
4455

4556
Woohoo! Congratulations
4657

47-
* If you compiled a model for existing model architecture by following our :doc:`../tutorials/compile-models` tutorial. Please upload your model stored in ``dist`` directory to Hugging Face (an example can be found `here <https://huggingface.co/mlc-ai/mlc-chat-vicuna-v1-7b-q4f32_0/tree/main>`__), and please create a pull request to MLC-LLM and add your model code to the `model zoo <https://github.com/mlc-ai/mlc-llm/tree/main/docs/model-zoo.rst>`__, and create a issue to track the speed and memory consumption of your model, see an example `here <https://github.com/mlc-ai/mlc-llm/issues/15>`__ (you don't need to test on all devices, let the community build it together!).
48-
* If you add a new model variant to MLC-LLM by following our :doc:`../tutorials/bring-your-own-models` tutorial. Please create a pull request to add your model architecture (currently model architectures are placed under `relax_models <https://github.com/mlc-ai/mlc-llm/tree/main/mlc_llm/relax_model>`__ folder).
58+
* If you compiled a model for existing model architecture by following our :doc:`../tutorials/compile-models` tutorial.
59+
Please upload your model stored in ``dist`` directory to Hugging Face (an example can be
60+
found `here <https://huggingface.co/mlc-ai/mlc-chat-vicuna-v1-7b-q4f32_0/tree/main>`__), and please create a
61+
pull request to MLC-LLM and add your model code to the `model zoo <https://github.com/mlc-ai/mlc-llm/tree/main/docs/model-zoo.rst>`__,
62+
and create a issue to track the speed and memory consumption of your model, see an example `here <https://github.com/mlc-ai/mlc-llm/issues/15>`__
63+
(you don't need to test on all devices, let the community build it together!).
64+
* If you add a new model variant to MLC-LLM by following our :doc:`../tutorials/bring-your-own-models` tutorial.
65+
Please create a pull request to add your model architecture (currently model architectures are placed under
66+
`relax_models <https://github.com/mlc-ai/mlc-llm/tree/main/mlc_llm/relax_model>`__ folder).
4967

5068
.. _coding-styles:
5169

5270
Coding Styles
5371
^^^^^^^^^^^^^
5472

55-
For python codes, we generally follow the `PEP8 style guide <https://peps.python.org/pep-0008/>`__. The python comments follow `NumPy style <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`__ python docstrings. To make things easy, you can use `black <https://pypi.org/project/black/>`__ to automatically format your python code.
73+
For python codes, we generally follow the `PEP8 style guide <https://peps.python.org/pep-0008/>`__.
74+
The python comments follow `NumPy style <https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html>`__ python docstrings.
75+
To make things easy, you can use `black <https://pypi.org/project/black/>`__ to automatically format your python code.
5676

5777
.. code:: bash
58-
78+
5979
pip install black
6080
black your_python_file.py
6181
62-
For C++ codes, we generally follow the `Google C++ style guide <https://google.github.io/styleguide/cppguide.html>`__. The C++ comments should be `Doxygen compatible <http://www.doxygen.nl/manual/docblocks.html#cppblock>`__. Fo your convenience, you can use `clang-format <https://clang.llvm.org/docs/ClangFormat.html>`__ to automatically format your C++ code.
82+
For C++ codes, we generally follow the `Google C++ style guide <https://google.github.io/styleguide/cppguide.html>`__.
83+
The C++ comments should be `Doxygen compatible <http://www.doxygen.nl/manual/docblocks.html#cppblock>`__.
84+
Fo your convenience, you can use `clang-format <https://clang.llvm.org/docs/ClangFormat.html>`__ to automatically format your C++ code.
6385

6486
.. code:: bash
65-
87+
6688
clang-format -i your_cpp_file.cpp
6789
6890
.. _general-development-process:
6991

7092
General Development Process
7193
---------------------------
7294

73-
Everyone in the community is welcomed to send patches, documents, and propose new directions to the project. The key guideline here is to enable everyone in the community to get involved and participate the decision and development. When major changes are proposed, an RFC (Request for Comments) should be sent to allow discussion by the community. We encourage public discussion, archivable channels such as github issues, so that everyone in the community can participate and review the process later.
95+
Everyone in the community is welcomed to send patches, documents, and propose new directions to the project.
96+
The key guideline here is to enable everyone in the community to get involved and participate the decision and development.
97+
We encourage public discussion in different channels, so that everyone in the community can participate
98+
and get informed in developments.
7499

75-
Code reviews are one of the key ways to ensure the quality of the code. High-quality code reviews prevent technical debt for long-term and are crucial to the success of the project. A pull request needs to be reviewed before it gets merged. A committer who has the expertise of the corresponding area would moderate the pull request and the merge the code when it is ready. The corresponding committer could request multiple reviewers who are familiar with the area of the code. We encourage contributors to request code reviews themselves and help review each other's code -- remember everyone is volunteering their time to the community, high-quality code review itself costs as much as the actual code contribution, you could get your code quickly reviewed if you do others the same favor.
100+
Code reviews are one of the key ways to ensure the quality of the code. High-quality code reviews prevent technical debt
101+
for long-term and are crucial to the success of the project. A pull request needs to be reviewed before it gets merged.
102+
A committer who has the expertise of the corresponding area would moderate the pull request and the merge the code when
103+
it is ready. The corresponding committer could request multiple reviewers who are familiar with the area of the code.
104+
We encourage contributors to request code reviews themselves and help review each other's code -- remember everyone
105+
is volunteering their time to the community, high-quality code review itself costs as much as the actual code
106+
contribution, you could get your code quickly reviewed if you do others the same favor.
76107

77-
The community should strive to reach a consensus on technical decisions through discussion. We expect committers to moderate technical discussions in a diplomatic way, and provide suggestions with clear technical reasoning when necessary.
108+
The community should strive to reach a consensus on technical decisions through discussion. We expect committers to
109+
moderate technical discussions in a diplomatic way, and provide suggestions with clear technical reasoning when necessary.
78110

79111

80112
.. _roles-committers:
81113

82114
Committers
83115
^^^^^^^^^^
84116

85-
Committers are individuals who are granted the write access to the project. A committer is usually responsible for a certain area or several areas of the code where they oversee the code review process.
117+
Committers are individuals who are granted the write access to the project. A committer is usually responsible for
118+
a certain area or several areas of the code where they oversee the code review process.
86119
The area of contribution can take all forms, including code contributions and code reviews, documents, education, and outreach.
87120
The review of pull requests will be assigned to the committers who recently contribute to the area this PR belong to.
88-
Committers are essential for a high quality and healthy project. The community actively look for new committers from contributors. Each existing committer can nominate new committers to MLC-LLM.
121+
Committers are essential for a high quality and healthy project. The community actively look for new committers
122+
from contributors. Each existing committer can nominate new committers to MLC projects.
89123

90124
.. _roles-contributors:
91125

92126
Contributors
93127
^^^^^^^^^^^^
94-
We also welcome contributors if you are not ready to be a committer yet. Everyone who contributes to the project (in the form of code, bugfix, documentation, tutorials, etc) is a contributors. We maintain a `page <https://github.com/mlc-ai/mlc-llm/blob/master/CONTRIBUTORS.md>`__ to acknowledge contributors, please let us know if you contribute to the project and your name is not included in the list.
128+
We also welcome contributors if you are not ready to be a committer yet. Everyone who contributes to
129+
the project (in the form of code, bugfix, documentation, tutorials, etc) is a contributors.
130+
We maintain a `page <https://github.com/mlc-ai/mlc-llm/blob/main/CONTRIBUTORS.md>`__ to acknowledge contributors,
131+
please let us know if you contribute to the project and your name is not included in the list.

docs/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
sphinx-tabs == 3.4.1
2-
sphinx-gallery == 5.2.3
3-
sphinx-rtd-theme == 1.1.1
2+
sphinx-rtd-theme
3+
sphinx == 5.2.3
44
sphinx-toolbox == 3.4.0

scripts/build_site.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
cd docs && make html && cd ..
5+
6+
cd site && jekyll b && cd ..
7+
8+
rm -rf site/_site/docs
9+
cp -r docs/_build/html site/_site/docs

scripts/gh_deploy_site.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# NOTE: this script is triggered by github action automatically
3+
# when megred into main
4+
5+
set -euxo pipefail
6+
7+
scripts/build_site.sh
8+
9+
git fetch
10+
git checkout -B gh-pages origin/gh-pages
11+
rm -rf docs .gitignore
12+
mkdir -p docs
13+
cp -rf site/_site/* docs
14+
touch docs/.nojekyll
15+
16+
DATE=`date`
17+
git add docs && git commit -am "Build at ${DATE}"
18+
git push origin gh-pages
19+
git checkout main && git submodule update
20+
echo "Finish deployment at ${DATE}"

scripts/local_deploy_site.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# NOTE: use this script to check local site
3+
4+
set -euxo pipefail
5+
6+
scripts/build_site.sh
7+
8+
cd site && jekyll serve --skip-initial-build --host localhost --baseurl /mlc-llm --port 8888

site/_config.yml

+2
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,7 @@ course_title:
3737
navigation:
3838
- title: Home
3939
link: /
40+
- title: Docs
41+
link: /docs
4042
- title: Github
4143
link: https://github.com/mlc-ai/mlc-llm

0 commit comments

Comments
 (0)