Skip to content

Commit

Permalink
Support MacOS by repalce ipc-channel with socketpair, upgrade depende…
Browse files Browse the repository at this point in the history
…ncies and improve CI. (#9)
  • Loading branch information
jmjoy authored Sep 10, 2022
1 parent 59e6a4a commit 144a02b
Show file tree
Hide file tree
Showing 16 changed files with 380 additions and 380 deletions.
6 changes: 6 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ github:
rebase: false
protected_branches:
master:
required_status_checks:
strict: true
contexts:
- license
- pecl-required
- required
required_pull_request_reviews:
dismiss_stale_reviews: true
required_approving_review_count: 1
4 changes: 2 additions & 2 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ on:
- "**"

jobs:
check:
name: Check
license:
name: license
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand Down
33 changes: 24 additions & 9 deletions .github/workflows/pecl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,27 @@ env:
RUST_BACKTRACE: "1"
RUSTFLAGS: "-D warnings"
LLVM_CONFIG_PATH: llvm-config-10
RUSTUP_HOME: /opt/rustup
CARGO_HOME: /opt/cargo
RUSTUP_HOME: /tmp/rustup
CARGO_HOME: /tmp/cargo

jobs:
pecl-required:
needs:
- pecl
runs-on: ubuntu-20.04
steps:
- name: Check results
run: |
[[ ${{ needs.pecl.result }} == 'success' ]] || exit 1;
pecl:
name: PECL
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-12
version:
- php: "8.1"
swoole: "5.0.0"
Expand All @@ -51,8 +61,13 @@ jobs:
submodules: 'recursive'

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

- name: Install protobuf for Macos
if: matrix.os == 'macos-12'
run: brew install protobuf

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -62,14 +77,14 @@ jobs:

- name: Install Rust Stable Globally
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path
ln -s $CARGO_HOME/bin/rustup /usr/local/bin/rustup
ln -s $CARGO_HOME/bin/rustc /usr/local/bin/rustc
ln -s $CARGO_HOME/bin/cargo /usr/local/bin/cargo
curl https://sh.rustup.rs -sSf | sudo -E sh -s -- -y --no-modify-path
sudo ln -sf $CARGO_HOME/bin/rustup /usr/local/bin/rustup
sudo ln -sf $CARGO_HOME/bin/rustc /usr/local/bin/rustc
sudo ln -sf $CARGO_HOME/bin/cargo /usr/local/bin/cargo
- name: PECL install
run: |
sudo rustup default stable
sudo cargo run -p scripts --release -- create-package-xml --version 0.0.0 --notes "Just for TEST."
printf "\n" | sudo pecl install package.xml
sudo -E cargo run -p scripts --release -- create-package-xml --version 0.0.0 --notes "Just for TEST."
cat package.xml
printf "\n" | sudo -E pecl install package.xml
php -d "extension=skywalking_agent" --ri skywalking_agent
70 changes: 58 additions & 12 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,25 @@ env:
LLVM_CONFIG_PATH: llvm-config-10

jobs:
required:
needs:
- test
- fmt
runs-on: ubuntu-20.04
steps:
- name: Check results
run: |
[[ ${{ needs.test.result }} == 'success' ]] || exit 1;
[[ ${{ needs.fmt.result }} == 'success' ]] || exit 1;
test:
name: Test
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-12
version:
# Many composer dependencies need PHP 7.2+
# - php: "7.0"
Expand All @@ -59,55 +71,84 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
submodules: "recursive"

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

- name: Install protobuf for Macos
if: matrix.os == 'macos-12'
run: brew install protobuf

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version.php }}
tools: php-config, composer:v2
extensions: opcache, swoole-${{ matrix.version.swoole }}
extensions: >
bcmath, calendar, ctype, dom, exif, gettext, iconv, intl, json, mbstring,
mysqli, mysqlnd, opcache, pdo, pdo_mysql, phar, posix, readline,
swoole-${{ matrix.version.swoole }}, xml, xmlreader, xmlwriter, yaml, zip
- name: Setup php-fpm
- name: Setup php-fpm for Linux
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install -y php${{ matrix.version.php }}-fpm
sudo rm -f /usr/sbin/php-fpm
sudo ln -s /usr/sbin/php-fpm${{ matrix.version.php }} /usr/sbin/php-fpm
sudo ln -sf /usr/sbin/php-fpm${{ matrix.version.php }} /usr/sbin/php-fpm
- name: PHP version
run: |
which php || php --version || php -m
which php-fpm || php-fpm --version || php-fpm -m
php-config || true
/usr/sbin/php-fpm --version
php -r 'echo "Swoole version: " . phpversion("swoole");'
php -r 'echo "Swoole version: " . phpversion("swoole") . "\n";'
composer --version
[[ `php --version` == PHP\ ${{ matrix.version.php }}.* ]] || exit 1;
[[ `php-fpm --version` == PHP\ ${{ matrix.version.php }}.* ]] || exit 1;
[[ `php-config --version` == ${{ matrix.version.php }}.* ]] || exit 1;
- name: Install Rust Stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy

- name: Setup cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-test-${{ matrix.version.php }}-${{ hashFiles('**/Cargo.lock') }}

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

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

- name: Docker compose
if: matrix.os == 'ubuntu-20.04'
run: docker compose up -d

- name: Vagrant up for docker compose
if: matrix.os == 'macos-12'
run: vagrant up

- name: Composer install
run: composer install --working-dir=tests/php

Expand All @@ -116,7 +157,12 @@ jobs:
with:
toolchain: stable
command: test
args: --release
args: --release --workspace

- name: View logs
if: always()
run: |
cat /tmp/*.log
fmt:
name: Fmt
Expand All @@ -131,7 +177,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
submodules: "recursive"

- name: Install Rust Nightly
uses: actions-rs/toolchain@v1
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

/skywalking_agent-*.tgz
/package.xml
/.vagrant

*.lo
*.la
Expand Down
Loading

0 comments on commit 144a02b

Please # to comment.