Skip to content

Commit b47d1c2

Browse files
Add doc-building workflow
1 parent 06d3b6d commit b47d1c2

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

.github/workflows/build-docs.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build mkl_random documentation
2+
on:
3+
pull_request:
4+
push:
5+
branches: [master]
6+
7+
permissions: read-all
8+
9+
jobs:
10+
build-and-deploy:
11+
name: Build and Deploy Documentation
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- name: Cancel Previous Runs
18+
uses: styfle/cancel-workflow-action@0.12.1
19+
with:
20+
access_token: ${{ github.token }}
21+
- name: Add Intel repository
22+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
23+
run: |
24+
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
25+
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
26+
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB
27+
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
28+
sudo apt-get update
29+
- name: Install Intel OneAPI
30+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
31+
run: |
32+
sudo apt-get install intel-oneapi-compiler-dpcpp-cpp intel-oneapi-mkl-devel
33+
- name: Setup Python
34+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.11'
38+
architecture: x64
39+
- name: Install sphinx dependencies
40+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
41+
shell: bash -l {0}
42+
run: |
43+
pip install numpy cython setuptools scikit-build cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design
44+
- name: Checkout repo
45+
uses: actions/checkout@v4.1.1
46+
with:
47+
fetch-depth: 0
48+
persist-credentials: false
49+
- name: Build mkl_random+docs
50+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
51+
shell: bash -l {0}
52+
run: |
53+
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
54+
source /opt/intel/oneapi/setvars.sh
55+
python setup.py develop
56+
python -c "import mkl_random; print(mkl_random.__version__)" || exit 1
57+
sphinx-build -m html docs/source docs/build
58+
mv docs/build/html ~/rendered_docs
59+
git clean -dfx
60+
- name: Save built docs as an artifact
61+
if: ${{ github.event.pull_request && github.event.action != 'closed'}}
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: ${{ env.PACKAGE_NAME }} rendered documentation
65+
path: ~/rendered_docs

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*~
2+
build/

0 commit comments

Comments
 (0)