Skip to content

Improve CI, with macos support. #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
- macos-11
php-version:
- "7.0"
- "7.1"
Expand All @@ -47,6 +48,7 @@ jobs:
uses: actions/checkout@v2

- name: Install libclang
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get install -y llvm-10-dev libclang-10-dev

- name: Setup PHP
Expand All @@ -55,16 +57,22 @@ jobs:
php-version: ${{ matrix.php-version }}
tools: php-config

- name: Setup php-fpm
- name: Setup php-fpm for Linux
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install -y php${{ matrix.php-version }}-fpm
sudo rm -f /usr/sbin/php-fpm
sudo ln -s /usr/sbin/php-fpm${{ matrix.php-version }} /usr/sbin/php-fpm

- name: Setup php-fpm for Macos
if: matrix.os == 'macos-11'
run: |
brew install php@${{ matrix.php-version }}

- name: PHP version
run: |
php-config || true
/usr/sbin/php-fpm --version
php-fpm --version

- name: Install Rust Nightly
uses: actions-rs/toolchain@v1
Expand All @@ -87,18 +95,18 @@ jobs:
command: fmt
args: --all -- --check

- name: Cargo build
- name: Cargo clippy
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: build
command: clippy
args: --release

- name: Cargo clippy
- name: Cargo build
uses: actions-rs/cargo@v1
with:
toolchain: stable
command: clippy
command: build
args: --release

- name: Cargo test
Expand All @@ -124,7 +132,7 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-20.04
php-version:
- "7.4"
features:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
jobs:
license-check:
name: License check
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
publish:
name: Publish

runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh

- **OS**
- [x] linux
- [ ] macos
- [x] macos
- [ ] windows
- **PHP**
- **version**
Expand Down
6 changes: 6 additions & 0 deletions examples/hello/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@

fn main() {
phper_build::register_configures();

#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}
}
17 changes: 17 additions & 0 deletions examples/http-client/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2022 PHPER Framework Team
// PHPER is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2. You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.

fn main() {
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}
}
17 changes: 17 additions & 0 deletions examples/http-server/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2022 PHPER Framework Team
// PHPER is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2. You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.

fn main() {
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}
}
17 changes: 17 additions & 0 deletions examples/logging/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2022 PHPER Framework Team
// PHPER is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2. You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.

fn main() {
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}
}
1 change: 1 addition & 0 deletions phper-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ fn main() {
.blocklist_function("__hypotl")
.blocklist_function("__ilogbf64x")
.blocklist_function("__ilogbl")
.blocklist_function("__infl")
.blocklist_function("__iscanonicall")
.blocklist_function("__iseqsigl")
.blocklist_function("__iseqsigl")
Expand Down
2 changes: 1 addition & 1 deletion phper-sys/php_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ bool phper_object_init_ex(zval *arg, zend_class_entry *class_type) {
}

bool phper_call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval_ptr, uint32_t param_count, zval params[]) {
function_table = function_table;
(void)function_table; // suppress "unused parameter" warnings.
return call_user_function(function_table, object, function_name, retval_ptr, param_count, params) == SUCCESS;
}

Expand Down
4 changes: 2 additions & 2 deletions phper/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ fn main() {

#[cfg(target_os = "macos")]
{
println!("cargo:rustc-cdylib-link-arg=-undefined");
println!("cargo:rustc-cdylib-link-arg=dynamic_lookup");
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}

assert_eq!(
Expand Down
17 changes: 17 additions & 0 deletions tests/integration/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2022 PHPER Framework Team
// PHPER is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan
// PSL v2. You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY
// KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.

fn main() {
#[cfg(target_os = "macos")]
{
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
}
}