Skip to content

Commit

Permalink
iouring ci
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFreeman committed May 30, 2024
1 parent 90feeae commit 9432005
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/iouring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Async IO With IOUring

on: [push, pull_request]

jobs:
test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3', '8.1-zts', '8.2-zts', '8.3-zts']
name: ${{ matrix.php }}
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
coverage: none
- name: Show machine information
run: |
date
env
uname -a
ulimit -a
php -v
php --ini
ls -al
pwd
echo "`git log -20 --pretty --oneline`"
echo "`git log -10 --stat --pretty --oneline`"
- name: Run Swoole test
run: |
export SWOOLE_BRANCH=${GITHUB_REF##*/}
export SWOOLE_USE_IOURING=1
export SWOOLE_BUILD_DIR=$(realpath .)
export PHP_VERSION=${{ matrix.php }}
${SWOOLE_BUILD_DIR}/scripts/route.sh
31 changes: 31 additions & 0 deletions scripts/docker-compile-with-iouring.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh -e
__CURRENT__=$(pwd)
__DIR__=$(cd "$(dirname "$0")";pwd)

if [ ! -f "/.dockerenv" ]; then
echo "" && echo "❌ This script is just for Docker!"
exit
fi

sh library.sh

cd "${__DIR__}" && cd ..
./scripts/clear.sh && phpize

mode=$(php -v | grep zts)
if [ "$mode" != "" ]; then
echo "" && echo "🚀 php zts + swoole thread mode + iouring!"
./configure --enable-iouring --enable-thread
else
echo "" && echo "🚀 php nts + swoole + iouring!"
./configure --enable-iouring
fi

make -j$(cat /proc/cpuinfo | grep processor | wc -l)
make install
docker-php-ext-enable swoole
php -v
php -m
php --ri curl
php --ri swoole

23 changes: 23 additions & 0 deletions scripts/docker-iouring-route.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh -e
__CURRENT__=$(pwd)
__DIR__=$(cd "$(dirname "$0")";pwd)
export SWOOLE_USE_IOURING=1

# enter the dir
cd "${__DIR__}"

# show system info
date && echo ""
uname -a && echo ""

# show php info
php -v && echo ""

# compile in docker
echo "" && echo "📦 Compile ext-swoole[iouring] in docker..." && echo ""
./docker-compile-with-iouring.sh

# run unit tests
echo "" && echo "📋 Run php tests[iouring] in docker..." && echo ""
./run-tests.sh

5 changes: 5 additions & 0 deletions scripts/library.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ echo DISABLE_INTERRUPT=on > ./instantclient/network/admin/sqlnet.ora
mv ./instantclient /usr/local/
echo '/usr/local/instantclient' > /etc/ld.so.conf.d/oracle-instantclient.conf
ldconfig

wget https://github.com/axboe/liburing/archive/refs/tags/liburing-2.6.tar.gz
tar zxf liburing-2.6.tar.gz
cd liburing-liburing-2.6 && ./configure && make -j$(cat /proc/cpuinfo | grep processor | wc -l) && make install

12 changes: 12 additions & 0 deletions scripts/route.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ run_thread_tests_in_docker(){
fi
}

run_iouring_tests_in_docker(){
docker exec swoole touch /.cienv && \
docker exec swoole /swoole-src/scripts/docker-iouring-route.sh
code=$?
if [ $code -ne 0 ]; then
echo "\n❌ Run iouring tests failed! ExitCode: $code"
exit 1
fi
}

remove_tests_resources(){
remove_docker_containers
remove_data_files
Expand All @@ -109,6 +119,8 @@ echo "\n⏳ Run tests in docker...\n"

if [ "$SWOOLE_THREAD" = 1 ]; then
run_thread_tests_in_docker
elif [ "$SWOOLE_USE_IOURING" = 1 ]; then
run_iouring_tests_in_docker
else
run_tests_in_docker
fi
Expand Down
2 changes: 2 additions & 0 deletions scripts/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ if [ "${SWOOLE_BRANCH}" = "valgrind" ]; then
options="${options} -m"
elif [ "$SWOOLE_THREAD" = 1 ]; then
dir="swoole_thread"
elif [ "$SWOOLE_USE_IOURING" = 1 ]; then
dir="swoole_runtime/file_hook"
else
dir="swoole_*"
fi
Expand Down

0 comments on commit 9432005

Please sign in to comment.