Skip to content

Commit f575083

Browse files
authored
fix(tests): streamline workflow by combining PHP info commands and adding Redis setup script (#806)
* fix(tests): streamline workflow by combining PHP info commands and adding Redis setup script * fix(tests): add 'pie' tool to PHP workflow configuration * Revert "fix(tests): add 'pie' tool to PHP workflow configuration" This reverts commit 1e7ed26. * fix(tests): add Swoole setup script and environment variables to workflow * fix(tests): update Swoole version syntax in workflow and setup script * fix(tests): update Swoole version syntax in workflow and setup script * fix(config): update language setting to Chinese (zh-CN) --------- Co-authored-by: Deeka Wong <[email protected]>
1 parent ddecc40 commit f575083

File tree

4 files changed

+49
-9
lines changed

4 files changed

+49
-9
lines changed

.coderabbit.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
language: "en-US"
1+
language: "zh-CN"
22
early_access: false
33
reviews:
44
profile: "chill"

.github/workflows/tests.yaml

+9-8
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,28 @@ jobs:
5555
# swoole: '5.0.3'
5656
max-parallel: 20
5757
fail-fast: false
58+
env:
59+
SW_VERSION: ${{ matrix.swoole }}
60+
PHP_VERSION: ${{ matrix.php }}
5861
steps:
5962
- name: Checkout
6063
uses: actions/checkout@v4
6164
- name: Setup PHP
6265
uses: shivammathur/setup-php@v2
6366
with:
6467
php-version: ${{ matrix.php }}
65-
extensions: redis, pdo, pdo_mysql, bcmath, swoole-${{ matrix.swoole }}
68+
extensions: redis, pdo, pdo_mysql, bcmath ,swoole-${{ matrix.swoole }}
6669
tools: phpize
6770
coverage: none
71+
# - name: Setup Swoole
72+
# run: ./.travis/setup.swoole.sh
6873
- name: Show PHP Information
69-
run: |
70-
php -v
71-
php --ri swoole
74+
run: php -v && php --ri swoole
7275
- name: Setup Dependencies
7376
run: composer update -o
7477
- name: Run Analyse
7578
run: composer analyse src
76-
- name: Setup Redis Server
77-
run: |
78-
docker run --name redis -p 6379:6379 -d redis
79-
netstat -tunlp | grep 6379
79+
- name: Setup Services
80+
run: ./.travis/setup.services.sh
8081
- name: Run Test Cases
8182
run: php vendor/bin/pest --parallel

.travis/setup.services.sh

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
docker run --name redis -p 6379:6379 -d redis &
4+
wait
5+
6+
# Check if redis container is running
7+
docker ps -a
8+
9+
# Check if redis is running
10+
netstat -tunlp | grep 6379

.travis/setup.swoole.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
php -m | grep -i swoole
4+
5+
if [ $? -eq 1 ]; then
6+
7+
# Install PIE
8+
wget https://github.com/php/pie/releases/download/0.2.0/pie.phar
9+
sudo chmod +x pie.phar
10+
sudo mv pie.phar /usr/local/bin/pie
11+
12+
# Upgrade dependencies
13+
sudo apt-get clean
14+
sudo apt-get update
15+
sudo apt-get upgrade -f
16+
sudo apt-get install libcurl4-openssl-dev libc-ares-dev libpq-dev
17+
18+
# Install Swoole
19+
sudo pie install swoole/swoole:~${SW_VERSION} --enable-openssl --enable-swoole-curl --enable-cares --enable-swoole-pgsql --enable-brotli
20+
21+
# Add extension to php.ini
22+
sudo sh -c "echo extension=swoole > /etc/php/${PHP_VERSION}/cli/conf.d/swoole.ini"
23+
24+
# Print Swoole info
25+
php --ri swoole
26+
27+
fi
28+
29+
sudo sh -c "echo swoole.use_shortname='Off' >> /etc/php/${PHP_VERSION}/cli/conf.d/swoole.ini"

0 commit comments

Comments
 (0)