Skip to content

Commit 574dbe5

Browse files
[CI] Add release wheel pipeline (#742)
1 parent 5052cc6 commit 574dbe5

File tree

10 files changed

+480
-142
lines changed

10 files changed

+480
-142
lines changed

.github/workflows/mlir-tensorrt-build-test.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,14 @@ on:
1111
description: 'Build matrix to utilize'
1212
default: ""
1313
type: string
14-
arch:
15-
description: 'Architecture, valid values are "x86_64" or "aarch64"'
16-
default: "x86_64"
17-
type: string
18-
github_runner:
19-
description: 'Runner, valid values are "linux-amd64-gpu-h100-latest-1" or "linux-arm64-gpu-l4-latest-1"'
20-
default: "linux-amd64-gpu-h100-latest-1"
21-
type: string
2214

2315
defaults:
2416
run:
2517
shell: bash
2618

2719
jobs:
2820
mlir-tensorrt-build-test:
29-
name: ${{ inputs.arch }}-cu${{ matrix.cuda }}-trt${{ matrix.trt }}-build-test
21+
name: ${{ matrix.arch }}-cu${{ matrix.cuda }}-trt${{ matrix.trt }}-build-test
3022
strategy:
3123
fail-fast: false
3224
max-parallel: 1
@@ -36,19 +28,20 @@ jobs:
3628
DOWNLOAD_TENSORRT_VERSION: ${{ matrix.trt }}
3729
# eg. CHANNEL: nightly, test or release
3830
CHANNEL: ${{ inputs.channel }}
39-
ARCH: ${{ inputs.arch }}
31+
ARCH: ${{ matrix.arch }}
4032
CMAKE_PRESET: ${{ matrix.cmake_preset }}
4133
CCACHE_DIR: ${{ github.workspace }}/mlir-tensorrt/ccache
42-
CCACHE_RESTORE_KEY: mlir-tensorrt-ccache-v1-${{ inputs.arch }}-${{ matrix.cmake_preset }}
4334
CPM_SOURCE_CACHE: ${{ github.workspace }}/mlir-tensorrt/.cache.cpm
35+
CCACHE_RESTORE_KEY: mlir-tensorrt-ccache-v1-${{ matrix.arch }}-${{ matrix.cmake_preset }}
4436
CPM_KEY: mlir-tensorrt-cpm-v1
4537
CPM_RESTORE_KEY: mlir-tensorrt-cpm-v1
46-
runs-on: ${{ inputs.github_runner }}
38+
runs-on: ${{ matrix.github_runner }}
4739
container:
4840
image: ${{ matrix.docker_image }}
4941
options: >-
5042
--gpus all
5143
--shm-size=1g
44+
timeout-minutes: 120
5245
steps:
5346
# Checkout the repository
5447
- name: Checkout TensorRT-Incubator
@@ -128,7 +121,7 @@ jobs:
128121
- name: Save CPM Cache
129122
# cpm cache is shared across x86_64 and aarch64, we let only x86_64 to save cpm cache when in cache miss case
130123
# this is to avoid both x86_64 and aarch64 to save cpm cache when in cache miss case
131-
if: ${{ inputs.arch == 'x86_64' &&
124+
if: ${{ matrix.arch == 'x86_64' &&
132125
(
133126
steps.restore-cpm.outputs.cache-hit != 'true' ||
134127
steps.restore-cpm.outputs['cache-matched-key'] != env.CPM_KEY
@@ -157,5 +150,6 @@ jobs:
157150
./build_tools/scripts/cicd-build.sh
158151
159152
concurrency:
160-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-mlir-tensorrt-${{ inputs.channel }}-${{ inputs.arch }}
153+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-mlir-tensorrt-${{ inputs.channel }}
161154
cancel-in-progress: true
155+

.github/workflows/mlir-tensorrt-ci.yml

Lines changed: 37 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ on:
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

182113
concurrency:
183114
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-mlir-tensorrt

0 commit comments

Comments
 (0)