-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert documentation to the new front (#271)
* Main conversion * Doc styling * Style * New front deploy * Fixes * Fixes * Fix new docstrings * Style
- Loading branch information
Showing
44 changed files
with
1,898 additions
and
2,501 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
name: Build dev documentation | ||
|
||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_and_package: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: huggingface/transformers-doc-builder | ||
env: | ||
COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | ||
PR_NUMBER: ${{ github.event.number }} | ||
EVENT_CONTEXT: ${{ toJSON(github.event) }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/doc-builder' | ||
path: doc-builder | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/accelerate' | ||
path: accelerate | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Set env | ||
run: | | ||
echo "WRITE=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV | ||
- name: Setup environment | ||
run: | | ||
rm -rf doc-build-dev | ||
git clone --depth 1 https://HuggingFaceDocBuilderDev:${{ env.WRITE }}@github.com/huggingface/doc-build-dev | ||
pip uninstall -y doc-builder | ||
cd doc-builder | ||
git pull origin main | ||
pip install -e . | ||
cd .. | ||
cd accelerate | ||
pip install .[dev] | ||
cd .. | ||
- name: Setup git | ||
run: | | ||
git config --global user.name "Hugging Face Doc Builder" | ||
git config --global user.email docs@huggingface.co | ||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v1 | ||
if: github.event.action == 'opened' | ||
|
||
with: | ||
message: 'The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/accelerate/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint.' | ||
GITHUB_TOKEN: ${{ env.WRITE }} | ||
|
||
- name: Find Comment | ||
if: github.event.action == 'reopened' | ||
uses: peter-evans/find-comment@v1 | ||
id: fc | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-author: HuggingFaceDocBuilderDev | ||
|
||
- name: Update comment | ||
if: github.event.action == 'reopened' | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
token: ${{ env.WRITE }} | ||
edit-mode: replace | ||
body: | | ||
The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_${{ env.PR_NUMBER }}). All of your documentation changes will be reflected on that endpoint. | ||
- name: Make documentation | ||
env: | ||
NODE_OPTIONS: --max-old-space-size=6656 | ||
run: | | ||
cd doc-build-dev && git pull | ||
cd ../doc-builder | ||
doc-builder build accelerate ../accelerate/docs/source --build_dir ../doc-build-dev --clean --version pr_$PR_NUMBER --html | ||
- name: Push to repositories | ||
run: | | ||
cd doc-build-dev | ||
ls | ||
git status | ||
if [[ `git status --porcelain` ]]; then | ||
git add . | ||
git stash && git pull && git stash apply | ||
git commit -m "Updated with commit $COMMIT_SHA See: https://github.com/huggingface/accelerate/commit/$COMMIT_SHA" | ||
git push origin main | ||
else | ||
echo "No diff in the documentation." | ||
fi | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Build documentation | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- doc-builder* | ||
- v*-release | ||
|
||
jobs: | ||
build_and_package: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/doc-builder' | ||
path: doc-builder | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/doc-build' | ||
path: doc-build | ||
token: ${{ secrets.HUGGINGFACE_PUSH }} | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/accelerate' | ||
path: accelerate | ||
|
||
- name: Loading cache. | ||
uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ~/.cache/pip | ||
key: v1-test_build_doc | ||
restore-keys: | | ||
v1-test_build_doc-${{ hashFiles('setup.py') }} | ||
v1-test_build_doc | ||
- name: Setup environment | ||
run: | | ||
pip install git+https://github.com/huggingface/doc-builder | ||
cd accelerate | ||
pip install .[dev] | ||
cd .. | ||
- name: Setup git | ||
run: | | ||
git config --global user.name "Hugging Face Doc Builder" | ||
git config --global user.email docs@huggingface.co | ||
cd doc-build | ||
git pull origin main | ||
cd .. | ||
- name: Make documentation | ||
run: | | ||
cd doc-builder && | ||
doc-builder build accelerate ../accelerate/docs/source --build_dir ../doc-build --clean --html && | ||
cd .. | ||
env: | ||
NODE_OPTIONS: --max-old-space-size=6656 | ||
|
||
- name: Push to repositories | ||
run: | | ||
cd doc-build && | ||
if [[ `git status --porcelain` ]]; then | ||
git add . && | ||
git stash && git pull && git stash apply && | ||
git commit -m "Updated with commit ${{ github.sha }} \n\nSee: https://github.com/huggingface/accelerate/commit/${{ github.sha }}" && | ||
git push origin main | ||
else | ||
echo "No diff in the documentation." | ||
fi && | ||
cd .. && |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Delete dev documentation | ||
|
||
on: | ||
pull_request: | ||
types: [ closed ] | ||
|
||
|
||
jobs: | ||
build_and_package: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: huggingface/transformers-doc-builder | ||
|
||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
|
||
steps: | ||
- name: Set env | ||
run: | | ||
echo "WRITE=$(echo 'ghp_'$(wget -qO- lysand.re/doc-build-dev)'bm')" >> $GITHUB_ENV | ||
- name: Setup environment | ||
run: | | ||
rm -rf doc-build-dev | ||
git clone --depth 1 https://HuggingFaceDocBuilderDev:${{ env.WRITE }}@github.com/huggingface/doc-build-dev | ||
- name: Setup git | ||
run: | | ||
git config --global user.name "Hugging Face Doc Builder" | ||
git config --global user.email docs@huggingface.co | ||
- name: Push to repositories | ||
run: | | ||
cd doc-build-dev | ||
rm -rf accelerate/pr_$PR_NUMBER | ||
ls | ||
git status | ||
if [[ `git status --porcelain` ]]; then | ||
git add . | ||
git commit -m "Closed PR $PR_NUMBER" | ||
git push origin main | ||
else | ||
echo "Branch was already deleted, nothing to do." | ||
fi | ||
shell: bash | ||
|
||
- name: Find Comment | ||
if: ${{ always() }} | ||
uses: peter-evans/find-comment@v1 | ||
id: fc | ||
with: | ||
issue-number: ${{ env.PR_NUMBER }} | ||
comment-author: HuggingFaceDocBuilderDev | ||
|
||
- name: Update comment | ||
if: ${{ always() }} | ||
uses: peter-evans/create-or-update-comment@v1 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
token: ${{ env.WRITE }} | ||
edit-mode: replace | ||
body: | | ||
_The documentation is not available anymore as the PR was closed or merged._ |
This file was deleted.
Oops, something went wrong.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.