diff --git a/.github/actions/install-valkey-glide/action.yml b/.github/actions/install-valkey-glide/action.yml new file mode 100644 index 0000000..77cd9b9 --- /dev/null +++ b/.github/actions/install-valkey-glide/action.yml @@ -0,0 +1,51 @@ +name: Install Valkey GLIDE extension +description: Install valkey_glide PHP extension from a GitHub release tarball + +inputs: + version: + description: Valkey GLIDE PHP release version + required: false + default: "1.1.2" + +runs: + using: composite + steps: + - name: Install valkey_glide build dependencies + shell: bash + run: | + sudo apt-get update -y + sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \ + build-essential \ + git \ + libffi-dev \ + pkg-config \ + python3 \ + libprotobuf-c-dev \ + libssl-dev \ + protobuf-compiler \ + protobuf-c-compiler + + - name: Install Rust toolchain and cbindgen + shell: bash + run: | + if ! command -v cargo >/dev/null 2>&1; then + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + fi + . "$HOME/.cargo/env" + export PATH="$HOME/.cargo/bin:$PATH" + rustup default stable + if ! command -v cbindgen >/dev/null 2>&1; then + cargo install cbindgen + fi + echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" + + - name: Install valkey_glide + shell: bash + run: | + . "$HOME/.cargo/env" + export PATH="$HOME/.cargo/bin:$PATH" + curl -fsSL -o /tmp/valkey_glide.tgz \ + "https://github.com/valkey-io/valkey-glide-php/releases/download/v${{ inputs.version }}/valkey_glide-${{ inputs.version }}.tgz" + yes '' | sudo env HOME="$HOME" CARGO_HOME="$HOME/.cargo" PATH="$PATH" pecl install /tmp/valkey_glide.tgz || [[ $? -eq 141 ]] + echo "extension=valkey_glide.so" | sudo tee "$(php -r 'echo PHP_CONFIG_FILE_SCAN_DIR;')/99-valkey_glide.ini" + rm -f /tmp/valkey_glide.tgz diff --git a/.github/workflows/php-cs-fixer.yaml b/.github/workflows/php-cs-fixer.yaml index 62d9bf0..09172d7 100644 --- a/.github/workflows/php-cs-fixer.yaml +++ b/.github/workflows/php-cs-fixer.yaml @@ -23,6 +23,11 @@ on: required: false type: string default: "chore(php-cs-fixer): fix code style issues" + with_valkey_glide: + description: "Install valkey_glide PHP extension before composer install" + required: false + type: boolean + default: false secrets: packagist_username: required: true @@ -35,8 +40,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v6 - with: - ref: ${{ github.head_ref }} - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -44,6 +47,10 @@ jobs: php-version: "${{ inputs.php_version }}" tools: composer:v2 + - name: Install Valkey GLIDE extension + if: ${{ inputs.with_valkey_glide }} + uses: encodium/.github/.github/actions/install-valkey-glide@main + - name: Cache PHP CS Fixer uses: actions/cache@v5 with: diff --git a/.github/workflows/php-laravel-test.yaml b/.github/workflows/php-laravel-test.yaml index e9906f4..86f5ed3 100644 --- a/.github/workflows/php-laravel-test.yaml +++ b/.github/workflows/php-laravel-test.yaml @@ -30,6 +30,11 @@ on: type: string required: false default: "" + with_valkey_glide: + description: "Install valkey_glide PHP extension before composer install" + required: false + type: boolean + default: false secrets: packagist_username: required: true @@ -68,6 +73,10 @@ jobs: - name: Setup problem matchers for PHPUnit run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Install Valkey GLIDE extension + if: ${{ inputs.with_valkey_glide }} + uses: encodium/.github/.github/actions/install-valkey-glide@main + - name: Install composer dependencies uses: ramsey/composer-install@v2 with: diff --git a/.github/workflows/php-stan.yaml b/.github/workflows/php-stan.yaml index 7e9d929..9732a3c 100644 --- a/.github/workflows/php-stan.yaml +++ b/.github/workflows/php-stan.yaml @@ -31,6 +31,11 @@ on: required: false type: string default: "ubuntu-latest" + with_valkey_glide: + description: "Install valkey_glide PHP extension before composer install" + required: false + type: boolean + default: false secrets: packagist_username: required: true @@ -51,8 +56,15 @@ jobs: coverage: none php-version: ${{ inputs.php_version }} tools: composer + + - name: Install Valkey GLIDE extension + if: ${{ inputs.with_valkey_glide }} + uses: encodium/.github/.github/actions/install-valkey-glide@main + + - name: Install composer dependencies + uses: ramsey/composer-install@v2 env: - COMPOSER_AUTH_JSON: | + COMPOSER_AUTH: | { "http-basic": { "repo.packagist.com": { @@ -62,9 +74,6 @@ jobs: } } - - name: Install composer dependencies - uses: ramsey/composer-install@v2 - - name: Restore PHPStan Cache uses: actions/cache/restore@v4 with: