Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/actions/build-and-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: 'Build and Test'
description: 'Build nvblox Docker image and run tests'
inputs:
platform:
description: 'Platform to build for'
required: true
cuda-arch:
description: 'CUDA architecture'
required: true
cuda-version:
description: 'CUDA version'
required: true
ubuntu-version:
description: 'Ubuntu version'
required: true
gcc-sanitizer:
description: 'Build in debug mode with gcc sanitizers enabled'
required: false
default: 0
ngc-api-key:
description: 'NGC API Key for authentication'
required: true
run-cpp-tests:
description: 'Run C++ unit tests'
required: false
default: 'true'
run-python-tests:
description: 'Run Python unit tests'
required: false
default: 'true'
run-cuda-sanitizer:
description: 'Run CUDA sanitizer tests'
required: false
default: 'true'
run-realsense-tests:
description: 'Run Realsense example tests'
required: false
default: 'true'
runs:
using: 'composite'
steps:
- name: NGC Login
uses: ./.github/actions/ngc-login
with:
ngc-api-key: ${{ inputs.ngc-api-key }}
- name: Set COMMON_PREMERGE_ARGS env
shell: bash
run: |
# Store arguments used for all jobs in an environment variable.
echo "COMMON_PREMERGE_ARGS=--platform ${{ inputs.platform }} --cuda-arch ${{ inputs.cuda-arch }} --cuda-version ${{ inputs.cuda-version }} --ubuntu-version ${{ inputs.ubuntu-version }} --gcc-sanitizer ${{ inputs.gcc-sanitizer }}" >> $GITHUB_ENV
# Note that the two build-image steps could be omitted since the build-and-test steps also build necessary images.
# However, we separate the steps to get cleaner logs and better timing granularity.
- name: Build dependency image
shell: bash
run: |
echo "::group::BUILD DEPENDENCY IMAGE"
time python3 ci/premerge.py $COMMON_PREMERGE_ARGS --build-image deps
echo "::endgroup::"
- name: Build build image
shell: bash
run: |
echo "::group::BUILD BINARIES IMAGE"
time python3 ci/premerge.py $COMMON_PREMERGE_ARGS --build-image build
echo "::endgroup::"
- name: Run CPP unit tests
if: inputs.run-cpp-tests == 'true'
shell: bash
run: |
echo "::group::RUN CPP UNIT TESTS"
time python3 ci/premerge.py $COMMON_PREMERGE_ARGS --build-and-test cpp
echo "::endgroup::"
- name: Run Python unit tests
if: inputs.run-python-tests == 'true'
shell: bash
run: |
echo "::group::RUN PYTHON UNIT TESTS"
time python3 ci/premerge.py $COMMON_PREMERGE_ARGS --build-and-test python
echo "::endgroup::"
- name: Run CUDA Sanitizer
if: inputs.run-cuda-sanitizer == 'true'
shell: bash
run: |
echo "::group::RUN CUDA SANITIZER"
time python3 ci/premerge.py $COMMON_PREMERGE_ARGS --build-and-test cuda-sanitizer
echo "::endgroup::"
- name: Run Realsense example test
if: inputs.run-realsense-tests == 'true'
shell: bash
run: |
echo "::group::RUN REALSENSE EXAMPLE TEST"
time python3 ci/premerge.py $COMMON_PREMERGE_ARGS --build-and-test realsense
echo "::endgroup::"
21 changes: 21 additions & 0 deletions .github/actions/ngc-login/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'NGC Login'
description: 'Login to NVIDIA NGC Container Registry'
inputs:
ngc-api-key:
description: 'NGC API Key for authentication'
required: false
runs:
using: 'composite'
steps:
- name: NGC Login
shell: bash
run: |
# Only attempt NGC login if API key is available
if [ -n "${{ inputs.ngc-api-key }}" ]; then
echo "Logging into NGC registry..."
docker login -u \$oauthtoken -p ${{ inputs.ngc-api-key }} nvcr.io
echo "✅ Successfully logged into NGC registry"
else
echo "⚠️ NGC_API_KEY not available - skipping NGC login"
echo "This is normal for PRs from forks or when secrets are not configured"
fi
132 changes: 132 additions & 0 deletions .github/workflows/premerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: nvblox premerge
on:
pull_request:
jobs:
## ------------------------------------------
## Linting and formatting
## ------------------------------------------
lint_precommit:
name: pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit clang-format==14.0.6
- name: Run pre-commit
run: pre-commit run --all-files --show-diff-on-failure
## ------------------------------------------
## Build and test x86/CU11/U22
## ------------------------------------------
premerge_x86_cu11_u22:
name: Build&Test x86-CU11-U22
needs: [lint_precommit]
runs-on: [self-hosted, gpu] # GPU jobs will run on AWS
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: true
- name: premerge_x86_cu11_u22 - Unit tests
uses: ./.github/actions/build-and-test
with:
platform: x86_64
cuda-arch: 'native'
cuda-version: '11'
ubuntu-version: '22'
ngc-api-key: ${{ secrets.NGC_API_KEY }}
## ------------------------------------------
## Build and test x86/CU12/U22
## ------------------------------------------
premerge_x86_cu12_u22:
name: Build&Test x86-CU12-U22
needs: [lint_precommit]
runs-on: [self-hosted, gpu] # GPU jobs will run on AWS
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: true
- name: premerge_x86_cu12_u22 - Unit tests
uses: ./.github/actions/build-and-test
with:
platform: x86_64
cuda-arch: 'native'
cuda-version: '12'
ubuntu-version: '22'
ngc-api-key: ${{ secrets.NGC_API_KEY }}
## ------------------------------------------
## Build and test x86/CU13/U24
## ------------------------------------------
premerge_x86_cu13_u24:
name: Build&Test x86-CU13-U24
needs: [lint_precommit]
runs-on: [self-hosted, gpu] # GPU jobs will run on AWS
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: true
- name: premerge_x86_cu13_u24 - Unit tests
uses: ./.github/actions/build-and-test
with:
platform: x86_64
cuda-arch: 'native'
cuda-version: '13'
ubuntu-version: '24'
ngc-api-key: ${{ secrets.NGC_API_KEY }}
run-realsense-tests: false # TODO(dtingahl) make realsense docker build for cuda13
## --------------------------------------------------------
## Build and test x86/CU12/U22/gcc-sanitizer
## --------------------------------------------------------
premerge_x86_cu12_u22_debug:
name: Build&Test x86-gcc-sanitizer
needs: [lint_precommit]
runs-on: [self-hosted, gpu] # GPU jobs will run on AWS
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: true
- name: premerge_x86_cu12_u22_debug - Unit tests
uses: ./.github/actions/build-and-test
with:
platform: x86_64
cuda-arch: 'native'
cuda-version: '12'
ubuntu-version: '22'
gcc-sanitizer: 1
ngc-api-key: ${{ secrets.NGC_API_KEY }}
run-python-tests: false # TODO(dtingdahl) Enable these tests
run-realsense-tests: false #
run-cuda-sanitizer: false #
## ------------------------------------------
## Build and test Orin
## ------------------------------------------
premerge_orin_jetpack6:
name: Build&Test orin-jetpack6
needs: [lint_precommit]
runs-on: [self-hosted, jetson-orin, jetpack-6.2]
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
lfs: true
- name: premerge_orin_jetpack6 - Unit tests
uses: ./.github/actions/build-and-test
with:
platform: jetpack6
cuda-version: '12' # unused
ubuntu-version: '22' # unused
cuda-arch: '87' # Native detection of sm-arch not supported on orin.
ngc-api-key: ${{ secrets.NGC_API_KEY }}
run-realsense-tests: false
run-cuda-sanitizer: false
28 changes: 28 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: SonarQube SA
on:
push:
branches:
- dtingdahl/ci_script2
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: SonarSource/sonarqube-scan-action@v4
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# We do not recommend to use this in a pull request. Prefer using pull request
# decoration instead.
# - uses: SonarSource/sonarqube-quality-gate-action@v1
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ repos:
- repo: https://github.com/doublify/pre-commit-clang-format
rev: 62302476d0da01515660132d76902359bed0f782
hooks:
- id: clang-format
entry: clang-format-14 -i
- id: clang-format # See premerge.yml for the clang-format version used.
files: \.(c|cc|cpp|cxx|cu|cuh|h|hh|hpp|hxx|inl|proto|pb\.h|pb\.cc)$
- repo: https://github.com/pylint-dev/pylint
rev: v3.0.3
Expand Down
Loading
Loading