diff --git a/.github/actions/embed/Dockerfile b/.github/actions/embed/Dockerfile index 75d61876a..a16d96b48 100644 --- a/.github/actions/embed/Dockerfile +++ b/.github/actions/embed/Dockerfile @@ -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" ] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 029c2e817..0e69aef8e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1b725ff03..449ab665d 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -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 diff --git a/.lefthook.yml b/.lefthook.yml index 8d518ea07..31eb5fc47 100644 --- a/.lefthook.yml +++ b/.lefthook.yml @@ -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 diff --git a/Cargo.toml b/Cargo.toml index d627a927c..0eee3c4ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" @@ -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 = [ diff --git a/README.md b/README.md index b3ecc4d5a..435bc2896 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,9 @@ All features are disabled by default. class type, `RustClosure`. - `anyhow` - Implements `Into` 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 diff --git a/tests/Cargo.toml b/tests/Cargo.toml index 8feadcc08..1f95058fb 100644 --- a/tests/Cargo.toml +++ b/tests/Cargo.toml @@ -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"]