From 379b67586e0dc00b10392b6eee9c1c3473f33040 Mon Sep 17 00:00:00 2001 From: Melody Ren Date: Thu, 31 Jul 2025 14:23:49 -0700 Subject: [PATCH 1/5] Add a nightly docker image build job Signed-off-by: Melody Ren --- .github/workflows/build_docker.yaml | 8 +- .github/workflows/nightly_build.yaml | 108 +++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nightly_build.yaml diff --git a/.github/workflows/build_docker.yaml b/.github/workflows/build_docker.yaml index 9ae964f1..e8eacb4c 100644 --- a/.github/workflows/build_docker.yaml +++ b/.github/workflows/build_docker.yaml @@ -23,6 +23,11 @@ on: type: string description: Docker tag to use for published image (e.g. ghcr.io/nvidia/cudaqx:latest-pub, defaults to private repo if blank) required: false + push: + type: boolean + description: Whether to push the built image. Set to `false` to build & load only. Default is true. + required: false + default: true jobs: build-combined-img: @@ -93,4 +98,5 @@ jobs: org.opencontainers.image.revision=${{ github.sha }} tags: ${{ inputs.pub_tag || format('ghcr.io/nvidia/private/cuda-quantum:{0}-cudaqx', env.tag) }} platforms: linux/amd64,linux/arm64 - push: true + push: ${{ inputs.push }} + load: ${{ !inputs.push }} diff --git a/.github/workflows/nightly_build.yaml b/.github/workflows/nightly_build.yaml new file mode 100644 index 00000000..68b60a8e --- /dev/null +++ b/.github/workflows/nightly_build.yaml @@ -0,0 +1,108 @@ +name: Nightly Combined Image + Tests + +on: + workflow_dispatch: + inputs: + branch: + description: 'Git branch or tag to build All-libs from' + required: true + default: 'main' + base-image: + description: 'CUDA-Quantum image to layer onto' + required: false + default: 'nvcr.io/nvidia/nightly/cuda-quantum:cu12-latest' + schedule: + - cron: '0 3 * * *' # 3 AM UTC + +env: + RELEASE_WORKFLOW: "All libs (Release)" + COMBINED_WORKFLOW: "Build Combined Docker Images" + COMBINED_TAG: "test-temp" + +jobs: + all-libs: + name: Run All-libs build (with optional docker-files ZIP) + runs-on: ubuntu-latest + outputs: + run_id: ${{ steps.dispatch.outputs.run_id }} + steps: + - name: (Optional) Discover docker-files-*.zip asset + id: find_docker + run: | + ASSET=$(gh api repos/${GITHUB_REPOSITORY}/releases \ + --jq '.[] + | select(.draft==true) + | .assets[] + | select(.name | test("^docker-files-[0-9]+\\.zip$")) + | .name' \ + | sort -t- -k3 -n \ + | tail -n1) + if [ -n "$ASSET" ]; then + echo "asset_name=$ASSET" >> $GITHUB_OUTPUT + fi + + - name: Dispatch All-libs workflow + id: dispatch + run: | + CMD="gh workflow run \"${{ env.RELEASE_WORKFLOW }}\" \ + --ref \"${{ github.event.inputs.branch }}\"" + if [ -n "${{ steps.find_docker.outputs.asset_name }}" ]; then + CMD="$CMD --field assets_tag=\"${{ steps.find_docker.outputs.asset_name }}\"" + fi + eval $CMD + RID=$(gh run list \ + --workflow "${{ env.RELEASE_WORKFLOW }}" \ + --branch "${{ github.event.inputs.branch }}" \ + --limit 1 --json databaseId \ + --jq '.[0].databaseId') + echo "run_id=$RID" >> $GITHUB_OUTPUT + + - name: Wait for All-libs to finish + run: gh run watch ${{ steps.dispatch.outputs.run_id }} + + build-combined: + name: Run Combined-image workflow + needs: all-libs + runs-on: ubuntu-latest + outputs: + combined_run_id: ${{ steps.dispatch.outputs.run_id }} + steps: + - name: Dispatch Combined workflow + id: dispatch + run: | + CMD="gh workflow run \"${{ env.COMBINED_WORKFLOW }}\" \ + --ref \"${{ github.event.inputs.branch }}\" \ + --field base_image=\"${{ github.event.inputs.base-image }}\" \ + --field artifacts_from_run=\"${{ needs.all-libs.outputs.run_id }}\" \ + --field pub_tag=\"${{ env.COMBINED_TAG }}\" \ + --field push=false" + + eval $CMD + + CID=$(gh run list \ + --workflow "${{ env.COMBINED_WORKFLOW }}" \ + --branch "${{ github.event.inputs.branch }}" \ + --limit 1 --json databaseId \ + --jq '.[0].databaseId') + echo "run_id=$CID" >> $GITHUB_OUTPUT + + - name: Wait for Combined to finish + run: gh run watch ${{ steps.dispatch.outputs.run_id }} + + nightly-tests: + name: Nightly Smoke Tests + needs: build-combined + runs-on: ubuntu-latest + container: + image: ghcr.io/nvidia/private/cuda-quantum:${{ env.COMBINED_TAG }} + options: --user root + steps: + - name: Checkout test harness + uses: actions/checkout@v4 + + - name: Install deps & run tests + run: echo "TODO: run tests" + + - name: Clean up local image + if: always() + run: docker image rm ghcr.io/nvidia/private/cuda-quantum:${{ env.COMBINED_TAG }} From c31d7a4ab071adde13eb6203159790724ec6bd06 Mon Sep 17 00:00:00 2001 From: Melody Ren Date: Thu, 31 Jul 2025 14:33:17 -0700 Subject: [PATCH 2/5] Fix syntax error Signed-off-by: Melody Ren --- .github/workflows/nightly_build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/nightly_build.yaml b/.github/workflows/nightly_build.yaml index 68b60a8e..695bb39f 100644 --- a/.github/workflows/nightly_build.yaml +++ b/.github/workflows/nightly_build.yaml @@ -1,4 +1,4 @@ -name: Nightly Combined Image + Tests +name: Nightly Combined Image and Tests on: workflow_dispatch: @@ -101,7 +101,8 @@ jobs: uses: actions/checkout@v4 - name: Install deps & run tests - run: echo "TODO: run tests" + run: | + echo "TODO: run tests" - name: Clean up local image if: always() From 7cd10a83ca10ef213395fee1ab8eb4b25b83ffb3 Mon Sep 17 00:00:00 2001 From: Melody Ren Date: Thu, 31 Jul 2025 15:05:47 -0700 Subject: [PATCH 3/5] Fix errors Signed-off-by: Melody Ren --- .github/workflows/nightly_build.yaml | 37 ++++++++++++---------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nightly_build.yaml b/.github/workflows/nightly_build.yaml index 695bb39f..dec92f69 100644 --- a/.github/workflows/nightly_build.yaml +++ b/.github/workflows/nightly_build.yaml @@ -23,9 +23,16 @@ jobs: all-libs: name: Run All-libs build (with optional docker-files ZIP) runs-on: ubuntu-latest + permissions: + contents: read + actions: write + workflows: write outputs: run_id: ${{ steps.dispatch.outputs.run_id }} steps: + - name: Checkout + uses: actions/checkout@v4 + - name: (Optional) Discover docker-files-*.zip asset id: find_docker run: | @@ -64,9 +71,17 @@ jobs: name: Run Combined-image workflow needs: all-libs runs-on: ubuntu-latest + permissions: + contents: read + actions: write + workflows: write outputs: - combined_run_id: ${{ steps.dispatch.outputs.run_id }} + run_id: ${{ steps.dispatch.outputs.run_id }} + image_tag: ${{ env.COMBINED_TAG }} steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Dispatch Combined workflow id: dispatch run: | @@ -74,7 +89,6 @@ jobs: --ref \"${{ github.event.inputs.branch }}\" \ --field base_image=\"${{ github.event.inputs.base-image }}\" \ --field artifacts_from_run=\"${{ needs.all-libs.outputs.run_id }}\" \ - --field pub_tag=\"${{ env.COMBINED_TAG }}\" \ --field push=false" eval $CMD @@ -88,22 +102,3 @@ jobs: - name: Wait for Combined to finish run: gh run watch ${{ steps.dispatch.outputs.run_id }} - - nightly-tests: - name: Nightly Smoke Tests - needs: build-combined - runs-on: ubuntu-latest - container: - image: ghcr.io/nvidia/private/cuda-quantum:${{ env.COMBINED_TAG }} - options: --user root - steps: - - name: Checkout test harness - uses: actions/checkout@v4 - - - name: Install deps & run tests - run: | - echo "TODO: run tests" - - - name: Clean up local image - if: always() - run: docker image rm ghcr.io/nvidia/private/cuda-quantum:${{ env.COMBINED_TAG }} From 49a5af933101f744479e4d8a7170a1c8d896f4c5 Mon Sep 17 00:00:00 2001 From: Melody Ren Date: Thu, 31 Jul 2025 15:07:14 -0700 Subject: [PATCH 4/5] Fix errors2 Signed-off-by: Melody Ren --- .github/workflows/nightly_build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/nightly_build.yaml b/.github/workflows/nightly_build.yaml index dec92f69..c086804e 100644 --- a/.github/workflows/nightly_build.yaml +++ b/.github/workflows/nightly_build.yaml @@ -26,7 +26,6 @@ jobs: permissions: contents: read actions: write - workflows: write outputs: run_id: ${{ steps.dispatch.outputs.run_id }} steps: @@ -74,7 +73,6 @@ jobs: permissions: contents: read actions: write - workflows: write outputs: run_id: ${{ steps.dispatch.outputs.run_id }} image_tag: ${{ env.COMBINED_TAG }} From c496a15fd35113b390e9a72151482ea6ec237d62 Mon Sep 17 00:00:00 2001 From: Melody Ren Date: Thu, 31 Jul 2025 15:19:37 -0700 Subject: [PATCH 5/5] Add git auth Signed-off-by: Melody Ren --- .github/workflows/nightly_build.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/nightly_build.yaml b/.github/workflows/nightly_build.yaml index c086804e..a5a64dff 100644 --- a/.github/workflows/nightly_build.yaml +++ b/.github/workflows/nightly_build.yaml @@ -32,6 +32,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Log in to GitHub CR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.PACKAGE_TOKEN || github.token }} + - name: (Optional) Discover docker-files-*.zip asset id: find_docker run: | @@ -80,6 +87,13 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Log in to GitHub CR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.PACKAGE_TOKEN || github.token }} + - name: Dispatch Combined workflow id: dispatch run: |