Skip to content

Commit d1587ea

Browse files
committed
add workflow to backfill docs
1 parent 16a805c commit d1587ea

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Backfill documentation
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: 'Tag to backfill from'
7+
required: true
8+
type: string
9+
10+
permissions: read-all
11+
12+
env:
13+
CHECK_CONFIG_SCRIPT: "import sys; from packaging.version import parse; print('true' if parse('0.17.0') <= parse(sys.argv[1]) < parse('0.22.0') else 'false')"
14+
15+
jobs:
16+
build-and-backfill:
17+
name: Build and Backfill Documentation
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 240
20+
permissions:
21+
contents: write
22+
steps:
23+
- name: Cancel Previous Runs
24+
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
25+
with:
26+
access_token: ${{ github.token }}
27+
- name: Add Intel repository
28+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
29+
run: |
30+
wget -qO- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
31+
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
32+
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
33+
| sudo tee /etc/apt/sources.list.d/oneAPI.list
34+
sudo apt update
35+
- name: Install Intel OneAPI
36+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
37+
run: |
38+
sudo apt install intel-oneapi-compiler-dpcpp-cpp
39+
sudo apt install intel-oneapi-tbb
40+
sudo apt install intel-oneapi-umf
41+
sudo apt install hwloc
42+
- name: Install Lua
43+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
44+
run: |
45+
sudo apt-get install liblua5.2-dev
46+
- name: Install Doxygen
47+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
48+
run: |
49+
sudo apt-get install doxygen
50+
- name: Install Ninja
51+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
52+
run: |
53+
sudo apt-get install ninja-build
54+
- name: Setup Python
55+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
56+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
57+
with:
58+
python-version: '3.14'
59+
architecture: x64
60+
- name: Install sphinx dependencies
61+
if: ${{ !github.event.pull_request || github.event.action != 'closed' }}
62+
shell: bash -l {0}
63+
run: |
64+
pip install numpy cython setuptools">=70.1" scikit-build cmake sphinx"<7.2" pydot graphviz furo \
65+
sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx-design \
66+
sphinxcontrib-jsmath sphinx-copybutton sphinxcontrib-spelling \
67+
versioneer[toml]==0.29
68+
- name: Checkout repo at tag
69+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
70+
with:
71+
ref: ${{ github.event.inputs.tag }}
72+
fetch-depth: 0
73+
persist-credentials: false
74+
- name: Inject new docs configuration
75+
shell: bash -l {0}
76+
run: |
77+
NEEDS_CONFIG=$(python -c "${{ env.CHECK_CONFIG_SCRIPT }}" "${{ github.event.inputs.tag }}")
78+
79+
if [[ "${NEEDS_CONFIG}" == "true" ]]; then
80+
git fetch origin master
81+
git checkout origin/master -- docs/doc_sources/conf.py.in docs/doc_sources/_temples/versions.html docs/doc_versions.txt
82+
else
83+
echo "Version does not require docs config injection."
84+
fi
85+
- name: Build dpctl+docs
86+
shell: bash -l {0}
87+
run: |
88+
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
89+
source /opt/intel/oneapi/setvars.sh
90+
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.2/doxyrest-2.1.2-linux-amd64.tar.xz
91+
tar xf doxyrest-2.1.2-linux-amd64.tar.xz
92+
python setup.py build_ext --inplace --generator=Ninja --build-type=Release \
93+
-- \
94+
-DCMAKE_C_COMPILER:PATH="$(which icx)" \
95+
-DCMAKE_CXX_COMPILER:PATH="$(which icpx)" \
96+
-DDPCTL_GENERATE_DOCS=ON \
97+
-DDPCTL_ENABLE_DOXYREST=ON \
98+
-DDPCTL_USE_MULTIVERSION_TEMPLATE=ON \
99+
-DDoxyrest_DIR="$(pwd)/doxyrest-2.1.2-linux-amd64" \
100+
-DCMAKE_VERBOSE_MAKEFILE=ON
101+
python -m pip install -e . --no-build-isolation
102+
python -c "import dpctl; print(dpctl.__version__)" || exit 1
103+
pushd "$(find _skbuild -name cmake-build)" || exit 1
104+
cmake --build . --target Sphinx || exit 1
105+
mv ../cmake-install/docs/docs ~/docs
106+
git clean -dfx
107+
popd
108+
git reset --hard
109+
- name: Publish docs
110+
env:
111+
TAG: ${{ github.event.inputs.tag }}
112+
shell: bash -l {0}
113+
run: |
114+
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
115+
git fetch tokened_docs
116+
git checkout --track tokened_docs/gh-pages
117+
[ -d "${TAG}" ] || mkdir "${TAG}"
118+
rm -rf "${TAG:?}/*"
119+
mv ~/docs/* "${TAG}/" || exit 1
120+
git add "${TAG}"
121+
git config user.name 'github-actions[doc-deploy-bot]'
122+
git config user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
123+
git commit -m "Docs backfilled for ${TAG}."
124+
git push tokened_docs gh-pages

0 commit comments

Comments
 (0)