Skip to content

Commit c9661a0

Browse files
committed
iouring ci
1 parent 90feeae commit c9661a0

File tree

6 files changed

+103
-0
lines changed

6 files changed

+103
-0
lines changed

.github/workflows/iouring.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Async IO With IOUring
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-linux:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
php: ['8.1', '8.2', '8.3']
12+
name: ${{ matrix.php }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup PHP
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: "${{ matrix.php }}"
19+
coverage: none
20+
- name: Show machine information
21+
run: |
22+
date
23+
env
24+
uname -a
25+
ulimit -a
26+
php -v
27+
php --ini
28+
ls -al
29+
pwd
30+
echo "`git log -20 --pretty --oneline`"
31+
echo "`git log -10 --stat --pretty --oneline`"
32+
- name: Run Swoole test
33+
run: |
34+
export SWOOLE_BRANCH=${GITHUB_REF##*/}
35+
export SWOOLE_USE_IOURING=1
36+
export SWOOLE_BUILD_DIR=$(realpath .)
37+
export PHP_VERSION=${{ matrix.php }}
38+
${SWOOLE_BUILD_DIR}/scripts/route.sh
39+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh -e
2+
__CURRENT__=$(pwd)
3+
__DIR__=$(cd "$(dirname "$0")";pwd)
4+
5+
if [ ! -f "/.dockerenv" ]; then
6+
echo "" && echo "❌ This script is just for Docker!"
7+
exit
8+
fi
9+
10+
sh library.sh
11+
12+
cd "${__DIR__}" && cd ..
13+
./scripts/clear.sh && phpize && ./configure --enable-iouring
14+
15+
make -j$(cat /proc/cpuinfo | grep processor | wc -l)
16+
make install
17+
docker-php-ext-enable swoole
18+
php -v
19+
php -m
20+
php --ri curl
21+
php --ri swoole
22+

scripts/docker-iouring-route.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh -e
2+
__CURRENT__=$(pwd)
3+
__DIR__=$(cd "$(dirname "$0")";pwd)
4+
export SWOOLE_USE_IOURING=1
5+
6+
# enter the dir
7+
cd "${__DIR__}"
8+
9+
# show system info
10+
date && echo ""
11+
uname -a && echo ""
12+
13+
# show php info
14+
php -v && echo ""
15+
16+
# compile in docker
17+
echo "" && echo "📦 Compile ext-swoole[iouring] in docker..." && echo ""
18+
./docker-compile-with-iouring.sh
19+
20+
# run unit tests
21+
echo "" && echo "📋 Run php tests[iouring] in docker..." && echo ""
22+
./run-tests.sh
23+

scripts/library.sh

100644100755
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ echo DISABLE_INTERRUPT=on > ./instantclient/network/admin/sqlnet.ora
1212
mv ./instantclient /usr/local/
1313
echo '/usr/local/instantclient' > /etc/ld.so.conf.d/oracle-instantclient.conf
1414
ldconfig
15+
16+
wget https://github.com/axboe/liburing/archive/refs/tags/liburing-2.6.tar.gz
17+
tar zxf liburing-2.6.tar.gz
18+
cd liburing-liburing-2.6 && ./configure && make -j$(cat /proc/cpuinfo | grep processor | wc -l) && make install
19+

scripts/route.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,16 @@ run_thread_tests_in_docker(){
9292
fi
9393
}
9494

95+
run_iouring_tests_in_docker(){
96+
docker exec swoole touch /.cienv && \
97+
docker exec swoole /swoole-src/scripts/docker-iouring-route.sh
98+
code=$?
99+
if [ $code -ne 0 ]; then
100+
echo "\n❌ Run iouring tests failed! ExitCode: $code"
101+
exit 1
102+
fi
103+
}
104+
95105
remove_tests_resources(){
96106
remove_docker_containers
97107
remove_data_files
@@ -109,6 +119,8 @@ echo "\n⏳ Run tests in docker...\n"
109119

110120
if [ "$SWOOLE_THREAD" = 1 ]; then
111121
run_thread_tests_in_docker
122+
elif [ "$SWOOLE_USE_IOURING" = 1 ]; then
123+
run_iouring_tests_in_docker
112124
else
113125
run_tests_in_docker
114126
fi

scripts/run-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ if [ "${SWOOLE_BRANCH}" = "valgrind" ]; then
6161
options="${options} -m"
6262
elif [ "$SWOOLE_THREAD" = 1 ]; then
6363
dir="swoole_thread"
64+
elif [ "$SWOOLE_USE_IOURING" = 1 ]; then
65+
dir="swoole_runtime/file_hook"
6466
else
6567
dir="swoole_*"
6668
fi

0 commit comments

Comments
 (0)