Skip to content

refactor: simplify SDK layout candidate ranking #1371

refactor: simplify SDK layout candidate ranking

refactor: simplify SDK layout candidate ranking #1371

Workflow file for this run

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# 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.
# Normal push/PR CI: lint, unit tests, wheel + sdist build, package
# metadata + content validation, and installed-wheel smoke tests.
# Publishing to TestPyPI lives in release.yaml and only runs for
# explicit release dispatches (both GA and non-GA).
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Code Check
on:
push:
pull_request:
branches: ["main", "release/*"]
jobs:
pre-commit:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
# Install via pip on the matrix Python rather than a third-party
# action: no allowlist coupling, no Node-20 runtime to chase, and
# plugins resolve in the same site-packages so `requires-plugins`
# in pyproject.toml is satisfied without `poetry self add`.
run: |
python -m pip install --upgrade pip
python -m pip install "poetry>=2.0" "poetry-dynamic-versioning>=1.7.1,<2.0.0"
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry -vvv install --with test
- name: Run pre-commit Check
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
- name: Run holoscan linting
# The action above stays the enforcing gate. This step runs the same
# hooks through the CLI's own lint command so a regression in runner
# resolution, project-root discovery, or path scoping surfaces here
# instead of in a downstream project. Hook environments are already
# warm from the step above, so the repeated run is cheap.
run: |
poetry run holoscan lint src --dryrun
poetry run holoscan lint
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python:
[
{ version: "3.11", coveralls: false },
{ version: "3.12", coveralls: true }, # publish coverage with latest version of Python
{ version: "3.13", coveralls: false },
]
env:
PYTHON_VERSION: ${{ matrix.python.version }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Set up Python ${{ matrix.python.version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python.version }}
- name: Install Poetry
# Install via pip on the matrix Python rather than a third-party
# action: no allowlist coupling, no Node-20 runtime to chase, and
# plugins resolve in the same site-packages so `requires-plugins`
# in pyproject.toml is satisfied without `poetry self add`.
run: |
python -m pip install --upgrade pip
python -m pip install "poetry>=2.0" "poetry-dynamic-versioning>=1.7.1,<2.0.0"
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry install --with test
- name: Run Pytest + Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PLATFORM: ${{ matrix.os }}
TMPDIR: ${{ runner.temp }}
TEMP: ${{ runner.temp }}
TMP: ${{ runner.temp }}
run: |
env
poetry run pytest
- name: Upload Coverage Report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ matrix.python.coveralls }}
with:
name: coverage
path: tests/reports/.coverage.lcov
- name: Upload Coveralls Report
# Pinned to the SHA the repo's Actions allowlist permits (v2.3.4);
# bumping requires extending the allowlist.
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
if: ${{ matrix.python.coveralls }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: tests/reports/.coverage.lcov
# Reverse integration: a holoscan-cli PR must satisfy the real HoloHub
# project-tree contract (HoloHub's own wrapper suite) before it merges.
holohub-integration:
name: HoloHub wrapper integration
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- name: Checkout holoscan-cli
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Checkout HoloHub
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
repository: nvidia-holoscan/holohub
path: holohub
persist-credentials: false
- name: Set up Python 3.12
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Install current CLI and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest .
- name: Run HoloHub integration against this checkout
env:
HOLOSCAN_CLI_SOURCE: ${{ github.workspace }}
HOLOSCAN_CLI_BASE_SDK_VERSION: "4.4.0"
run: |
python -m pytest -v --noconftest \
holohub/utilities/cli/tests/test_holoscan_cli_consolidation.py
build:
name: build wheel + sdist
runs-on: ubuntu-latest
needs: [pre-commit, test, holohub-integration]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Install Poetry
# See note in the pre-commit job above.
run: |
python -m pip install --upgrade pip
python -m pip install "poetry>=2.0" "poetry-dynamic-versioning>=1.7.1,<2.0.0"
- name: Build wheel and sdist
run: |
poetry run which python
source $(poetry env info --path)/bin/activate
poetry install
poetry dynamic-versioning -vvv
poetry build -vvv --clean
- name: Validate package metadata
run: |
source $(poetry env info --path)/bin/activate
python -m pip install --upgrade twine
python -m twine check dist/*
- name: Assert wheel package contents
run: .github/scripts/assert_wheel_contents.sh dist
- name: Upload build
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: build-artifact
path: dist/*
smoke-test:
name: installed-artifact smoke test
runs-on: ${{ matrix.os }}
needs: [build]
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Download build
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: build-artifact
path: dist/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Holoscan CLI in clean venv
run: |
python -m venv /tmp/holoscan-cli-smoke
wheel=$(find dist -name 'holoscan_cli-*.whl' | head -n1)
/tmp/holoscan-cli-smoke/bin/pip install "$wheel"
- name: Smoke test
run: .github/scripts/smoke_test.sh /tmp/holoscan-cli-smoke/bin
- name: Validate create extra from wheel
run: |
wheel=$(find dist -name 'holoscan_cli-*.whl' | head -n1)
/tmp/holoscan-cli-smoke/bin/pip install "${wheel}[create]"
/tmp/holoscan-cli-smoke/bin/python -c \
'import cookiecutter, jsonschema, referencing'
create_root=$(mktemp -d)
installed_version=$(/tmp/holoscan-cli-smoke/bin/python -c \
'from importlib.metadata import version; print(version("holoscan-cli"))')
for language in cpp python; do
project_name="Artifact ${language}"
module_root="${create_root}/holoscan-artifact-${language}"
operator_extension=cpp
if [[ "${language}" == "python" ]]; then
operator_extension=py
fi
/tmp/holoscan-cli-smoke/bin/holoscan create "${project_name}" \
--interactive false \
--language "${language}" \
--directory "${create_root}"
test -f "${module_root}/metadata.json"
/tmp/holoscan-cli-smoke/bin/python -c \
'import json,sys; data=json.load(open(sys.argv[1])); assert "module" in data' \
"${module_root}/metadata.json"
grep -Fx "holoscan-cli==${installed_version}" \
"${module_root}/requirements-cli.txt"
grep -F "\"holoscan-cli==${installed_version}\"" "${module_root}/pyproject.toml"
! grep -F "holoscan-cli[create]" "${module_root}/pyproject.toml"
test ! -e "${module_root}/holohub"
test ! -e "${module_root}/holoscan"
test -f "${module_root}/CMakeLists.txt"
test -f \
"${module_root}/applications/artifact_${language}_pipeline/python/metadata.json"
test -f \
"${module_root}/operators/artifact_${language}_op/artifact_${language}_op.${operator_extension}"
(
cd "${module_root}"
/tmp/holoscan-cli-smoke/bin/holoscan version --json | \
/tmp/holoscan-cli-smoke/bin/python -c \
'import json,sys; data=json.load(sys.stdin); assert data["version"] == sys.argv[1]' \
"${installed_version}"
/tmp/holoscan-cli-smoke/bin/holoscan list --json | \
/tmp/holoscan-cli-smoke/bin/python -c \
'import json,sys; data=json.load(sys.stdin); assert any(p["project_type"] == "module" for p in data["projects"])'
)
done
- name: Install sdist in clean venv
run: |
python -m venv /tmp/holoscan-cli-sdist-smoke
sdist=$(find dist -name '*.tar.gz' | head -n1)
test -n "$sdist"
/tmp/holoscan-cli-sdist-smoke/bin/pip install "$sdist"
- name: Source-distribution smoke test
run: .github/scripts/smoke_test.sh /tmp/holoscan-cli-sdist-smoke/bin
- name: Install tool runners
run: python -m pip install --upgrade uv pipx
- name: Tool-runner smoke test
run: .github/scripts/tool_runner_smoke.sh dist
cpu-cli-docker-smoke:
name: CPU CLI + Docker smoke test
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
- name: Download build
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: build-artifact
path: dist/
- name: Set up Python 3.12
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.12"
- name: Install Holoscan CLI in clean venv
run: |
python -m venv /tmp/holoscan-cli-cpu-smoke
wheel=$(find dist -name 'holoscan_cli-*.whl' | head -n1)
/tmp/holoscan-cli-cpu-smoke/bin/pip install "$wheel"
- name: CPU CLI + Docker smoke test
run: .github/scripts/cpu_cli_docker_smoke.sh /tmp/holoscan-cli-cpu-smoke/bin