@@ -15,12 +15,67 @@ concurrency:
1515
1616env :
1717 CARGO_TERM_COLOR : always
18- RUSTFLAGS : " -C debuginfo=1"
18+ RUSTFLAGS : " -C debuginfo=0 -C codegen-units=16"
19+ CARGO_TARGET_DIR : ${{ github.workspace }}/.cargo-target
1920
2021jobs :
22+ build-wheel :
23+ runs-on : ubuntu-24.04
24+ timeout-minutes : 30
25+ steps :
26+ - uses : actions/checkout@v4
27+ - name : Set up Python 3.11
28+ uses : actions/setup-python@v4
29+ with :
30+ python-version : " 3.11"
31+ - name : Setup Rust
32+ uses : actions-rust-lang/setup-rust-toolchain@v1
33+ with :
34+ cache : false
35+ - name : Cache Rust build (shared)
36+ uses : actions/cache@v4
37+ with :
38+ path : |
39+ .cargo-target
40+ ~/.cargo/registry
41+ ~/.cargo/git
42+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
43+ restore-keys : |
44+ ${{ runner.os }}-cargo-
45+ - name : Install dependencies
46+ run : |
47+ sudo apt update
48+ sudo apt install -y protobuf-compiler
49+ - name : Install uv
50+ uses : astral-sh/setup-uv@v3
51+ - name : Setup sccache
52+ uses : mozilla-actions/sccache@v0.0.3
53+ - name : Configure sccache
54+ run : echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
55+ - name : Cache uv downloads
56+ uses : actions/cache@v4
57+ with :
58+ path : ~/.cache/uv
59+ key : ${{ runner.os }}-uv-${{ hashFiles('python/pyproject.toml') }}
60+ restore-keys : |
61+ ${{ runner.os }}-uv-
62+ - name : Build wheel (Debug Mode)
63+ working-directory : python
64+ run : |
65+ uv venv
66+ source .venv/bin/activate
67+ uv pip install maturin[patchelf]
68+ maturin build --debug -o dist
69+ - name : Upload wheel
70+ uses : actions/upload-artifact@v4
71+ with :
72+ name : python-wheel
73+ path : python/dist/*.whl
74+
2175 test :
2276 runs-on : ubuntu-24.04
2377 timeout-minutes : 30
78+ needs : build-wheel
2479 strategy :
2580 matrix :
2681 python-version : ["3.11"]
@@ -34,28 +89,50 @@ jobs:
3489 uses : actions-rust-lang/setup-rust-toolchain@v1
3590 with :
3691 cache : false
37- - uses : Swatinem/rust-cache@v2
92+ - name : Cache Rust build (shared)
93+ uses : actions/cache@v4
3894 with :
39- workspaces : python
40- cache-targets : false
95+ path : |
96+ .cargo-target
97+ ~/.cargo/registry
98+ ~/.cargo/git
99+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
100+ restore-keys : |
101+ ${{ runner.os }}-cargo-
41102 - name : Install dependencies
42103 run : |
43104 sudo apt update
44105 sudo apt install -y protobuf-compiler
45106 - name : Install uv
46107 uses : astral-sh/setup-uv@v3
108+ - name : Setup sccache
109+ uses : mozilla-actions/sccache@v0.0.3
110+ - name : Configure sccache
111+ run : echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
112+ - name : Cache uv downloads
113+ uses : actions/cache@v4
114+ with :
115+ path : ~/.cache/uv
116+ key : ${{ runner.os }}-uv-${{ hashFiles('python/pyproject.toml') }}
117+ restore-keys : |
118+ ${{ runner.os }}-uv-
47119 - name : Create virtual environment and install dependencies
48120 working-directory : python
49121 run : |
50122 uv venv
51123 source .venv/bin/activate
52- uv pip install maturin[patchelf]
53- uv pip install -e .[tests]
54- - name : Build Python extension
124+ uv pip install pytest
125+ - name : Download wheel
126+ uses : actions/download-artifact@v4
127+ with :
128+ name : python-wheel
129+ path : python/dist
130+ - name : Install wheel
55131 working-directory : python
56132 run : |
57133 source .venv/bin/activate
58- maturin develop
134+ uv pip install dist/*.whl
135+
59136 - name : Run tests
60137 working-directory : python
61138 run : |
@@ -80,6 +157,17 @@ jobs:
80157 python-version : " 3.11"
81158 - name : Install uv
82159 uses : astral-sh/setup-uv@v3
160+ - name : Setup sccache
161+ uses : mozilla-actions/sccache@v0.0.3
162+ - name : Configure sccache
163+ run : echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
164+ - name : Cache uv downloads
165+ uses : actions/cache@v4
166+ with :
167+ path : ~/.cache/uv
168+ key : ${{ runner.os }}-uv-${{ hashFiles('python/pyproject.toml') }}
169+ restore-keys : |
170+ ${{ runner.os }}-uv-
83171 - name : Install linting tools
84172 working-directory : python
85173 run : |
0 commit comments