11name : MLIR-TensorRT CI
22
33on :
4- pull_request :
5- branches :
6- - main
7- types : [synchronize, opened, reopened, ready_for_review]
8- paths : ["mlir-tensorrt/**"]
94 push :
105 branches :
11- - main
12- paths : ["mlir-tensorrt/**"]
6+ - " pull-request/[0-9]+"
7+ tags :
8+ # release tag example: v0.4.2
9+ # release candidate tag example: v0.4.2-rc1
10+ - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
11+ workflow_dispatch :
12+ schedule :
13+ - cron : ' 0 0 * * *' # Runs at 00:00 UTC every day (minute hour day-of-month month-of-year day-of-week)
1314
1415env :
15- DEFAULT_IMAGE : ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda12.5 -ubuntu-llvm17
16+ DEFAULT_IMAGE : ghcr.io/nvidia/tensorrt-incubator/mlir-tensorrt:cuda12.9 -ubuntu-llvm17
1617 REGISTRY : ghcr.io
1718
1819jobs :
19- mlir-tensorrt-test-pr :
20- if : github.event_name != 'pull_request' || github.event.pull_request.draft == false
21- runs-on : tripy-self-hosted
22-
20+ format-check :
21+ name : Lint Check
22+ runs-on : ubuntu-latest
2323 steps :
24- # Value of `github.workspace` is /home/runner/work/{repo_name}/{repo-name}
25- # i.e. /home/runner/work/TensorRT-Incubator/TensorRT-Incubator in our case.
26- # After this action, repo is cloned inside above path.
27- - uses : actions/checkout@v4
24+ - name : checkout TensorRT-Incubator
25+ uses : actions/checkout@v4
2826 with :
2927 fetch-depth : 5
30-
31- # Run initial format check
3228 - name : Run python format and clang check
3329 uses : addnab/docker-run-action@v3
34- if : ${{ github.event_name == 'pull_request' }}
3530 with :
3631 image : ${{ env.DEFAULT_IMAGE }}
3732 options : -v ${{ github.workspace }}:/tensorrt-incubator
3833 registry : ${{ env.REGISTRY }}
3934 username : ${{ github.actor }}
4035 password : ${{ secrets.GITHUB_TOKEN }}
41- # This step does two things
42- # 1. Check if Python files follow black format
43- # 2. Check if C++ files follow clang format
44- # NOTE: We are placed at the root directory ('/') inside the container.
4536 run : |
46- cd tensorrt-incubator
37+ set -euo pipefail
38+ set -x
39+ cd /tensorrt-incubator
4740 git config --global --add safe.directory /tensorrt-incubator
48- cat > run_format_check.sh <<EOF
49- #!/bin/bash
50- set -e
51- python3 -m black --check --extend-exclude='.*\.pyi' mlir-tensorrt/compiler/
52- python3 -m black --check --extend-exclude='.*\.pyi' mlir-tensorrt/integrations/python/
41+ uvx -p 3.12 black --check --extend-exclude='.*\.pyi' \
42+ mlir-tensorrt/compiler/ mlir-tensorrt/integrations/python/
5343 git clang-format HEAD~1 --diff
54- EOF
55-
56- bash run_format_check.sh
5744
58- # Create cache folders
59- - name : Create cache folder
60- run : |
61- mkdir -p ${{ github.workspace }}/ccache
62- mkdir -p ${{ github.workspace }}/.cache.cpm
63-
64- # Restore cache, if exists.
65- - name : Restore cache
66- id : restore-cache
67- uses : actions/cache/restore@v4
45+ generate-matrix :
46+ name : Generate Build Matrix
47+ runs-on : ubuntu-latest
48+ outputs :
49+ matrix : ${{ steps.generate.outputs.matrix }}
50+ channel : ${{ steps.generate.outputs.channel }}
51+ steps :
52+ - name : Checkout TensorRT-Incubator
53+ uses : actions/checkout@v4
6854 with :
69- key : ${{ runner.os }}-mlir-tensorrt-cache-${{ hashFiles('mlir-tensorrt/**/*.cpp', 'mlir-tensorrt/**/*.h', 'mlir-tensorrt/build_tools/**/*') }}
70- restore-keys : |
71- ${{ runner.os }}-mlir-tensorrt-cache-
72- path : |
73- ${{ github.workspace }}/ccache
74- ${{ github.workspace }}/.cache.cpm/*
75- !${{ github.workspace }}/.cache.cpm/tensorrt
55+ path : ${{ github.workspace }}/tensorrt-incubator
56+ - name : Generate Build Matrix
57+ id : generate
58+ run : |
59+ set -euo pipefail
60+ set -x
61+ CHANNEL="test"
62+ if [ "${GITHUB_EVENT_NAME:-}" = "schedule" ]; then
63+ CHANNEL="nightly"
64+ elif [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then
65+ CHANNEL="release"
66+ fi
67+ MATRIX_BLOB="$(python3 ${{ github.workspace }}/tensorrt-incubator/.github/workflows/mlir-tensorrt/generate-matrix.py --channel "${CHANNEL}")"
68+ echo "${MATRIX_BLOB}"
69+ echo "${CHANNEL}"
70+ echo "matrix=${MATRIX_BLOB}" >> "${GITHUB_OUTPUT}"
71+ echo "channel=${CHANNEL}" >> "${GITHUB_OUTPUT}"
7672
77- # TensorRT 10 tests
78- - name : TensorRT 10 build
79- uses : addnab/docker-run-action@v3
80- with :
81- image : ${{ env.DEFAULT_IMAGE }}
82- options : -v ${{ github.workspace }}/mlir-tensorrt:/mlir-tensorrt -v ${{ github.workspace }}/ccache:/ccache -v ${{ github.workspace }}/.cache.cpm:/.cache.cpm --gpus all
83- registry : ${{ env.REGISTRY }}
84- username : ${{ github.actor }}
85- password : ${{ secrets.GITHUB_TOKEN }}
86- run : |
87- cd mlir-tensorrt
88- ./build_tools/scripts/cicd_build.sh --build_only
73+ mlir-tensorrt-build-test :
74+ name : Build and Test
75+ needs : generate-matrix
76+ if : ${{ needs.generate-matrix.outputs.channel != 'release' }}
77+ uses : ./.github/workflows/mlir-tensorrt-build-test.yml
78+ with :
79+ build-matrix : ${{ needs.generate-matrix.outputs.matrix }}
80+ channel : ${{ needs.generate-matrix.outputs.channel }}
8981
90- - name : Save cache
91- id : save-cache
92- uses : actions/cache/save@v4
93- with :
94- key : ${{ runner.os }}-mlir-tensorrt-cache-${{ hashFiles('mlir-tensorrt/**/*.cpp', 'mlir-tensorrt/**/*.h', 'mlir-tensorrt/build_tools/**/*') }}
95- path : |
96- ${{ github.workspace }}/ccache
97- ${{ github.workspace }}/.cache.cpm/*
98- !${{ github.workspace }}/.cache.cpm/tensorrt
82+ mlir-tensorrt-release :
83+ name : Release
84+ needs : generate-matrix
85+ if : ${{ needs.generate-matrix.outputs.channel == 'release' }}
86+ uses : ./.github/workflows/mlir-tensorrt-release.yml
87+ with :
88+ build-matrix : ${{ needs.generate-matrix.outputs.matrix }}
89+ channel : release
9990
100- - name : TensorRT 10 test
101- uses : addnab/docker-run-action@v3
102- with :
103- image : ${{ env.DEFAULT_IMAGE }}
104- options : -v ${{ github.workspace }}/mlir-tensorrt:/mlir-tensorrt -v ${{ github.workspace }}/ccache:/ccache -v ${{ github.workspace }}/.cache.cpm:/.cache.cpm --gpus all
105- registry : ${{ env.REGISTRY }}
106- username : ${{ github.actor }}
107- password : ${{ secrets.GITHUB_TOKEN }}
108- run : |
109- cd mlir-tensorrt
110- ./build_tools/scripts/cicd_build.sh
111-
112- # TensorRT 10 & ASAN
113- - name : TensorRT 10 ASAN test
114- uses : addnab/docker-run-action@v3
115- with :
116- image : ${{ env.DEFAULT_IMAGE }}
117- options : -v ${{ github.workspace }}/mlir-tensorrt:/mlir-tensorrt -v ${{ github.workspace }}/ccache:/ccache -v ${{ github.workspace }}/.cache.cpm:/.cache.cpm --gpus all
118- registry : ${{ env.REGISTRY }}
119- username : ${{ github.actor }}
120- password : ${{ secrets.GITHUB_TOKEN }}
121- run : |
122- cd mlir-tensorrt
123- ENABLE_ASAN=ON ./build_tools/scripts/cicd_build.sh
91+ concurrency :
92+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-mlir-tensorrt
93+ cancel-in-progress : true
0 commit comments