@@ -16,61 +16,124 @@ concurrency:
1616 cancel-in-progress : true
1717
1818jobs :
19+ check-changes :
20+ name : Check for source changes
21+ runs-on : ubuntu-latest
22+ outputs :
23+ source-changed : ${{ steps.changes.outputs.source == 'true' }}
24+ docs-changed : ${{ steps.changes.outputs.docs == 'true' }}
25+ steps :
26+ - name : Checkout repository
27+ uses : actions/checkout@v6
28+ with :
29+ fetch-depth : 0
30+
31+ - name : Check for changes
32+ id : changes
33+ uses : dorny/paths-filter@v3
34+ with :
35+ filters : |
36+ source:
37+ - 'src/**'
38+ - 'cext/**'
39+ - 'test/**'
40+ - 'samples/**'
41+ - 'pyproject.toml'
42+ - 'setup.py'
43+ - 'CMakeLists.txt'
44+ - 'ci/**'
45+ - '.github/workflows/**'
46+ - 'Dockerfile.ci'
47+ docs:
48+ - 'docs/**'
49+ - '*.md'
50+
51+ build-ci-image :
52+ name : Build CI Image
53+ runs-on : ubuntu-latest
54+ timeout-minutes : 30
55+ needs : check-changes
56+ if : needs.check-changes.outputs.source-changed == 'true'
57+ steps :
58+ - name : Checkout repository
59+ uses : actions/checkout@v6
60+
61+ - name : Set up Docker Buildx
62+ uses : docker/setup-buildx-action@v3
63+ with :
64+ buildkitd-config : /etc/buildkit/buildkitd.toml
65+
66+ - name : Build CI image
67+ timeout-minutes : 20
68+ uses : docker/build-push-action@v6
69+ with :
70+ context : .
71+ file : ./Dockerfile.ci
72+ tags : cutile-ci:${{ github.sha }}
73+ cache-from : type=gha
74+ cache-to : type=gha,mode=max
75+ load : true
76+ outputs : type=docker,compression=zstd
77+
78+ - name : Export CI image
79+ run : |
80+ docker save cutile-ci:${{ github.sha }} | gzip > cutile-ci-image.tar.gz
81+
82+ - name : Upload CI image artifact
83+ uses : actions/upload-artifact@v5
84+ with :
85+ name : ci-image
86+ path : cutile-ci-image.tar.gz
87+ retention-days : 1
1988 lint :
2089 name : Lint
2190 runs-on : ubuntu-latest
2291 timeout-minutes : 10
92+ container :
93+ image : python:3.10-slim
2394 steps :
2495 - name : Checkout repository
2596 uses : actions/checkout@v6
2697
27- - name : Set up Python
28- uses : actions/setup-python@v6
29- with :
30- python-version : " 3.10"
31-
3298 - name : Install lint dependencies
33- run : |
34- python -m pip install --upgrade pip
35- pip install flake8 reuse
99+ run : pip install --no-cache-dir flake8==7.3.0 reuse==5.1.0
36100
37101 - name : Run flake8
38102 run : flake8
39103
104+ - name : Run cpplint
105+ run : python ci/cpplint.py
106+
40107 - name : Check license headers (REUSE)
41- run : |
42- outputs=$(reuse lint --lines | grep -v -e "src/cuda/tile/VERSION" || true)
43- if [ -n "$outputs" ]; then
44- echo -e "License check failed\n${outputs}"
45- exit 1
46- fi
108+ run : ci/scripts/check_license.sh
47109
48110 - name : Check inline samples are up to date
49111 run : python test/tools/inline_samples.py --check
50112
51113 build-wheel :
52114 name : Build wheel (Linux x86_64, Python ${{ matrix.python-version }})
53115 runs-on : ubuntu-latest
116+ needs : [check-changes, build-ci-image]
117+ if : needs.check-changes.outputs.source-changed == 'true'
54118 timeout-minutes : 30
55119 container :
56- image : nvidia/cuda:13.0.2-devel-ubuntu24.04
120+ image : cutile-ci:${{ github.sha }}
57121 strategy :
58122 fail-fast : false
59123 matrix :
60124 python-version : ["3.10", "3.11", "3.12", "3.13"]
61125 steps :
126+ - name : Load CI image
127+ uses : actions/download-artifact@v5
128+ with :
129+ name : ci-image
130+ - run : docker load < cutile-ci-image.tar.gz
131+
62132 - name : Checkout repository
63133 uses : actions/checkout@v6
64134
65- - name : Install build dependencies
66- run : |
67- apt-get update
68- apt-get install -y software-properties-common cmake build-essential git
69- add-apt-repository -y ppa:deadsnakes/ppa
70- apt-get update
71- apt-get install -y python${{ matrix.python-version }} python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-dev
72-
73135 - name : Build wheel
136+ timeout-minutes : 15
74137 run : |
75138 python${{ matrix.python-version }} -m venv .venv
76139 .venv/bin/pip install --upgrade pip build wheel setuptools
@@ -86,17 +149,21 @@ jobs:
86149 build-docs :
87150 name : Build docs
88151 runs-on : ubuntu-latest
152+ needs : [check-changes, build-ci-image, build-wheel]
153+ if : always() && (needs.check-changes.outputs.source-changed == 'true' || needs.check-changes.outputs.docs-changed == 'true')
89154 timeout-minutes : 15
90- needs : build-wheel
155+ container :
156+ image : cutile-ci:${{ github.sha }}
91157 steps :
158+ - name : Load CI image
159+ uses : actions/download-artifact@v5
160+ with :
161+ name : ci-image
162+ - run : docker load < cutile-ci-image.tar.gz
163+
92164 - name : Checkout repository
93165 uses : actions/checkout@v6
94166
95- - name : Set up Python
96- uses : actions/setup-python@v6
97- with :
98- python-version : " 3.10"
99-
100167 - name : Download wheel artifact
101168 uses : actions/download-artifact@v5
102169 with :
@@ -105,14 +172,13 @@ jobs:
105172
106173 - name : Install dependencies
107174 run : |
108- python -m pip install --upgrade pip
109175 pip install dist/*.whl
110- pip install -r docs/requirements.txt
111176
112177 - name : Build documentation
178+ timeout-minutes : 10
113179 run : |
114180 cd docs
115- make html
181+ timeout 8m make html
116182
117183 - name : Upload documentation artifact
118184 uses : actions/upload-artifact@v5
0 commit comments