Skip to content

Commit

Permalink
Fix CI on macOS (#126)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
davidcole1340 authored Mar 6, 2022
1 parent a3fbc24 commit 75ea323
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 38 deletions.
55 changes: 18 additions & 37 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions docsrs_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 75ea323

Please sign in to comment.