Skip to content

Commit a9b6aa4

Browse files
authored
Merge branch 'main' into re-enable-python-mpi-tests
2 parents aff1045 + f36a079 commit a9b6aa4

1,014 files changed

Lines changed: 8837 additions & 10715 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.

‎.clang-format‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ IncludeCategories:
55
Priority: 4
66
- Regex: '^"(llvm|llvm-c|clang|clang-c|mlir|mlir-c)/'
77
Priority: 3
8-
- Regex: '^"(qoda|\.\.)/'
8+
- Regex: '^"(cudaq|\.\.)/'
99
Priority: 2
1010
- Regex: '.*'
1111
Priority: 1

‎.github/actions/setup-xcode-stable/action.yml‎

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Set up latest stable Xcode
2-
description: Select the newest non-beta Xcode installed on the macOS runner.
2+
description: >-
3+
Select the newest stable Xcode installed on the macOS runner. Excludes
4+
betas and release candidates (matches the "latest-stable" semantics of
5+
maxim-lobanov/setup-xcode).
36
47
outputs:
58
version:
@@ -23,26 +26,53 @@ runs:
2326
run: |
2427
set -euo pipefail
2528
26-
# Mirrors the selection strategy from maxim-lobanov/setup-xcode
27-
# (scan installed Xcode apps, ignore beta releases, choose newest
28-
# stable), but keeps it local to avoid external-action allowlist issues.
29+
# Implements the "latest-stable" selection strategy from
30+
# maxim-lobanov/setup-xcode (scan installed Xcode apps, exclude
31+
# both betas and release candidates, choose the newest stable),
32+
# kept local to avoid external-action allowlist issues.
33+
#
34+
# Note: LicenseInfo.plist's licenseType is not a reliable signal
35+
# for release candidates (Apple commonly sets it to "GM" or
36+
# "Release" on RCs, not "Beta"). GitHub-hosted runners do, however,
37+
# name pre-release bundles consistently, e.g.
38+
# /Applications/Xcode_<v>_beta_<n>.app
39+
# /Applications/Xcode_<v>_Release_Candidate.app
40+
# so we filter on the .app bundle name in addition to the license
41+
# type. Without this, an RC's SDK can be selected and its absolute
42+
# path baked into cached LLVM CMake imported targets, only to vanish
43+
# from the runner image once Apple ships the GA build.
2944
selection_file=$(mktemp)
3045
python3 > "$selection_file" <<'PY'
3146
from pathlib import Path
3247
import plistlib
3348
import re
3449
import sys
3550
51+
# The "rc" token must be delimited by non-letters on both sides so
52+
# it matches "_RC.", "_RC1.", "-rc.", etc. but not substrings of
53+
# real words. \b alone is insufficient because "_" is a word char
54+
# in Python regex, so "_RC" has no boundary between "_" and "R".
55+
PRERELEASE_NAME = re.compile(
56+
r"(beta"
57+
r"|release[\s_.\-]?candidate"
58+
r"|(?<![A-Za-z])rc\d*(?![A-Za-z]))",
59+
re.IGNORECASE)
60+
3661
def semver_key(version):
3762
return tuple(int(part) for part in re.findall(r"\d+", version))
3863
3964
versions = []
40-
for app in Path("/Applications").iterdir():
65+
for app in sorted(Path("/Applications").iterdir()):
4166
if not app.is_dir() or app.is_symlink():
4267
continue
4368
if not re.match(r"^Xcode.*\.app$", app.name):
4469
continue
4570
71+
if PRERELEASE_NAME.search(app.name):
72+
print(f"Skipping pre-release Xcode (bundle name): {app.name}",
73+
file=sys.stderr)
74+
continue
75+
4676
version_plist = app / "Contents" / "version.plist"
4777
license_plist = app / "Contents" / "Resources" / "LicenseInfo.plist"
4878
if not version_plist.exists() or not license_plist.exists():
@@ -56,7 +86,11 @@ runs:
5686
version = str(version_info.get("CFBundleShortVersionString", ""))
5787
build = str(version_info.get("ProductBuildVersion", ""))
5888
license_type = str(license_info.get("licenseType", "")).lower()
59-
if not version or not license_type or "beta" in license_type:
89+
if not version or not license_type:
90+
continue
91+
if "beta" in license_type:
92+
print(f"Skipping pre-release Xcode (license type): {app.name}",
93+
file=sys.stderr)
6094
continue
6195
6296
versions.append((semver_key(version), version, build, str(app)))

‎.github/pre-commit/spellcheck_config.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ matrix:
138138
- name: cxx_headers
139139
sources:
140140
# Exclude test directories, third-party code (tpls/), vendored nlopt, and build artifacts
141-
- '**/*.h|!test/**/*.h|!targettests/**/*.h|!tpls/**/*.h|!runtime/cudaq/algorithms/optimizers/nlopt/nlopt-src/**/*.h|!_skbuild/**/*.h|!build/**/*.h|!build_*/**/*.h'
141+
- '**/*.h|!cudaq/test/**/*.h|!targettests/**/*.h|!tpls/**/*.h|!runtime/cudaq/algorithms/optimizers/nlopt/nlopt-src/**/*.h|!_skbuild/**/*.h|!build/**/*.h|!build_*/**/*.h'
142142
glob_flags: N|G|B
143143
expect_match: false
144144
aspell:
@@ -263,7 +263,7 @@ matrix:
263263
sources:
264264
# Exclude test directories, third-party code (tpls/), build artifacts, sphinx config,
265265
# and files with f-string syntax that pyspelling's parser can't handle
266-
- '**/*.py|!python/tests/**/*.py|!test/**/*.py|!targettests/**/*.py|!tpls/**/*.py|!_skbuild/**/*.py|!build/**/*.py|!build_*/**/*.py|!_version.py|!docs/sphinx/conf.py|!utils/mock_qpu/qci/__init__.py'
266+
- '**/*.py|!python/tests/**/*.py|!cudaq/test/**/*.py|!targettests/**/*.py|!tpls/**/*.py|!_skbuild/**/*.py|!build/**/*.py|!build_*/**/*.py|!_version.py|!docs/sphinx/conf.py|!utils/mock_qpu/qci/__init__.py'
267267
glob_flags: N|G|B
268268
expect_match: false
269269
aspell:

‎.github/pre-commit/spelling_allowlist.txt‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ Photonics
108108
PyPI
109109
Pygments
110110
QAOA
111+
QASM
112+
QBRAID
111113
QCI
112114
QCaaS
113115
QEC
@@ -169,6 +171,7 @@ amongst
169171
ancilla
170172
ansatz
171173
ansatzes
174+
api
172175
archiver
173176
arity
174177
auxillary
@@ -302,6 +305,7 @@ lossy
302305
lvalue
303306
macOS
304307
makefiles
308+
measurementCounts
305309
merchantability
306310
mps
307311
multinomial
@@ -314,6 +318,7 @@ natively
314318
normalization
315319
nullary
316320
nvcc
321+
nvq
317322
observables
318323
optimizer
319324
optimizers
@@ -334,22 +339,26 @@ prepend
334339
preprocessor
335340
probability
336341
programmatically
337-
pybind
342+
qBraid
338343
qaoa
344+
qbraid
339345
qed
340346
qio
347+
qrn
341348
quantize
342349
quantized
343350
qubit
344351
qubits
345352
qudit
346353
qudits
354+
queryable
347355
qumode
348356
qumodes
349357
reStructuredText
350358
realtime
351359
reconfigurable
352360
reproducibility
361+
resultData
353362
reusability
354363
runtime
355364
runtimes

‎.github/workflows/build_package_sources.yml‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ jobs:
7878
7979
- name: Pull images
8080
run: |
81-
docker pull "${{ steps.images.outputs.base_image }}"
82-
docker pull "${{ steps.images.outputs.target_image }}"
81+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
82+
retry docker pull "${{ steps.images.outputs.base_image }}"
83+
retry docker pull "${{ steps.images.outputs.target_image }}"
8384
8485
- name: Diff package lists
8586
run: |
@@ -164,14 +165,15 @@ jobs:
164165

165166
- name: Install wheel
166167
run: |
168+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
167169
whl=$(find wheel -name '*.whl' 2>/dev/null | head -1)
168170
if [ -z "$whl" ]; then
169171
echo "No .whl file found under wheel/"
170172
find wheel -type f
171173
exit 1
172174
fi
173175
echo "Installing $whl"
174-
pip install "$whl"
176+
retry pip install "$whl"
175177
# Capture package name (PEP 427: name-version-...); normalize to pip form (dashes)
176178
installed_pkg=$(basename "$whl" .whl | sed -E 's/-[0-9]+\.[0-9]+(\.[0-9]+)?.*//' | tr '_' '-')
177179
echo "$installed_pkg" > installed_wheel_package.txt
@@ -356,6 +358,7 @@ jobs:
356358
- name: Download CUDA-Q prerequisite sources
357359
run: |
358360
set -euo pipefail
361+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
359362
# Generate cudaq_prereqs.lock for the current configuration
360363
bash scripts/install_prerequisites.sh -l
361364
cat cudaq_prereqs.lock
@@ -397,24 +400,24 @@ jobs:
397400
fname="$(basename "$url")"
398401
dest="prereqs/${name}/${fname}"
399402
echo "Downloading tar archive for $name from $url -> $dest"
400-
curl -L "$url" -o "$dest"
403+
retry curl -L "$url" -o "$dest"
401404
;;
402405
sh)
403406
fname="$(basename "$url")"
404407
dest="prereqs/${name}/${fname}"
405408
echo "Downloading shell installer for $name from $url -> $dest"
406-
curl -L "$url" -o "$dest"
409+
retry curl -L "$url" -o "$dest"
407410
chmod +x "$dest"
408411
;;
409412
pem)
410413
dest="prereqs/${name}/${name}.pem"
411414
echo "Downloading PEM bundle for $name from $url -> $dest"
412-
curl -L "$url" -o "$dest"
415+
retry curl -L "$url" -o "$dest"
413416
;;
414417
git)
415418
dest_dir="prereqs/${name}"
416419
echo "Cloning git repo for $name from $url (ref=${ref:-HEAD}) -> $dest_dir"
417-
git clone "$url" "$dest_dir"
420+
retry git clone "$url" "$dest_dir"
418421
if [ -n "${ref:-}" ]; then
419422
git -C "$dest_dir" checkout "$ref"
420423
fi

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ jobs:
4141
pull_request_base: ${{ steps.pr_info.outputs.pr_base }}
4242
cache_base: ${{ steps.pr_info.outputs.pr_base }}
4343
llvm_commit: ${{ steps.repo_info.outputs.llvm_commit }}
44-
pybind11_commit: ${{ steps.repo_info.outputs.pybind11_commit }}
4544
nanobind_commit: ${{ steps.repo_info.outputs.nanobind_commit }}
4645
platform_config: ${{ steps.config.outputs.platforms }}
4746
build_test_matrix: ${{ steps.config.outputs.build_test_matrix }}
@@ -111,7 +110,6 @@ jobs:
111110
- id: repo_info
112111
run: |
113112
echo "llvm_commit=$(git rev-parse @:./tpls/llvm)" >> $GITHUB_OUTPUT
114-
echo "pybind11_commit=$(git rev-parse @:./tpls/pybind11)" >> $GITHUB_OUTPUT
115113
echo "nanobind_commit=$(git rev-parse @:./tpls/nanobind)" >> $GITHUB_OUTPUT
116114
117115
devdeps:
@@ -160,7 +158,6 @@ jobs:
160158
toolchain=gcc12
161159
distro=rhel8
162160
llvm_commit=${{ needs.metadata.outputs.llvm_commit }}
163-
pybind11_commit=${{ needs.metadata.outputs.pybind11_commit }}
164161
nanobind_commit=${{ needs.metadata.outputs.nanobind_commit }}
165162
registry_cache_from: ${{ inputs.cache_base || needs.metadata.outputs.cache_base }}
166163
environment: ghcr-ci
@@ -254,7 +251,7 @@ jobs:
254251
gen_code_coverage:
255252
name: Gen code coverage
256253
needs: [metadata, config_devdeps]
257-
if: github.event_name != 'push'
254+
if: false
258255
strategy:
259256
matrix:
260257
platform: [amd64]
@@ -444,9 +441,10 @@ jobs:
444441
esac
445442
}
446443
444+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
447445
# All sub-jobs (with names + html_url + conclusion). Paginate; this
448446
# workflow can have hundreds of matrix legs across reusable workflows.
449-
gh api --paginate "repos/$REPO/actions/runs/$RUN_ID/jobs" \
447+
retry gh api --paginate "repos/$REPO/actions/runs/$RUN_ID/jobs" \
450448
--jq '.jobs[] | {name, html_url, conclusion, status, started_at, completed_at}' \
451449
| jq -s '.' > /tmp/jobs.json
452450
@@ -630,14 +628,15 @@ jobs:
630628
if: env.PR_NUMBER != ''
631629
run: |
632630
set -euo pipefail
631+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
633632
marker="<!-- ci-summary:${{ github.workflow }}:${EVENT_NAME} -->"
634-
existing=$(gh api --paginate "repos/$REPO/issues/$PR_NUMBER/comments" \
633+
existing=$(retry gh api --paginate "repos/$REPO/issues/$PR_NUMBER/comments" \
635634
--jq ".[] | select(.body | startswith(\"$marker\")) | .id" | head -1 || true)
636635
if [ -n "$existing" ]; then
637636
jq -Rs '{body: .}' < /tmp/comment.md \
638-
| gh api "repos/$REPO/issues/comments/$existing" -X PATCH --input -
637+
| retry gh api "repos/$REPO/issues/comments/$existing" -X PATCH --input -
639638
else
640-
gh pr comment "$PR_NUMBER" --repo "$REPO" --body-file /tmp/comment.md
639+
retry gh pr comment "$PR_NUMBER" --repo "$REPO" --body-file /tmp/comment.md
641640
fi
642641
continue-on-error: true
643642

‎.github/workflows/ci_macos.yml‎

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ jobs:
145145
- name: Restore prerequisites from GHCR
146146
run: |
147147
set -e # Exit on error
148+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
148149
echo "${{ github.token }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
149-
oras pull ${{ needs.devdeps.outputs.image_hash }}
150+
retry oras pull ${{ needs.devdeps.outputs.image_hash }}
150151
151152
tar -xzf macos-artifacts.tar.gz -C $HOME
152153
rm macos-artifacts.tar.gz
@@ -163,7 +164,9 @@ jobs:
163164
registry-token: ${{ github.token }}
164165

165166
- name: Install Python dependencies
166-
run: CCACHE_DISABLE=1 pip install -r requirements-dev.txt
167+
run: |
168+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
169+
CCACHE_DISABLE=1 retry pip install -r requirements-dev.txt
167170
168171
- name: Build MLIR Python bindings
169172
run: |
@@ -236,8 +239,9 @@ jobs:
236239
- name: Restore prerequisites from GHCR
237240
run: |
238241
set -e # Exit on error
242+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
239243
echo "${{ github.token }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
240-
oras pull ${{ needs.devdeps.outputs.image_hash }}
244+
retry oras pull ${{ needs.devdeps.outputs.image_hash }}
241245
242246
tar -xzf macos-artifacts.tar.gz -C $HOME
243247
rm macos-artifacts.tar.gz
@@ -250,7 +254,9 @@ jobs:
250254
registry-token: ${{ github.token }}
251255

252256
- name: Install Python dependencies
253-
run: CCACHE_DISABLE=1 pip install -r requirements-dev.txt
257+
run: |
258+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
259+
CCACHE_DISABLE=1 retry pip install -r requirements-dev.txt
254260
255261
- name: Build MLIR Python bindings
256262
run: |
@@ -387,8 +393,9 @@ jobs:
387393
- name: Restore prerequisites from GHCR
388394
run: |
389395
set -e # Exit on error
396+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
390397
echo "${{ github.token }}" | oras login ghcr.io -u ${{ github.actor }} --password-stdin
391-
oras pull ${{ needs.devdeps.outputs.image_hash }}
398+
retry oras pull ${{ needs.devdeps.outputs.image_hash }}
392399
393400
tar -xzf macos-artifacts.tar.gz -C $HOME
394401
rm macos-artifacts.tar.gz
@@ -402,8 +409,9 @@ jobs:
402409

403410
- name: Install dependencies
404411
run: |
405-
CCACHE_DISABLE=1 pip install -r requirements-dev.txt
406-
brew install makeself pigz
412+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
413+
CCACHE_DISABLE=1 retry pip install -r requirements-dev.txt
414+
retry brew install makeself pigz
407415
408416
- name: Build MLIR Python bindings
409417
run: |
@@ -498,8 +506,9 @@ jobs:
498506
499507
- name: Install CUDA-Q (Python via wheel)
500508
run: |
509+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
501510
sudo -u cudaqtest -H python3 -m venv /Users/cudaqtest/venv
502-
sudo -u cudaqtest -H /Users/cudaqtest/venv/bin/pip install wheel/*.whl
511+
retry sudo -u cudaqtest -H /Users/cudaqtest/venv/bin/pip install wheel/*.whl
503512
504513
- name: Validate installation
505514
run: |

‎.github/workflows/clean_caches.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,15 @@ jobs:
3838
- name: Download cache keys
3939
id: artifacts
4040
run: |
41+
retry() { for n in 1 2 3; do "$@" && return 0; [ $n -lt 3 ] && sleep $((15*n*n)); done; return 1; }
4142
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
42-
artifacts=$(gh api $artifacts_url -q '.artifacts[] | {name: .name, url: .archive_download_url}')
43+
artifacts=$(retry gh api $artifacts_url -q '.artifacts[] | {name: .name, url: .archive_download_url}')
4344
4445
for artifact in `echo "$artifacts"`; do
4546
name=`echo $artifact | jq -r '.name'`
4647
if [ "${name#cache_key}" != "${name}" ]; then
4748
url=`echo $artifact | jq -r '.url'`
48-
gh api $url > cache_keys.zip
49+
retry gh api $url > cache_keys.zip
4950
unzip -d cache_keys cache_keys.zip
5051
for file in `find cache_keys/ -type f`; do
5152
keys+=" `cat $file`"

0 commit comments

Comments
 (0)