diff --git a/.github/workflows/mercure.yml b/.github/workflows/mercure.yml deleted file mode 100644 index 457a376..0000000 --- a/.github/workflows/mercure.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Mercure Integration - -on: - pull_request: - branches: - - develop - paths: - - '**.php' - - 'composer.*' - - 'phpunit*' - - '.github/workflows/mercure.yml' - push: - branches: - - develop - paths: - - '**.php' - - 'composer.*' - - 'phpunit*' - - '.github/workflows/mercure.yml' - -permissions: - contents: read - -jobs: - build: - name: Mercure Publisher and Subscriber Integration - runs-on: ubuntu-latest - if: (! contains(github.event.head_commit.message, '[ci skip]')) - services: - mercure: - image: dunglas/mercure:v0.24.2 - env: - SERVER_NAME: ':80' - MERCURE_PUBLISHER_JWT_KEY: development-publisher-key-change-before-production - MERCURE_SUBSCRIBER_JWT_KEY: development-subscriber-key-change-before-production - MERCURE_EXTRA_DIRECTIVES: heartbeat 1s - ports: - - 3000:80 - - steps: - - name: Checkout - uses: actions/checkout@v7 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - tools: composer - extensions: curl, json, mbstring, xml - coverage: none - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Get composer cache directory - run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> "$GITHUB_ENV" - - - name: Cache composer dependencies - uses: actions/cache@v6 - with: - path: ${{ env.COMPOSER_CACHE_FILES_DIR }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: | - if [ -f composer.lock ]; then - composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader - else - composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader - fi - - - name: Test Mercure integration - run: SSE_MERCURE_INTEGRATION=1 composer test -- --group integration diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 900c7b1..da71a35 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -29,7 +29,19 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['8.2', '8.3', '8.4', '8.5'] + include: + - php-version: '8.2' + coverage: none + command: composer test + - php-version: '8.3' + coverage: xdebug + command: vendor/bin/phpunit --coverage-text + - php-version: '8.4' + coverage: none + command: composer test + - php-version: '8.5' + coverage: none + command: composer test steps: - name: Checkout @@ -41,7 +53,7 @@ jobs: php-version: ${{ matrix.php-version }} tools: composer extensions: json, mbstring, xml - coverage: xdebug + coverage: ${{ matrix.coverage }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -64,15 +76,154 @@ jobs: fi - name: Test with PHPUnit - run: vendor/bin/phpunit --coverage-text + run: ${{ matrix.command }} env: TERM: xterm-256color - if: matrix.php-version == '8.3' - name: Run Coveralls + name: Upload unit coverage uses: coverallsapp/github-action@v2.3.8 with: github-token: ${{ secrets.GITHUB_TOKEN }} file: build/phpunit/clover.xml format: clover - flag-name: PHP ${{ matrix.php-version }} + flag-name: unit + parallel: true + + redis: + name: Redis Integration Coverage + runs-on: ubuntu-latest + if: (! contains(github.event.head_commit.message, '[ci skip]')) + services: + redis: + image: redis:7.4-alpine + ports: + - 16379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 1s + --health-timeout 1s + --health-retries 10 + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + tools: composer + extensions: json, mbstring, pcntl, xml + coverage: xdebug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> "$GITHUB_ENV" + + - name: Cache composer dependencies + uses: actions/cache@v6 + with: + path: ${{ env.COMPOSER_CACHE_FILES_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + if [ -f composer.lock ]; then + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader + else + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader + fi + + - name: Test Redis integration with coverage + run: SSE_REDIS_INTEGRATION=1 vendor/bin/phpunit --coverage-text --group integration + env: + TERM: xterm-256color + + - name: Upload Redis integration coverage + uses: coverallsapp/github-action@v2.3.8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + file: build/phpunit/clover.xml + format: clover + flag-name: redis + parallel: true + + mercure: + name: Mercure Integration Coverage + runs-on: ubuntu-latest + if: (! contains(github.event.head_commit.message, '[ci skip]')) + services: + mercure: + image: dunglas/mercure:v0.24.2 + env: + SERVER_NAME: ':80' + MERCURE_PUBLISHER_JWT_KEY: development-publisher-key-change-before-production + MERCURE_SUBSCRIBER_JWT_KEY: development-subscriber-key-change-before-production + MERCURE_EXTRA_DIRECTIVES: heartbeat 1s + ports: + - 3000:80 + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + tools: composer + extensions: curl, json, mbstring, xml + coverage: xdebug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> "$GITHUB_ENV" + + - name: Cache composer dependencies + uses: actions/cache@v6 + with: + path: ${{ env.COMPOSER_CACHE_FILES_DIR }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + if [ -f composer.lock ]; then + composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader + else + composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader + fi + + - name: Test Mercure integration with coverage + run: SSE_MERCURE_INTEGRATION=1 vendor/bin/phpunit --coverage-text --group integration + env: + TERM: xterm-256color + + - name: Upload Mercure integration coverage + uses: coverallsapp/github-action@v2.3.8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + file: build/phpunit/clover.xml + format: clover + flag-name: mercure + parallel: true + + coveralls: + needs: + - main + - redis + - mercure + name: Coveralls Finished + runs-on: ubuntu-latest + if: ${{ always() && ! contains(github.event.head_commit.message, '[ci skip]') }} + + steps: + - name: Finish parallel Coveralls build + uses: coverallsapp/github-action@v2.3.8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/.github/workflows/redis.yml b/.github/workflows/redis.yml deleted file mode 100644 index ca431ef..0000000 --- a/.github/workflows/redis.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Redis Integration - -on: - pull_request: - branches: - - develop - paths: - - '**.php' - - 'composer.*' - - 'phpunit*' - - '.github/workflows/redis.yml' - push: - branches: - - develop - paths: - - '**.php' - - 'composer.*' - - 'phpunit*' - - '.github/workflows/redis.yml' - -permissions: - contents: read - -jobs: - build: - name: Redis Pub/Sub Integration Tests - runs-on: ubuntu-latest - if: (! contains(github.event.head_commit.message, '[ci skip]')) - services: - redis: - image: redis:7.4-alpine - ports: - - 16379:6379 - options: >- - --health-cmd "redis-cli ping" - --health-interval 1s - --health-timeout 1s - --health-retries 10 - - steps: - - name: Checkout - uses: actions/checkout@v7 - - - name: Set up PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.3' - tools: composer - extensions: json, mbstring, xml - coverage: none - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Get composer cache directory - run: echo "COMPOSER_CACHE_FILES_DIR=$(composer config cache-files-dir)" >> "$GITHUB_ENV" - - - name: Cache composer dependencies - uses: actions/cache@v6 - with: - path: ${{ env.COMPOSER_CACHE_FILES_DIR }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Install dependencies - run: | - if [ -f composer.lock ]; then - composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader - else - composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader - fi - - - name: Test Redis integration - run: SSE_REDIS_INTEGRATION=1 composer test -- --group integration