diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7996d88cf..8eff9d004a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,18 +34,26 @@ jobs: with: toolchain: ${{ matrix.rust-toolchain }} override: true + components: rustfmt, clippy - name: Setup LLVM & Clang + id: clang uses: KyleMayes/install-llvm-action@v1 with: version: ${{ matrix.llvm }} directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }} + - name: Configure Clang + run: | + echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib" >> $GITHUB_ENV + echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV + - name: Configure Clang (macOS only) + if: "contains(matrix.os, 'macos')" + run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV - name: Install mdbook uses: peaceiris/actions-mdbook@v1 with: mdbook-version: latest - name: Build env: - LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib EXT_PHP_RS_TEST: run: cargo build --release --all-features --all - name: Test guide examples @@ -56,57 +64,30 @@ jobs: mdbook test guide -L target/release/deps - name: Test inline examples uses: actions-rs/cargo@v1 - env: - LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib with: command: test args: --release --all - build-zts: - name: Build with ZTS - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Build - uses: ./.github/actions/zts - lint: - name: Lint - runs-on: ubuntu-latest - strategy: - matrix: - llvm: - - '11.0' - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Setup Rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt, clippy - - name: Setup LLVM & Clang - uses: KyleMayes/install-llvm-action@v1 - with: - version: ${{ matrix.llvm }} - directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }} - name: Run rustfmt uses: actions-rs/cargo@v1 - env: - LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib with: command: fmt args: --all -- --check - name: Run clippy uses: actions-rs/cargo@v1 - env: - LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib with: command: clippy args: --all -- -D warnings - name: Build with docs stub + if: "contains(matrix.os, 'ubuntu') && ${{ matrix.php }} == '8.1'" env: DOCS_RS: run: cargo clean && cargo build + build-zts: + name: Build with ZTS + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build + uses: ./.github/actions/zts diff --git a/build.rs b/build.rs index f5be63d564..69f6fc0b4b 100644 --- a/build.rs +++ b/build.rs @@ -23,6 +23,7 @@ fn main() { if env::var("DOCS_RS").is_ok() { println!("cargo:warning=docs.rs detected - using stub bindings"); println!("cargo:rustc-cfg=php_debug"); + println!("cargo:rustc-cfg=php81"); std::fs::copy("docsrs_bindings.rs", out_path) .expect("Unable to copy docs.rs stub bindings to output directory."); diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 8f5ec99c46..9f153d36d3 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -249,7 +249,7 @@ impl Remove { let ext_file = format!( "{}{}{}", consts::DLL_PREFIX, - artifact.name.replace("-", "_"), + artifact.name.replace('-', "_"), consts::DLL_SUFFIX ); ext_path.push(&ext_file); diff --git a/docsrs_bindings.rs b/docsrs_bindings.rs index 8b16701fd9..a6d7795ebe 100644 --- a/docsrs_bindings.rs +++ b/docsrs_bindings.rs @@ -300,6 +300,9 @@ extern "C" { __zend_orig_lineno: u32, ); } +extern "C" { + pub fn __zend_malloc(len: size_t) -> *mut ::std::os::raw::c_void; +} pub type zend_string_init_interned_func_t = ::std::option::Option< unsafe extern "C" fn( str_: *const ::std::os::raw::c_char,