Unverified Commit 1b75d723 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Automatically build doc notebooks (#14718)

* Test workflow

* Build doc

* Make a clean build

* Add doc config

* Restore other workflows

* Final job

* Print something in else statements

* Pull before making changes
parent ae82ee6a
...@@ -17,11 +17,19 @@ jobs: ...@@ -17,11 +17,19 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
repository: 'huggingface/doc-builder' repository: 'huggingface/doc-builder'
path: doc-builder
token: ${{ secrets.HUGGINGFACE_PUSH }}
- uses: actions/checkout@v2
with:
repository: 'huggingface/transformers'
path: transformers
- uses: actions/checkout@v2
with:
repository: 'huggingface/notebooks'
path: notebooks
token: ${{ secrets.HUGGINGFACE_PUSH }} token: ${{ secrets.HUGGINGFACE_PUSH }}
- name: Clone transformers
run: |
git clone https://github.com/huggingface/transformers
- name: Loading cache. - name: Loading cache.
uses: actions/cache@v2 uses: actions/cache@v2
...@@ -37,7 +45,7 @@ jobs: ...@@ -37,7 +45,7 @@ jobs:
run: | run: |
sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev sudo apt-get -y update && sudo apt-get install -y libsndfile1-dev
pip install git+https://github.com/huggingface/doc-builder pip install git+https://github.com/huggingface/doc-builder@add-install-cell
pip install git+https://github.com/huggingface/transformers#egg=transformers[dev] pip install git+https://github.com/huggingface/transformers#egg=transformers[dev]
export TORCH_VERSION=$(python -c "from torch import version; print(version.__version__.split('+')[0])") export TORCH_VERSION=$(python -c "from torch import version; print(version.__version__.split('+')[0])")
...@@ -55,15 +63,37 @@ jobs: ...@@ -55,15 +63,37 @@ jobs:
run: | run: |
git config --global user.name "Hugging Face" git config --global user.name "Hugging Face"
git config --global user.email transformers@huggingface.co git config --global user.email transformers@huggingface.co
cd doc-builder
git pull origin main git pull origin main
cd ..
cd notebooks
git pull origin master
cd ..
- name: Make documentation - name: Make documentation
run: | run: |
doc-builder build transformers ./transformers/docs/source doc-builder build transformers transformers/docs/source --build_dir doc-builder/build --notebook_dir notebooks/transformers_doc --clean
- name: Push to repository - name: Push to repositories
run: | run: |
git add build cd doc-builder
git commit -m "Updated with commit ${{ github.sha }}" if [[ `git status --porcelain` ]]; then
git push origin main git add build
git commit -m "Updated with commit ${{ github.sha }}"
git push origin main
else
echo "No diff in the documentation."
fi
cd ..
cd notebooks
if [[ `git status --porcelain` ]]; then
git add build
git commit -m "Updated Transformer doc notebooks with commit ${{ github.sha }}"
git push origin master
else
echo "No diff in the notebooks."
fi
cd ..
INSTALL_CONTENT = """
# Transformers installation ! pip install transformers datasets # To install from source instead of the last release,
comment the command above and uncomment the following one. # ! pip install
git+https://github.com/huggingface/transformers.git
"""
notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment