Skip to content

Commit f6ac4c1

Browse files
committed
Merge branch 'develop' into oop-pseudo
2 parents 12f2f64 + f956f9e commit f6ac4c1

996 files changed

Lines changed: 218803 additions & 20193 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/update-ghcr-ci-image-centos10-openmpi.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/update-ghcr-ci-image-ubuntu22-clang.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/update-ghcr-ci-image-ubuntu22-openmpi.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/update-ghcr-ci-image-ubuntu22-serial.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/update-ghcr-ci-image-ubuntu24-openmpi.yaml

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Build and Push CI Images to GHCR
2+
3+
on:
4+
push:
5+
paths:
6+
- 'config/docker/dependencies/**'
7+
branches:
8+
- develop
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
13+
jobs:
14+
discover_images:
15+
if: github.repository == 'qmcpack/qmcpack'
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
outputs:
20+
images: ${{ steps.discover.outputs.images }}
21+
has_images: ${{ steps.discover.outputs.has_images }}
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v7
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Discover changed images
30+
id: discover
31+
shell: bash
32+
env:
33+
BEFORE: ${{ github.event.before }}
34+
AFTER: ${{ github.sha }}
35+
run: |
36+
set -euo pipefail
37+
38+
dependencies_dir=config/docker/dependencies
39+
images=()
40+
41+
# Map changed paths to their top-level image directories
42+
if [[ -n "$BEFORE" &&
43+
! "$BEFORE" =~ ^0+$ ]] &&
44+
git cat-file -e "$BEFORE^{commit}" 2>/dev/null; then
45+
while IFS= read -r path; do
46+
relative_path=${path#"$dependencies_dir"/}
47+
image=${relative_path%%/*}
48+
if [[ "$relative_path" == */* &&
49+
-f "$dependencies_dir/$image/Dockerfile" ]]; then
50+
images+=("$image")
51+
fi
52+
done < <(git diff --name-only "$BEFORE" "$AFTER" -- "$dependencies_dir")
53+
else
54+
# Without a usable base commit, rebuild every image
55+
while IFS= read -r dockerfile; do
56+
images+=("$(basename "$(dirname "$dockerfile")")")
57+
done < <(
58+
find "$dependencies_dir" -mindepth 2 -maxdepth 2 \
59+
-type f -name Dockerfile -print
60+
)
61+
fi
62+
63+
# Sort the image names for a stable build matrix order
64+
mapfile -t images < <(
65+
printf '%s\n' "${images[@]}" | sed '/^$/d' | sort -u
66+
)
67+
68+
# Form a JSON matrix of images names and verify they are valid
69+
image_json=[
70+
separator=
71+
for image in "${images[@]}"; do
72+
if [[ ! "$image" =~ ^[a-z0-9][a-z0-9._-]*$ ]]; then
73+
echo "Invalid GHCR image name derived from directory: $image" >&2
74+
exit 1
75+
fi
76+
image_json+="$separator\"$image\""
77+
separator=,
78+
done
79+
image_json+=]
80+
81+
# Output the matrix and whether the build job needs to run
82+
echo "images=$image_json" >> "$GITHUB_OUTPUT"
83+
if [[ "$image_json" == "[]" ]]; then
84+
echo "has_images=false" >> "$GITHUB_OUTPUT"
85+
else
86+
echo "has_images=true" >> "$GITHUB_OUTPUT"
87+
fi
88+
89+
build-and-push-image:
90+
needs: discover_images
91+
if: needs.discover_images.outputs.has_images == 'true'
92+
strategy:
93+
fail-fast: false
94+
matrix:
95+
image: ${{ fromJSON(needs.discover_images.outputs.images) }}
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: read
99+
packages: write
100+
101+
steps:
102+
- name: Checkout repository
103+
uses: actions/checkout@v7
104+
105+
- name: Log in to the Container registry
106+
uses: docker/login-action@v4
107+
with:
108+
registry: ${{ env.REGISTRY }}
109+
username: ${{ github.actor }}
110+
password: ${{ secrets.GITHUB_TOKEN }}
111+
112+
- name: Set up Docker Buildx
113+
uses: docker/setup-buildx-action@v4
114+
115+
- name: Build and push Docker image
116+
uses: docker/build-push-action@v7
117+
with:
118+
context: .
119+
file: config/docker/dependencies/${{ matrix.image }}/Dockerfile
120+
push: true
121+
tags: |
122+
ghcr.io/qmcpack/${{ matrix.image }}:latest
123+
platforms: linux/amd64
124+

CMake/GNUCompilers.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,10 @@ if(ENABLE_GCOV)
159159
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage -O0 -fno-inline -fno-inline-small-functions -fno-default-inline")
160160
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage -O0 -fno-inline -fno-inline-small-functions -fno-default-inline")
161161
endif(ENABLE_GCOV)
162+
163+
# Workaround Apple SDK headers using C11 spelling of static_assert which GCC
164+
# does not accept as an extension
165+
if(APPLE)
166+
add_compile_definitions("$<$<COMPILE_LANGUAGE:CXX>:_Static_assert=static_assert>")
167+
endif()
168+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
try_compile(
2+
DEFAULT_IS_OLDER_THAN_CXX20
3+
${CMAKE_BINARY_DIR}
4+
${PROJECT_CMAKE}/try_compile_sources/trap_cxx20.cpp)
5+
6+
if(DEFAULT_IS_OLDER_THAN_CXX20)
7+
set(COMPILER_CXX_STANDARD_DEFAULT 17)
8+
else()
9+
set(COMPILER_CXX_STANDARD_DEFAULT 20)
10+
endif()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Trap C++20 or newer
2+
3+
int main(int argc, char **argv)
4+
{
5+
#if __cplusplus >= 202002L
6+
#error Compiling in C++20 or newer.
7+
#endif
8+
return 0;
9+
}

0 commit comments

Comments
 (0)