diff --git a/.github/actions/configure-cmake/action.yaml b/.github/actions/configure-cmake/action.yaml index c368d6b8c..c1148acc9 100644 --- a/.github/actions/configure-cmake/action.yaml +++ b/.github/actions/configure-cmake/action.yaml @@ -46,6 +46,15 @@ runs: run: | # Source the container entrypoint script . /entrypoint.sh + + # Load Spack-installed GCC if necessary + # FIXME: The entrypoint.sh script should include the adjustment of PATH + # such that $(which g++) refers to the Spack-installed GCC. + if [ "$CPP_COMPILER" == "g++" ]; then + spack load gcc@15.2 + CPP_COMPILER=$(which g++) + fi + cd "$GITHUB_WORKSPACE/$BUILD_PATH" SOURCE_DIR="$GITHUB_WORKSPACE/$SOURCE_PATH" echo "Configuring with CMake preset: $PRESET" diff --git a/.github/workflows/cmake-build.yaml b/.github/workflows/cmake-build.yaml index dcba5940f..91cf79b34 100644 --- a/.github/workflows/cmake-build.yaml +++ b/.github/workflows/cmake-build.yaml @@ -217,7 +217,7 @@ jobs: - name: Configure CMake id: configure - uses: Framework-R-D/phlex/.github/actions/configure-cmake@main + uses: knoepfel/phlex/.github/actions/configure-cmake@cpp23-for-containers with: source-path: ${{ env.local_checkout_path }} build-path: ${{ env.local_build_path }} diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index cf40e3a0a..2e9fb68e3 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -98,7 +98,6 @@ jobs: - name: Verify compile_commands.json (C++ only) if: matrix.language == 'cpp' run: | - set -euo pipefail if [ ! -f "$CODEQL_EXTRACTOR_CPP_COMPILATION_DATABASE" ]; then echo "Expected compile_commands.json at $CODEQL_EXTRACTOR_CPP_COMPILATION_DATABASE" >&2 exit 1 @@ -159,7 +158,6 @@ jobs: - name: Check CodeQL SARIF for new or resolved alerts id: check_codeql run: | - set -euo pipefail ARGS=( --sarif "$GITHUB_WORKSPACE/sarif" --min-level "${CODEQL_MIN_LEVEL}" diff --git a/CMakePresets.json b/CMakePresets.json index 79b4a20aa..dc1d73c27 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -5,7 +5,7 @@ "hidden": false, "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "YES", - "CMAKE_CXX_STANDARD": "20", + "CMAKE_CXX_STANDARD": "23", "CMAKE_CXX_STANDARD_REQUIRED": "YES", "CMAKE_CXX_EXTENSIONS": "NO", "CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "CetProvideDependency" diff --git a/ci/Dockerfile b/ci/Dockerfile index e8a409e76..9b027cab7 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -15,7 +15,7 @@ ARG parallelism=18 -FROM gcc:15.2.0 AS base +FROM ubuntu:24.04 AS base ARG parallelism ENV DEBIAN_FRONTEND=noninteractive @@ -27,6 +27,33 @@ ENV PHLEX_SPACK_ENV=/opt/spack-environments/phlex-ci SHELL ["/bin/bash", "-c"] +######################################################################## +# Install essential build tools, git, and Python + +RUN <<'INSTALL_ESSENTIALS' +set -euo pipefail + +apt-get update +apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + file \ + git \ + gnupg2 \ + libcurl4-openssl-dev \ + locales-all \ + python3 \ + python3-dev \ + python3-pip \ + unzip +apt-get clean +rm -rf /var/lib/apt/lists/* + +# Make python3 available as 'python' +update-alternatives --install /usr/bin/python python /usr/bin/python3 1 +INSTALL_ESSENTIALS + ######################################################################## # Install locale support required by tooling and Spack @@ -117,13 +144,31 @@ set -euo pipefail # Register binary caches for Spack installs and optional local cache volume . /spack/share/spack/setup-env.sh -spack mirror add --type binary phlex-ci-scisoft https://scisoft.fnal.gov/scisoft/phlex-dev-build-cache +spack mirror add --type binary phlex-ci-scisoft https://scisoft.fnal.gov/scisoft/spack-packages/phlex-dev if [ -d "/build-cache" ]; then spack --timestamp mirror add --type binary phlex-ci-local /build-cache fi CONFIGURE_SPACK_MIRRORS +######################################################################## +# Install GCC 15.2 + +RUN <<'INSTALL_GCC' +set -euo pipefail + +# Install GCC in its own layer to improve cache reuse +. /spack/share/spack/setup-env.sh + +spack --timestamp install --fail-fast -j $parallelism -p 1 \ + --no-check-signature gcc@15.2 target=x86_64_v3 + +# Make GCC external to simplify concretization +spack compiler find $(spack location -i gcc@15.2) + +spack clean -dfs +INSTALL_GCC + ######################################################################## # Create, activate, and concretize the phlex-ci Spack environment diff --git a/ci/spack.yaml b/ci/spack.yaml index 616d9fdfa..04e95090a 100644 --- a/ci/spack.yaml +++ b/ci/spack.yaml @@ -5,14 +5,13 @@ spack: - cmake - lcov - ninja - - python - py-gcovr - - py-numpy - py-pip # Needed temporarily for ruff installation - | - llvm@21.1.4: +zstd +llvm_dylib +link_llvm_dylib targets=x86 + llvm@21.1.4: +zstd +llvm_dylib +link_llvm_dylib ~lldb targets=x86 view: true + concretizer: unify: true @@ -29,7 +28,7 @@ spack: phlex: require: - "+form" - - "cxxstd=20" + - "cxxstd=23" - "%gcc@15" @@ -49,4 +48,8 @@ spack: root: require: - "~x" # No graphics libraries required - - "cxxstd=20" + # FIXME: davix requires openssl headers which are not currently + # available in the container. They are also not needed + # for Phlex development. This should be rectified. + - "~davix" + - "cxxstd=23"