Skip to content

Commit ca0c56f

Browse files
committed
CI: Replace Manylinux2014 with Manylinux_2_28 and update deprecated github actions
Node 16 Github actions are deprecated, but node 20 actions are incompatible with Manylinux_2014/CentOS7. - Replaces manylinux wheel building to use 2_28 (based on Alma 8) - Updates depreacted actions in all workflows.
1 parent 42786c5 commit ca0c56f

File tree

10 files changed

+237
-68
lines changed

10 files changed

+237
-68
lines changed

.github/scripts/install_cuda_el8.sh

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Install CUDA on Alma8/manylinux_2_28.
2+
3+
## -------------------
4+
## Constants
5+
## -------------------
6+
7+
# dnf install cuda-nvrtc-devel-11-4 cuda-compiler-11-4 cuda-cudart-devel-11-4 cuda-nvcc-11-4 cuda-nvrtc-11-4 cuda-nvtx-11-4 libcurand-devel-11-4
8+
9+
# List of sub-packages to install.
10+
# @todo - pass this in from outside the script?
11+
# @todo - check the specified subpackages exist via apt pre-install? apt-rdepends cuda-9-0 | grep "^cuda-"?
12+
13+
# Ideally choose from the list of meta-packages to minimise variance between cuda versions (although it does change too)
14+
CUDA_PACKAGES_IN=(
15+
"cuda-compiler"
16+
"cuda-cudart-devel" # libcudart.so
17+
"cuda-driver-devel" # libcuda.so
18+
"cuda-nvtx"
19+
"cuda-nvrtc-devel"
20+
"libcurand-devel" # 11-0+
21+
)
22+
23+
## -------------------
24+
## Bash functions
25+
## -------------------
26+
# returns 0 (true) if a >= b
27+
function version_ge() {
28+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
29+
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "$2" ]
30+
}
31+
# returns 0 (true) if a > b
32+
function version_gt() {
33+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
34+
[ "$1" = "$2" ] && return 1 || version_ge $1 $2
35+
}
36+
# returns 0 (true) if a <= b
37+
function version_le() {
38+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
39+
[ "$(printf '%s\n' "$@" | sort -V | head -n 1)" == "$1" ]
40+
}
41+
# returns 0 (true) if a < b
42+
function version_lt() {
43+
[ "$#" != "2" ] && echo "${FUNCNAME[0]} requires exactly 2 arguments." && exit 1
44+
[ "$1" = "$2" ] && return 1 || version_le $1 $2
45+
}
46+
47+
48+
## -------------------
49+
## Select CUDA version
50+
## -------------------
51+
52+
# Get the cuda version from the environment as $cuda.
53+
CUDA_VERSION_MAJOR_MINOR=${cuda}
54+
55+
# Split the version.
56+
# We (might/probably) don't know PATCH at this point - it depends which version gets installed.
57+
CUDA_MAJOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f1)
58+
CUDA_MINOR=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f2)
59+
CUDA_PATCH=$(echo "${CUDA_VERSION_MAJOR_MINOR}" | cut -d. -f3)
60+
# query rpm to find the major enterprise linux release
61+
EL_MAJOR=$(rpm -E %{rhel})
62+
63+
echo "CUDA_MAJOR: ${CUDA_MAJOR}"
64+
echo "CUDA_MINOR: ${CUDA_MINOR}"
65+
echo "CUDA_PATCH: ${CUDA_PATCH}"
66+
echo "EL_MAJOR: ${EL_MAJOR}"
67+
68+
# If we don't know the CUDA_MAJOR or MINOR, error.
69+
if [ -z "${CUDA_MAJOR}" ] ; then
70+
echo "Error: Unknown CUDA Major version. Aborting."
71+
exit 1
72+
fi
73+
if [ -z "${CUDA_MINOR}" ] ; then
74+
echo "Error: Unknown CUDA Minor version. Aborting."
75+
exit 1
76+
fi
77+
# If we don't know the Ubuntu version, error.
78+
if [ -z ${EL_MAJOR} ]; then
79+
echo "Error: Unknown EL version. Aborting."
80+
exit 1
81+
fi
82+
83+
## -------------------------------
84+
## Select CUDA packages to install
85+
## -------------------------------
86+
CUDA_PACKAGES=""
87+
for package in "${CUDA_PACKAGES_IN[@]}"
88+
do :
89+
# CUDA < 11, lib* packages were actually cuda-cu* (generally, this might be greedy.)
90+
if [[ ${package} == libcu* ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "11.0" ; then
91+
package="${package/libcu/cuda-cu}"
92+
fi
93+
# CUDA < 11, -devel- packages were actually -dev
94+
if [[ ${package} == *devel* ]] && version_lt "$CUDA_VERSION_MAJOR_MINOR" "11.0" ; then
95+
package="${package//devel/dev}"
96+
fi
97+
# Build the full package name and append to the string.
98+
CUDA_PACKAGES+=" ${package}-${CUDA_MAJOR}-${CUDA_MINOR}"
99+
done
100+
echo "CUDA_PACKAGES ${CUDA_PACKAGES}"
101+
102+
## -----------------
103+
## Prepare to install
104+
## -----------------
105+
106+
CPU_ARCH="x86_64"
107+
# Nvidia don't provide an explicit alma repo. 11.2's closest is RHEL.
108+
# 12.4 includes rocky8/9, rhel7/8/9, cent7, so RHEL is the closes that should hopefully be fine, otherwise will have to switch to the much slower runfile installer.
109+
DNF_REPO_URI="https://developer.download.nvidia.com/compute/cuda/repos/rhel${EL_MAJOR}/${CPU_ARCH}/cuda-rhel${EL_MAJOR}.repo"
110+
111+
echo "DNF_REPO_URI ${DNF_REPO_URI}"
112+
113+
## -----------------
114+
## Check for root/sudo
115+
## -----------------
116+
117+
# Detect if the script is being run as root, storing true/false in is_root.
118+
is_root=false
119+
if (( $EUID == 0)); then
120+
is_root=true
121+
fi
122+
# Find if sudo is available
123+
has_sudo=false
124+
if command -v sudo &> /dev/null ; then
125+
has_sudo=true
126+
fi
127+
# Decide if we can proceed or not (root or sudo is required) and if so store whether sudo should be used or not.
128+
if [ "$is_root" = false ] && [ "$has_sudo" = false ]; then
129+
echo "Root or sudo is required. Aborting."
130+
exit 1
131+
elif [ "$is_root" = false ] ; then
132+
USE_SUDO=sudo
133+
else
134+
USE_SUDO=
135+
fi
136+
137+
## -----------------
138+
## Install
139+
## -----------------
140+
echo "Adding CUDA Repository"
141+
$USE_SUDO dnf config-manager --add-repo ${DNF_REPO_URI}
142+
$USE_SUDO dnf clean all
143+
144+
echo "Installing CUDA packages ${CUDA_PACKAGES}"
145+
$USE_SUDO dnf -y install ${CUDA_PACKAGES}
146+
147+
if [[ $? -ne 0 ]]; then
148+
echo "CUDA Installation Error."
149+
exit 1
150+
fi
151+
152+
## -----------------
153+
## Set environment vars / vars to be propagated
154+
## -----------------
155+
156+
CUDA_PATH=/usr/local/cuda-${CUDA_MAJOR}.${CUDA_MINOR}
157+
echo "CUDA_PATH=${CUDA_PATH}"
158+
export CUDA_PATH=${CUDA_PATH}
159+
export PATH="$CUDA_PATH/bin:$PATH"
160+
export LD_LIBRARY_PATH="$CUDA_PATH/lib:$LD_LIBRARY_PATH"
161+
export LD_LIBRARY_PATH="$CUDA_PATH/lib64:$LD_LIBRARY_PATH"
162+
# Check nvcc is now available.
163+
nvcc -V
164+
165+
# If executed on github actions, make the appropriate echo statements to update the environment
166+
if [[ $GITHUB_ACTIONS ]]; then
167+
# Set paths for subsequent steps, using ${CUDA_PATH}
168+
echo "Adding CUDA to CUDA_PATH, PATH and LD_LIBRARY_PATH"
169+
echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV
170+
echo "${CUDA_PATH}/bin" >> $GITHUB_PATH
171+
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
172+
echo "LD_LIBRARY_PATH=${CUDA_PATH}/lib64:${LD_LIBRARY_PATH}" >> $GITHUB_ENV
173+
fi

.github/workflows/CMake.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
CMAKE: ${{ matrix.cmake }}
6969

7070
steps:
71-
- uses: actions/checkout@v3
71+
- uses: actions/checkout@v4
7272

7373
- name: Install cmake from GitHub Releases
7474
if: ${{ env.CMAKE != '' && env.CMAKE != 'default' }}
@@ -96,7 +96,7 @@ jobs:
9696
9797
- name: Select Python
9898
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
99-
uses: actions/setup-python@v4
99+
uses: actions/setup-python@v5
100100
with:
101101
python-version: ${{ env.PYTHON }}
102102

.github/workflows/Docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# Define constants
2727
BUILD_DIR: "build"
2828
steps:
29-
- uses: actions/checkout@v3
29+
- uses: actions/checkout@v4
3030

3131
- name: Install doxygen >= 1.9.0 + other dependencies
3232
run: |

.github/workflows/Draft-Release.yml

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
VISUALISATION: ${{ matrix.VISUALISATION }}
8888

8989
steps:
90-
- uses: actions/checkout@v3
90+
- uses: actions/checkout@v4
9191

9292
- name: Install CUDA
9393
if: ${{ startswith(env.OS, 'ubuntu') && env.CUDA != '' }}
@@ -106,7 +106,7 @@ jobs:
106106
107107
- name: Select Python
108108
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
109-
uses: actions/setup-python@v4
109+
uses: actions/setup-python@v5
110110
with:
111111
python-version: ${{ env.PYTHON }}
112112

@@ -249,7 +249,7 @@ jobs:
249249
CUDAFLAGS: -allow-unsupported-compiler
250250

251251
steps:
252-
- uses: actions/checkout@v3
252+
- uses: actions/checkout@v4
253253

254254
- name: Install CUDA (Windows)
255255
if: ${{ runner.os == 'Windows' && env.CUDA != '' }}
@@ -261,7 +261,7 @@ jobs:
261261

262262
- name: Select Python
263263
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
264-
uses: actions/setup-python@v4
264+
uses: actions/setup-python@v5
265265
with:
266266
python-version: ${{ env.PYTHON }}
267267

@@ -312,11 +312,11 @@ jobs:
312312
run: cmake --build . --config ${{ env.CONFIG }} --target ALL_BUILD --verbose -j `nproc`
313313

314314

315-
# Manylinux2014 Wheel builds, using the manylinux2014 container
316-
wheel-manylinux2014:
315+
# Manylinux Wheel builds, using the ManyLinux_2_28 container. 2014's base OS is depreacted and no longer supported on GitHub actions
316+
wheel-manylinux_2_28:
317317
runs-on: ${{ matrix.cudacxx.os }}
318318
# Run steps inside a manylinux container.
319-
container: quay.io/pypa/manylinux2014_x86_64
319+
container: quay.io/pypa/manylinux_2_28_x86_64
320320
strategy:
321321
fail-fast: false
322322
# Multiplicative build matrix
@@ -325,11 +325,11 @@ jobs:
325325
cudacxx:
326326
- cuda: "12.0"
327327
cuda_arch: "50-real;60-real;70-real;80-real;90-real;90-virtual"
328-
hostcxx: devtoolset-10
328+
hostcxx: gcctoolset-12
329329
os: ubuntu-20.04
330330
- cuda: "11.2"
331331
cuda_arch: "35-real;50-real;60-real;70-real;80-real;80-virtual"
332-
hostcxx: devtoolset-9
332+
hostcxx: gcctoolset-9
333333
os: ubuntu-20.04
334334
python:
335335
- "3.12"
@@ -346,17 +346,17 @@ jobs:
346346
- "OFF"
347347

348348
# Name the job based on matrix/env options
349-
name: "wheel-manylinux2014 (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
349+
name: "wheel-manylinux_2_28 (${{ matrix.cudacxx.cuda }}, ${{matrix.python}}, ${{ matrix.VISUALISATION }}, ${{ matrix.config.name }}, ${{ matrix.cudacxx.os }})"
350350

351351
env:
352352
# Control if the wheel should be repaired. This will fail until .so's are addressed
353353
AUDITWHEEL_REPAIR: "OFF"
354-
MANYLINUX: "manylinux2014"
354+
MANYLINUX: "manylinux_2_28"
355355
ARCH: "x86_64"
356356
# Control if static GLEW should be built and used or not.
357357
USE_STATIC_GLEW: "ON"
358358
# Compute the wheelhouse name which should be unique within the matrix. This must be unique per build matrix/job combination
359-
ARTIFACT_NAME: wheel-manylinux2014-${{ matrix.cudacxx.cuda }}-${{matrix.python}}-${{ matrix.VISUALISATION }}-${{ matrix.config.name }}-${{ matrix.cudacxx.os }}
359+
ARTIFACT_NAME: wheel-manylinux_2_28-${{ matrix.cudacxx.cuda }}-${{matrix.python}}-${{ matrix.VISUALISATION }}-${{ matrix.config.name }}-${{ matrix.cudacxx.os }}
360360
# Define constants
361361
BUILD_DIR: "build"
362362
FLAMEGPU_BUILD_TESTS: "OFF"
@@ -375,16 +375,13 @@ jobs:
375375
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
376376

377377
steps:
378-
- uses: actions/checkout@v3
379-
380-
# Downgrade the devtoolset in the image based on the build matrix, using:
381-
# gcc-10 for CUDA >= 11.2. Unclear if devtoolset-10 will upgrade to unpatched 11.3 which breaks CUDA builds that use <chrono>.
382-
# gcc-9 for CUDA >= 11.0
383-
# these are not the officially supported toolset on centos by cuda, but it's what works.
384-
- name: Install RHEL devtoolset (CentOS)
385-
if: ${{ startsWith(env.HOSTCXX, 'devtoolset-') }}
378+
- uses: actions/checkout@v4
379+
380+
# Downgrade the gcc-toolset in the image based on the build matrix
381+
- name: Install RHEL gcc-toolset (EL 8)
382+
if: ${{ startsWith(env.HOSTCXX, 'gcc-toolset-') }}
386383
run: |
387-
# Install devtoolset-X
384+
# Install gcc-toolset-X
388385
yum install -y ${{ env.HOSTCXX }}
389386
# Enable the toolset via source not scl enable which doesn't get on with multi-step GHA
390387
source /opt/rh/${{ env.HOSTCXX }}/enable
@@ -394,13 +391,13 @@ jobs:
394391
echo "CXX=$(which g++)" >> $GITHUB_ENV
395392
echo "CUDAHOSTCXX=$(which g++)" >> $GITHUB_ENV
396393
397-
- name: Install CUDA (CentOS)
394+
- name: Install CUDA (EL 8)
398395
if: ${{ env.CUDA != '' }}
399396
env:
400397
cuda: ${{ env.CUDA }}
401-
run: .github/scripts/install_cuda_centos.sh
398+
run: .github/scripts/install_cuda_el8.sh
402399

403-
- name: Install Visualisation Dependencies (CentOS)
400+
- name: Install Visualisation Dependencies (EL 8)
404401
if: ${{ env.VISUALISATION == 'ON' }}
405402
run: |
406403
yum install -y glew-devel fontconfig-devel SDL2-devel freetype-devel
@@ -426,11 +423,13 @@ jobs:
426423
make
427424
make install
428425
426+
- name: Add custom problem matchers for annotations
427+
run: echo "::add-matcher::.github/problem-matchers.json"
428+
429429
# This patches a bug where ManyLinux doesn't generate buildnumber as git dir is owned by diff user
430430
- name: Enable git safe-directory
431431
run: git config --global --add safe.directory $GITHUB_WORKSPACE
432432

433-
# Unlike other builds manylinux, uses static glew as it has been built and installed.
434433
- name: Configure cmake
435434
run: >
436435
cmake . -B "${{ env.BUILD_DIR }}"
@@ -469,7 +468,7 @@ jobs:
469468
# Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames)
470469
- name: Upload Wheel Artifacts
471470
if: ${{ env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
472-
uses: actions/upload-artifact@v3
471+
uses: actions/upload-artifact@v4
473472
with:
474473
name: ${{ env.ARTIFACT_NAME }}
475474
path: ${{ env.BUILD_DIR }}/lib/${{ env.CONFIG }}/python/dist/*.whl
@@ -534,7 +533,7 @@ jobs:
534533
CUDAFLAGS: -allow-unsupported-compiler
535534

536535
steps:
537-
- uses: actions/checkout@v3
536+
- uses: actions/checkout@v4
538537

539538
- name: Install CUDA (Windows)
540539
if: ${{ runner.os == 'Windows' && env.CUDA != '' }}
@@ -546,7 +545,7 @@ jobs:
546545

547546
- name: Select Python
548547
if: ${{ env.PYTHON != '' && env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
549-
uses: actions/setup-python@v4
548+
uses: actions/setup-python@v5
550549
with:
551550
python-version: ${{ env.PYTHON }}
552551

@@ -587,7 +586,7 @@ jobs:
587586
# Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames)
588587
- name: Upload Wheel Artifacts
589588
if: ${{env.FLAMEGPU_BUILD_PYTHON == 'ON' }}
590-
uses: actions/upload-artifact@v3
589+
uses: actions/upload-artifact@v4
591590
with:
592591
name: ${{ env.ARTIFACT_NAME }}
593592
path: ${{ env.BUILD_DIR }}/lib/${{ env.CONFIG }}/python/dist/*.whl
@@ -600,17 +599,17 @@ jobs:
600599
needs:
601600
- build-ubuntu
602601
- build-windows
603-
- wheel-manylinux2014
602+
- wheel-manylinux_2_28
604603
- wheel-windows
605604
if: ${{ success() && startsWith(github.ref, 'refs/tags/v') && github.event_name != 'workflow_dispatch' && github.event_name != 'pull_request' }}
606605
runs-on: ubuntu-20.04
607606
steps:
608-
- uses: actions/checkout@v3
607+
- uses: actions/checkout@v4
609608

610609
# Download python wheels from previous jobs.
611610
- name: Download Wheel Artifacts
612611
id: download
613-
uses: actions/download-artifact@v3
612+
uses: actions/download-artifact@v4
614613
with:
615614
path: artifacts
616615

0 commit comments

Comments
 (0)