|
1 |
| -name: gh-pages deploy |
| 1 | +name: Build Lightning Docs & Deploy to gh-pages |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - master
|
7 | 7 |
|
| 8 | +defaults: |
| 9 | + run: |
| 10 | + shell: bash |
| 11 | + |
| 12 | +env: |
| 13 | + FREEZE_REQUIREMENTS: "1" |
| 14 | + TORCH_URL: "https://download.pytorch.org/whl/cpu/torch_stable.html" |
| 15 | + PYPI_CACHE_DIR: "_pip-wheels" |
| 16 | + |
8 | 17 | jobs:
|
9 |
| - build: |
| 18 | + make-html: |
10 | 19 | runs-on: ubuntu-latest
|
| 20 | + container: |
| 21 | + image: pytorchlightning/pytorch_lightning:docs |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + pkg-name: ["app", "fabric", "pytorch"] |
11 | 26 | steps:
|
12 | 27 | - uses: actions/checkout@v3
|
| 28 | + with: |
| 29 | + submodules: true |
13 | 30 |
|
14 |
| - - name: Set up Python 3.8 |
15 |
| - uses: actions/setup-python@v3 |
| 31 | + - name: pip wheels cache |
| 32 | + uses: actions/cache/restore@v3 |
16 | 33 | with:
|
17 |
| - python-version: '3.8' |
| 34 | + path: ${{ env.PYPI_CACHE_DIR }} |
| 35 | + key: pypi_wheels |
18 | 36 |
|
19 |
| - - name: Upgrade pip |
20 |
| - run: python3 -m pip install --upgrade pip |
| 37 | + - name: Install package & dependencies |
| 38 | + run: | |
| 39 | + mkdir -p $PYPI_CACHE_DIR # in case cache was not hit |
| 40 | + ls -lh $PYPI_CACHE_DIR |
| 41 | + mkdir -p pypi_pkgs # in case template is not pulled |
| 42 | + pip --version |
| 43 | + pip install -U -r requirements.txt \ |
| 44 | + -f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL} |
| 45 | + pip install -U -r requirements/${{ matrix.pkg-name }}/docs.txt \ |
| 46 | + -f pypi_pkgs/ -f $PYPI_CACHE_DIR -f ${TORCH_URL} |
| 47 | + pip list |
| 48 | + shell: bash |
21 | 49 |
|
22 |
| - - name: Get pip cache dir |
23 |
| - id: pip-cache |
24 |
| - run: echo "::set-output name=dir::$(pip cache dir)" |
| 50 | + - name: Make Documentation |
| 51 | + working-directory: ./docs/source-${{ matrix.pkg-name }} |
| 52 | + run: make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going" |
25 | 53 |
|
26 |
| - - name: Cache dependencies |
27 |
| - uses: actions/cache@v2 |
28 |
| - with: |
29 |
| - path: ${{ steps.pip-cache.outputs.dir }} |
30 |
| - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
31 |
| - restore-keys: | |
32 |
| - ${{ runner.os }}-pip- |
| 54 | + - name: Keep artifact |
| 55 | + id: keep-artifact |
| 56 | + run: python -c "print('DAYS=' + str(7 if '${{ github.event_name }}'.startswith('pull_request') else 0))" >> $GITHUB_OUTPUT |
33 | 57 |
|
34 |
| - - name: Install dependencies |
35 |
| - run: pip install -r requirements.txt |
| 58 | + - name: Upload built docs |
| 59 | + uses: actions/upload-artifact@v3 |
| 60 | + with: |
| 61 | + name: docs-${{ matrix.pkg-name }}-${{ github.sha }} |
| 62 | + path: docs/build/html/ |
| 63 | + retention-days: ${{ steps.keep-artifact.outputs.DAYS }} |
36 | 64 |
|
37 |
| - - name: Build Sphinx documents |
38 |
| - run: make docs |
| 65 | + - name: Dump handy wheels |
| 66 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 67 | + continue-on-error: true |
| 68 | + uses: ./.github/actions/pip-wheels |
| 69 | + with: |
| 70 | + wheel-dir: ${{ env.PYPI_CACHE_DIR }} |
| 71 | + torch-url: ${{ env.TORCH_URL }} |
| 72 | + cache-key: "pypi_wheels" |
39 | 73 |
|
| 74 | + deploy-docs: |
| 75 | + needs: [make-html] |
| 76 | + runs-on: ubuntu-latest |
| 77 | + strategy: |
| 78 | + fail-fast: false |
| 79 | + matrix: |
| 80 | + pkg-name: ["app", "fabric", "pytorch"] |
| 81 | + steps: |
| 82 | + - uses: actions/download-artifact@v3 |
| 83 | + with: |
| 84 | + name: docs-${{ matrix.pkg-name }}-${{ github.sha }} |
| 85 | + path: docs/build/html/ |
40 | 86 | - name: Deploy to gh-pages branch
|
41 | 87 | uses: peaceiris/actions-gh-pages@v3
|
42 | 88 | with:
|
43 | 89 | github_token: ${{ secrets.DEPLOY_TOKEN }}
|
44 |
| - publish_dir: ./build/html |
| 90 | + publish_dir: ./docs/build/html |
45 | 91 | cname: docs.pytorchlightning.kr
|
46 | 92 | enable_jekyll: false
|
47 | 93 | force_orphan: true
|
|
0 commit comments