Skip to content

Integrate Test App into Actions #24

Integrate Test App into Actions

Integrate Test App into Actions #24

Workflow file for this run

# SPDX-FileCopyrightText: Copyright (c) 2024 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.
# This workflow will install Python dependencies,
# run tests with a variety of Python versions,
# and upload a new build to TestPyPI.
#
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Code Check
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry install --with test
- name: Run pre-commit Check
uses: pre-commit/[email protected]
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python:
[
{ version: "3.9", coveralls: false },
{ version: "3.10", coveralls: false },
{ version: "3.11", coveralls: false },
{ version: "3.12", coveralls: true }, # publish coverage with latest version of Python
]
env:
PYTHON_VERSION: ${{ matrix.python.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python.version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python.version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- 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 }}
run: |
poetry run pytest
- name: Upload Coverage Report
uses: actions/[email protected]
if: ${{ matrix.python.coveralls }}
with:
name: coverage
path: tests/reports/.coverage.lcov
- name: Upload Coveralls Report
uses: coverallsapp/[email protected]
if: ${{ matrix.python.coveralls }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: tests/reports/.coverage.lcov
test-app:
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@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: Gr1N/setup-poetry@v9
- name: Install library and dependencies
run: |
poetry run pip install --upgrade pip setuptools
poetry install --with test
- name: Build Application
run: |
poetry build
wheel=$(find dist/ -name holoscan_cli-*-py3-none-linux_x86_64.whl)
echo "Installing from ${wheel}"
pip install ${wheel}
- name: Version Check
run: |
output=$(holoscan version | tail -1 | tr -s ' ' | cut -d' ' -f3)
expected=$(grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
echo "Expected version: ${expected}"
echo " Actual version: "$output""
test "$output" = "$expected"
- name: Package Test App
run: |
holoscan package --source tests/app/artifacts.json \
-c tests/app/python/app.yaml \
-t test-app-python \
--platform x64-workstation \
--sdk-version 0.0.0 \
--holoscan-sdk-file $(find dist/ -name holoscan_cli-*-py3-none-linux_x86_64.whl) \
tests/app/python/
- name: Run Test App
env:
HOLOSCAN_SKIP_NVIDIA_CTK_CHECK: true
run: |
mkdir input
mkdir output
touch input/file
touch output/file
holoscan run -r $(docker images | grep "test-app-python" | awk '{print $1":"$2}') -i input -o output
# testpypi-deploy:
# name: Build and publish Python 🐍 distributions 📦 to TestPyPI
# runs-on: ubuntu-latest
# needs: test
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Publish distribution 📦 to Test PyPI
# uses: JRubics/[email protected]
# continue-on-error: true
# with:
# pypi_token: ${{ secrets.TEST_PYPI_PASSWORD }}
# repository_name: 'testpypi'
# repository_url: 'https://test.pypi.org/legacy/'