Skip to content

Commit b3aced6

Browse files
authored
Merge pull request #2312 from IntelPython/update-allowed-docs-versions-and-add-backfill
Update allowed docs versions and add backfill workflow
2 parents ad1b1f3 + 4b87bc6 commit b3aced6

2 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
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+
actions: write
23+
steps:
24+
- name: Cancel Previous Runs
25+
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
26+
with:
27+
access_token: ${{ github.token }}
28+
- name: Add Intel repository
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+
run: |
37+
sudo apt install intel-oneapi-compiler-dpcpp-cpp
38+
sudo apt install intel-oneapi-tbb
39+
sudo apt install intel-oneapi-umf
40+
sudo apt install hwloc
41+
- name: Install Lua
42+
run: |
43+
sudo apt-get install liblua5.2-dev
44+
- name: Install Doxygen
45+
run: |
46+
sudo apt-get install doxygen
47+
- name: Install Ninja
48+
run: |
49+
sudo apt-get install ninja-build
50+
- name: Setup Python
51+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
52+
with:
53+
python-version: '3.14'
54+
architecture: x64
55+
- name: Install sphinx dependencies
56+
shell: bash -l {0}
57+
run: |
58+
pip install numpy cython setuptools">=70.1" scikit-build cmake sphinx"<7.2" pydot graphviz furo \
59+
sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx-design \
60+
sphinxcontrib-jsmath sphinx-copybutton sphinxcontrib-spelling \
61+
versioneer[toml]==0.29
62+
- name: Checkout repo at tag
63+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
64+
with:
65+
ref: ${{ github.event.inputs.tag }}
66+
fetch-depth: 0
67+
persist-credentials: false
68+
- name: Inject new docs configuration
69+
shell: bash -l {0}
70+
run: |
71+
NEEDS_CONFIG=$(python -c "${{ env.CHECK_CONFIG_SCRIPT }}" "${{ github.event.inputs.tag }}")
72+
73+
if [[ "${NEEDS_CONFIG}" == "true" ]]; then
74+
git fetch origin master
75+
git checkout origin/master -- docs/doc_sources/conf.py.in docs/doc_sources/_temples/versions.html docs/doc_versions.txt
76+
else
77+
echo "Version does not require docs config injection."
78+
fi
79+
- name: Build dpctl+docs
80+
shell: bash -l {0}
81+
run: |
82+
# Ensure that SYCL libraries are on LD_LIBRARY_PATH
83+
source /opt/intel/oneapi/setvars.sh
84+
wget https://github.com/vovkos/doxyrest/releases/download/doxyrest-2.1.2/doxyrest-2.1.2-linux-amd64.tar.xz
85+
tar xf doxyrest-2.1.2-linux-amd64.tar.xz
86+
python setup.py build_ext --inplace --generator=Ninja --build-type=Release \
87+
-- \
88+
-DCMAKE_C_COMPILER:PATH="$(which icx)" \
89+
-DCMAKE_CXX_COMPILER:PATH="$(which icpx)" \
90+
-DDPCTL_GENERATE_DOCS=ON \
91+
-DDPCTL_ENABLE_DOXYREST=ON \
92+
-DDPCTL_USE_MULTIVERSION_TEMPLATE=ON \
93+
-DDoxyrest_DIR="$(pwd)/doxyrest-2.1.2-linux-amd64" \
94+
-DCMAKE_VERBOSE_MAKEFILE=ON
95+
python -m pip install -e . --no-build-isolation --no-deps
96+
python -c "import dpctl; print(dpctl.__version__)" || exit 1
97+
pushd "$(find _skbuild -name cmake-build)" || exit 1
98+
cmake --build . --target Sphinx || exit 1
99+
mv ../cmake-install/docs/docs ~/docs
100+
git clean -dfx
101+
popd
102+
git reset --hard
103+
- name: Publish docs
104+
env:
105+
TAG: ${{ github.event.inputs.tag }}
106+
shell: bash -l {0}
107+
run: |
108+
git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
109+
git fetch tokened_docs
110+
git checkout --track tokened_docs/gh-pages
111+
[ -d "${TAG}" ] || mkdir "${TAG}"
112+
rm -rf "${TAG:?}/*"
113+
mv ~/docs/* "${TAG}/" || exit 1
114+
git add "${TAG}"
115+
git config user.name 'github-actions[doc-deploy-bot]'
116+
git config user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
117+
git commit -m "Docs backfilled for ${TAG}."
118+
git push tokened_docs gh-pages

docs/doc_versions.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
latest
2+
0.22.1
3+
0.22.0
24
0.21.1
35
0.21.0
6+
0.20.2
7+
0.20.1
8+
0.20.0
9+
0.19.0
10+
0.18.2
11+
0.18.1
12+
0.18.0
13+
0.17.0

0 commit comments

Comments
 (0)