Skip to content

Commit d6d9594

Browse files
authored
Improve CI, with macos support. (#45)
1 parent e81ef23 commit d6d9594

File tree

12 files changed

+97
-14
lines changed

12 files changed

+97
-14
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
os:
34-
- ubuntu-latest
34+
- ubuntu-20.04
35+
- macos-11
3536
php-version:
3637
- "7.0"
3738
- "7.1"
@@ -47,6 +48,7 @@ jobs:
4748
uses: actions/checkout@v2
4849

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

5254
- name: Setup PHP
@@ -55,16 +57,22 @@ jobs:
5557
php-version: ${{ matrix.php-version }}
5658
tools: php-config
5759

58-
- name: Setup php-fpm
60+
- name: Setup php-fpm for Linux
61+
if: matrix.os == 'ubuntu-20.04'
5962
run: |
6063
sudo apt-get install -y php${{ matrix.php-version }}-fpm
6164
sudo rm -f /usr/sbin/php-fpm
6265
sudo ln -s /usr/sbin/php-fpm${{ matrix.php-version }} /usr/sbin/php-fpm
6366
67+
- name: Setup php-fpm for Macos
68+
if: matrix.os == 'macos-11'
69+
run: |
70+
brew install php@${{ matrix.php-version }}
71+
6472
- name: PHP version
6573
run: |
6674
php-config || true
67-
/usr/sbin/php-fpm --version
75+
php-fpm --version
6876
6977
- name: Install Rust Nightly
7078
uses: actions-rs/toolchain@v1
@@ -87,18 +95,18 @@ jobs:
8795
command: fmt
8896
args: --all -- --check
8997

90-
- name: Cargo build
98+
- name: Cargo clippy
9199
uses: actions-rs/cargo@v1
92100
with:
93101
toolchain: stable
94-
command: build
102+
command: clippy
95103
args: --release
96104

97-
- name: Cargo clippy
105+
- name: Cargo build
98106
uses: actions-rs/cargo@v1
99107
with:
100108
toolchain: stable
101-
command: clippy
109+
command: build
102110
args: --release
103111

104112
- name: Cargo test
@@ -124,7 +132,7 @@ jobs:
124132
fail-fast: false
125133
matrix:
126134
os:
127-
- ubuntu-latest
135+
- ubuntu-20.04
128136
php-version:
129137
- "7.4"
130138
features:

.github/workflows/license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ on:
2020
jobs:
2121
license-check:
2222
name: License check
23-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-20.04
2424
steps:
2525
- name: Checkout
2626
uses: actions/checkout@v2

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
publish:
2727
name: Publish
2828

29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-20.04
3030
steps:
3131
- name: Checkout
3232
uses: actions/checkout@v2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The framework that allows us to write PHP extensions using pure and safe Rust wh
2222

2323
- **OS**
2424
- [x] linux
25-
- [ ] macos
25+
- [x] macos
2626
- [ ] windows
2727
- **PHP**
2828
- **version**

examples/hello/build.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@
1010

1111
fn main() {
1212
phper_build::register_configures();
13+
14+
#[cfg(target_os = "macos")]
15+
{
16+
println!("cargo:rustc-link-arg=-undefined");
17+
println!("cargo:rustc-link-arg=dynamic_lookup");
18+
}
1319
}

examples/http-client/build.rs

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

examples/http-server/build.rs

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

examples/logging/build.rs

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

phper-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ fn main() {
189189
.blocklist_function("__hypotl")
190190
.blocklist_function("__ilogbf64x")
191191
.blocklist_function("__ilogbl")
192+
.blocklist_function("__infl")
192193
.blocklist_function("__iscanonicall")
193194
.blocklist_function("__iseqsigl")
194195
.blocklist_function("__iseqsigl")

phper-sys/php_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ bool phper_object_init_ex(zval *arg, zend_class_entry *class_type) {
183183
}
184184

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

phper/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn main() {
1515

1616
#[cfg(target_os = "macos")]
1717
{
18-
println!("cargo:rustc-cdylib-link-arg=-undefined");
19-
println!("cargo:rustc-cdylib-link-arg=dynamic_lookup");
18+
println!("cargo:rustc-link-arg=-undefined");
19+
println!("cargo:rustc-link-arg=dynamic_lookup");
2020
}
2121

2222
assert_eq!(

tests/integration/build.rs

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

0 commit comments

Comments
 (0)