|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +name: ci |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ci-${{ github.ref }} |
| 17 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 18 | + |
| 19 | +jobs: |
| 20 | + checks: |
| 21 | + name: checks |
| 22 | + runs-on: ubuntu-latest |
| 23 | + timeout-minutes: 15 |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 26 | + with: |
| 27 | + persist-credentials: false |
| 28 | + |
| 29 | + - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 |
| 30 | + |
| 31 | + # fetch-core.sh reads proto/ and sdk/conformance from NVIDIA/OpenShell |
| 32 | + # at the pinned ref (public, no credentials). |
| 33 | + - name: Format, lint, typecheck, proto and fixture drift |
| 34 | + run: mise run check |
| 35 | + |
| 36 | + test: |
| 37 | + name: test (${{ matrix.python }}) |
| 38 | + runs-on: ubuntu-latest |
| 39 | + timeout-minutes: 15 |
| 40 | + strategy: |
| 41 | + fail-fast: false |
| 42 | + matrix: |
| 43 | + # Keep in sync with requires-python and the classifiers in pyproject.toml. |
| 44 | + python: ["3.11", "3.12", "3.13", "3.14"] |
| 45 | + env: |
| 46 | + UV_PYTHON: ${{ matrix.python }} |
| 47 | + steps: |
| 48 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 49 | + with: |
| 50 | + persist-credentials: false |
| 51 | + |
| 52 | + - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 |
| 53 | + |
| 54 | + - name: Unit tests |
| 55 | + run: mise run test |
| 56 | + |
| 57 | + build: |
| 58 | + name: build |
| 59 | + runs-on: ubuntu-latest |
| 60 | + timeout-minutes: 15 |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 63 | + with: |
| 64 | + persist-credentials: false |
| 65 | + # setuptools-scm reads the version from git history. |
| 66 | + fetch-depth: 0 |
| 67 | + |
| 68 | + - uses: jdx/mise-action@e6a8b3978addb5a52f2b4cd9d91eafa7f0ab959d # v4.2.0 |
| 69 | + |
| 70 | + - name: Build, verify, and install the wheel and sdist |
| 71 | + run: mise run build |
| 72 | + |
| 73 | + # The one required status check. Its name matches ai-openshell/sdk-go, so |
| 74 | + # rulesets can require `ci` in every SDK repository regardless of the jobs |
| 75 | + # each one runs. |
| 76 | + ci: |
| 77 | + name: ci |
| 78 | + if: always() |
| 79 | + needs: [checks, test, build] |
| 80 | + runs-on: ubuntu-latest |
| 81 | + timeout-minutes: 5 |
| 82 | + steps: |
| 83 | + - name: Require every job to succeed |
| 84 | + env: |
| 85 | + RESULTS: ${{ join(needs.*.result, ' ') }} |
| 86 | + run: | |
| 87 | + for result in $RESULTS; do |
| 88 | + if [ "$result" != success ]; then |
| 89 | + echo "::error::a required job finished with '$result' ($RESULTS)" |
| 90 | + exit 1 |
| 91 | + fi |
| 92 | + done |
0 commit comments