From ca7addfb127e8079f1879d400253ae85ace69ba4 Mon Sep 17 00:00:00 2001 From: David Cole Date: Tue, 22 Feb 2022 12:25:06 +1300 Subject: [PATCH 01/12] Attempt to fix CI on macOS by not installing LLVM --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7996d88cf..5bb52432d7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - macos-ci pull_request: jobs: @@ -36,6 +37,7 @@ jobs: override: true - name: Setup LLVM & Clang uses: KyleMayes/install-llvm-action@v1 + if: matrix.os != 'macos-latest' with: version: ${{ matrix.llvm }} directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }} From a0cc5a1eaebae0a0a7c253788dccb7bb7af9af5d Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 13:35:24 +1300 Subject: [PATCH 02/12] Download LLVM even on macOS --- .github/workflows/build.yml | 39 ++++++++----------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5bb52432d7..45aca7f86b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,7 +37,6 @@ jobs: override: true - name: Setup LLVM & Clang uses: KyleMayes/install-llvm-action@v1 - if: matrix.os != 'macos-latest' with: version: ${{ matrix.llvm }} directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }} @@ -63,36 +62,6 @@ jobs: 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: @@ -112,3 +81,11 @@ jobs: 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 From abc198281e3f0e29c8532016b5a35ca0956fd41b Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 13:50:58 +1300 Subject: [PATCH 03/12] Only set LIBCLANG_PATH on non-macOS --- .github/workflows/build.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45aca7f86b..38254910d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,18 +35,22 @@ jobs: with: toolchain: ${{ matrix.rust-toolchain }} 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: non-macOS - Configure Clang + if: !contains(matrix.os, 'macos') + run: | + echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib" >> $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 @@ -57,22 +61,16 @@ 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 - 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 From 1c85bc40fa433b30904f14223563d92e22a25375 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 13:57:48 +1300 Subject: [PATCH 04/12] Fix yaml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38254910d4..4108a44488 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: version: ${{ matrix.llvm }} directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }} - name: non-macOS - Configure Clang - if: !contains(matrix.os, 'macos') + if: "!contains(matrix.os, 'macos')" run: | echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib" >> $GITHUB_ENV - name: Install mdbook From a5bd43a711f099d70d011806ddb06aa121971db8 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:09:35 +1300 Subject: [PATCH 05/12] Try to set SDK path for macOS --- .github/workflows/build.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4108a44488..bd8b433a40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,14 +37,24 @@ jobs: 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: non-macOS - Configure Clang - if: "!contains(matrix.os, 'macos')" - run: | + - 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 + #echo "CPATH=$LLVM_PATH/lib/clang/$LLVM_VERSION/include" >> $GITHUB_ENV + #echo "LDFLAGS=-L$LLVM_PATH/lib" >> $GITHUB_ENV + #echo "CPPFLAGS=-I$LLVM_PATH/include" >> $GITHUB_ENV + #echo "CC=$LLVM_PATH/bin/clang" >> $GITHUB_ENV + #echo "CXX=$LLVM_PATH/bin/clang++" >> $GITHUB_ENV - name: Install mdbook uses: peaceiris/actions-mdbook@v1 with: From 9e64c7d484758b7ab458486b3d604fa8d73b6216 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:24:54 +1300 Subject: [PATCH 06/12] Multi-line run --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd8b433a40..66462fea6e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: version: ${{ matrix.llvm }} directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }} - name: Configure Clang - run: + 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) From 8d68ea001d86e401a3fce753180a8421c4de38b5 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:30:20 +1300 Subject: [PATCH 07/12] Clippy lint --- crates/cli/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); From 09cd30f727781f143aa513e685fc03ec2a5b7c5b Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:44:51 +1300 Subject: [PATCH 08/12] Only check docs on PHP 8.1 --- .github/workflows/build.yml | 1 + docsrs_bindings.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66462fea6e..dddf050518 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,6 +85,7 @@ jobs: command: clippy args: --all -- -D warnings - name: Build with docs stub + if: "${{ matrix.php }} == '8.1'" env: DOCS_RS: run: 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, From 09d71934db388415888d4c4ea1754c6ab706e7d6 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:46:06 +1300 Subject: [PATCH 09/12] When running with docs stub, use PHP 8.1 --- build.rs | 1 + 1 file changed, 1 insertion(+) 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."); From bfd3b6f41ae3780f9e6c390bf1c892db13c3e110 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:54:23 +1300 Subject: [PATCH 10/12] Only build docs on Ubuntu --- .github/workflows/build.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dddf050518..bd06d9a9be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -48,13 +48,7 @@ jobs: 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 - #echo "CPATH=$LLVM_PATH/lib/clang/$LLVM_VERSION/include" >> $GITHUB_ENV - #echo "LDFLAGS=-L$LLVM_PATH/lib" >> $GITHUB_ENV - #echo "CPPFLAGS=-I$LLVM_PATH/include" >> $GITHUB_ENV - #echo "CC=$LLVM_PATH/bin/clang" >> $GITHUB_ENV - #echo "CXX=$LLVM_PATH/bin/clang++" >> $GITHUB_ENV + run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV - name: Install mdbook uses: peaceiris/actions-mdbook@v1 with: @@ -85,7 +79,7 @@ jobs: command: clippy args: --all -- -D warnings - name: Build with docs stub - if: "${{ matrix.php }} == '8.1'" + if: "contains(matrix.os, 'ubuntu') && ${{ matrix.php }} == '8.1'" env: DOCS_RS: run: From 049e9003a97a34b3c9ad3bab8fd427120390fba1 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:56:58 +1300 Subject: [PATCH 11/12] Remove `macos-ci` branch from actions --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd06d9a9be..8eff9d004a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,6 @@ on: push: branches: - master - - macos-ci pull_request: jobs: From 312d11f1e7cc98481f1135a871f62123d78126f5 Mon Sep 17 00:00:00 2001 From: David Cole Date: Sun, 6 Mar 2022 14:58:02 +1300 Subject: [PATCH 12/12] Trigger actions