-
Notifications
You must be signed in to change notification settings - Fork 11
94 lines (92 loc) · 3.8 KB
/
build-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Build mkl_random documentation
on:
pull_request:
push:
branches: [master]
permissions: read-all
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@0.12.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@v5
with:
python-version: '3.11'
architecture: x64
- name: Install sphinx dependencies
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
shell: bash -l {0}
run: |
pip install numpy cython setuptools scikit-build cmake sphinx sphinx_rtd_theme furo pydot graphviz sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx_design
- name: Checkout repo
uses: actions/checkout@v4.1.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
python setup.py develop
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@v4
with:
name: ${{ env.PACKAGE_NAME }} rendered documentation
path: ~/rendered_docs
- 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