Repository navigation
Document MKLRandomState in the API reference and align docstrings with NumPy
#635
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 mkl_random documentation | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| env: | |
| PACKAGE_NAME: mkl_random | |
| jobs: | |
| build-and-deploy: | |
| name: Build and Deploy Documentation | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Cancel Previous Runs | |
| uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1 | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Add Intel repository | |
| if: ${{ !github.event.pull_request || github.event.action != 'closed' }} | |
| run: | | |
| wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB | |
| sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main" | |
| sudo apt-get update | |
| - name: Install Intel OneAPI | |
| if: ${{ !github.event.pull_request || github.event.action != 'closed' }} | |
| run: | | |
| sudo apt-get install intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mkl-devel | |
| - name: Setup Python | |
| if: ${{ !github.event.pull_request || github.event.action != 'closed' }} | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.14" | |
| architecture: x64 | |
| - name: Install sphinx dependencies | |
| if: ${{ !github.event.pull_request || github.event.action != 'closed' }} | |
| shell: bash -l {0} | |
| run: | | |
| pip install meson-python ninja cython cmake numpy sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design numpydoc | |
| - name: Checkout repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Build mkl_random+docs | |
| if: ${{ !github.event.pull_request || github.event.action != 'closed' }} | |
| shell: bash -l {0} | |
| run: | | |
| # Ensure that SYCL libraries are on LD_LIBRARY_PATH | |
| source /opt/intel/oneapi/setvars.sh | |
| pip install --no-deps --no-build-isolation -e . --verbose | |
| python -c "import mkl_random; print(mkl_random.__version__)" || exit 1 | |
| sphinx-build -M html docs/source docs/build | |
| mkdir -p ~/rendered_docs | |
| cp -r docs/build/html/* ~/rendered_docs/ | |
| git clean -dfx | |
| - name: Save built docs as an artifact | |
| if: ${{ github.event.pull_request && github.event.action != 'closed'}} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ${{ env.PACKAGE_NAME }} rendered documentation | |
| path: ~/rendered_docs | |
| # TEMPORARY: publish this PR's docs to gh-pages and comment the link. | |
| # Remove after review. | |
| - name: Publish pull-request docs | |
| if: ${{ github.event.pull_request && github.event.action != 'closed' }} | |
| env: | |
| PR_NUM: ${{ github.event.number }} | |
| shell: bash -l {0} | |
| run: | | |
| git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/mkl_random.git | |
| git fetch tokened_docs | |
| git checkout --track tokened_docs/gh-pages | |
| [ -d "pull/${PR_NUM}" ] && git rm -rf "pull/${PR_NUM}" | |
| mkdir -p "pull/${PR_NUM}" | |
| cd "pull/${PR_NUM}" | |
| mv ~/rendered_docs/* . | |
| git add . | |
| git config --global user.name 'github-actions[doc-deploy-bot]' | |
| git config --global user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com' | |
| git commit -m "Docs for pull request ${PR_NUM}" | |
| git push tokened_docs gh-pages | |
| - name: Comment with URL to published pull-request docs | |
| if: ${{ github.event.pull_request && github.event.action != 'closed' }} | |
| env: | |
| PR_NUM: ${{ github.event.number }} | |
| uses: mshick/add-pr-comment@ec328af66588ab8f77cdeb2c264f14aba45bbf59 # v2 | |
| with: | |
| message-id: url_to_docs | |
| allow-repeats: false | |
| message: | | |
| View rendered docs @ https://intelpython.github.io/mkl_random/pull/${{ env.PR_NUM }}/index.html | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure git | |
| if: ${{ !github.event.pull_request && github.event.action != 'closed'}} | |
| run: | | |
| git config --local user.email "scripting@intel.com" | |
| git config --local user.name "mkl_random-doc-bot" | |
| timeout-minutes: 5 | |
| - name: Checkout gh-pages | |
| if: ${{ !github.event.pull_request && github.event.action != 'closed'}} | |
| run: | | |
| git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/mkl_random.git | |
| git fetch --all | |
| git checkout --track tokened_docs/gh-pages | |
| - name: 'Copy build to root' | |
| if: ${{ !github.event.pull_request && github.event.action != 'closed'}} | |
| run: | | |
| cp -R ~/rendered_docs/* . | |
| timeout-minutes: 10 | |
| - name: 'Commit changes' | |
| if: ${{ !github.event.pull_request && github.event.action != 'closed'}} | |
| run: | | |
| git add . && git commit -m "Deploy: ${{ github.sha }}" | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| - name: Publish changes | |
| if: ${{ success() && !github.event.pull_request && github.event.action != 'closed'}} | |
| run: | | |
| git push tokened_docs gh-pages | |
| timeout-minutes: 10 |