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
2 changes: 1 addition & 1 deletion .github/actions/embed/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ ENV PATH=/cargo/bin:/rust/bin:$PATH

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path && cargo install cargo-expand

ENTRYPOINT [ "/cargo/bin/cargo", "test", "--workspace", "--release", "--all-features", "--no-fail-fast" ]
ENTRYPOINT [ "/cargo/bin/cargo", "test", "--workspace", "--release", "--features", "closure,embed,anyhow", "--no-fail-fast" ]
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
- name: Run rustfmt
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features -- -W clippy::pedantic -D warnings
run: cargo clippy --workspace --all-targets --features closure,embed,anyhow -- -W clippy::pedantic -D warnings
# Docs
- name: Run rustdoc
run: cargo rustdoc -- -D warnings
Expand Down Expand Up @@ -162,12 +162,12 @@ jobs:
- name: Build
env:
EXT_PHP_RS_TEST: ""
run: cargo build --release --features closure,anyhow --workspace ${{ matrix.php == '8.0' && '--no-default-features' || '' }}
run: cargo build --release --features closure,anyhow,runtime --workspace ${{ matrix.php == '8.0' && '--no-default-features' || '' }}
# Test
- name: Test inline examples
# Macos fails on unstable rust. We skip the inline examples test for now.
if: "!(contains(matrix.os, 'macos') && matrix.rust == 'nightly')"
run: cargo test --release --workspace --features closure,anyhow --no-fail-fast ${{ matrix.php == '8.0' && '--no-default-features' || '' }}
run: cargo test --release --workspace --features closure,anyhow,runtime --no-fail-fast ${{ matrix.php == '8.0' && '--no-default-features' || '' }}
build-zts:
name: Build with ZTS
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ jobs:
cargo tarpaulin --version
- name: Run tests
run: |
cargo tarpaulin --engine llvm --workspace --all-features --tests --exclude tests --exclude-files docsrs_bindings.rs --exclude-files "crates/macros/tests/expand/*.expanded.rs" --timeout 120 --out Xml
cargo tarpaulin --engine llvm --workspace --features closure,embed,anyhow --tests --exclude tests --exclude-files docsrs_bindings.rs --exclude-files "crates/macros/tests/expand/*.expanded.rs" --timeout 120 --out Xml
- name: Upload coverage
uses: coverallsapp/github-action@v2
2 changes: 1 addition & 1 deletion .lefthook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pre-commit:
- "crates/macros/tests/expand/*.expanded.rs"
stage_fixed: true
- name: clippy
run: cargo clippy --workspace --all-targets --all-features -- -W clippy::pedantic -D warnings
run: cargo clippy --workspace --all-targets --features closure,embed,anyhow -- -W clippy::pedantic -D warnings
glob: "*.rs"
- name: bindings
run: tools/update_bindings.sh && git diff --exit-code docsrs_bindings.rs
Expand Down
6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ skeptic = "0.13"

[build-dependencies]
anyhow = "1"
bindgen = "0.72"
bindgen = { version = "0.72", default-features = false, features = ["logging", "prettyplease"] }
cc = "1.2"
skeptic = "0.13"

Expand All @@ -41,11 +41,13 @@ native-tls = "0.2"
zip = "6.0"

[features]
default = ["enum"]
default = ["enum", "runtime"]
closure = []
embed = []
anyhow = ["dep:anyhow"]
enum = []
runtime = ["bindgen/runtime"]
static = ["bindgen/static"]

[workspace]
members = [
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ All features are disabled by default.
class type, `RustClosure`.
- `anyhow` - Implements `Into<PhpException>` for `anyhow::Error`, allowing you
to return anyhow results from PHP functions. Supports anyhow v1.x.
- `static` - Allows building the library against
[statically linked clang](https://github.com/KyleMayes/clang-sys?tab=readme-ov-file#static),
for example with [static-php-cli](https://static-php.dev/)

## Usage

Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false
license = "MIT OR Apache-2.0"

[dependencies]
ext-php-rs = { path = "../", default-features = false, features = ["closure"] }
ext-php-rs = { path = "../", default-features = false, features = ["closure", "runtime"] }

[features]
default = ["enum"]
Expand Down