Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@ jobs:
strategy:
fail-fast: false
matrix:
backend: # Different backends for Tokenizers
- default
- fancy-regex
include:
- name: default
build: cargo build --verbose
test: cargo test --verbose
- name: fancy-regex
build: cargo build --no-default-features --features fancy-regex --verbose
test: cargo test --no-default-features --features fancy-regex --verbose
- name: local-only
build: cargo build --no-default-features --features onig,local-only --verbose
test: cargo test --no-default-features --features onig,local-only --verbose

steps:
- name: Checkout
Expand All @@ -26,23 +33,28 @@ jobs:
components: clippy, rustfmt

- name: Build
run: |
if [ "${{ matrix.backend }}" = "default" ]; then
cargo build --verbose
else
cargo build --no-default-features --features fancy-regex --verbose
fi
run: ${{ matrix.build }}

- name: Test
run: |
if [ "${{ matrix.backend }}" = "default" ]; then
cargo test --verbose
else
cargo test --no-default-features --features fancy-regex --verbose
fi
run: ${{ matrix.test }}

- name: Lint (clippy)
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Format check
run: cargo fmt -- --check

wasm-check:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown

- name: Check wasm feature set
run: RUSTFLAGS='--cfg getrandom_backend="wasm_js"' cargo check --no-default-features --features wasm --target wasm32-unknown-unknown
4 changes: 2 additions & 2 deletions tests/test_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fn test_from_bytes_matches_from_pretrained_for_local_model() {
}
}

#[cfg(not(feature = "hf-hub"))]
#[cfg(all(not(feature = "hf-hub"), not(feature = "local-only")))]
#[test]
fn test_from_pretrained_remote_requires_hf_hub_feature() {
let err = StaticModel::from_pretrained("minishlab/potion-base-2M", None, None, None).unwrap_err();
Expand All @@ -133,7 +133,7 @@ fn test_from_pretrained_remote_requires_hf_hub_feature() {
);
}

#[cfg(all(feature = "hf-hub", feature = "local-only"))]
#[cfg(feature = "local-only")]
#[test]
fn test_from_pretrained_remote_disallowed_by_local_only_feature() {
let err = StaticModel::from_pretrained("minishlab/potion-base-2M", None, None, None).unwrap_err();
Expand Down
Loading