From 59711923f951b5349d15d1df54dd2e944235af60 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Thu, 11 Jan 2024 10:46:30 -0800 Subject: [PATCH] Add conda to ci --- .github/workflows/ci_pipe.yml | 47 ++++++++++++++++++++++++++++++++++- .github/workflows/pr.yaml | 17 +++++++++++-- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_pipe.yml b/.github/workflows/ci_pipe.yml index 4989172fb3..4774548067 100644 --- a/.github/workflows/ci_pipe.yml +++ b/.github/workflows/ci_pipe.yml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,14 @@ on: run_check: required: true type: boolean + conda_run_build: + description: 'Runs the conda-build stage to ensure the conda package builds successfully' + required: true + type: boolean + conda_upload_label: + description: 'The label to use when uploading the conda package. Leave empty to disable uploading' + required: true + type: string container: required: true type: string @@ -183,3 +191,40 @@ jobs: - name: build_docs shell: bash run: ./morpheus/ci/scripts/github/docs.sh + + package: + name: Package + if: ${{ inputs.conda_run_build }} + needs: [check, documentation, test] + runs-on: linux-amd64-cpu16 + timeout-minutes: 60 + container: + credentials: + username: '$oauthtoken' + password: ${{ secrets.NGC_API_KEY }} + image: ${{ inputs.container }} + strategy: + fail-fast: true + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + lfs: false + path: 'morpheus' + fetch-depth: 0 + + - name: Get AWS credentials using OIDC + uses: aws-actions/configure-aws-credentials@v1-node16 + with: + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + aws-region: ${{ vars.AWS_REGION }} + role-duration-seconds: 43200 # 12h + + - name: conda + shell: bash + env: + CONDA_TOKEN: "${{ secrets.CONDA_TOKEN }}" + SCRIPT_ARGS: "${{ inputs.conda_upload_label != '' && 'upload' || '' }}" + CONDA_PKG_LABEL: "${{ inputs.conda_upload_label }}" + run: ./morpheus/ci/scripts/github/conda.sh $SCRIPT_ARGS diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 0109a5eec7..1142280ee0 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -64,7 +64,12 @@ jobs: uses: rapidsai/shared-action-workflows/get-pr-info@branch-23.08 if: ${{ startsWith(github.ref_name, 'pull-request/') }} outputs: + is_pr: ${{ startsWith(github.ref_name, 'pull-request/') }} + is_main_branch: ${{ github.ref_name == 'main' }} + is_dev_branch: ${{ startsWith(github.ref_name, 'branch-') }} + has_conda_build_label: ${{ steps.get-pr-info.outcome == 'success' && contains(fromJSON(steps.get-pr-info.outputs.pr-info).labels.*.name, 'conda-build') || false }} has_skip_ci_label: ${{ steps.get-pr-info.outcome == 'success' && contains(fromJSON(steps.get-pr-info.outputs.pr-info).labels.*.name, 'skip-ci') || false }} + pr_info: ${{ steps.get-pr-info.outcome == 'success' && steps.get-pr-info.outputs.pr-info || '' }} checks: secrets: inherit @@ -81,8 +86,16 @@ jobs: # Only run the CI pipeline if the PR does not have the skip-ci label if: ${{ ! fromJSON(needs.prepare.outputs.has_skip_ci_label) }} with: - run_check: ${{ startsWith(github.ref_name, 'pull-request/') }} + # Run checks for any PR branch + run_check: ${{ fromJSON(needs.prepare.outputs.is_pr) }} + # Run conda-build for main/dev branches and PRs with the conda-build label + conda_run_build: ${{ !fromJSON(needs.prepare.outputs.is_pr) || fromJSON(needs.prepare.outputs.has_conda_build_label) }} + # Update conda package only for non PR branches. Use 'main' for main branch and 'dev' for all other branches + # Disable conda upload for now, once we have morpheus packages in conda forge set the value to + # !fromJSON(needs.prepare.outputs.is_pr) && (fromJSON(needs.prepare.outputs.is_main_branch) && 'main' || 'dev') || '' + conda_upload_label: "" container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-build-230913 test_container: nvcr.io/ea-nvidia-morpheus/morpheus:morpheus-ci-test-230913 + # Info about the PR. Empty for non PR branches. Useful for extracting PR number, title, etc. secrets: NGC_API_KEY: ${{ secrets.NGC_API_KEY }}