3030 LLVM_CONFIG_PATH : llvm-config-10
3131
3232jobs :
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
0 commit comments