Skip to content

Commit 144a02b

Browse files
authored
Support MacOS by repalce ipc-channel with socketpair, upgrade dependencies and improve CI. (#9)
1 parent 59e6a4a commit 144a02b

16 files changed

Lines changed: 380 additions & 380 deletions

File tree

.asf.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ github:
3030
rebase: false
3131
protected_branches:
3232
master:
33+
required_status_checks:
34+
strict: true
35+
contexts:
36+
- license
37+
- pecl-required
38+
- required
3339
required_pull_request_reviews:
3440
dismiss_stale_reviews: true
3541
required_approving_review_count: 1

.github/workflows/license.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ on:
2424
- "**"
2525

2626
jobs:
27-
check:
28-
name: Check
27+
license:
28+
name: license
2929
runs-on: ubuntu-20.04
3030
steps:
3131
- name: Checkout

.github/workflows/pecl.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,27 @@ env:
2828
RUST_BACKTRACE: "1"
2929
RUSTFLAGS: "-D warnings"
3030
LLVM_CONFIG_PATH: llvm-config-10
31-
RUSTUP_HOME: /opt/rustup
32-
CARGO_HOME: /opt/cargo
31+
RUSTUP_HOME: /tmp/rustup
32+
CARGO_HOME: /tmp/cargo
3333

3434
jobs:
35+
pecl-required:
36+
needs:
37+
- pecl
38+
runs-on: ubuntu-20.04
39+
steps:
40+
- name: Check results
41+
run: |
42+
[[ ${{ needs.pecl.result }} == 'success' ]] || exit 1;
43+
3544
pecl:
3645
name: PECL
3746
strategy:
3847
fail-fast: false
3948
matrix:
4049
os:
4150
- ubuntu-20.04
51+
- macos-12
4252
version:
4353
- php: "8.1"
4454
swoole: "5.0.0"
@@ -51,8 +61,13 @@ jobs:
5161
submodules: 'recursive'
5262

5363
- name: Install libclang
64+
if: matrix.os == 'ubuntu-20.04'
5465
run: sudo apt-get install -y llvm-10-dev libclang-10-dev protobuf-compiler
5566

67+
- name: Install protobuf for Macos
68+
if: matrix.os == 'macos-12'
69+
run: brew install protobuf
70+
5671
- name: Setup PHP
5772
uses: shivammathur/setup-php@v2
5873
with:
@@ -62,14 +77,14 @@ jobs:
6277

6378
- name: Install Rust Stable Globally
6479
run: |
65-
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
66-
ln -s $CARGO_HOME/bin/rustup /usr/local/bin/rustup
67-
ln -s $CARGO_HOME/bin/rustc /usr/local/bin/rustc
68-
ln -s $CARGO_HOME/bin/cargo /usr/local/bin/cargo
80+
curl https://sh.rustup.rs -sSf | sudo -E sh -s -- -y --no-modify-path
81+
sudo ln -sf $CARGO_HOME/bin/rustup /usr/local/bin/rustup
82+
sudo ln -sf $CARGO_HOME/bin/rustc /usr/local/bin/rustc
83+
sudo ln -sf $CARGO_HOME/bin/cargo /usr/local/bin/cargo
6984
7085
- name: PECL install
7186
run: |
72-
sudo rustup default stable
73-
sudo cargo run -p scripts --release -- create-package-xml --version 0.0.0 --notes "Just for TEST."
74-
printf "\n" | sudo pecl install package.xml
87+
sudo -E cargo run -p scripts --release -- create-package-xml --version 0.0.0 --notes "Just for TEST."
88+
cat package.xml
89+
printf "\n" | sudo -E pecl install package.xml
7590
php -d "extension=skywalking_agent" --ri skywalking_agent

.github/workflows/rust.yml

Lines changed: 58 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,25 @@ env:
3030
LLVM_CONFIG_PATH: llvm-config-10
3131

3232
jobs:
33+
required:
34+
needs:
35+
- test
36+
- fmt
37+
runs-on: ubuntu-20.04
38+
steps:
39+
- name: Check results
40+
run: |
41+
[[ ${{ needs.test.result }} == 'success' ]] || exit 1;
42+
[[ ${{ needs.fmt.result }} == 'success' ]] || exit 1;
43+
3344
test:
3445
name: Test
3546
strategy:
3647
fail-fast: false
3748
matrix:
3849
os:
3950
- ubuntu-20.04
51+
- macos-12
4052
version:
4153
# Many composer dependencies need PHP 7.2+
4254
# - php: "7.0"
@@ -59,55 +71,84 @@ jobs:
5971
- name: Checkout
6072
uses: actions/checkout@v2
6173
with:
62-
submodules: 'recursive'
74+
submodules: "recursive"
6375

64-
- name: Install libclang
76+
- name: Install libclang and protobuf for Linux
77+
if: matrix.os == 'ubuntu-20.04'
6578
run: sudo apt-get install -y llvm-10-dev libclang-10-dev protobuf-compiler
6679

80+
- name: Install protobuf for Macos
81+
if: matrix.os == 'macos-12'
82+
run: brew install protobuf
83+
6784
- name: Setup PHP
6885
uses: shivammathur/setup-php@v2
6986
with:
7087
php-version: ${{ matrix.version.php }}
7188
tools: php-config, composer:v2
72-
extensions: opcache, swoole-${{ matrix.version.swoole }}
89+
extensions: >
90+
bcmath, calendar, ctype, dom, exif, gettext, iconv, intl, json, mbstring,
91+
mysqli, mysqlnd, opcache, pdo, pdo_mysql, phar, posix, readline,
92+
swoole-${{ matrix.version.swoole }}, xml, xmlreader, xmlwriter, yaml, zip
7393
74-
- name: Setup php-fpm
94+
- name: Setup php-fpm for Linux
95+
if: matrix.os == 'ubuntu-20.04'
7596
run: |
7697
sudo apt-get install -y php${{ matrix.version.php }}-fpm
77-
sudo rm -f /usr/sbin/php-fpm
78-
sudo ln -s /usr/sbin/php-fpm${{ matrix.version.php }} /usr/sbin/php-fpm
98+
sudo ln -sf /usr/sbin/php-fpm${{ matrix.version.php }} /usr/sbin/php-fpm
7999
80100
- name: PHP version
81101
run: |
102+
which php || php --version || php -m
103+
which php-fpm || php-fpm --version || php-fpm -m
82104
php-config || true
83-
/usr/sbin/php-fpm --version
84-
php -r 'echo "Swoole version: " . phpversion("swoole");'
105+
php -r 'echo "Swoole version: " . phpversion("swoole") . "\n";'
85106
composer --version
86107
108+
[[ `php --version` == PHP\ ${{ matrix.version.php }}.* ]] || exit 1;
109+
[[ `php-fpm --version` == PHP\ ${{ matrix.version.php }}.* ]] || exit 1;
110+
[[ `php-config --version` == ${{ matrix.version.php }}.* ]] || exit 1;
111+
87112
- name: Install Rust Stable
88113
uses: actions-rs/toolchain@v1
89114
with:
90115
toolchain: stable
91116
override: true
92117
components: clippy
93118

119+
- name: Setup cargo cache
120+
uses: actions/cache@v3
121+
with:
122+
path: |
123+
~/.cargo/bin/
124+
~/.cargo/registry/index/
125+
~/.cargo/registry/cache/
126+
~/.cargo/git/db/
127+
target/
128+
key: ${{ matrix.os }}-test-${{ matrix.version.php }}-${{ hashFiles('**/Cargo.lock') }}
129+
94130
- name: Cargo clippy
95131
uses: actions-rs/cargo@v1
96132
with:
97133
toolchain: stable
98134
command: clippy
99-
args: --release
135+
args: --release --workspace
100136

101137
- name: Cargo build
102138
uses: actions-rs/cargo@v1
103139
with:
104140
toolchain: stable
105141
command: build
106-
args: --release
142+
args: --release --workspace
107143

108144
- name: Docker compose
145+
if: matrix.os == 'ubuntu-20.04'
109146
run: docker compose up -d
110147

148+
- name: Vagrant up for docker compose
149+
if: matrix.os == 'macos-12'
150+
run: vagrant up
151+
111152
- name: Composer install
112153
run: composer install --working-dir=tests/php
113154

@@ -116,7 +157,12 @@ jobs:
116157
with:
117158
toolchain: stable
118159
command: test
119-
args: --release
160+
args: --release --workspace
161+
162+
- name: View logs
163+
if: always()
164+
run: |
165+
cat /tmp/*.log
120166
121167
fmt:
122168
name: Fmt
@@ -131,7 +177,7 @@ jobs:
131177
- name: Checkout
132178
uses: actions/checkout@v2
133179
with:
134-
submodules: 'recursive'
180+
submodules: "recursive"
135181

136182
- name: Install Rust Nightly
137183
uses: actions-rs/toolchain@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
/skywalking_agent-*.tgz
1111
/package.xml
12+
/.vagrant
1213

1314
*.lo
1415
*.la

0 commit comments

Comments
 (0)