-
Notifications
You must be signed in to change notification settings - Fork 27.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build dev documentation #15210
Merged
+159
−0
Merged
Build dev documentation #15210
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3abe3a1
Wrap up
LysandreJik c5ff103
Remove secret
LysandreJik b1289cf
Fix path
LysandreJik 7d14f0e
Typo
LysandreJik 4ef246f
Specific token for comments
LysandreJik a519f1b
Cleaner comments
LysandreJik 86de776
Correct PR number
LysandreJik 20d82a2
Explicit master install
LysandreJik f7c4221
Force uninstall
LysandreJik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,101 @@ | ||
name: Build dev documentation | ||
|
||
on: | ||
pull_request: | ||
|
||
|
||
jobs: | ||
build_and_package: | ||
runs-on: [self-hosted, doc-builder] | ||
container: | ||
image: huggingface/doc-builder-transformers | ||
options: "-v /home/github_actions:/mnt" | ||
env: | ||
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/transformers' | ||
path: transformers | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/notebooks' | ||
path: notebooks | ||
|
||
- name: Set env | ||
run: echo "WRITE=$(cat /mnt/WRITE)" >> $GITHUB_ENV | ||
|
||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v1 | ||
if: github.event.action == 'opened' || github.event.action == 'reopened' | ||
|
||
with: | ||
message: 'Thank you for your PR! The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/transformers/pr_15110). All of your documentation changes will be reflected on that endpoint.' | ||
GITHUB_TOKEN: ${{ env.WRITE }} | ||
|
||
- 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: | | ||
apt-get -y update && apt-get install -y libsndfile1-dev | ||
|
||
pip install git+https://github.com/huggingface/doc-builder | ||
cd transformers | ||
pip install .[dev] | ||
cd .. | ||
|
||
export TORCH_VERSION=$(python -c "from torch import version; print(version.__version__.split('+')[0])") | ||
pip install torch-scatter -f https://data.pyg.org/whl/torch-${TORCH_VERSION}+cpu.html | ||
|
||
pip install torchvision | ||
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' | ||
|
||
apt install -y tesseract-ocr | ||
pip install pytesseract | ||
pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com | ||
pip install https://github.com/kpu/kenlm/archive/master.zip | ||
|
||
- name: Setup git | ||
run: | | ||
git config --global user.name "Hugging Face Doc Builder" | ||
git config --global user.email docs@huggingface.co | ||
|
||
cd doc-builder | ||
git pull origin main | ||
cd .. | ||
|
||
cd notebooks | ||
git pull origin master | ||
cd .. | ||
WRITE=`cat /mnt/WRITE` | ||
|
||
rm -rf doc-build-dev | ||
git clone https://HuggingFaceDocBuilder:$WRITE@github.com/huggingface/doc-build-dev | ||
|
||
- name: Make documentation | ||
run: | | ||
doc-builder build transformers transformers/docs/source --build_dir doc-build-dev --notebook_dir notebooks/transformers_doc --clean --version pr_$PR_NUMBER | ||
|
||
- name: Push to repositories | ||
run: | | ||
cd doc-build-dev | ||
ls | ||
git add . | ||
git commit -m "Updated with commit ${{ github.sha }} See: https://github.com/huggingface/transformers/commit/${{ github.sha }}" | ||
git push origin main |
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,57 @@ | ||
name: Delete dev documentation | ||
|
||
on: | ||
pull_request: | ||
types: [ closed ] | ||
|
||
|
||
jobs: | ||
build_and_package: | ||
runs-on: [self-hosted, doc-builder] | ||
container: | ||
image: huggingface/doc-builder-transformers | ||
options: "-v /home/github_actions:/mnt" | ||
env: | ||
PR_NUMBER: ${{ github.event.number }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set env | ||
run: echo "WRITE=$(cat /mnt/WRITE)" >> $GITHUB_ENV | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
repository: 'huggingface/doc-build-dev' | ||
path: doc-build-dev | ||
token: ${{ env.WRITE }} | ||
|
||
- 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 | ||
ls | ||
rm -rf transformers/pr_$PR_NUMBER | ||
ls | ||
git add . | ||
git commit -m "Closed PR ${GITHUB_REF##*/}" | ||
git push origin main | ||
|
||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v1 | ||
if: github.event.pull_request.merged == false | ||
|
||
with: | ||
message: 'Thank you for your PR. The documentation will now be removed from the staging environment - feel free to reopen this PR to recreate it.' | ||
GITHUB_TOKEN: ${{ env.WRITE }} | ||
|
||
- name: Comment PR | ||
uses: thollander/actions-comment-pull-request@v1 | ||
if: github.event.pull_request.merged == true | ||
|
||
with: | ||
message: 'Great job merging this PR! the documentation will now be removed from the staging environment.' | ||
GITHUB_TOKEN: ${{ env.WRITE }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still missing the PR number here :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, great catch, thanks!