Merge pull request #160 from BlackHolePerturbationToolkit/generic-int… #23
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: Publish documentation to GitHub Pages | |
| on: | |
| push: | |
| jobs: | |
| select: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build: ${{ steps.select.outputs.build }} | |
| publish: ${{ steps.select.outputs.publish }} | |
| notebooks: ${{ steps.select.outputs.notebooks }} | |
| steps: | |
| - name: initialize | |
| run: | | |
| echo "FEWPAGE_BUILD=false" >> "$GITHUB_ENV" | |
| echo "FEWPAGE_PUBLISH=false" >> "$GITHUB_ENV" | |
| echo "FEWPAGE_NOTEBOOK=false" >> "$GITHUB_ENV" | |
| - name: build on commit message | |
| if: contains(github.event.head_commit.message, '[ci:build-pages]') | |
| run: | | |
| echo "FEWPAGE_BUILD=true" >> "$GITHUB_ENV" | |
| - name: build on commit message | |
| if: contains(github.event.head_commit.message, '[ci:publish-pages]') | |
| run: | | |
| echo "FEWPAGE_BUILD=true" >> "$GITHUB_ENV" | |
| echo "FEWPAGE_PUBLISH=true" >> "$GITHUB_ENV" | |
| - name: execute notebooks on request | |
| if: contains(github.event.head_commit.message, '[doc:run-notebooks]') | |
| run: | | |
| echo "FEWPAGE_NOTEBOOK=true" >> "$GITHUB_ENV" | |
| - name: build and publish on tag 'v*' | |
| if: startsWith(github.event.ref, 'refs/tags/v') | |
| run: | | |
| echo "FEWPAGE_BUILD=true" >> "$GITHUB_ENV" | |
| echo "FEWPAGE_PUBLISH=true" >> "$GITHUB_ENV" | |
| echo "FEWPAGE_NOTEBOOK=true" >> "$GITHUB_ENV" | |
| - name: output results | |
| id: select | |
| run: | | |
| echo "build=$FEWPAGE_BUILD" >> $GITHUB_OUTPUT | |
| echo "publish=$FEWPAGE_PUBLISH" >> $GITHUB_OUTPUT | |
| echo "notebooks=$FEWPAGE_NOTEBOOK" >> $GITHUB_OUTPUT | |
| build_doc: | |
| name: Build documentation | |
| runs-on: "ubuntu-24.04" | |
| needs: | |
| - select | |
| if: needs.select.outputs.build == 'true' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install pandoc | |
| uses: ConorMacBride/install-package@v1 | |
| with: | |
| apt: liblapacke-dev pandoc | |
| # - name: Update version scheme | |
| # run: | | |
| # sed -i 's|version_scheme = "no-guess-dev"|version_scheme = "only-version"|g' pyproject.toml | |
| # sed -i 's|local_scheme = "node-and-date"|local_scheme = "no-local-version"|g' pyproject.toml | |
| - name: Install bare package | |
| run: | | |
| python -m pip install '.[doc, testing]' \ | |
| --config-settings=cmake.define.FEW_WITH_GPU=OFF \ | |
| --config-settings=cmake.define.FEW_LAPACKE_FETCH=OFF \ | |
| --config-settings=cmake.define.FEW_LAPACKE_DETECT_WITH=PKGCONFIG | |
| - name: Restore the cache | |
| uses: actions/cache/restore@v4 | |
| id: restore_cache | |
| with: | |
| path: local_cache | |
| key: ${{ hashFiles('src/few/files/registry.yml') }} | |
| - name: Export configuration options to force using prefetched cache of files | |
| if: steps.restore_cache.outputs.cache-hit == 'true' | |
| run: | | |
| echo "FEW_FILE_ALLOW_DOWNLOAD=no" >> "$GITHUB_ENV" | |
| echo "FEW_FILE_EXTRA_PATHS=$(pwd)/local_cache" >> "$GITHUB_ENV" | |
| - name: Check external links are working | |
| run: | | |
| sphinx-build -M linkcheck docs/source docs/build_checklinks \ | |
| --define nbsphinx_execute=never | |
| - name: Run notebook examples | |
| if: needs.select.outputs.notebooks == 'true' | |
| run: | | |
| jupyter nbconvert --execute --clear-output examples/Trajectory_tutorial.ipynb | |
| jupyter nbconvert --execute --clear-output examples/Amplitude_tutorial.ipynb | |
| jupyter nbconvert --execute --clear-output examples/modeselect.ipynb | |
| jupyter nbconvert --execute --clear-output examples/modesummation.ipynb | |
| jupyter nbconvert --execute --clear-output examples/cubicspline.ipynb | |
| jupyter nbconvert --execute --clear-output examples/swsh.ipynb | |
| jupyter nbconvert --execute --clear-output examples/utility.ipynb | |
| jupyter nbconvert --execute --clear-output examples/waveform.ipynb | |
| - name: Build documentation | |
| run: | | |
| sphinx-build -M html docs/source docs/build \ | |
| --define nbsphinx_execute=never | |
| - name: Upload static files as artifact | |
| id: deployment | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/build/html | |
| deploy: | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build_doc | |
| - select | |
| if: needs.select.outputs.publish == 'true' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |