ci: add GPU test job using self-hosted runners #126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| images: | |
| name: Define Base Images | |
| runs-on: ubuntu-latest | |
| outputs: | |
| lint: ghcr.io/nvidia/cutile-python/lint:2026-03-18-3ee906b0ced0 | |
| docs: ghcr.io/nvidia/cutile-python/docs:2026-03-18-67c908a4176e | |
| build_py310: ghcr.io/nvidia/cutile-python/build_py_3.10_x86_64:2026-03-18-a2fdea5320fe | |
| build_py311: ghcr.io/nvidia/cutile-python/build_py_3.11_x86_64:2026-03-18-8573f3996301 | |
| build_py312: ghcr.io/nvidia/cutile-python/build_py_3.12_x86_64:2026-03-18-63835ff03f5d | |
| build_py313: ghcr.io/nvidia/cutile-python/build_py_3.13_x86_64:2026-03-18-9cadab6c475e | |
| test_py310: ghcr.io/nvidia/cutile-python/test_py_3.10_x86_64:2026-03-18-09e8ff4f33de | |
| test_py311: ghcr.io/nvidia/cutile-python/test_py_3.11_x86_64:2026-03-18-0f68d8d46ac4 | |
| test_py312: ghcr.io/nvidia/cutile-python/test_py_3.12_x86_64:2026-03-18-3fe476fda925 | |
| test_py313: ghcr.io/nvidia/cutile-python/test_py_3.13_x86_64:2026-03-18-f40db2451d39 | |
| steps: | |
| - run: echo "Defining image tags" | |
| lint: | |
| name: Lint | |
| needs: images | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| container: | |
| image: ${{ needs.images.outputs.lint }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Mark workspace as safe directory | |
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Run flake8 | |
| run: flake8 | |
| - name: Run cpplint | |
| run: python scripts/cpplint.py | |
| - name: Check license headers | |
| run: python scripts/check_license.py | |
| - name: Check inline samples are up to date | |
| run: python test/tools/inline_samples.py --check | |
| docs: | |
| name: Build Docs | |
| needs: [images, build] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| container: | |
| image: ${{ needs.images.outputs.docs }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Download wheel | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheel-py3.12-linux-x86_64 | |
| path: dist/ | |
| - name: Install wheel | |
| run: pip install dist/*.whl | |
| - name: Build documentation | |
| run: make -C docs html | |
| - name: Upload docs artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docs-html | |
| path: docs/build/html | |
| retention-days: 7 | |
| build: | |
| name: Build Wheel (Python ${{ matrix.python-version }}) | |
| needs: images | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: "3.10" | |
| image_key: build_py310 | |
| - python-version: "3.11" | |
| image_key: build_py311 | |
| - python-version: "3.12" | |
| image_key: build_py312 | |
| - python-version: "3.13" | |
| image_key: build_py313 | |
| container: | |
| image: ${{ needs.images.outputs[matrix.image_key] }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Build wheel | |
| run: python setup.py bdist_wheel | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel-py${{ matrix.python-version }}-linux-x86_64 | |
| path: dist/*.whl | |
| if-no-files-found: error | |
| retention-days: 7 | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| needs: [images, build] | |
| runs-on: [self-hosted, gpu] | |
| timeout-minutes: 60 | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: "3.10" | |
| image_key: test_py310 | |
| - python-version: "3.11" | |
| image_key: test_py311 | |
| - python-version: "3.12" | |
| image_key: test_py312 | |
| - python-version: "3.13" | |
| image_key: test_py313 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Download wheel | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheel-py${{ matrix.python-version }}-linux-x86_64 | |
| path: dist/ | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull test image | |
| run: docker pull ${{ needs.images.outputs[matrix.image_key] }} | |
| - name: Run tests | |
| run: | | |
| docker run --rm --gpus all \ | |
| -v "${{ github.workspace }}":/workspace \ | |
| -w /workspace \ | |
| ${{ needs.images.outputs[matrix.image_key] }} \ | |
| bash -c "pip install dist/*.whl && \ | |
| pytest --ignore internal \ | |
| -m 'not benchmark and not use_mlir' \ | |
| --durations=10 \ | |
| --junitxml=/workspace/test-results.xml" | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results-py${{ matrix.python-version }} | |
| path: test-results.xml | |
| retention-days: 7 |