diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 31bfa3d..e7e1b30 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 @@ -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 diff --git a/tests/test_model.rs b/tests/test_model.rs index 9f59931..6b2e1ef 100644 --- a/tests/test_model.rs +++ b/tests/test_model.rs @@ -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(); @@ -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();