diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3a78c4c15..1a7af08a9 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -41,6 +41,13 @@ on: description: "build_type: one of [branch, nightly, pull-request]" type: string default: nightly + # Triggering 'test.yaml' from inside 'build.yaml' allows the use of the 'needs:' mechanism + # to ensure tests only start runniing once the builds they need are complete. + trigger-tests: + description: | + If 'true', trigger the test workflow after all builds complete. + type: boolean + default: false concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -213,6 +220,39 @@ jobs: date: ${{ inputs.date }} package-name: cuopt_sh_client package-type: python + tests: + # Docker image build / tests aren't necessary for the 'test.yaml' workflow, + # so 'test.yaml' can be triggered without waiting for those. + needs: + - upload-conda + - wheel-publish-cuopt + - wheel-publish-cuopt-mps-parser + - wheel-publish-cuopt-server + - wheel-publish-cuopt-sh-client + - wheel-publish-libcuopt + if: inputs.trigger-tests + runs-on: ubuntu-latest + # ref: https://docs.github.com/en/actions/reference/security/secure-use#use-an-intermediate-environment-variable + env: + GH_TOKEN: ${{ github.token }} + INPUT_BRANCH: "${{ inputs.branch }}" + INPUT_BUILD_TYPE: "${{ inputs.build_type }}" + INPUT_DATE: "${{ inputs.date }}" + INPUT_SHA: "${{ inputs.sha }}" + steps: + - name: trigger-test-workflow + run: | + # NOTE: '--ref' is the branch to pull the workflow file from, 'branch' input is the branch + # to pull the actual cuOpt source code from + gh workflow run \ + --repo NVIDIA/cuopt \ + --ref "${{ github.ref }}" \ + 'test.yaml' \ + -f branch="${INPUT_BRANCH}" \ + -f build_type="${INPUT_BUILD_TYPE}" \ + -f date="${INPUT_DATE}" \ + -f sha="${INPUT_SHA}" + build-images: needs: - wheel-publish-cuopt diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 2feece10e..0b118cdac 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -7,8 +7,9 @@ on: jobs: - trigger-build: + trigger-nightly-builds-and-tests: runs-on: ubuntu-latest + timeout-minutes: 30 strategy: matrix: include: @@ -23,55 +24,13 @@ jobs: export DATE=$(date +%F) export SHA=$(gh api -q '.commit.sha' "repos/nvidia/cuopt/branches/${CUOPT_BRANCH}") - gh workflow run build.yaml \ + # NOTE: '--ref' is the branch to pull the workflow file from, 'branch' input is the branch + # to pull the actual cuOpt source code from + gh workflow run build.yaml \ + --repo NVIDIA/cuopt \ + --ref "${{ github.ref }}" \ -f branch="${CUOPT_BRANCH}" \ - -f sha="${SHA}" \ - -f date="${DATE}" \ - -f build_type=nightly - - # Wait a short bit for the workflow to register (optional) - sleep 3 - - # Get the latest run ID for this workflow on this branch - RUN_ID=$(gh run list --workflow=build.yaml --branch="${CUOPT_BRANCH}" --json databaseId --limit 1 | jq -r '.[0].databaseId') - - STATUS=$(gh run view $RUN_ID --json status,conclusion --jq '.status') - CONCLUSION=$(gh run view $RUN_ID --json status,conclusion --jq '.conclusion') - - while [[ "$STATUS" != "completed" || "$CONCLUSION" == "null" ]]; do - echo "Status: $STATUS, Conclusion: $CONCLUSION — waiting 10 seconds..." - sleep 10 - STATUS=$(gh run view $RUN_ID --json status,conclusion --jq '.status') - CONCLUSION=$(gh run view $RUN_ID --json status,conclusion --jq '.conclusion') - done - - echo "Workflow run finished with conclusion: $CONCLUSION" - - if [[ "$CONCLUSION" != "success" ]]; then - echo "Build did not succeed" - exit 1 - fi - - - trigger-test: - runs-on: ubuntu-latest - needs: trigger-build - strategy: - matrix: - include: - - cuopt_version: "25.10" - steps: - - uses: actions/checkout@v4 - - name: Trigger Test - env: - GH_TOKEN: ${{ github.token }} - run: | - export CUOPT_BRANCH="branch-${{ matrix.cuopt_version }}" - export DATE=$(date +%F) - export SHA=$(gh api -q '.commit.sha' "repos/nvidia/cuopt/branches/${CUOPT_BRANCH}") - - gh workflow run test.yaml \ - -f branch=${CUOPT_BRANCH} \ - -f sha=${SHA} \ - -f date=${DATE} \ - -f build_type=nightly + -f build_type=nightly \ + -f date="${DATE}" \ + -f sha="${SHA}" \ + -f trigger-tests="true" diff --git a/.github/workflows/test_images.yaml b/.github/workflows/test_images.yaml index bfeda82f6..66cbce036 100644 --- a/.github/workflows/test_images.yaml +++ b/.github/workflows/test_images.yaml @@ -35,6 +35,7 @@ on: jobs: prepare: + name: test-images (prepare) runs-on: ubuntu-latest outputs: CUDA_SHORT: ${{ steps.trim.outputs.CUDA_SHORT }} @@ -50,6 +51,7 @@ jobs: echo "PYTHON_SHORT=$PYTHON_SHORT" >> $GITHUB_OUTPUT test: + name: test-images (${{ inputs.ARCH }}, ${{ inputs.IMAGE_TAG_PREFIX }}-cuda${{ needs.prepare.outputs.CUDA_SHORT }}-py${{ needs.prepare.outputs.PYTHON_SHORT }}) runs-on: "linux-${{ inputs.ARCH }}-gpu-a100-latest-1" needs: prepare container: diff --git a/docs/cuopt/source/cuopt-server/quick-start.rst b/docs/cuopt/source/cuopt-server/quick-start.rst index 782feac83..56011b4cf 100644 --- a/docs/cuopt/source/cuopt-server/quick-start.rst +++ b/docs/cuopt/source/cuopt-server/quick-start.rst @@ -86,7 +86,7 @@ Step 2: Once given access, users can find `cuOpt container `_. +* Generate an NGC API key from settings. If you have not generated an API Key, you can generate it by going to the Setup option in your profile and choose Get API Key. Store this or generate a new one next time. More information can be found `here `_. Step 4: Pull the container: diff --git a/docs/cuopt/source/faq.rst b/docs/cuopt/source/faq.rst index 70ec00845..99c8d7b6d 100644 --- a/docs/cuopt/source/faq.rst +++ b/docs/cuopt/source/faq.rst @@ -23,7 +23,7 @@ General FAQ 1. Log into NGC using the invite and choose the appropriate NGC org. - 2. Generate an NGC API key from settings. If you have not generated an API Key, you can generate it by going to the Setup option in your profile and choose `Get API Key `_. Store this or generate a new one next time. + 2. Generate an NGC API key from settings. If you have not generated an API Key, you can generate it by going to the Setup option in your profile and choose `Get API Key `_. Store this or generate a new one next time. 3. Go to the container section for cuOpt and copy the pull tag for the latest image. - Within the Select a tag dropdown, locate the container image release that you want to run.