-
Notifications
You must be signed in to change notification settings - Fork 18
136 lines (119 loc) · 5.42 KB
/
ci_check.yml
File metadata and controls
136 lines (119 loc) · 5.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Check
on:
workflow_call:
inputs:
full_ci:
description: 'Whether to run checks across all files'
required: false
default: false
type: boolean
run_python_integration_langchain:
description: 'Whether LangChain, LangGraph, and DeepAgents Python integration checks may need optional extras'
required: false
default: false
type: boolean
base:
description: 'The comparison base used for filtered pre-commit checks'
required: false
default: ''
type: string
defaults:
run:
shell: bash
env:
GH_TOKEN: "${{ github.token }}"
GIT_COMMIT: "${{ github.sha }}"
NEMO_RELAY_CI_WORKSPACE: "${{ github.workspace }}"
NEMO_RELAY_CI_WORKSPACE_TMP: "${{ github.workspace }}/tmp"
UV_PYTHON_DOWNLOADS: never
jobs:
check:
name: Run
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Load CI tool versions
id: ci-config
uses: ./.github/actions/load-ci-tool-versions
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
with:
version: ${{ steps.ci-config.outputs.uv_version }}
enable-cache: true
cache-dependency-glob: ${{ env.NEMO_RELAY_CI_WORKSPACE }}/uv.lock
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: ${{ steps.ci-config.outputs.go_version }}
cache: false
- name: Install managed Python
run: |
set -e
UV_PYTHON_DOWNLOADS=manual uv python install --managed-python ${{ steps.ci-config.outputs.default_python_version }}
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: ${{ steps.ci-config.outputs.node_version }}
- uses: actions-rust-lang/setup-rust-toolchain@150fca883cd4034361b621bd4e6a9d34e5143606 # v1.15.4
with:
cache: false
toolchain: ${{ steps.ci-config.outputs.rust_version }}
components: clippy, rustfmt
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
with:
shared-key: nemo-relay-rust-${{ runner.os }}-${{ runner.arch }}-${{ steps.ci-config.outputs.rust_version }}
workspaces: . -> target
cache-all-crates: true
cache-bin: false
save-if: false
- name: Install cargo-deny
uses: taiki-e/install-action@c070f87102a1c75b3183910f391c1cb887fe13c8 # v2.77.6
with:
tool: cargo-deny@${{ steps.ci-config.outputs.cargo_deny_version }}
- name: Install cargo-about
uses: taiki-e/install-action@c070f87102a1c75b3183910f391c1cb887fe13c8 # v2.77.6
with:
tool: cargo-about@${{ steps.ci-config.outputs.cargo_about_version }}
- name: Cache pre-commit environments
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ runner.temp }}/.cache/pre-commit
key: >-
nemo-relay-pre-commit-${{ runner.os }}-${{ runner.arch }}-py${{ steps.ci-config.outputs.default_python_version }}-node${{ steps.ci-config.outputs.node_version }}-rust${{ steps.ci-config.outputs.rust_version }}-pc${{ steps.ci-config.outputs.pre_commit_version }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
nemo-relay-pre-commit-${{ runner.os }}-${{ runner.arch }}-py${{ steps.ci-config.outputs.default_python_version }}-node${{ steps.ci-config.outputs.node_version }}-rust${{ steps.ci-config.outputs.rust_version }}-pc${{ steps.ci-config.outputs.pre_commit_version }}-
- name: pre-commit
working-directory: ${{ env.NEMO_RELAY_CI_WORKSPACE }}
env:
FULL_CI: ${{ inputs.full_ci }}
PRE_COMMIT_BASE: ${{ inputs.base }}
PRE_COMMIT_HOME: ${{ runner.temp }}/.cache/pre-commit
PYTHON_INTEGRATION_LANGCHAIN: ${{ inputs.run_python_integration_langchain }}
# The attribution hook syncs docs deps; do not apply repo warning policy to third-party Rust builds.
RUSTFLAGS: ""
run: |
set -e
uv tool install pre-commit==${{ steps.ci-config.outputs.pre_commit_version }}
FLOW_CI_UV_SYNC_EXTRA_ARGS=()
if [[ "$PYTHON_INTEGRATION_LANGCHAIN" == "true" ]]; then
FLOW_CI_UV_SYNC_EXTRA_ARGS+=(--extra langchain --extra langgraph --extra deepagents)
fi
uv sync --inexact --no-install-project --no-install-package nemo-relay "${FLOW_CI_UV_SYNC_EXTRA_ARGS[@]}"
if [[ "$FULL_CI" == "true" || -z "$PRE_COMMIT_BASE" ]]; then
pre-commit run --all-files --show-diff-on-failure
else
if [[ "$PRE_COMMIT_BASE" =~ ^[0-9a-f]{40}$ || "$PRE_COMMIT_BASE" == refs/* ]]; then
base_ref="$PRE_COMMIT_BASE"
else
base_ref="origin/$PRE_COMMIT_BASE"
fi
if [[ ! "$PRE_COMMIT_BASE" =~ ^[0-9a-f]{40}$ && "$base_ref" != "$GITHUB_REF" ]]; then
base_ref="$(git merge-base "$base_ref" HEAD)"
fi
pre-commit run --from-ref "$base_ref" --to-ref HEAD --show-diff-on-failure
fi