Use common github workflows in CI #916
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
--- | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- master | |
- '*.*' | |
- '*.*.*' | |
pull_request: null | |
name: ci-pgsql | |
jobs: | |
tests: | |
name: PHP ${{ matrix.php-version }}-pgsql-${{ matrix.pgsql-version }} | |
env: | |
extensions: curl, intl, pdo, pdo_pgsql | |
key: cache-v1 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
php-version: | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
- "8.3" | |
pgsql-version: | |
- "10" | |
- "11" | |
- "12" | |
- "13" | |
services: | |
postgres: | |
image: postgres:${{ matrix.pgsql-version }} | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: spiral | |
ports: | |
- 15432:5432 | |
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cache environment | |
id: cache-env | |
uses: shivammathur/cache-extensions@v1 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ${{ env.extensions }} | |
key: ${{ env.key }} | |
- name: Cache extensions | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.cache-env.outputs.dir }} | |
key: ${{ steps.cache-env.outputs.key }} | |
restore-keys: ${{ steps.cache-env.outputs.key }} | |
- name: Install PHP with extensions | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-version }} | |
extensions: ${{ env.extensions }} | |
ini-values: date.timezone='UTC' | |
coverage: pcov | |
- name: Determine composer cache directory | |
if: matrix.os == 'ubuntu-latest' | |
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV | |
- name: Cache dependencies installed with composer | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.COMPOSER_CACHE_DIR }} | |
key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- | |
- name: Install dependencies with composer | |
if: matrix.php-version != '8.3' | |
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | |
- name: Install dependencies with composer php 8.3 | |
if: matrix.php-version == '8.3' | |
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi | |
- name: Run pgsql tests with phpunit | |
env: | |
DB: postgres | |
POSTGRES: ${{ matrix.pgsql-version }} | |
run: vendor/bin/phpunit --group driver-postgres --colors=always | |
... |