Skip to content

ci: fix docker registry names to lowercase #37

ci: fix docker registry names to lowercase

ci: fix docker registry names to lowercase #37

Workflow file for this run

# SPDX-FileCopyrightText: Copyright (c) <2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: CI
on:
push:
branches: [main, pull-request/1]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check-changes:
name: Check for source changes
runs-on: ubuntu-latest
outputs:
source-changed: ${{ steps.changes.outputs.source == 'true' }}
docs-changed: ${{ steps.changes.outputs.docs == 'true' }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for changes
id: changes
uses: dorny/paths-filter@v3
with:
filters: |
source:
- 'src/**'
- 'cext/**'
- 'test/**'
- 'samples/**'
- 'pyproject.toml'
- 'setup.py'
- 'CMakeLists.txt'
- 'ci/**'
- '.github/workflows/**'
- 'Dockerfile.ci'
docs:
- 'docs/**'
- '*.md'
build-ci-images:
name: Build CI Image (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
timeout-minutes: 30
needs: check-changes
if: needs.check-changes.outputs.source-changed == 'true'
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /opt/hostedtoolcache/go
sudo rm -rf /opt/hostedtoolcache/node
docker system prune -af
df -h
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/nvidia/cutile-python/ci-py${{ matrix.python-version }}
tags: |
type=sha,prefix={{branch}}-
- name: Check disk space before build
run: df -h
- name: Build and push CI image
id: build
timeout-minutes: 20
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.ci
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=py${{ matrix.python-version }}
cache-to: type=gha,mode=max,scope=py${{ matrix.python-version }}
outputs: type=registry,compression=zstd
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
container:
image: python:3.10-slim
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install lint dependencies
env:
PIP_BREAK_SYSTEM_PACKAGES: 1
run: pip install --no-cache-dir flake8==7.3.0 reuse==5.1.0
- name: Run flake8
run: flake8
- name: Run cpplint
run: python ci/cpplint.py
- name: Check license headers (REUSE)
run: ci/scripts/check_license.sh
- name: Check inline samples are up to date
run: python test/tools/inline_samples.py --check
build-wheel:
name: Build wheel (Linux x86_64, Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
needs: [check-changes, build-ci-images]
if: needs.check-changes.outputs.source-changed == 'true'
timeout-minutes: 30
container:
image: ghcr.io/nvidia/cutile-python/ci-py${{ matrix.python-version }}:${{ github.ref_name }}-${{ github.sha }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build wheel
timeout-minutes: 15
run: |
python${{ matrix.python-version }} -m venv .venv
.venv/bin/pip install --upgrade pip build wheel setuptools
.venv/bin/python -m build --wheel --outdir dist/
- name: Upload wheel artifact
uses: actions/upload-artifact@v5
with:
name: wheel-linux-x86_64-py${{ matrix.python-version }}
path: dist/*.whl
retention-days: 7
build-docs:
name: Build docs
runs-on: ubuntu-latest
needs: [check-changes, build-ci-images, build-wheel]
if: always() && (needs.check-changes.outputs.source-changed == 'true' || needs.check-changes.outputs.docs-changed == 'true')
timeout-minutes: 15
container:
image: ghcr.io/nvidia/cutile-python/ci-py3.10:${{ github.ref_name }}-${{ github.sha }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Download wheel artifact
uses: actions/download-artifact@v5
with:
name: wheel-linux-x86_64-py3.10
path: dist/
- name: Install dependencies
run: pip install dist/*.whl
- name: Build documentation
timeout-minutes: 10
run: |
cd docs
timeout 8m make html
- name: Upload documentation artifact
uses: actions/upload-artifact@v5
with:
name: docs-html
path: docs/build/html/
retention-days: 7