Skip to content

Commit 075e3c2

Browse files
authored
Make ONNX support optional (#13)
* deps: make ONNX support optional * ci: test without protoc and ONNX support
1 parent 3de83e2 commit 075e3c2

7 files changed

Lines changed: 315 additions & 115 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ env:
1212

1313
jobs:
1414
test:
15-
name: Test on ${{ matrix.os }}
15+
name: Test (${{ matrix.os }}, minimal=${{ matrix.minimal }})
1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest, windows-latest, macos-latest]
21+
minimal: [true, false]
22+
env:
23+
CARGO_FLAGS: ${{ matrix.minimal && '--no-default-features' || '' }}
2124

2225
steps:
2326
- name: Checkout code
@@ -29,42 +32,42 @@ jobs:
2932
components: rustfmt, clippy
3033

3134
- name: Install protoc (Linux)
32-
if: runner.os == 'Linux'
35+
if: ${{ runner.os == 'Linux' && !matrix.minimal }}
3336
run: |
3437
sudo apt-get update
3538
sudo apt-get install -y protobuf-compiler
3639
3740
- name: Install protoc (macOS)
38-
if: runner.os == 'macOS'
41+
if: ${{ runner.os == 'macOS' && !matrix.minimal }}
3942
run: brew install protobuf
4043

4144
- name: Install protoc (Windows)
42-
if: runner.os == 'Windows'
45+
if: ${{ runner.os == 'Windows' && !matrix.minimal }}
4346
run: choco install protoc
4447

4548
- name: Cache cargo registry
4649
uses: actions/cache@v4
4750
with:
4851
path: ~/.cargo/registry
49-
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
52+
key: ${{ runner.os }}-${{ matrix.minimal }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
5053
restore-keys: |
51-
${{ runner.os }}-cargo-registry-
54+
${{ runner.os }}-${{ matrix.minimal }}-cargo-registry-
5255
5356
- name: Cache cargo index
5457
uses: actions/cache@v4
5558
with:
5659
path: ~/.cargo/git
57-
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
60+
key: ${{ runner.os }}-${{ matrix.minimal }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
5861
restore-keys: |
59-
${{ runner.os }}-cargo-git-
62+
${{ runner.os }}-${{ matrix.minimal }}-cargo-git-
6063
6164
- name: Cache target directory
6265
uses: actions/cache@v4
6366
with:
6467
path: target
65-
key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }}
68+
key: ${{ runner.os }}-${{ matrix.minimal }}-target-${{ hashFiles('**/Cargo.lock') }}
6669
restore-keys: |
67-
${{ runner.os }}-target-
70+
${{ runner.os }}-${{ matrix.minimal }}-target-
6871
6972
# Cache the ResNet-50 ONNX model separately so it survives Cargo.lock churn
7073
# and is not evicted as collateral damage when the target/ cache is invalidated.

0 commit comments

Comments
 (0)