Skip to content

Commit eb33a3c

Browse files
committed
Add initial CI
Signed-off-by: Charlie Truong <chtruong@nvidia.com>
1 parent 85d372c commit eb33a3c

4 files changed

Lines changed: 164 additions & 0 deletions

File tree

.github/workflows/cicd-main.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
name: CICD NeMo
15+
on:
16+
pull_request:
17+
branches:
18+
- main
19+
- r**
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.event.label.name || 'main' }}-${{ github.event_name }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
pre-flight:
27+
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@v0.64.2
28+
29+
lint-check:
30+
name: Lint check
31+
runs-on: ubuntu-latest
32+
needs: [pre-flight]
33+
if: |
34+
(
35+
needs.pre-flight.outputs.is_deployment_workflow == 'false'
36+
&& needs.pre-flight.outputs.is_ci_workload == 'true'
37+
) || (
38+
needs.pre-flight.outputs.is_deployment_workflow == 'false'
39+
&& needs.pre-flight.outputs.is_ci_workload == 'false'
40+
&& needs.pre-flight.outputs.docs_only == 'false'
41+
)
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
46+
- name: Check lint
47+
run: |
48+
pip install pre-commit==3.6.0
49+
pre-commit install
50+
pre-commit run --all-files --show-diff-on-failure --color=always
51+
52+
cicd-unit-tests:
53+
if: |
54+
(
55+
success()
56+
|| needs.pre-flight.outputs.is_ci_workload == 'true'
57+
|| needs.pre-flight.outputs.force_run_all == 'true'
58+
)
59+
&& !cancelled()
60+
needs: [pre-flight, cicd-wait-in-queue]
61+
runs-on: self-hosted-nemo
62+
name: Launch_Unit_Tests
63+
environment: nemo-ci
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
- name: Run tests
68+
run: |
69+
uv run --all-extras pytest --cov=src/nemotron tests
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Copyright check
16+
17+
on:
18+
pull_request:
19+
branches:
20+
- main
21+
- r**
22+
23+
jobs:
24+
pre-flight:
25+
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_cicd_preflight.yml@v0.64.2
26+
27+
copyright-check:
28+
needs: [pre-flight]
29+
if: |
30+
!(needs.pre-flight.outputs.docs_only == 'true'
31+
|| needs.pre-flight.outputs.is_deployment_workflow == 'true')
32+
uses: NVIDIA-NeMo/FW-CI-templates/.github/workflows/_copyright_check.yml@v0.2.0
33+
34+
copyright-check-summary:
35+
needs: [pre-flight, copyright-check]
36+
if: |
37+
(
38+
needs.pre-flight.outputs.docs_only == 'true'
39+
|| needs.pre-flight.outputs.is_deployment_workflow == 'true'
40+
|| always()
41+
)
42+
&& !cancelled()
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Result
46+
run: |
47+
FAILED_JOBS=$(gh run view $GITHUB_RUN_ID --json jobs --jq '[.jobs[] | select(.status == "completed" and .conclusion != "success")] | length') || echo 0
48+
49+
if [ "${FAILED_JOBS:-0}" -eq 0 ] || [ "$SKIPPING_IS_ALLOWED" == "true" ]; then
50+
echo "✅ All previous jobs completed successfully"
51+
exit 0
52+
else
53+
echo "❌ Found $FAILED_JOBS failed job(s)"
54+
# Show which jobs failed
55+
gh run view $GITHUB_RUN_ID --json jobs --jq '.jobs[] | select(.status == "completed" and .conclusion != "success") | .name'
56+
exit 1
57+
fi

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: end-of-file-fixer
6+
# only include python files
7+
files: \.py$
8+
- id: trailing-whitespace
9+
# only include python files
10+
files: \.py$
11+
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
rev: "v0.9.9" # Use the appropriate version
14+
hooks:
15+
- id: ruff
16+
args: ["--fix"]
17+
- id: ruff
18+
args: ["check", "--select", "I", "--fix"]
19+
- id: ruff-format
20+
21+
- repo: local
22+
hooks:
23+
- id: no-underscore-md
24+
name: "Disallow '_' in Markdown filenames"
25+
language: system
26+
entry: |
27+
bash -c '
28+
# Report the offending files
29+
echo "[pre-commit] ERROR: Found Markdown files with underscores:" >&2
30+
for file in "$@"; do
31+
echo " - $file (use hyphens instead)" >&2
32+
done
33+
exit 1
34+
'
35+
files: '.*\/[^\/]*_[^\/]*\.md$'
36+
exclude: '^\.github/'
37+
types: [file]

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.12

0 commit comments

Comments
 (0)