feat(pydantic-validation): pydantic config validation (#454) #1980
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: CICD NeMo | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: "Branch to run tests on" | |
| required: false | |
| default: "main" | |
| schedule: | |
| - cron: 0 0 * * * | |
| push: | |
| branches: | |
| - main | |
| - "pull-request/[0-9]+" | |
| - "deploy-release/*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.label.name || 'main' }}-${{ github.event_name }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| pre-flight: | |
| uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/[email protected] | |
| linting: | |
| runs-on: ubuntu-latest | |
| needs: [pre-flight] | |
| if: | | |
| ( | |
| needs.pre-flight.outputs.is_deployment_workflow == 'false' | |
| && needs.pre-flight.outputs.is_ci_workload == 'true' | |
| ) || ( | |
| needs.pre-flight.outputs.is_deployment_workflow == 'false' | |
| && needs.pre-flight.outputs.is_ci_workload == 'false' | |
| && needs.pre-flight.outputs.docs_only == 'false' | |
| ) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install ruff | |
| run: | | |
| pip install ruff | |
| - name: Check lint | |
| run: | | |
| pip install pre-commit==3.6.0 | |
| pre-commit install | |
| pre-commit run --all-files --show-diff-on-failure --color=always | |
| validate-container-digests: | |
| runs-on: ubuntu-latest | |
| needs: [pre-flight, linting] | |
| if: | | |
| ( | |
| needs.pre-flight.outputs.is_deployment_workflow == 'false' | |
| && needs.pre-flight.outputs.is_ci_workload == 'true' | |
| ) || ( | |
| needs.pre-flight.outputs.is_deployment_workflow == 'false' | |
| && needs.pre-flight.outputs.is_ci_workload == 'false' | |
| && needs.pre-flight.outputs.docs_only == 'false' | |
| ) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install package dependencies | |
| run: | | |
| cd packages/nemo-evaluator-launcher | |
| pip install -e . | |
| - name: Validate container digests | |
| run: | | |
| make container-metadata-verify | |
| cicd-wait-in-queue: | |
| runs-on: ubuntu-latest | |
| needs: [pre-flight, linting, validate-container-digests] | |
| environment: test | |
| if: | | |
| !(needs.pre-flight.outputs.is_ci_workload == 'true' | |
| || needs.pre-flight.outputs.is_deployment_workflow == 'true' | |
| || needs.pre-flight.outputs.docs_only == 'true') | |
| steps: | |
| - name: Running CI tests | |
| run: | | |
| echo "Running CI tests" | |
| cicd-unit-tests-nemo-evaluator: | |
| needs: [pre-flight, cicd-wait-in-queue, validate-container-digests] | |
| runs-on: ubuntu-latest | |
| name: unit-tests | |
| environment: nemo-ci | |
| if: | | |
| ( | |
| success() | |
| || needs.pre-flight.outputs.is_ci_workload == 'true' | |
| || needs.pre-flight.outputs.force_run_all == 'true' | |
| ) | |
| && !cancelled() | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: main | |
| uses: ./.github/actions/test-template | |
| with: | |
| script: Launch_Unit_Tests | |
| timeout: 10 | |
| type_of_test: "unit_tests" | |
| cpu-only: true | |
| package: nemo-evaluator | |
| cicd-unit-tests-nemo-evaluator-launcher: | |
| needs: [pre-flight, cicd-wait-in-queue, validate-container-digests] | |
| runs-on: ubuntu-latest | |
| name: unit-tests-launcher | |
| environment: nemo-ci | |
| if: | | |
| ( | |
| success() | |
| || needs.pre-flight.outputs.is_ci_workload == 'true' | |
| || needs.pre-flight.outputs.force_run_all == 'true' | |
| ) | |
| && !cancelled() | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: main | |
| uses: ./.github/actions/test-template | |
| with: | |
| script: Launch_Unit_Tests | |
| timeout: 10 | |
| type_of_test: "unit_tests" | |
| cpu-only: true | |
| package: nemo-evaluator-launcher | |
| cicd-e2e-tests-nemo-evaluator: | |
| needs: | |
| [pre-flight, cicd-unit-tests-nemo-evaluator, validate-container-digests] | |
| runs-on: ubuntu-latest | |
| name: functional-tests | |
| environment: nemo-ci | |
| if: | | |
| ( | |
| success() | |
| || needs.pre-flight.outputs.is_ci_workload == 'true' | |
| || needs.pre-flight.outputs.force_run_all == 'true' | |
| ) | |
| && !cancelled() | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: main | |
| uses: ./.github/actions/test-template | |
| with: | |
| script: Launch_Functional_Tests | |
| timeout: ${{ matrix.timeout || 10 }} | |
| type_of_test: "functional_tests" | |
| cpu-only: true | |
| package: nemo-evaluator | |
| has-azure-credentials: true | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| cicd-integration-tests: | |
| needs: | |
| - cicd-unit-tests-nemo-evaluator | |
| runs-on: self-hosted-nemo | |
| if: | | |
| ( | |
| github.event_name == 'schedule' | |
| || github.event_name == 'workflow_dispatch' | |
| || (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| ) | |
| && !cancelled() | |
| name: integration-tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: main | |
| uses: ./.github/actions/test-template | |
| with: | |
| script: Launch_Integration_Tests | |
| timeout: 60 | |
| type_of_test: "integration_tests" | |
| cpu-only: false | |
| use-credentials: true | |
| ngc-api-user: ${{ secrets.NGC_API_USER }} | |
| ngc-api-key: ${{ secrets.NGC_API_KEY }} | |
| Nemo_CICD_Test: | |
| needs: | |
| - pre-flight | |
| - cicd-unit-tests-nemo-evaluator | |
| - cicd-unit-tests-nemo-evaluator-launcher | |
| - cicd-e2e-tests-nemo-evaluator | |
| if: | | |
| ( | |
| needs.pre-flight.outputs.docs_only == 'true' | |
| || needs.pre-flight.outputs.is_deployment_workflow == 'true' | |
| || needs.pre-flight.outputs.is_ci_workload == 'true' | |
| || always() | |
| ) | |
| && !cancelled() | |
| runs-on: ubuntu-latest | |
| permissions: write-all | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get workflow result | |
| id: result | |
| shell: bash -x -e -u -o pipefail {0} | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RUN_ID: ${{ github.run_id }} | |
| IS_CI_WORKLOAD: ${{ needs.pre-flight.outputs.is_ci_workload == 'true' }} | |
| SKIPPING_IS_ALLOWED: ${{ needs.pre-flight.outputs.docs_only == 'true' || needs.pre-flight.outputs.is_deployment_workflow == 'true' || needs.pre-flight.outputs.is_ci_workload == 'true' }} | |
| run: | | |
| if [ "$IS_CI_WORKLOAD" == "true" ]; then | |
| FAILED_JOBS=$(gh run view $GITHUB_RUN_ID --json jobs --jq '[.jobs[] | select(.status == "completed" and .conclusion != "success")] | length') || echo 0 | |
| else | |
| FAILED_JOBS=$(gh run view $GITHUB_RUN_ID --json jobs --jq '[.jobs[] | select(.status == "completed" and .conclusion != "success" and .name != "integration-tests")] | length') || echo 0 | |
| fi | |
| if [ "${FAILED_JOBS:-0}" -eq 0 ] || [ "$SKIPPING_IS_ALLOWED" == "true" ]; then | |
| echo "✅ All previous jobs completed successfully" | |
| exit 0 | |
| else | |
| echo "❌ Found $FAILED_JOBS failed job(s)" | |
| # Show which jobs failed | |
| gh run view $GITHUB_RUN_ID --json jobs --jq '.jobs[] | select(.status == "completed" and .conclusion != "success") | .name' | |
| exit 1 | |
| fi | |
| Coverage_Fake: | |
| runs-on: ubuntu-latest | |
| needs: [Nemo_CICD_Test, pre-flight] | |
| if: | | |
| ( | |
| needs.pre-flight.outputs.docs_only == 'true' | |
| || needs.pre-flight.outputs.is_deployment_workflow == 'true' | |
| ) | |
| && needs.pre-flight.outputs.is_ci_workload == 'false' | |
| && !cancelled() | |
| environment: nemo-ci | |
| steps: | |
| - name: Generate fake coverage report | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.PAT }} | |
| script: | | |
| await github.rest.repos.createCommitStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| sha: context.sha, | |
| state: 'success', | |
| description: 'No code changes - coverage check skipped', | |
| context: 'codecov/patch' | |
| }); | |
| Coverage: | |
| runs-on: ubuntu-latest | |
| needs: [Nemo_CICD_Test, pre-flight] | |
| if: | | |
| ( | |
| (needs.pre-flight.outputs.is_ci_workload == 'true' && !failure()) | |
| || success() | |
| ) | |
| && !cancelled() | |
| strategy: | |
| matrix: | |
| flag: [unit-test, e2e] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download coverage reports of current branch | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: coverage-${{ matrix.flag }}-* | |
| merge-multiple: true | |
| - name: List coverage files | |
| run: find . -type f -name "*.xml" -o -name "*.lcov" | |
| - name: Get total coverage of current branch | |
| shell: bash -x -e -u -o pipefail {0} | |
| if: always() | |
| run: | | |
| pip install coverage | |
| ls -al . | |
| coverage combine --rcfile .github/config/.coveragerc | |
| coverage report -i --rcfile .github/config/.coveragerc | |
| coverage xml --rcfile .github/config/.coveragerc | |
| rm -rf coverage-* | |
| ls -al | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true | |
| flags: ${{ matrix.flag }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-${{ matrix.flag }}-aggregated | |
| path: | | |
| .coverage | |
| include-hidden-files: true |