Skip to content

Commit 12418a7

Browse files
authored
Additional publishing jobs (#1121)
1 parent 4939871 commit 12418a7

File tree

5 files changed

+196
-26
lines changed

5 files changed

+196
-26
lines changed

.github/workflows/docker_images.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,7 @@ jobs:
612612
runs-on: ${{ needs.metadata.outputs.runner }}
613613
permissions:
614614
contents: read
615+
packages: read
615616

616617
steps:
617618
- name: Checkout repository
@@ -722,6 +723,9 @@ jobs:
722723
# all jobs that depend on it will need to add the same condition.
723724
if: always() && !cancelled() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
724725
runs-on: ${{ needs.metadata.outputs.runner }}
726+
permissions:
727+
contents: read
728+
packages: read
725729

726730
steps:
727731
- name: Checkout repository
@@ -765,7 +769,7 @@ jobs:
765769
docker cp scripts/validate_container.sh cuda-quantum:"/home/cudaq/validate_container.sh"
766770
# In containers without GPU support, UCX does not work properly since it is configured to work with GPU-support.
767771
# Hence, don't enforce UCX when running these tests.
768-
(docker exec cuda-quantum bash -c "unset OMPI_MCA_pml && bash validate_container.sh" > /tmp/validation.out) && passed=true || passed=false
772+
(docker exec cuda-quantum bash -c "unset OMPI_MCA_pml && bash validate_container.sh" | tee /tmp/validation.out) && passed=true || passed=false
769773
docker stop cuda-quantum
770774
771775
if ! $passed; then

.github/workflows/prebuilt_binaries.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ jobs:
174174
context: .
175175
file: ./docker/release/installer.Dockerfile
176176
build-args: |
177-
release_version=${{ steps.config.outputs.cudaq_version }}
178177
base_image=${{ steps.config.outputs.image_name }}@${{ steps.docker_build.outputs.digest }}
179178
platforms: ${{ inputs.platform }}
180179
outputs: type=local,dest=/tmp/install
@@ -315,7 +314,7 @@ jobs:
315314
- name: Sanity checks
316315
run: |
317316
docker run --rm -dit --name cuda-quantum validation:local
318-
(docker exec cuda-quantum bash -l validate.sh > /tmp/validation.out) && passed=true || passed=false
317+
(docker exec cuda-quantum bash -l validate.sh | tee /tmp/validation.out) && passed=true || passed=false
319318
docker stop cuda-quantum
320319
321320
if ! $passed; then
@@ -433,7 +432,7 @@ jobs:
433432
434433
staging:
435434
name: Staging
436-
needs: [build_installer, validation]
435+
needs: [build_installer, build_openmpi, validation]
437436
if: inputs.environment
438437
runs-on: ubuntu-latest
439438
permissions: {}
@@ -452,7 +451,9 @@ jobs:
452451
453452
mkdir -p "$(dirname "$info_file")" && rm -rf "$info_file"
454453
echo "source-sha: ${{ github.sha }}" >> "$info_file"
455-
echo "cuda-quantum-installer-image: $image_hash" >> "$info_file"
454+
echo "cuda-quantum-assets-image: $image_hash" >> "$info_file"
455+
echo "platform-base-image: ${{ inputs.platform_base_image }}" >> "$info_file"
456+
echo "openmpi-build-cache: ${{ needs.build_openmpi.outputs.build_cache }}" >> "$info_file"
456457
echo "platform: ${{ inputs.platform }}" >> "$info_file"
457458
458459
- name: Upload build info

.github/workflows/publishing.yml

Lines changed: 183 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
if [ "${name%_publishing}" != "$name" ]; then
8282
download "$url" "$name"
8383
platforms=`cat "$name.txt" | egrep -o 'platforms?: \S*' | cut -d ' ' -f 2`
84-
image_hash=`cat "$name.txt" | grep -o -e "cuda-quantum-dev-image: \S*" -e "cuda-quantum-installer-image: \S*" -e "cuda-quantum-wheeldeps-image: \S*" | cut -d ' ' -f 2`
84+
image_hash=`cat "$name.txt" | grep -o -e "cuda-quantum-dev-image: \S*" -e "cuda-quantum-assets-image: \S*" -e "cuda-quantum-wheeldeps-image: \S*" | cut -d ' ' -f 2`
8585
if [ -n "$(echo $platforms | grep ',')" ]; then runner=linux-amd64-cpu8
8686
else runner=$(echo $platforms | tr / -)-cpu8
8787
fi
@@ -178,7 +178,7 @@ jobs:
178178
done
179179
180180
for file in ${{ join(fromJson(steps.artifacts.outputs.installers).info_files, ' ') }}; do
181-
create_assets $file cuda-quantum-installer-image cuda-quantum-installer '${{ steps.artifacts.outputs.installers }}'
181+
create_assets $file cuda-quantum-assets-image cuda-quantum-assets '${{ steps.artifacts.outputs.installers }}'
182182
done
183183
184184
- name: Wait for assets
@@ -253,7 +253,6 @@ jobs:
253253
for file in ${{ join(fromJson(steps.artifacts.outputs.installers).info_files, ' ') }}; do
254254
download_assets $file '${{ steps.artifacts.outputs.installers }}'
255255
done
256-
257256
env:
258257
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
259258

@@ -290,7 +289,19 @@ jobs:
290289
uses: actions/checkout@v3
291290
with:
292291
ref: ${{ needs.assets.outputs.github_commit }}
293-
token: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
292+
293+
- name: Log in to DockerHub
294+
uses: docker/login-action@v3
295+
with:
296+
username: ${{ secrets.DOCKERHUB_USERNAME }}
297+
password: ${{ secrets.DOCKERHUB_READONLY_TOKEN }}
298+
299+
- name: Log in to GitHub CR
300+
uses: docker/login-action@v3
301+
with:
302+
registry: ghcr.io
303+
username: ${{ github.actor }}
304+
password: ${{ github.token }}
294305

295306
- name: Load docker assets
296307
uses: actions/download-artifact@v4
@@ -339,12 +350,6 @@ jobs:
339350
env:
340351
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
341352

342-
- name: Log in to DockerHub
343-
uses: docker/login-action@v3
344-
with:
345-
username: ${{ secrets.DOCKERHUB_USERNAME }}
346-
password: ${{ secrets.DOCKERHUB_READONLY_TOKEN }}
347-
348353
- name: Log in to default registry
349354
if: steps.release_info.outputs.push_to_ngc != 'true'
350355
uses: docker/login-action@v3
@@ -443,6 +448,111 @@ jobs:
443448
outputs: |
444449
image_hash: ${{ steps.release_info.outputs.image_name }}@${{ steps.cudaq_build.outputs.digest }}
445450
451+
cudaq_installer:
452+
name: CUDA Quantum installer
453+
if: ${{ toJson(fromJson(needs.assets.outputs.installers).info_files) != '[]' }}
454+
needs: assets
455+
runs-on: ubuntu-latest
456+
permissions:
457+
contents: read
458+
packages: write
459+
id-token: write
460+
461+
environment:
462+
name: ghcr-deployment
463+
url: ${{ vars.deployment_url }}
464+
465+
strategy:
466+
matrix:
467+
info_file: ${{ fromJson(needs.assets.outputs.installers).info_files }}
468+
fail-fast: false
469+
470+
steps:
471+
- name: Checkout repository
472+
uses: actions/checkout@v3
473+
with:
474+
ref: ${{ needs.assets.outputs.github_commit }}
475+
476+
- name: Load build assets
477+
uses: actions/download-artifact@v4
478+
with:
479+
name: ${{ needs.assets.outputs.retrieved_assets }}
480+
path: /tmp/assets
481+
482+
- name: Retrieve assets
483+
id: release_info
484+
run: |
485+
release_id=${{ fromJson(needs.assets.outputs.installers)[format('{0}', matrix.info_file)].release_id }}
486+
assets_folder=assets && mkdir "$assets_folder" && cd "$assets_folder"
487+
cp -r /tmp/assets/${{ matrix.info_file }}/. "$(pwd)"
488+
489+
build_info=${{ matrix.info_file }}*
490+
platform=`cat $build_info | grep -o 'platform: \S*' | cut -d ' ' -f 2`
491+
platform_id=`echo $platform | sed 's/linux\///g' | tr -d ' '`
492+
platform_arch=`([ "$platform_id" == "amd64" ] && echo x86_64) || ([ "$platform_id" == "arm64" ] && echo aarch64) || echo any`
493+
assets_image=`cat $build_info | grep -o 'cuda-quantum-assets-image: \S*' | cut -d ' ' -f 2`
494+
platform_base_image=`cat $build_info | grep -o 'platform-base-image: \S*' | cut -d ' ' -f 2`
495+
openmpi_buildcache=`cat $build_info | grep -o 'openmpi-build-cache: \S*' | cut -d ' ' -f 2`
496+
for file in `ls *zip`; do unzip "$file" && rm "$file"; done && cd -
497+
498+
echo "release_id=$release_id" >> $GITHUB_OUTPUT
499+
echo "platform=$platform" >> $GITHUB_OUTPUT
500+
echo "platform_arch=$platform_arch" >> $GITHUB_OUTPUT
501+
echo "assets_image=$assets_image" >> $GITHUB_OUTPUT
502+
echo "platform_base_image=$platform_base_image" >> $GITHUB_OUTPUT
503+
echo "openmpi_buildcache=$openmpi_buildcache" >> $GITHUB_OUTPUT
504+
env:
505+
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
506+
507+
- name: Log in to DockerHub
508+
uses: docker/login-action@v3
509+
with:
510+
username: ${{ secrets.DOCKERHUB_USERNAME }}
511+
password: ${{ secrets.DOCKERHUB_READONLY_TOKEN }}
512+
513+
- name: Log in to default registry
514+
if: steps.release_info.outputs.push_to_ngc != 'true'
515+
uses: docker/login-action@v3
516+
with:
517+
registry: ${{ vars.registry }}
518+
username: ${{ github.actor }}
519+
password: ${{ github.token }}
520+
521+
- name: Set up buildx runner
522+
uses: docker/setup-buildx-action@v2
523+
524+
- name: Build installer
525+
uses: docker/build-push-action@v5
526+
with:
527+
context: .
528+
file: ./docker/release/installer.Dockerfile
529+
build-args: |
530+
base_image=${{ steps.release_info.outputs.assets_image }}
531+
additional_components=assets
532+
platforms: ${{ steps.release_info.outputs.platform }}
533+
outputs: type=local,dest=/tmp/install
534+
535+
- name: Update release information
536+
run: |
537+
release_id=${{ steps.release_info.outputs.release_id }}
538+
gh release view $release_id --json body --jq .body > rel_notes.txt
539+
header_length=`cat rel_notes.txt | grep -n "Release notes generated" | cut -d ':' -f 1`
540+
head -n $(($header_length - 1)) rel_notes.txt > new_notes.txt
541+
echo -e "\nImage to create ${{ steps.release_info.outputs.platform }} installer:\n" >> new_notes.txt
542+
echo "- cuda-quantum-assets: ${{ steps.release_info.outputs.assets_image }}" >> new_notes.txt
543+
(echo && tail -n +$header_length rel_notes.txt) >> new_notes.txt
544+
gh release edit $release_id -R ${{ github.repository }} --notes-file new_notes.txt
545+
env:
546+
GH_TOKEN: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
547+
548+
- name: Upload installer
549+
uses: actions/upload-artifact@v4
550+
with:
551+
name: ${{ steps.release_info.outputs.platform_arch }}-installer
552+
path: /tmp/install
553+
retention-days: 1
554+
if-no-files-found: error
555+
446556
cudaq_wheels:
447557
name: CUDA Quantum Python wheels
448558
if: ${{ toJson(fromJson(needs.assets.outputs.python_wheels).info_files) != '[]' }}
@@ -467,7 +577,6 @@ jobs:
467577
uses: actions/checkout@v3
468578
with:
469579
ref: ${{ needs.assets.outputs.github_commit }}
470-
token: ${{ secrets.REPO_BOT_ACCESS_TOKEN }}
471580

472581
- name: Load wheel assets
473582
uses: actions/download-artifact@v4
@@ -528,7 +637,7 @@ jobs:
528637
- name: Upload wheels
529638
uses: actions/upload-artifact@v4
530639
with:
531-
name: ${{ steps.release_info.outputs.platform_arch }}-wheels
640+
name: ${{ steps.release_info.outputs.platform_arch }}-py${{ matrix.python_version }}-wheels
532641
path: /tmp/wheels
533642
retention-days: 1
534643
if-no-files-found: error
@@ -561,7 +670,7 @@ jobs:
561670

562671
config:
563672
name: Configure validation
564-
needs: [cudaq_hpc, cudaq_wheels]
673+
needs: [cudaq_hpc, cudaq_installer, cudaq_wheels]
565674
runs-on: ubuntu-latest
566675

567676
outputs:
@@ -580,11 +689,67 @@ jobs:
580689
images=`echo '${{ steps.read_json.outputs.result }}' | jq '[.image_hash[] | select(. != "")]'`
581690
echo "docker_images=$(echo $images)" >> $GITHUB_OUTPUT
582691
583-
validation:
584-
name: Validation
585-
needs: [assets, config]
692+
installer_validation:
693+
name: Installer validation
694+
needs: [assets, cudaq_installer]
586695
runs-on: linux-amd64-gpu-v100-latest-1
587696

697+
container:
698+
image: redhat/ubi8:8.0
699+
options: --user root
700+
env:
701+
NVIDIA_VISIBLE_DEVICES: ${{ env.NVIDIA_VISIBLE_DEVICES }}
702+
TERM: xterm
703+
704+
steps:
705+
- name: Checkout repository
706+
uses: actions/checkout@v3
707+
with:
708+
ref: ${{ needs.assets.outputs.github_commit }}
709+
710+
- name: Load installer
711+
uses: actions/download-artifact@v4
712+
with:
713+
name: x86_64-installer
714+
path: /tmp/install
715+
716+
- name: Install runtime dependencies
717+
run: |
718+
dnf install -y --nobest --setopt=install_weak_deps=False \
719+
'dnf-command(config-manager)' gcc-toolset-12
720+
enable_script=`find / -path '*gcc*' -path '*12*' -name enable`
721+
. "$enable_script"
722+
. scripts/configure_build.sh install-cudart
723+
724+
# TODO: Add nvidia-mgpu to the arguments for validate_container.sh
725+
# (Currently missing an rpath, since it is not finding libcustatevec.so.1)
726+
- name: Install and run sanity checks
727+
shell: bash
728+
run: |
729+
chmod +x /tmp/install/install_cuda_quantum.*
730+
/tmp/install/install_cuda_quantum.* --accept
731+
rm -rf examples && mv docs/sphinx/examples examples && rm -rf examples/python
732+
bash -l scripts/validate_container.sh nvidia tensornet | tee /tmp/validation.out
733+
734+
- name: Create summary
735+
if: always() && !cancelled()
736+
run: |
737+
if [ -f /tmp/validation.out ]; then
738+
echo "## Validation" >> $GITHUB_STEP_SUMMARY
739+
echo "The validation of the CUDA Quantum installation produced the following output:" >> $GITHUB_STEP_SUMMARY
740+
echo '```text' >> $GITHUB_STEP_SUMMARY
741+
cat /tmp/validation.out >> $GITHUB_STEP_SUMMARY
742+
echo '```' >> $GITHUB_STEP_SUMMARY
743+
fi
744+
745+
image_validation:
746+
name: Docker image validation
747+
needs: config
748+
runs-on: linux-amd64-gpu-v100-latest-1
749+
permissions:
750+
contents: read
751+
packages: read
752+
588753
strategy:
589754
matrix:
590755
image_hash: ${{ fromJson(needs.config.outputs.docker_images) }}
@@ -671,7 +836,7 @@ jobs:
671836
672837
create_release:
673838
name: CUDA Quantum Release
674-
needs: [assets, cudaq_hpc, cudaq_wheels, validation]
839+
needs: [assets, cudaq_hpc, cudaq_wheels, image_validation]
675840
if: needs.assets.outputs.release_title
676841
runs-on: ubuntu-latest
677842

@@ -721,7 +886,7 @@ jobs:
721886

722887
clean_up:
723888
name: Clean up
724-
needs: [assets, cudaq_hpc, cudaq_wheels, create_release, validation]
889+
needs: [assets, cudaq_hpc, cudaq_wheels, create_release, image_validation]
725890
# Force this job to run even when some of the dependencies above are skipped.
726891
if: always() && !cancelled() && needs.assets.result != 'skipped' && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled')
727892
runs-on: ubuntu-latest

docker/release/cudaq.ext.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ RUN apt-get install -y --no-install-recommends \
3131
# just here for convenience:
3232
curl jq
3333
RUN if [ -x "$(command -v pip)" ]; then \
34-
apt-get install -y --no-install-recommends gcc \
34+
apt-get install -y --no-install-recommends gcc libpython3-dev \
3535
&& pip install --no-cache-dir jupyterlab matplotlib; \
3636
if [ -n "$MPI_ROOT" ]; then \
3737
pip install --no-cache-dir mpi4py~=3.1; \

docker/release/installer.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ ARG base_image=ghcr.io/nvidia/cuda-quantum-assets:amd64-gcc11-main
1818
ARG additional_components=none
1919

2020
FROM $base_image as additional_components_none
21-
ONBUILD RUN echo "No additional components included."
21+
RUN echo "No additional components included."
2222
FROM $base_image as additional_components_assets
23-
ONBUILD COPY assets /assets
23+
COPY assets /assets/
2424
RUN source /cuda-quantum/scripts/configure_build.sh && \
2525
for folder in `find /assets/*$(uname -m)/* -maxdepth 0 -type d`; \
2626
do bash /cuda-quantum/scripts/migrate_assets.sh -s "$folder" && rm -rf "$folder"; \

0 commit comments

Comments
 (0)