Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Codecov | |
on: | |
push: | |
paths-ignore: | |
- "doc/**" | |
- "mddoc/**" | |
- "res/**" | |
- "split-repository/**" | |
- "website/**" | |
- ".markdownlint.json" | |
- "README.md" | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
cancel-in-progress: true | |
env: | |
PHP_VERSION: 8.2 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
testType: [core, swoole, components] | |
services: | |
zookeeper: | |
image: zookeeper:3.4 | |
ports: | |
- 2181:2181 | |
options: >- | |
--health-cmd="echo stat | nc localhost 2181 | grep Mode" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
redis: | |
image: redis:7 | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: root | |
ports: | |
- 3306:3306 | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
postgres: | |
image: postgres:13 | |
env: | |
POSTGRES_USER: root | |
POSTGRES_DB: db_imi_test | |
POSTGRES_PASSWORD: root | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd="pg_isready" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
rabbitmq: | |
image: rabbitmq:3.11-management | |
env: | |
RABBITMQ_DEFAULT_VHOST: "/" | |
RABBITMQ_DEFAULT_USER: "guest" | |
RABBITMQ_DEFAULT_PASS: "guest" | |
ports: | |
- 4369:4369 | |
- 15672:15672 | |
- 5672:5672 | |
- 25672:25672 | |
options: >- | |
--health-cmd="rabbitmq-diagnostics -q ping" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
kafka1: | |
image: wurstmeister/kafka:2.13-2.7.0 | |
env: | |
KAFKA_BROKER_ID: 1 | |
KAFKA_ADVERTISED_HOST_NAME: kafka1 | |
KAFKA_ADVERTISED_PORT: 9092 | |
KAFKA_HOST_NAME: kafka1 | |
KAFKA_PORT: 9092 | |
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | |
HOSTNAME_COMMAND: hostname -i | |
KAFKA_LISTENERS: PLAINTEXT://kafka1:9092 | |
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092 | |
KAFKA_NUM_PARTITIONS: 3 | |
ports: | |
- 9092:9092 | |
options: >- | |
--hostname=kafka1 | |
--health-cmd="kafka-topics.sh --list --zookeeper zookeeper:2181" | |
--health-interval=10s | |
--health-timeout=5s | |
--health-retries=3 | |
env: | |
TEST_TYPE: ${{ matrix.testType }} | |
SWOOLE_VERSION: v5.1.1 | |
ROADRUNNER_VERSION: 2.7.* | |
IMI_ROADRUNNER_BINARY: ${{ github.workspace }}/rr | |
AMQP_SERVER_HOST: 127.0.0.1 | |
KAFKA_BOOTSTRAP_SERVERS: kafka1:9092 | |
SWOOLE_CONFIGURE_OPTS: > | |
--enable-openssl | |
--enable-http2 | |
--enable-mysqlnd | |
--enable-sockets | |
--enable-swoole-json | |
--enable-swoole-curl | |
--enable-swoole-pgsql | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install libs | |
run: sudo apt update && sudo apt install -y libevent-dev libcurl4-openssl-dev libc-ares-dev libpq-dev postgresql-client | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
tools: pecl | |
coverage: xdebug | |
extensions: > | |
apcu, bcmath, curl, openssl, mbstring, intl, json, redis, mysqli, pdo, pdo_mysql, pdo_pgsql, | |
sockets, zip, inotify, event, :opcache | |
swoole-swoole/swoole-src@${{ env.SWOOLE_VERSION }} | |
- name: Check Version | |
run: | | |
php -v | |
php -m | |
php --ri xdebug | |
php --ri swoole | |
- name: Get composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache vendor | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ env.PHP_VERSION }}-${{ env.SWOOLE_VERSION }}-${{ hashFiles('*/composer.json', 'src/Components/*/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ env.PHP_VERSION }}-${{ env.SWOOLE_VERSION }}- | |
${{ runner.os }}-composer- | |
- name: Prepare | |
run: | | |
printf "127.0.0.1\tkafka1\n" | sudo tee -a /etc/hosts | |
mysql -h 127.0.0.1 -uroot -proot -e 'CREATE DATABASE IF NOT EXISTS db_imi_test;' | |
composer update --prefer-dist --no-progress | |
tests/db/install-db.sh | |
PGPASSWORD=root psql -h 127.0.0.1 -d db_imi_test -U root -f ./.github/pgsql.sql | |
src/Components/roadrunner/vendor/bin/rr get-binary -f $ROADRUNNER_VERSION | |
./rr -v | |
- name: Run test suite | |
id: run-test-suite | |
run: ./dev/test-coverage-actions.sh php $TEST_TYPE | |
- name: Upload coverage file | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.testType }}-coverage | |
path: tests/coverage.php | |
- name: Upload log files | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.testType }}-logs | |
path: | | |
tests/unit/Component/logs/*.log | |
src/Components/*/tests/*/*/logs/*.log | |
src/Components/*/example/.runtime/logs/*.log | |
upload-coverage: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
tools: pecl | |
extensions: > | |
bcmath, curl, openssl, mbstring, intl, json, sockets, zip, event | |
- name: Check Version | |
run: | | |
php -v | |
php -m | |
- name: Prepare | |
run: | | |
composer update --prefer-dist --no-progress | |
mkdir -p ./dev/cover | |
- name: Download core coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: core-coverage | |
path: ./dev/cover/core-coverage.php | |
- name: Download swoole coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: swoole-coverage | |
path: ./dev/cover/swoole-coverage.php | |
- name: Download components coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: components-coverage | |
path: ./dev/cover/components-coverage.php | |
- name: Parse coverage data | |
run: php ./dev/merge-coverage.php clover | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: "./tests/coverage.xml" | |
- name: Upload coverage reports to artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: tests/coverage.xml |