Skip to content

test: add smoke tests for training and generation hot paths #940

test: add smoke tests for training and generation hot paths

test: add smoke tests for training and generation hot paths #940

Workflow file for this run

# Copyright (c) 2024-2026, NVIDIA CORPORATION.
#
# 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: CI - checks
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
defaults:
run:
shell: bash -x -e -u -o pipefail {0}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# ---------------------------------------------------------------------------
# Detect which files changed so downstream jobs can be skipped when only
# docs, config, or other non-source files are modified. The "ci-status"
# summary job (below) is the single required check for branch protection,
# so skipped jobs won't block merge.
# ---------------------------------------------------------------------------
changes:
name: Detect changes
if: github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
src: ${{ steps.changes.outputs.src }}
test: ${{ steps.changes.outputs.test }}
deps: ${{ steps.changes.outputs.deps }}
steps:
- uses: actions/checkout@v6
- name: Detect changes
id: changes
uses: ./.github/actions/detect-changes
format:
name: Format
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.deps == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python environment
id: setup
uses: ./.github/actions/setup-python-env
with:
fetch-depth: 0
bootstrap-tools: "true"
- name: Bootstrap
run: make bootstrap-nss dev
- name: Check formatting, linting, and copyright headers
run: make format-check
- name: Check uv.lock is up to date
run: make lock-check
typecheck:
name: Typecheck
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.deps == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python environment
id: setup
uses: ./.github/actions/setup-python-env
with:
fetch-depth: 0
bootstrap-tools: "true"
- name: Bootstrap
run: make bootstrap-nss cpu
- name: Run ty type checks
run: make typecheck
unit-test:
name: Unit Tests
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.deps == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python environment
id: setup
uses: ./.github/actions/setup-python-env
with:
bootstrap-tools: "true"
- name: Bootstrap
run: make bootstrap-nss cpu
- name: Run unit tests with coverage
run: make test-ci
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: coverage-report
path: coverage.json
retention-days: 30
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.json
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
smoke-test:
name: Smoke Tests
needs: changes
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.test == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python environment
uses: ./.github/actions/setup-python-env
with:
bootstrap-tools: "true"
- name: Run CPU smoke tests
run: |
make bootstrap-nss cpu
make test-smoke
# ---------------------------------------------------------------------------
# Single required status check for branch protection.
# Aggregates results from all upstream jobs so that skipped jobs (due to
# path filtering) don't block merge.
# ---------------------------------------------------------------------------
ci-status:
name: CI Status
if: always() && !cancelled()
needs: [changes, format, typecheck, unit-test, smoke-test]
runs-on: ubuntu-latest
steps:
- name: Check job results
run: |
echo "changes: ${{ needs.changes.result }}"
echo "format: ${{ needs.format.result }}"
echo "typecheck: ${{ needs.typecheck.result }}"
echo "unit-test: ${{ needs.unit-test.result }}"
echo "smoke-test: ${{ needs.smoke-test.result }}"
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "::error::One or more CI jobs failed"
exit 1
fi
echo "All CI jobs passed (or were skipped)."