77 branches :
88 - " pull-request/[0-9]+"
99 - " main"
10- # Disable the release and nightly CI for now, we will enable them later
11- # # this is for release CI
12- # tags:
13- # # release tag example: v0.4.2
14- # # release candidate tag example: v0.4.2-rc1
15- # - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
16- # workflow_dispatch:
17- # # this is for nightly CI, it will be automatically triggered by the schedule on main branch only
10+ # this is for release CI
11+ tags :
12+ # release tag example: mlir-tensorrt-v0.4.3 or mlir-tensorrt-v0.4.3dev20251212
13+ - ' mlir-tensorrt-v[0-9]*.[0-9]*.[0-9]*'
14+ workflow_dispatch :
15+ # this is for nightly CI, it will be automatically triggered by the schedule on main branch only
1816 # schedule:
1917 # - cron: '0 0 * * *' # Runs at 00:00 UTC every day (minute hour day-of-month month-of-year day-of-week)
2018
@@ -41,51 +39,16 @@ jobs:
4139 run : |
4240 set -euo pipefail
4341 set -x
44- cd "${GITHUB_WORKSPACE}"
45- git config --global --add safe.directory "${GITHUB_WORKSPACE}"
46-
47- EVENT_NAME="${{ github.event_name }}"
48- DEFAULT_BASE="${{ github.event.repository.default_branch || 'main' }}"
49- RANGE=""
50- if [ "${EVENT_NAME}" = "push" ]; then
51- FROM="${{ github.event.before }}"
52- TO="${{ github.sha }}"
53- if [ -z "${FROM}" ] || [ "${FROM}" = "0000000000000000000000000000000000000000" ]; then
54- # First push or unknown before: compare against default branch
55- git fetch --no-tags --prune --depth=100 origin "${DEFAULT_BASE}"
56- RANGE="origin/${DEFAULT_BASE}..${TO}"
57- else
58- RANGE="${FROM}..${TO}"
59- fi
60- else
61- BASE_REF="${{ github.base_ref || github.event.repository.default_branch || 'main' }}"
62- git fetch --no-tags --prune --depth=100 origin "${BASE_REF}"
63- # Prefer triple-dot; fall back to double-dot if no merge base
64- if git merge-base "origin/${BASE_REF}" HEAD >/dev/null 2>&1; then
65- RANGE="origin/${BASE_REF}...HEAD"
66- else
67- RANGE="origin/${BASE_REF}..HEAD"
68- fi
69- fi
70-
71- # Run git diff and capture status explicitly
72- set +e
73- DIFF_OUTPUT="$(git diff --name-only ${RANGE})"
74- DIFF_STATUS=$?
75- set -e
76- if [ ${DIFF_STATUS} -ne 0 ]; then
77- echo "git diff failed for RANGE='${RANGE}'" >&2
78- # when diff is failed, always think there is a code change, try to run the CI
42+ if bash ./.github/workflows/mlir-tensorrt/ci-utils.sh detect-code-change; then
7943 echo "has_changes=true" >> "${GITHUB_OUTPUT}"
8044 else
81- echo "${DIFF_OUTPUT}" | grep -E '^(mlir-tensorrt/|\.github/workflows/mlir-tensorrt[^/]*\.yml|\.github/workflows/mlir-tensorrt/)' || true
82- echo "has_changes=true" >> "${GITHUB_OUTPUT}"
45+ echo "has_changes=false" >> "${GITHUB_OUTPUT}"
8346 fi
8447
85- format-check :
86- name : Lint Check
87- needs : changes
48+ pre-check :
49+ name : Pre Check
8850 if : ${{ needs.changes.outputs.has_changes == 'true' }}
51+ needs : changes
8952 runs-on : ubuntu-latest
9053 container :
9154 image : ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda12.9-ubuntu24.04-0.1
@@ -96,45 +59,20 @@ jobs:
9659 - uses : actions/checkout@v5
9760 with :
9861 fetch-depth : 5
99- - name : Run checks
62+ - name : Run lint checks
63+ # lint check is only needed for PRs and push to main
64+ if : ${{ github.ref_type != 'tag' && github.event_name != 'schedule' }}
10065 run : |
101- # Determine base for formatting diff (push-safe and PR-safe)
102- cd "${GITHUB_WORKSPACE}"
103- git config --global --add safe.directory "${GITHUB_WORKSPACE}"
104- EVENT_NAME="${{ github.event_name }}"
105- DEFAULT_BASE="${{ github.event.repository.default_branch || 'main' }}"
106- RANGE=""
107- if [ "${EVENT_NAME}" = "push" ]; then
108- FROM="${{ github.event.before }}"
109- TO="${{ github.sha }}"
110- if [ -z "${FROM}" ] || [ "${FROM}" = "0000000000000000000000000000000000000000" ]; then
111- git fetch --no-tags --prune --depth=100 origin "${DEFAULT_BASE}"
112- RANGE="origin/${DEFAULT_BASE}..${TO}"
113- else
114- RANGE="${FROM}..${TO}"
115- fi
116- else
117- BASE_REF="${{ github.base_ref || github.event.repository.default_branch || 'main' }}"
118- git fetch --no-tags --prune --depth=100 origin "${BASE_REF}"
119- if git merge-base "origin/${BASE_REF}" HEAD >/dev/null 2>&1; then
120- RANGE="origin/${BASE_REF}...HEAD"
121- else
122- RANGE="origin/${BASE_REF}..HEAD"
123- fi
124- fi
125-
126- # Check Python formatting with black
127- uv tool install black
128- uvx black --check --extend-exclude='.*\.pyi' mlir-tensorrt/compiler/ mlir-tensorrt/integrations
129-
130- # Check C++ formatting with clang-format
131- # git clang-format accepts a commit range. Use RANGE computed above.
132- CLANG_FORMAT_DIFF=$(git clang-format-20 ${RANGE} --diff -q)
133- if [ -n "${CLANG_FORMAT_DIFF}" ]; then
134- echo "${CLANG_FORMAT_DIFF}"
135- echo "Error: C++ files are not properly formatted. Run 'git clang-format ${BASE_COMMIT}' to fix."
136- exit 1
137- fi
66+ set -euo pipefail
67+ set -x
68+ bash ./.github/workflows/mlir-tensorrt/ci-utils.sh lint-check
69+ - name : Run release checks
70+ # release check is only needed for release tags
71+ if : ${{ github.ref_type == 'tag' }}
72+ run : |
73+ set -euo pipefail
74+ set -x
75+ bash ./.github/workflows/mlir-tensorrt/ci-utils.sh release-check
13876 - name : Generate Build Matrix
13977 id : generate-matrix
14078 run : |
@@ -152,32 +90,25 @@ jobs:
15290 echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
15391 echo "channel=${CHANNEL}" >> "${GITHUB_OUTPUT}"
15492
155- mlir-tensorrt-build-test-x86_64 :
156- name : Build and Test on x86_64
93+ mlir-tensorrt-build-test :
94+ name : Build and Test
15795 needs :
158- - changes
159- - format-check
160- if : ${{ needs.changes.outputs.has_changes == 'true' && needs.format-check.outputs.channel != 'release' }}
96+ - pre-check
97+ if : ${{ needs.pre-check.outputs.channel != 'release' }}
16198 uses : ./.github/workflows/mlir-tensorrt-build-test.yml
16299 with :
163- build-matrix : ${{ needs.format-check.outputs.matrix }}
164- channel : ${{ needs.format-check.outputs.channel }}
165- arch : x86_64
166- github_runner : linux-amd64-gpu-h100-latest-1
100+ build-matrix : ${{ needs.pre-check.outputs.matrix }}
101+ channel : ${{ needs.pre-check.outputs.channel }}
167102
168- mlir-tensorrt-build-test-aarch64 :
169- name : Build and Test on aarch64
103+ mlir-tensorrt-wheel-tarball-release :
104+ name : Release
170105 needs :
171- - changes
172- - format-check
173- - mlir-tensorrt-build-test-x86_64
174- if : ${{ needs.changes.outputs.has_changes == 'true' && needs.format-check.outputs.channel != 'release' }}
175- uses : ./.github/workflows/mlir-tensorrt-build-test.yml
106+ - pre-check
107+ if : ${{ needs.pre-check.outputs.channel == 'release' }}
108+ uses : ./.github/workflows/mlir-tensorrt-release.yml
176109 with :
177- build-matrix : ${{ needs.format-check.outputs.matrix }}
178- channel : ${{ needs.format-check.outputs.channel }}
179- arch : aarch64
180- github_runner : linux-arm64-gpu-l4-latest-1
110+ build-matrix : ${{ needs.pre-check.outputs.matrix }}
111+
181112
182113concurrency :
183114 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-mlir-tensorrt
0 commit comments