Skip to content
Open
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
112 changes: 112 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
CARGO_TERM_COLOR: always

jobs:
zigbuild:
strategy:
matrix:
target:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-apple-darwin
- aarch64-apple-darwin
- x86_64-pc-windows-gnu
- wasm32-unknown-unknown

runs-on: ubuntu-latest
container:
image: ghcr.io/rust-cross/cargo-zigbuild:sha-59b27c3

steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Install CMake
if: matrix.target != 'wasm32-unknown-unknown'
run: |
apt-get update -y && apt-get install -y --no-install-recommends --no-install-suggests cmake

- name: Add wasm target
if: matrix.target == 'wasm32-unknown-unknown'
run: rustup target add wasm32-unknown-unknown

- name: Install clippy
run: rustup component add clippy

- name: Run cargo clippy
if: matrix.target != 'wasm32-unknown-unknown'
run: cargo clippy --target ${{ matrix.target }} --features cmake -- -D warnings

- name: Build
run: cargo zigbuild --target ${{ matrix.target }}

- name: Build with thin feature
run: cargo zigbuild --target ${{ matrix.target }} --features thin

- name: Build with cmake feature
if: matrix.target != 'wasm32-unknown-unknown'
run: cargo zigbuild --target ${{ matrix.target }} --features cmake

- name: Build with cmake feature (no default features)
if: matrix.target != 'wasm32-unknown-unknown'
run: cargo zigbuild --target ${{ matrix.target }} --no-default-features --features cmake,legacy,zdict_builder

windows-msvc:
strategy:
matrix:
target:
- i686-pc-windows-msvc
- x86_64-pc-windows-msvc

runs-on: windows-latest

steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Setup Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable-${{ matrix.target }}
targets: ${{ matrix.target }}

- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

- name: Build with feature thin
run: cargo build --verbose --features thin
- name: Run tests with feature thin
run: cargo test --verbose --features thin

- name: Build zstd-safe with feature seekable
run: cargo build --manifest-path zstd-safe/Cargo.toml --verbose --features seekable
- name: Run zstd-safe tests with feature seekable
run: cargo test --manifest-path zstd-safe/Cargo.toml --verbose --features seekable
- name: Build zstd-safe with features std and seekable
run: cargo build --manifest-path zstd-safe/Cargo.toml --verbose --features std,seekable
- name: Run zstd-safe tests with features std and seekable
run: cargo test --manifest-path zstd-safe/Cargo.toml --verbose --features std,seekable
38 changes: 0 additions & 38 deletions .github/workflows/linux.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/macos.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/wasm.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .github/workflows/windows.yml

This file was deleted.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ partial-io = "0.5"
walkdir = "2.2"

[features]
default = ["legacy", "arrays", "zdict_builder"]
default = ["legacy", "arrays", "zdict_builder", "cc"]

bindgen = ["zstd-safe/bindgen"]
cc = ["zstd-safe/cc"]
debug = ["zstd-safe/debug"]
legacy = ["zstd-safe/legacy"]
pkg-config = ["zstd-safe/pkg-config"]
Expand All @@ -40,6 +41,7 @@ zstdmt = ["zstd-safe/zstdmt"]
experimental = ["zstd-safe/experimental"]
thin = ["zstd-safe/thin"]
arrays = ["zstd-safe/arrays"]
cmake = ["zstd-safe/cmake"]
no_asm = ["zstd-safe/no_asm"]
doc-cfg = []
zdict_builder = ["zstd-safe/zdict_builder"]
Expand Down
4 changes: 2 additions & 2 deletions src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<'a> DecoderDictionary<'a> {
///
/// * `sample_data` is the concatenation of all sample data.
/// * `sample_sizes` is the size of each sample in `sample_data`.
/// The sum of all `sample_sizes` should equal the length of `sample_data`.
/// The sum of all `sample_sizes` should equal the length of `sample_data`.
/// * `max_size` is the maximum size of the dictionary to generate.
///
/// The result is the dictionary data. You can, for example, feed it to [`CDict::create`].
Expand Down Expand Up @@ -222,7 +222,7 @@ where
/// Train a dict from a list of files.
///
/// * `filenames` is an iterator of files to load. Each file will be treated as an individual
/// sample.
/// sample.
/// * `max_size` is the maximum size of the dictionary to generate.
///
/// The result is the dictionary data. You can, for example, feed it to [`CDict::create`].
Expand Down
4 changes: 3 additions & 1 deletion zstd-safe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ features = ["experimental", "arrays", "std", "zdict_builder", "doc-cfg"]
zstd-sys = { path = "zstd-sys", version = "2.0.15", default-features = false }

[features]
default = ["legacy", "arrays", "zdict_builder"]
default = ["legacy", "arrays", "zdict_builder", "cc"]

bindgen = ["zstd-sys/bindgen"]
cc = ["zstd-sys/cc"]
debug = ["zstd-sys/debug"]
experimental = ["zstd-sys/experimental"]
legacy = ["zstd-sys/legacy"]
Expand All @@ -31,6 +32,7 @@ std = ["zstd-sys/std"] # Implements WriteBuf for std types like Cursor and Vec.
zstdmt = ["zstd-sys/zstdmt"]
thin = ["zstd-sys/thin"]
arrays = []
cmake = ["zstd-sys/cmake"]
no_asm = ["zstd-sys/no_asm"]
doc-cfg = []
zdict_builder = ["zstd-sys/zdict_builder"]
Expand Down
15 changes: 14 additions & 1 deletion zstd-safe/zstd-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ include = [
"/zstd/lib/**/*.c",
"/zstd/lib/**/*.h",
"/zstd/lib/**/*.S",
"/zstd/lib/libzstd.pc.in",
"/zstd/contrib/seekable_format/*.c",
"/zstd/contrib/seekable_format/*.h",
"/zstd/build/cmake/CMakeLists.txt",
"/zstd/build/cmake/zstdConfig.cmake.in",
"/zstd/build/cmake/CMakeModules/*.cmake",
"/zstd/build/cmake/lib/CMakeLists.txt",
"/zstd/build/cmake/lib/*.in",
]
# exclude = [
# "zstd",
Expand Down Expand Up @@ -63,10 +69,17 @@ version = "0.3.28"
[build-dependencies.cc]
version = "1.0.45"
features = ["parallel"]
optional = true

[build-dependencies.cmake]
version = "0.1"
optional = true

[features]
default = ["legacy", "zdict_builder", "bindgen"]
default = ["legacy", "zdict_builder", "bindgen", "cc"]

cc = ["dep:cc"] # Use cc crate to build zstd (default)
cmake = ["dep:cmake"] # Use CMake to build zstd (improves cross-compilation support)
debug = [] # Enable zstd debug logs
experimental = [] # Expose experimental ZSTD API
legacy = [] # Enable legacy ZSTD support (for versions < zstd-0.8)
Expand Down
Loading