Skip to content

Merge pull request #11 from smoench/php83 #72

Merge pull request #11 from smoench/php83

Merge pull request #11 from smoench/php83 #72

name: Test application
on:
pull_request:
push:
branches:
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
jobs:
code-style:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: 8.3
- name: Get composer cache directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
id: composer-cache
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Check code style
run: vendor/bin/ecs
phpstan:
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: 8.3
- name: Get composer cache directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
id: composer-cache
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-interaction --prefer-dist
- name: Run PHPStan
run: vendor/bin/phpstan analyse
unit-test:
name: 'Run unit tests with php ${{ matrix.php-version }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.2', '8.3' ]
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
coverage: pcov
php-version: ${{ matrix.php-version }}
- name: Get composer cache directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
id: composer-cache
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer validate --strict
composer install --no-interaction --prefer-dist
- name: Run tests
run: vendor/bin/phpunit --testsuite=unit --coverage-clover=coverage.xml
functional-test:
name: 'Run functional tests with OS ${{ matrix.opensearch-version }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- opensearch-version: '1.3'
opensearch-composer-version: '^1'
- opensearch-version: '2.4'
opensearch-composer-version: '^2'
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: 8.3
- name: Get composer cache directory
id: composer-cache-dir
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
id: composer-cache
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer require --no-update opensearch-project/opensearch-php:${{ matrix.opensearch-composer-version }}
composer install --no-interaction --prefer-dist
- name: Setup OpenSearch
uses: ankane/setup-opensearch@v1
with:
opensearch-version: ${{ matrix.opensearch-version }}
- name: Run tests
run: vendor/bin/phpunit --testsuite=functional