forked from NVIDIA/cuda-quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
812 lines (767 loc) · 35.7 KB
/
integration_tests.yml
File metadata and controls
812 lines (767 loc) · 35.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
name: Nightly integration tests
concurrency:
# only one integration tests workflow to be run at a time, since it involves pushing/cleaning up a test image (same tag).
group: ${{ github.workflow }}${{ github.event.workflow_run.name }}
cancel-in-progress: false
# Run on request and every day at 3 AM UTC
on:
workflow_dispatch:
inputs:
target:
description: 'Target (choose nightly to run like nightly tests)'
required: true
default: 'nightly'
type: choice
options:
- nightly
- anyon
- fermioniq
- infleqtion
- ionq
- iqm
- oqc
- orca
- pasqal
- qci
- quantinuum
- scaleway
- tii
single_test_name:
type: string
required: false
description: 'Single test (e.g., targettests/quantinuum/load_value.cpp). Runs default tests if left blank'
target_machine:
type: string
required: false
description: 'Target machine (e.g., H2-1E).'
cudaq_test_image:
type: string
required: false
default: '' # picked up from repo variable if not provided
description: 'CUDA Quantum image to run the tests in. Default to the latest CUDA Quantum nightly image'
commit_sha:
type: string
required: false
description: 'Commit SHA to pull the code (examples/tests) for testing. Default to the commit associated with the CUDA Quantum docker image if left blank'
workflow_id:
type: string
required: false
description: 'Workflow Id to retrieve the Python wheel for testing. Default to the wheels produced by the Publishing workflow associated with the latest nightly CUDA Quantum Docker image if left blank'
python_version:
type: choice
required: true
description: 'Python version to run wheel test'
options:
- '3.11'
- '3.12'
- '3.13'
schedule:
- cron: 0 3 * * *
env:
python_version: '3.12'
jobs:
# Run a daily check of all links in the docs to find any newly broken links
links:
runs-on: ubuntu-latest
name: "Check links"
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Check links in Markdown files
uses: ./.github/actions/check-markdown-links
# We need this job purely to choose the container image values because the
# `env` context is unavailable outside of "steps" contexts.
setup:
name: Configure jobs
runs-on: ubuntu-latest
permissions:
packages: write
environment:
name: ghcr-deployment
url: ${{ vars.deployment_url }}
outputs:
cudaq_test_image: ${{ steps.vars.outputs.cudaq_nightly_image }}@${{ steps.test_image.outputs.digest }}
steps:
- name: Set variables
id: vars
run: |
cudaq_test_image=${{ inputs.cudaq_test_image || vars.cudaq_test_image }}
cudaq_nightly_image=ghcr.io/nvidia/${{ vars.packages_prefix }}cuda-quantum
sudo apt-get update && sudo apt-get install -y --no-install-recommends curl
curl -L https://github.com/regclient/regclient/releases/latest/download/regctl-linux-amd64 > regctl
chmod 755 regctl
manifest=`./regctl image manifest $cudaq_test_image --format "{{ json . }}"`
platforms=`echo $manifest | jq -r '.manifests | map("\(.platform.os)/\(.platform.architecture)") | .[]'`
echo "FROM $cudaq_test_image" >> test_image.Dockerfile
echo "platforms=$(echo $platforms | tr ' ' ,)" >> $GITHUB_OUTPUT
echo "cudaq_nightly_image=$cudaq_nightly_image" >> $GITHUB_OUTPUT
- name: Log in to GitHub CR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Set up context for buildx
run: |
docker context create builder_context
- name: Set up buildx runner
uses: docker/setup-buildx-action@v3
with:
endpoint: builder_context
version: v0.19.0
driver-opts: |
image=moby/buildkit:v0.19.0
- name: Extract metadata
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ steps.vars.outputs.cudaq_nightly_image }}
flavor: latest=false
tags: type=raw,value=nightly
labels: |
org.opencontainers.image.title=cuda-quantum
org.opencontainers.image.description=CUDA-Q image used for nightly integration tests
- name: Update nightly image on GHCR
id: test_image
uses: docker/build-push-action@v5
with:
context: .
file: test_image.Dockerfile
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
platforms: ${{ steps.vars.outputs.platforms }}
push: true
metadata:
name: Retrieve commit info
runs-on: ubuntu-latest
needs: setup
container:
image: ${{ needs.setup.outputs.cudaq_test_image }}
options: --user root
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
outputs:
cudaq_commit: ${{ steps.commit-sha.outputs.sha }}
steps:
- name: Get commit SHA
id: commit-sha
run: |
if [ -n "${{ inputs.commit_sha }}" ]; then
echo "sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
else
echo "sha=$(cat $CUDA_QUANTUM_PATH/build_info.txt | grep -o 'source-sha: \S*' | cut -d ' ' -f 2)" >> $GITHUB_OUTPUT
fi
# Setup job to determine which providers to test
provider_matrix_setup:
name: Setup provider matrix
runs-on: ubuntu-latest
needs: [setup, metadata]
outputs:
providers: ${{ steps.set-matrix.outputs.providers }}
steps:
- name: Set provider matrix
id: set-matrix
run: |
# Determine which providers to test based on inputs and event type
if [[ "${{ github.event_name }}" == "schedule" || "${{ inputs.target }}" == "nightly" ]]; then
providers='["anyon", "fermioniq", "infleqtion", "ionq", "iqm", "oqc", "orca", "pasqal", "qci", "quantinuum", "scaleway", "tii"]'
else
# Just run the specified target provider
providers="[\"${{ inputs.target }}\"]"
fi
echo "providers=$providers" >> $GITHUB_OUTPUT
# The parallel provider jobs using the matrix
provider_test:
name: Test ${{ matrix.provider }}
needs: [setup, metadata, provider_matrix_setup]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
provider: ${{ fromJson(needs.provider_matrix_setup.outputs.providers) }}
# Must have environment protection for the secrets
environment: backend-validation
container:
image: ${{ needs.setup.outputs.cudaq_test_image }}
options: --user root
credentials:
username: ${{ github.actor }}
password: ${{ github.token }}
steps:
- name: Get code
uses: actions/checkout@v6
with:
ref: ${{ needs.metadata.outputs.cudaq_commit }}
fetch-depth: 1
- name: Get tests
id: gettests
run: |
if [ -n "${{ inputs.single_test_name }}" ]; then
if [ -e "${{ inputs.single_test_name }}" ]; then
echo "testlist=${{ inputs.single_test_name }}" >> $GITHUB_OUTPUT
else
echo "::error::File ${{ inputs.single_test_name }} not found"
exit 1
fi
else
# Get tests specifically for this provider
case "${{ matrix.provider }}" in
anyon)
filelist="targettests/anyon/*.cpp"
;;
fermioniq)
filelist="docs/sphinx/targets/cpp/fermioniq.cpp docs/sphinx/targets/python/fermioniq.py docs/sphinx/targets/python/fermioniq_observables.py"
;;
infleqtion)
filelist="docs/sphinx/targets/cpp/infleqtion.cpp docs/sphinx/targets/python/infleqtion.py"
;;
ionq)
filelist="targettests/ionq/*.cpp"
;;
iqm)
filelist="targettests/iqm/*.cpp"
;;
oqc)
filelist="targettests/oqc/*.cpp"
;;
orca)
filelist="docs/sphinx/targets/cpp/orca.cpp docs/sphinx/targets/cpp/orca_mqpu.cpp docs/sphinx/targets/python/orca.py docs/sphinx/targets/python/orca_mqpu.py"
;;
pasqal)
filelist="docs/sphinx/targets/cpp/pasqal.cpp docs/sphinx/targets/python/pasqal.py"
;;
qci)
filelist="targettests/qci/*.cpp"
;;
quantinuum)
# Include both legacy Quantinuum and Quantinuum-NG tests
filelist="targettests/quantinuum/*.cpp targettests/quantinuum_ng/*.cpp docs/sphinx/targets/python/quantinuum.py"
;;
scaleway)
filelist="targettests/scaleway/*.cpp docs/sphinx/targets/python/scaleway.py"
;;
tii)
filelist="docs/sphinx/targets/cpp/tii.cpp docs/sphinx/targets/python/tii.py"
;;
esac
echo "testlist=$filelist" >> $GITHUB_OUTPUT
fi
# Provider-specific setup steps
- name: Setup ${{ matrix.provider }} account
run: |
case "${{ matrix.provider }}" in
anyon)
echo "### Setting up Anyon account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.ANYON_USERNAME }}"
echo "::add-mask::${{ secrets.ANYON_PASSWORD }}"
TEMP_NETRC=$(mktemp)
chmod 600 "$TEMP_NETRC"
printf "machine api.anyon.cloud\nlogin %s\npassword %s\n" "${{ secrets.ANYON_USERNAME }}" "${{ secrets.ANYON_PASSWORD }}" > "$TEMP_NETRC"
response=$(curl -sS --netrc-file "$TEMP_NETRC" -X POST \
-H "Content-Type: application/json" \
https://api.anyon.cloud:5000/login 2>&1) || {
echo "::error::Failed to authenticate with Anyon"
rm -f "$TEMP_NETRC"
exit 1
}
rm -f "$TEMP_NETRC"
id_token=$(printf '%s' "$response" | jq -r '.id_token')
refresh_token=$(printf '%s' "$response" | jq -r '.refresh_token')
echo "::add-mask::$id_token"
echo "::add-mask::$refresh_token"
printf "key: %s\nrefresh: %s\n" "$id_token" "$refresh_token" > "$HOME/.anyon_config"
chmod 600 "$HOME/.anyon_config"
;;
fermioniq)
echo "### Setting up Fermioniq account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.FERMIONIQ_ACCESS_TOKEN_ID }}"
echo "::add-mask::${{ secrets.FERMIONIQ_ACCESS_TOKEN_SECRET }}"
echo "FERMIONIQ_ACCESS_TOKEN_ID=${{ secrets.FERMIONIQ_ACCESS_TOKEN_ID }}" >> $GITHUB_ENV
echo "FERMIONIQ_ACCESS_TOKEN_SECRET=${{ secrets.FERMIONIQ_ACCESS_TOKEN_SECRET }}" >> $GITHUB_ENV
echo "FERMIONIQ_PROJECT_ID=c86e2cb8-d776-41ae-8240-d3d55e18b7c3" >> $GITHUB_ENV
;;
infleqtion)
echo "### Setting up Infleqtion account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.SUPERSTAQ_API_KEY }}"
echo "SUPERSTAQ_API_KEY=${{ secrets.SUPERSTAQ_API_KEY }}" >> $GITHUB_ENV
;;
ionq)
echo "### Setting up IonQ account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.IONQ_API_KEY }}"
echo "IONQ_API_KEY=${{ secrets.IONQ_API_KEY }}" >> $GITHUB_ENV
;;
iqm)
echo "### Setting up IQM account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.IQM_TOKEN }}"
IQM_TOKEN_FILE="$(mktemp --suffix=.json)"
printf '{ "access_token": "%s" }' "${{ secrets.IQM_TOKEN }}" > "$IQM_TOKEN_FILE"
chmod 600 "$IQM_TOKEN_FILE"
echo "IQM_TOKENS_FILE=$IQM_TOKEN_FILE" >> "$GITHUB_ENV"
echo "IQM_SERVER_URL=https://cocos.resonance.meetiqm.com/pyrite:test" >> $GITHUB_ENV
;;
oqc)
echo "### Setting up OQC account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.OQC_URL }}"
echo "::add-mask::${{ secrets.BACKEND_LOGIN_EMAIL }}"
echo "::add-mask::${{ secrets.OQC_DEVICE }}"
echo "::add-mask::${{ secrets.OQC_AUTH_TOKEN }}"
echo "OQC_URL=${{ secrets.OQC_URL }}" >> $GITHUB_ENV
echo "OQC_EMAIL=${{ secrets.BACKEND_LOGIN_EMAIL }}" >> $GITHUB_ENV
echo "OQC_DEVICE=${{ secrets.OQC_DEVICE }}" >> $GITHUB_ENV
echo "OQC_AUTH_TOKEN=${{ secrets.OQC_AUTH_TOKEN }}" >> $GITHUB_ENV
;;
orca)
echo "### Setting up ORCA account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.ORCA_ACCESS_URL }}"
echo "ORCA_ACCESS_URL=${{ secrets.ORCA_ACCESS_URL }}" >> $GITHUB_ENV
;;
pasqal)
echo "### Setting up Pasqal account" >> $GITHUB_STEP_SUMMARY
python3 -m pip install pasqal-cloud
echo "::add-mask::${{ secrets.PASQAL_USERNAME }}"
echo "::add-mask::${{ secrets.PASQAL_PASSWORD }}"
echo "::add-mask::${{ secrets.PASQAL_PROJECT_ID }}"
TEMP_SCRIPT=$(mktemp --suffix=.py)
chmod 600 "$TEMP_SCRIPT"
printf '%s\n' \
"import os" \
"import sys" \
"from pasqal_cloud import SDK" \
"try:" \
" sdk = SDK(username=os.environ['PASQAL_USER'], password=os.environ['PASQAL_PASS'])" \
" sys.stdout.write(str(sdk.user_token()))" \
"except Exception as e:" \
" sys.stderr.write('Authentication failed\n')" \
" sys.exit(1)" > "$TEMP_SCRIPT"
PASQAL_AUTH_TOKEN=$(PASQAL_USER="${{ secrets.PASQAL_USERNAME }}" \
PASQAL_PASS="${{ secrets.PASQAL_PASSWORD }}" \
python3 "$TEMP_SCRIPT" 2>/dev/null) || {
echo "::error::Failed to authenticate with Pasqal"
rm -f "$TEMP_SCRIPT"
exit 1
}
rm -f "$TEMP_SCRIPT"
echo "::add-mask::$PASQAL_AUTH_TOKEN"
echo "PASQAL_AUTH_TOKEN=$PASQAL_AUTH_TOKEN" >> $GITHUB_ENV
echo "PASQAL_USERNAME=${{ secrets.PASQAL_USERNAME }}" >> $GITHUB_ENV
echo "PASQAL_PASSWORD=${{ secrets.PASQAL_PASSWORD }}" >> $GITHUB_ENV
echo "PASQAL_PROJECT_ID=${{ secrets.PASQAL_PROJECT_ID }}" >> $GITHUB_ENV
echo "PASQAL_MACHINE_TARGET=EMU_FREE" >> $GITHUB_ENV
;;
qci)
echo "### Setting up QCI account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.QCI_AUTH_TOKEN }}"
echo "QCI_AUTH_TOKEN=${{ secrets.QCI_AUTH_TOKEN }}" >> $GITHUB_ENV
;;
quantinuum)
echo "### Setting up Quantinuum account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.BACKEND_LOGIN_EMAIL }}"
echo "::add-mask::${{ secrets.QUANTINUUM_NEXUS_PASSWORD }}"
response=$(
curl -sS -w "%{http_code}" \
-c ~/.quantinuum_cookies.txt \
-X POST https://nexus.quantinuum.com/auth/login \
-H "Content-Type: application/json" \
-d '{ "email":"${{ secrets.BACKEND_LOGIN_EMAIL }}","password":"${{ secrets.QUANTINUUM_NEXUS_PASSWORD }}" }' \
-o /dev/null
) || {
echo "::error::Quantinuum login request failed (curl error)"
exit 1
}
if [ "$response" -ne 200 ]; then
echo "::error::Quantinuum login failed with HTTP $response"
exit 1
fi
if ! grep -q "myqos_oat" ~/.quantinuum_cookies.txt || \
! grep -q "myqos_id" ~/.quantinuum_cookies.txt; then
echo "::error::Quantinuum login succeeded (HTTP 200) but expected cookies (myqos_oat, myqos_id) were not set. Cookie jar contents:"
awk '{if(NF>=7){$7="REDACTED"} print}' ~/.quantinuum_cookies.txt
exit 1
fi
awk '$6 == "myqos_oat" {refresh=$7} $6 == "myqos_id" {key=$7} END {print "key: " key "\nrefresh: " refresh}' ~/.quantinuum_cookies.txt > ~/.quantinuum_config
chmod 600 ~/.quantinuum_config
rm ~/.quantinuum_cookies.txt
;;
scaleway)
echo "### Setting up Scaleway account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.SCW_PROJECT_ID }}"
echo "::add-mask::${{ secrets.SCW_SECRET_KEY }}"
echo "SCW_PROJECT_ID=${{ secrets.SCW_PROJECT_ID }}" >> $GITHUB_ENV
echo "SCW_SECRET_KEY=${{ secrets.SCW_SECRET_KEY }}" >> $GITHUB_ENV
;;
tii)
echo "### Setting up TII account" >> $GITHUB_STEP_SUMMARY
echo "::add-mask::${{ secrets.TII_API_TOKEN }}"
echo "::add-mask::${{ secrets.TII_PROJECT }}"
echo "TII_API_TOKEN=${{ secrets.TII_API_TOKEN }}" >> $GITHUB_ENV
echo "TII_PROJECT=${{ secrets.TII_PROJECT }}" >> $GITHUB_ENV
;;
esac
shell: bash
# Run the provider-specific tests
- name: Run tests for ${{ matrix.provider }}
run: |
echo "### Testing ${{ matrix.provider }}" >> $GITHUB_STEP_SUMMARY
export CUDAQ_LOG_LEVEL="info"
set +e # Allow script to keep going through errors
test_err_sum=0
test_skip_sum=0
# Single loop handles both C++ and Python tests
for filename in ${{ steps.gettests.outputs.testlist }}; do
# Check if file exists
if [ ! -e "$filename" ]; then
echo "::warning::File not found: $filename"
echo ":warning: Test skipped (file not found): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
continue
fi
case "${{ matrix.provider }}" in
anyon)
nvq++ -v $filename -DSYNTAX_CHECK --target anyon --anyon-machine telegraph-8q
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
;;
fermioniq)
if [[ "$filename" == *.cpp ]]; then
nvq++ --target fermioniq --fermioniq-project-id $FERMIONIQ_PROJECT_ID $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
infleqtion)
if [[ "$filename" == *.cpp ]]; then
nvq++ --target infleqtion $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
ionq)
nvq++ -v $filename --target ionq
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
;;
iqm)
nvq++ -DSYNTAX_CHECK --target iqm $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
;;
oqc)
nvq++ -DSYNTAX_CHECK --target oqc $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
;;
orca)
if [[ "$filename" == *.cpp ]]; then
nvq++ --target orca --orca-url $ORCA_ACCESS_URL $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
pasqal)
if [[ "$filename" == *.cpp ]]; then
nvq++ --target pasqal --pasqal-machine $PASQAL_MACHINE_TARGET $filename
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename (direct execution)" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename (direct execution)" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
if [ "$(uname)" = "Linux" ] && [ "$(uname -m)" = "x86_64" ] && \
[ -f "${QRMI_INSTALL_PREFIX:-/usr/local/qrmi}/lib64/libqrmi.so" ]; then
PASQAL_MACHINE_TARGET=qrmi \
SLURM_JOB_QPU_RESOURCES=EMU_FREE \
EMU_FREE_QRMI_PASQAL_CLOUD_PROJECT_ID=$PASQAL_PROJECT_ID \
python3 "$filename" 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename (qrmi execution)" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename (qrmi execution)" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":information_source: Skipped QRMI test for $filename (QRMI not available in this build)" >> $GITHUB_STEP_SUMMARY
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
qci)
nvq++ -v $filename --target qci
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
;;
quantinuum)
if [[ "$filename" == *.cpp ]]; then
if [[ "$filename" == *"quantinuum_ng/"* ]]; then
echo "### Running Quantinuum-NG test" >> $GITHUB_STEP_SUMMARY
nvq++ -v $filename --target quantinuum --quantinuum-machine Helios-1E --quantinuum-project ${{ secrets.QUANTINUUM_NEXUS_PROJECT_ID }} --quantinuum-max-cost 15 --quantinuum-max-qubits 7 --quantinuum-noisy-simulation false
else
echo "### Running standard Quantinuum test" >> $GITHUB_STEP_SUMMARY
nvq++ -v $filename -DSYNTAX_CHECK --target quantinuum --quantinuum-machine H2-1SC --quantinuum-project ${{ secrets.QUANTINUUM_NEXUS_PROJECT_ID }}
fi
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
echo "### Running Quantinuum Python test" >> $GITHUB_STEP_SUMMARY
QUANTINUUM_NEXUS_PROJECT=${{ secrets.QUANTINUUM_NEXUS_PROJECT_ID }} python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
scaleway)
if [[ "$filename" == *.cpp ]]; then
nvq++ -v $filename --target scaleway --scaleway-machine EMU-CUDAQ-64C-512M --scaleway-deduplication-id ghci-workflow-testing
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
tii)
if [[ "$filename" == *.cpp ]]; then
nvq++ -v $filename --target tii --tii-device tii-sim --tii-project ${{ secrets.TII_PROJECT }}
test_status=$?
if [ $test_status -eq 0 ]; then
./a.out
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo ":x: Test failed (failed to compile): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
elif [[ "$filename" == *.py ]]; then
python3 $filename 1> /dev/null
test_status=$?
if [ $test_status -eq 0 ]; then
echo ":white_check_mark: Successfully ran test: $filename" >> $GITHUB_STEP_SUMMARY
else
echo ":x: Test failed (failed to execute): $filename" >> $GITHUB_STEP_SUMMARY
test_err_sum=$((test_err_sum+1))
fi
else
echo "::warning::Unsupported file type: $filename"
echo ":warning: Test skipped (unsupported file type): $filename" >> $GITHUB_STEP_SUMMARY
test_skip_sum=$((test_skip_sum+1))
fi
;;
esac
done
# Print summary
if [ $test_skip_sum -gt 0 ]; then
echo "::warning::${test_skip_sum} tests skipped"
fi
set -e # Re-enable exit code error checking
if [ ! $test_err_sum -eq 0 ]; then
echo "::error::${test_err_sum} tests failed. See step summary for a list of failures"
exit 1
fi
# Clean up
rm -f "$HOME/.anyon_config" "$HOME/.quantinuum_config"
shell: bash