fix #211
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: PHP Laravel Package | |
on: [ push, pull_request ] | |
jobs: | |
# phpcs: | |
# name: PHPCS | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: PHPCS check | |
# uses: chekalsky/phpcs-action@v1 | |
# with: | |
# enable_warnings: true | |
# lint-changelog: | |
# name: Lint changelog file | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Check out code | |
# uses: actions/checkout@v2 | |
# - name: Lint changelog file | |
# uses: avto-dev/markdown-lint@v1 | |
# with: | |
# rules: './.github/workflows/lint/rules/changelog.js' | |
# config: '/lint/config/changelog.yml' | |
# args: './CHANGELOG.md' | |
testing: | |
name: Test on PHP ${{ matrix.php }} on laravel ${{ matrix.laravel }} with ${{ matrix.setup }} dependencies | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
strategy: | |
fail-fast: false | |
matrix: | |
setup: [ 'basic', 'lowest', 'stable' ] | |
php: [ '8.2', '8.3' , '8.4' ] | |
laravel: [ 11.*, 12.* ] | |
include: | |
- laravel: 11.* | |
php: 8.3 | |
testbench: 9.* | |
- laravel: 12.* | |
php: 8.4 | |
testbench: 10.* | |
# - laravel: 9.* | |
# testbench: 7.* | |
# vardumper: 6.* | |
# exclude: | |
# - php: '8.2' | |
# setup: 'lowest' | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use PHP ${{ matrix.php }} | |
uses: shivammathur/setup-php@v2 # Action page: <https://github.com/shivammathur/setup-php> | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: mbstring | |
coverage: xdebug | |
- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer> | |
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-${{ matrix.setup }}-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ matrix.setup }}-${{ matrix.laravel }}- | |
- name: Validate composer.json | |
run: composer validate | |
- name: Install [LOWEST] Composer dependencies | |
if: matrix.setup == 'lowest' | |
run: | | |
composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest | |
- name: Install [BASIC] Composer dependencies | |
if: matrix.setup == 'basic' | |
run: | | |
composer update --prefer-dist --no-interaction --no-suggest | |
- name: Install [STABLE] Composer dependencies | |
if: matrix.setup == 'stable' | |
run: composer update --prefer-dist --no-interaction --no-suggest --prefer-stable | |
- name: Show most important packages' versions | |
run: composer info | grep -e efureev -e laravel/framework -e phpunit/phpunit -e orchestra/testbench | |
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" | |
# Docs: https://getcomposer.org/doc/articles/scripts.md | |
- name: Run test suite | |
run: composer test-cover | |
env: | |
DB_HOST: localhost | |
DB_PORT: ${{ job.services.postgres.ports[5432] }} | |
- name: Run codacy-coverage-reporter | |
uses: codacy/codacy-coverage-reporter-action@v1 | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} |