Skip to content

Commit 75ea323

Browse files
Fix CI on macOS (#126)
* Attempt to fix CI on macOS by not installing LLVM * Download LLVM even on macOS * Only set LIBCLANG_PATH on non-macOS * Fix yaml * Try to set SDK path for macOS * Multi-line run * Clippy lint * Only check docs on PHP 8.1 * When running with docs stub, use PHP 8.1 * Only build docs on Ubuntu * Remove `macos-ci` branch from actions * Trigger actions
1 parent a3fbc24 commit 75ea323

File tree

4 files changed

+23
-38
lines changed

4 files changed

+23
-38
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,26 @@ jobs:
3434
with:
3535
toolchain: ${{ matrix.rust-toolchain }}
3636
override: true
37+
components: rustfmt, clippy
3738
- name: Setup LLVM & Clang
39+
id: clang
3840
uses: KyleMayes/install-llvm-action@v1
3941
with:
4042
version: ${{ matrix.llvm }}
4143
directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }}
44+
- name: Configure Clang
45+
run: |
46+
echo "LIBCLANG_PATH=${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib" >> $GITHUB_ENV
47+
echo "LLVM_VERSION=${{ steps.clang.outputs.version }}" >> $GITHUB_ENV
48+
- name: Configure Clang (macOS only)
49+
if: "contains(matrix.os, 'macos')"
50+
run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
4251
- name: Install mdbook
4352
uses: peaceiris/actions-mdbook@v1
4453
with:
4554
mdbook-version: latest
4655
- name: Build
4756
env:
48-
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
4957
EXT_PHP_RS_TEST:
5058
run: cargo build --release --all-features --all
5159
- name: Test guide examples
@@ -56,57 +64,30 @@ jobs:
5664
mdbook test guide -L target/release/deps
5765
- name: Test inline examples
5866
uses: actions-rs/cargo@v1
59-
env:
60-
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
6167
with:
6268
command: test
6369
args: --release --all
64-
build-zts:
65-
name: Build with ZTS
66-
runs-on: ubuntu-latest
67-
steps:
68-
- name: Checkout code
69-
uses: actions/checkout@v2
70-
- name: Build
71-
uses: ./.github/actions/zts
72-
lint:
73-
name: Lint
74-
runs-on: ubuntu-latest
75-
strategy:
76-
matrix:
77-
llvm:
78-
- '11.0'
79-
steps:
80-
- name: Checkout code
81-
uses: actions/checkout@v2
82-
- name: Setup Rust
83-
uses: actions-rs/toolchain@v1
84-
with:
85-
profile: minimal
86-
toolchain: stable
87-
override: true
88-
components: rustfmt, clippy
89-
- name: Setup LLVM & Clang
90-
uses: KyleMayes/install-llvm-action@v1
91-
with:
92-
version: ${{ matrix.llvm }}
93-
directory: ${{ runner.temp }}/llvm-${{ matrix.llvm }}
9470
- name: Run rustfmt
9571
uses: actions-rs/cargo@v1
96-
env:
97-
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
9872
with:
9973
command: fmt
10074
args: --all -- --check
10175
- name: Run clippy
10276
uses: actions-rs/cargo@v1
103-
env:
104-
LIBCLANG_PATH: ${{ runner.temp }}/llvm-${{ matrix.llvm }}/lib
10577
with:
10678
command: clippy
10779
args: --all -- -D warnings
10880
- name: Build with docs stub
81+
if: "contains(matrix.os, 'ubuntu') && ${{ matrix.php }} == '8.1'"
10982
env:
11083
DOCS_RS:
11184
run:
11285
cargo clean && cargo build
86+
build-zts:
87+
name: Build with ZTS
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v2
92+
- name: Build
93+
uses: ./.github/actions/zts

build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fn main() {
2323
if env::var("DOCS_RS").is_ok() {
2424
println!("cargo:warning=docs.rs detected - using stub bindings");
2525
println!("cargo:rustc-cfg=php_debug");
26+
println!("cargo:rustc-cfg=php81");
2627

2728
std::fs::copy("docsrs_bindings.rs", out_path)
2829
.expect("Unable to copy docs.rs stub bindings to output directory.");

crates/cli/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl Remove {
249249
let ext_file = format!(
250250
"{}{}{}",
251251
consts::DLL_PREFIX,
252-
artifact.name.replace("-", "_"),
252+
artifact.name.replace('-', "_"),
253253
consts::DLL_SUFFIX
254254
);
255255
ext_path.push(&ext_file);

docsrs_bindings.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@ extern "C" {
300300
__zend_orig_lineno: u32,
301301
);
302302
}
303+
extern "C" {
304+
pub fn __zend_malloc(len: size_t) -> *mut ::std::os::raw::c_void;
305+
}
303306
pub type zend_string_init_interned_func_t = ::std::option::Option<
304307
unsafe extern "C" fn(
305308
str_: *const ::std::os::raw::c_char,

0 commit comments

Comments
 (0)