Simplify build process #7
Workflow file for this run
This file contains hidden or 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
| name: Build documentation | |
| on: | |
| repository_dispatch: | |
| schedule: | |
| - cron: '29 11 * * *' | |
| pull_request: | |
| push: | |
| branches: [main] | |
| workflow_call: | |
| jobs: | |
| cancel-superseded: | |
| name: Cancel superseded | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/cancel-workflow-action@0.12.1 | |
| with: | |
| access_token: ${{ github.token }} | |
| build-docs: | |
| name: Build ${{ matrix.package }} docs | |
| needs: cancel-superseded | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - package: msprime | |
| cache-version: v11 | |
| additional-setup: sudo apt-get install -y libgsl0-dev | |
| make-command: make | |
| - package: tsinfer | |
| cache-version: v13 | |
| additional-setup: sudo apt-get install -y tabix | |
| make-command: make | |
| - package: tskit | |
| cache-version: v16 | |
| additional-setup: sudo apt-get install -y libgsl0-dev doxygen | |
| requirements-path: python/requirements/CI-docs/requirements.txt | |
| make-command: make -C python | |
| - package: tstrait | |
| cache-version: v4 | |
| - package: tscompare | |
| cache-version: v1 | |
| requirements-path: requirements/CI-docs-pip/requirements.txt | |
| - package: tsbrowse | |
| cache-version: v2 | |
| requirements-path: requirements.txt | |
| additional-setup: source venv-latest/bin/activate && playwright install | |
| - package: pyslim | |
| cache-version: v6 | |
| - package: tsdate | |
| cache-version: v8 | |
| requirements-path: docs/requirements.txt | |
| - package: tszip | |
| cache-version: v2 | |
| steps: | |
| - uses: actions/checkout@v4.2.2 | |
| name: Checkout ${{ matrix.package }} | |
| with: | |
| ref: main | |
| repository: tskit-dev/${{ matrix.package }} | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Get commit SHA1 for cache | |
| run: git rev-parse HEAD > SHA1 | |
| - uses: actions/cache@v4.2.2 | |
| id: docs-cache | |
| name: Docs cache | |
| with: | |
| path: dist | |
| key: ${{ matrix.package }}-docs-${{ matrix.cache-version }}-${{ hashFiles('SHA1') }} | |
| - uses: actions/setup-python@v5.4.0 | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| name: Setup Python | |
| with: | |
| python-version: '3.11' | |
| - name: Build virtualenv | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: python -m venv venv-latest | |
| - name: Install deps | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| source venv-latest/bin/activate | |
| pip install -r ${{ matrix.requirements-path || 'requirements/CI-docs/requirements.txt' }} | |
| - name: Additional setup | |
| if: steps.docs-cache.outputs.cache-hit != 'true' && matrix.additional-setup | |
| run: ${{ matrix.additional-setup }} | |
| - name: Build C module | |
| if: steps.docs-cache.outputs.cache-hit != 'true' && matrix.make-command | |
| run: | | |
| source venv-latest/bin/activate | |
| ${{ matrix.make-command }} | |
| - name: Build Latest Docs | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| source venv-latest/bin/activate | |
| cd docs | |
| make dist | |
| git checkout . | |
| - name: Copy docs | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p dist | |
| cp -r docs/_build/html dist/latest | |
| - name: Checkout latest stable tag | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| git fetch --tags --recurse-submodules=no | |
| git checkout `git tag --list --sort=creatordate | grep -vi "[baC]" | tail -n1` | |
| git submodule update --init --recursive | |
| - name: Build virtualenv | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: python -m venv venv-stable | |
| - name: Install deps | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| source venv-stable/bin/activate | |
| [ -f ${{ matrix.requirements-path || 'requirements/CI-docs/requirements.txt' }} ] && pip install -r ${{ matrix.requirements-path || 'requirements/CI-docs/requirements.txt' }} | |
| - name: Build C module | |
| if: steps.docs-cache.outputs.cache-hit != 'true' && matrix.make-command | |
| run: | | |
| source venv-stable/bin/activate | |
| ${{ matrix.make-command }} | |
| - name: Build Stable Docs | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| source venv-stable/bin/activate | |
| cd docs | |
| make dist | |
| git checkout . | |
| - name: Copy docs | |
| if: steps.docs-cache.outputs.cache-hit != 'true' | |
| run: | | |
| cp -r docs/_build/html dist/stable | |
| - name: Upload docs | |
| uses: actions/upload-artifact@v4.6.1 | |
| with: | |
| name: ${{ matrix.package }}-docs | |
| path: dist | |