66 description : ' Tag to backfill from'
77 required : true
88 type : string
9+ python-version :
10+ description : ' Python version to build with (default: the one recorded in the tag)'
11+ required : false
12+ type : string
13+ compiler-version :
14+ description : ' DPC++ version to build with (default: the one required by the tag)'
15+ required : false
16+ type : string
917
1018permissions :
1119 contents : read
1220
1321env :
1422 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')"
23+ # dpctl gained NumPy 2 support in 0.18.0dev1; earlier tags fail to build against it.
24+ NUMPY_SPEC_SCRIPT : " import sys; from packaging.version import parse; print('numpy<2' if parse(sys.argv[1]) < parse('0.18.0dev1') else 'numpy')"
25+ # Used only for tags that predate the docs workflow and so record no version.
26+ DEFAULT_PYTHON_VERSION : ' 3.10'
1527
1628jobs :
1729 build-and-backfill :
3345 echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" \
3446 | sudo tee /etc/apt/sources.list.d/oneAPI.list
3547 sudo apt update
48+ - name : Checkout repo at tag
49+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
50+ with :
51+ ref : ${{ github.event.inputs.tag }}
52+ fetch-depth : 0
53+ persist-credentials : false
54+ - name : Resolve DPC++ version for the tag
55+ id : resolve-compiler
56+ env :
57+ TAG : ${{ github.event.inputs.tag }}
58+ COMPILER_VERSION_INPUT : ${{ github.event.inputs.compiler-version }}
59+ run : |
60+ COMPILER_PACKAGE=intel-oneapi-compiler-dpcpp-cpp
61+
62+ if [[ -n "${COMPILER_VERSION_INPUT}" ]]; then
63+ COMPILER_VERSION="${COMPILER_VERSION_INPUT}"
64+ echo "Using DPC++ ${COMPILER_VERSION} requested via workflow input."
65+ else
66+ # build against compiler version declared in the conda recipe
67+ COMPILER_VERSION=$(grep -oP 'required_compiler_version\s*=\s*"\K[^"]+' \
68+ conda-recipe/meta.yaml 2>/dev/null | head -n 1 || true)
69+ if [[ -z "${COMPILER_VERSION}" ]]; then
70+ echo "${TAG} declares no required_compiler_version. Using the latest DPC++."
71+ echo "package=${COMPILER_PACKAGE}" >> "$GITHUB_OUTPUT"
72+ exit 0
73+ fi
74+ echo "${TAG} requires DPC++ ${COMPILER_VERSION}."
75+ fi
76+
77+ VERSIONED_PACKAGE="${COMPILER_PACKAGE}-$(cut -d. -f1,2 <<< "${COMPILER_VERSION}")"
78+ if apt-cache show "${VERSIONED_PACKAGE}" > /dev/null 2>&1; then
79+ COMPILER_PACKAGE="${VERSIONED_PACKAGE}"
80+ echo "Installing ${COMPILER_PACKAGE}."
81+ else
82+ echo "::warning::${VERSIONED_PACKAGE} is not in the Intel apt repository. Using the latest DPC++ instead."
83+ fi
84+ echo "package=${COMPILER_PACKAGE}" >> "$GITHUB_OUTPUT"
3685 - name : Install Intel OneAPI
86+ env :
87+ COMPILER_PACKAGE : ${{ steps.resolve-compiler.outputs.package }}
3788 run : |
38- sudo apt install intel-oneapi-compiler-dpcpp-cpp
89+ sudo apt install "${COMPILER_PACKAGE}"
3990 sudo apt install intel-oneapi-tbb
4091 sudo apt install intel-oneapi-umf
4192 sudo apt install hwloc
@@ -48,36 +99,61 @@ jobs:
4899 - name : Install Ninja
49100 run : |
50101 sudo apt-get install ninja-build
102+ - name : Resolve Python version for the tag
103+ id : resolve-python
104+ env :
105+ TAG : ${{ github.event.inputs.tag }}
106+ PYTHON_VERSION_INPUT : ${{ github.event.inputs.python-version }}
107+ run : |
108+ if [[ -n "${PYTHON_VERSION_INPUT}" ]]; then
109+ PYTHON_VERSION="${PYTHON_VERSION_INPUT}"
110+ echo "Using Python ${PYTHON_VERSION} requested via workflow input."
111+ else
112+ # reuse pin from generate-docs.yml at the tag
113+ PYTHON_VERSION=$(grep -oP "python-version:\s*'?\K[0-9]+\.[0-9]+" \
114+ .github/workflows/generate-docs.yml 2>/dev/null | head -n 1 || true)
115+ if [[ -z "${PYTHON_VERSION}" ]]; then
116+ PYTHON_VERSION="${DEFAULT_PYTHON_VERSION}"
117+ echo "${TAG} records no docs Python version; falling back to ${PYTHON_VERSION}."
118+ else
119+ echo "Using Python ${PYTHON_VERSION} as recorded at ${TAG}."
120+ fi
121+ fi
122+ echo "python-version=${PYTHON_VERSION}" >> "$GITHUB_OUTPUT"
51123 - name : Setup Python
52124 uses : actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
53125 with :
54- python-version : ' 3.14 '
126+ python-version : ${{ steps.resolve-python.outputs.python-version }}
55127 architecture : x64
56128 - name : Install sphinx dependencies
57129 shell : bash -l {0}
130+ env :
131+ TAG : ${{ github.event.inputs.tag }}
58132 run : |
59- pip install numpy cython setuptools">=70.1" scikit-build cmake sphinx"<7.2" pydot graphviz furo \
133+ pip install packaging
134+ NUMPY_SPEC=$(python -c "$NUMPY_SPEC_SCRIPT" "$TAG")
135+ echo "Building against ${NUMPY_SPEC}."
136+ pip install "${NUMPY_SPEC}" cython setuptools">=70.1" scikit-build cmake sphinx"<7.2" pydot graphviz furo \
60137 sphinxcontrib-programoutput sphinxcontrib-googleanalytics sphinx-design \
61138 sphinxcontrib-jsmath sphinx-copybutton sphinxcontrib-spelling \
62139 versioneer[toml]==0.29
63- - name : Checkout repo at tag
64- uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
65- with :
66- ref : ${{ github.event.inputs.tag }}
67- fetch-depth : 0
68- persist-credentials : false
69140 - name : Inject new docs configuration
70141 shell : bash -l {0}
71142 env :
72143 TAG : ${{ github.event.inputs.tag }}
73144 run : |
74- NEEDS_CONFIG=$(python -c "$CHECK_CONFIG_SCRIPT" "$TAG")
145+ git fetch origin master
75146
147+ # a tag cannot list the versions released after it, so the version list
148+ # behind the sidebar dropdown always has to come from master
149+ git checkout origin/master -- docs/doc_versions.txt
150+
151+ NEEDS_CONFIG=$(python -c "$CHECK_CONFIG_SCRIPT" "$TAG")
76152 if [[ "${NEEDS_CONFIG}" == "true" ]]; then
77- git fetch origin master
78- git checkout origin/master -- docs/doc_sources/conf.py.in docs/doc_sources/_temples /versions.html docs/doc_versions.txt
153+ git checkout origin/ master -- docs/doc_sources/conf.py.in \
154+ docs/doc_sources/_templates /versions.html
79155 else
80- echo "Version does not require docs config injection ."
156+ echo "Tag already has the current docs template, only the version list was injected ."
81157 fi
82158 - name : Build dpctl+docs
83159 shell : bash -l {0}
@@ -111,10 +187,10 @@ jobs:
111187 git remote add tokened_docs https://IntelPython:${{ secrets.GITHUB_TOKEN }}@github.com/IntelPython/dpctl.git
112188 git fetch tokened_docs
113189 git checkout --track tokened_docs/gh-pages
114- [ -d "${TAG}" ] || mkdir "${TAG}"
115- rm -rf "${TAG:?}/* "
116- mv ~/docs/* "${TAG}/ " || exit 1
117- git add "${TAG}"
190+ # replace the directory outright so a re-run cannot merge into stale docs
191+ rm -rf "${TAG:?}"
192+ mv ~/docs "${TAG}" || exit 1
193+ git add --all "${TAG}"
118194 git config user.name 'github-actions[doc-deploy-bot]'
119195 git config user.email 'github-actions[doc-deploy-bot]@users.noreply.github.com'
120196 git commit -m "Docs backfilled for ${TAG}."
0 commit comments