fix: update branch-alias to 4.5.x-dev to match version series #7
This file contains hidden or 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: Tests | |
| permissions: {} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release-* | |
| pull_request: | |
| branches: | |
| - main | |
| - release-* | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| env: | |
| COUCHBASE_PHP_EXTENSION_VERSION: "4.5.0" | |
| strategy: | |
| matrix: | |
| php: ['8.2', '8.3', '8.4', '8.5'] | |
| server: ['7.6.3', '8.0.0'] | |
| name: PHP ${{ matrix.php }} - Couchbase ${{ matrix.server }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: json, mbstring, openssl, pcre, pdo, tokenizer, xml, zip | |
| coverage: xdebug | |
| tools: composer:v2 | |
| - name: Install Couchbase PHP extension | |
| run: | | |
| # Build dynamic download URL from matrix variables | |
| COUCHBASE_VERSION="${{ env.COUCHBASE_PHP_EXTENSION_VERSION }}" | |
| PHP_VERSION="${{ matrix.php }}" | |
| DOWNLOAD_URL="https://packages.couchbase.com/clients/php/couchbase-${COUCHBASE_VERSION}-php${PHP_VERSION}-nts-linux-x86_64.tgz" | |
| echo "Downloading Couchbase extension from: $DOWNLOAD_URL" | |
| curl -L -o couchbase-extension.tgz "$DOWNLOAD_URL" | |
| # Extract the archive | |
| tar -xzf couchbase-extension.tgz | |
| EXTRACTED_DIR="couchbase-${COUCHBASE_VERSION}-php${PHP_VERSION}-nts-linux-x86_64" | |
| # Get PHP extension and include directories | |
| EXTENSION_DIR=$(php -i | grep "^extension_dir" | cut -d' ' -f3) | |
| INCLUDE_PATH=$(php -i | grep "^include_path" | cut -d' ' -f3 | cut -d':' -f2) | |
| echo "Extension directory: $EXTENSION_DIR" | |
| echo "Include path: $INCLUDE_PATH" | |
| # Install the extension binary | |
| sudo cp "${EXTRACTED_DIR}/couchbase.so" "$EXTENSION_DIR/" | |
| # Install PHP class files | |
| sudo mkdir -p "$INCLUDE_PATH/Couchbase" | |
| sudo cp -r "${EXTRACTED_DIR}/Couchbase/"* "$INCLUDE_PATH/Couchbase/" | |
| # Enable the extension | |
| PHP_INI_PATH=$(php --ini | grep "Loaded Configuration" | cut -d: -f2 | tr -d ' "') | |
| echo "PHP INI path: $PHP_INI_PATH" | |
| echo "extension=couchbase.so" | sudo tee -a "$PHP_INI_PATH" | |
| # Verify installation | |
| php -m | grep couchbase | |
| # Clean up extracted files to avoid PHP CS Fixer scanning them | |
| rm -rf couchbase-extension.tgz "${EXTRACTED_DIR}" | |
| - name: Get composer cache directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Install cbdinocluster | |
| run: | | |
| mkdir -p "$HOME/bin" | |
| curl -L -o "$HOME/bin/cbdinocluster" https://github.com/couchbaselabs/cbdinocluster/releases/download/v0.0.113/cbdinocluster-linux-amd64 | |
| chmod a+x "$HOME/bin/cbdinocluster" | |
| echo "$HOME/bin" >> $GITHUB_PATH | |
| - name: Initialize cbdinocluster | |
| run: | | |
| cbdinocluster -v init --auto | |
| - name: Start couchbase cluster | |
| env: | |
| CLUSTERCONFIG: | | |
| nodes: | |
| - count: 1 | |
| version: ${{ matrix.server }} | |
| services: | |
| - kv | |
| - count: 1 | |
| version: ${{ matrix.server }} | |
| services: | |
| - kv | |
| - n1ql | |
| - index | |
| - count: 1 | |
| version: ${{ matrix.server }} | |
| services: | |
| - kv | |
| - fts | |
| - cbas | |
| docker: | |
| kv-memory: 1600 | |
| fts-memory: 2000 | |
| run: | | |
| CLUSTER_ID=$(cbdinocluster -v allocate --def="${CLUSTERCONFIG}") | |
| CONNECTION_STRING=$(cbdinocluster -v connstr "${CLUSTER_ID}") | |
| cbdinocluster -v buckets add ${CLUSTER_ID} default --ram-quota-mb=100 --flush-enabled=true --num-replicas=1 | |
| cbdinocluster -v buckets load-sample ${CLUSTER_ID} travel-sample | |
| echo "CLUSTER_ID=${CLUSTER_ID}" >> "$GITHUB_ENV" | |
| echo "TEST_CONNECTION_STRING=${CONNECTION_STRING}?dump_configuration=true" >> "$GITHUB_ENV" | |
| - name: Run unit tests | |
| run: composer test:unit | |
| - name: Run integration tests | |
| run: composer test:integration --coverage-clover=coverage.xml | |
| env: | |
| TEST_BUCKET: "default" | |
| TEST_USERNAME: "Administrator" | |
| TEST_PASSWORD: "password" | |
| TEST_SERVER_VERSION: ${{ matrix.server }} | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.php == '8.3' && matrix.server == '8.0.0' | |
| with: | |
| file: ./coverage.xml | |
| flags: integration | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| lint: | |
| runs-on: ubuntu-latest | |
| name: Code Quality | |
| env: | |
| COUCHBASE_PHP_EXTENSION_VERSION: "4.5.0" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: json, mbstring, openssl, pcre, pdo, tokenizer, xml, zip | |
| tools: composer:v2, cs2pr | |
| - name: Install Couchbase PHP extension | |
| run: | | |
| # Build dynamic download URL (using PHP 8.3 for lint job) | |
| COUCHBASE_VERSION="${{ env.COUCHBASE_PHP_EXTENSION_VERSION }}" | |
| PHP_VERSION="8.3" | |
| DOWNLOAD_URL="https://packages.couchbase.com/clients/php/couchbase-${COUCHBASE_VERSION}-php${PHP_VERSION}-nts-linux-x86_64.tgz" | |
| echo "Downloading Couchbase extension from: $DOWNLOAD_URL" | |
| curl -L -o couchbase-extension.tgz "$DOWNLOAD_URL" | |
| # Extract the archive | |
| tar -xzf couchbase-extension.tgz | |
| EXTRACTED_DIR="couchbase-${COUCHBASE_VERSION}-php${PHP_VERSION}-nts-linux-x86_64" | |
| # Get PHP extension and include directories | |
| EXTENSION_DIR=$(php -i | grep "^extension_dir" | cut -d' ' -f3) | |
| INCLUDE_PATH=$(php -i | grep "^include_path" | cut -d' ' -f3 | cut -d':' -f2) | |
| echo "Extension directory: $EXTENSION_DIR" | |
| echo "Include path: $INCLUDE_PATH" | |
| # Install the extension binary | |
| sudo cp "${EXTRACTED_DIR}/couchbase.so" "$EXTENSION_DIR/" | |
| # Install PHP class files | |
| sudo mkdir -p "$INCLUDE_PATH/Couchbase" | |
| sudo cp -r "${EXTRACTED_DIR}/Couchbase/"* "$INCLUDE_PATH/Couchbase/" | |
| # Enable the extension | |
| PHP_INI_PATH=$(php --ini | grep "Loaded Configuration" | cut -d: -f2 | tr -d ' "') | |
| echo "PHP INI path: $PHP_INI_PATH" | |
| echo "extension=couchbase.so" | sudo tee -a "$PHP_INI_PATH" | |
| # Verify installation | |
| php -m | grep couchbase | |
| # Clean up extracted files to avoid PHP CS Fixer scanning them | |
| rm -rf couchbase-extension.tgz "${EXTRACTED_DIR}" | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress --no-interaction | |
| - name: Check PHP syntax | |
| run: composer lint | |
| - name: Run PHP CS Fixer (dry-run) | |
| run: | | |
| composer global require friendsofphp/php-cs-fixer | |
| ~/.composer/vendor/bin/php-cs-fixer fix --dry-run --diff --verbose | |
| continue-on-error: true |