Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM php:8.4-cli-alpine

# Install system dependencies
RUN apk add --no-cache \
postgresql-dev \
libpq \
git \
unzip \
libzip-dev \
icu-dev

# Install PHP extensions
RUN docker-php-ext-install \
pdo_pgsql \
pgsql \
zip \
intl

# Install pcov for code coverage
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
&& pecl install pcov \
&& docker-php-ext-enable pcov \
&& apk del .build-deps

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /app

COPY . /app

RUN composer install --no-interaction --no-progress

# Run the full test gate (PHPCS + PHPUnit) by default.
# pcov is available in the image for `composer test-cover`.
CMD ["composer", "test"]
76 changes: 51 additions & 25 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,39 @@ 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:
name: Coding Standards (PHPCS)
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v6

- name: Use PHP 8.4
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring
coverage: none

- 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.json') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer update --prefer-dist --no-interaction

- name: Run PHPCS
run: composer phpcs

testing:
name: Test on PHP ${{ matrix.php }} with ${{ matrix.setup }} dependencies
Expand All @@ -23,15 +47,15 @@ jobs:
fail-fast: false
matrix:
setup: [ 'basic', 'lowest', 'stable' ]
php: [ '8.2','8.3' ]
php: [ '8.4', '8.5' ]

services:
postgres:
image: postgres:15
image: postgres:18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
POSTGRES_USER: forge
POSTGRES_PASSWORD: forge
POSTGRES_DB: forge
ports:
- 5432:5432
options: >-
Expand All @@ -41,14 +65,14 @@ jobs:
--health-retries 5

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- 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
extensions: mbstring, pdo_pgsql, pgsql
coverage: none

- name: Get Composer Cache Directory # Docs: <https://github.com/actions/cache/blob/master/examples.md#php---composer>
id: composer-cache
Expand All @@ -68,15 +92,15 @@ jobs:

- name: Install [LOWEST] Composer dependencies
if: matrix.setup == 'lowest'
run: composer update --prefer-dist --no-interaction --no-suggest --prefer-lowest
run: composer update --prefer-dist --no-interaction --prefer-lowest

- name: Install [BASIC] Composer dependencies
if: matrix.setup == 'basic'
run: composer update --prefer-dist --no-interaction --no-suggest
run: composer update --prefer-dist --no-interaction

- name: Install [STABLE] Composer dependencies
if: matrix.setup == 'stable'
run: composer update --prefer-dist --no-interaction --no-suggest --prefer-stable
run: composer update --prefer-dist --no-interaction --prefer-stable

- name: Show most important packages' versions
run: composer info | grep -e efureev -e laravel/framework -e phpunit/phpunit
Expand All @@ -89,6 +113,9 @@ jobs:
env:
DB_HOST: localhost
DB_PORT: ${{ job.services.postgres.ports[5432] }}
DB_DATABASE: forge
DB_USERNAME: forge
DB_PASSWORD: forge

release:
name: Create Release
Expand All @@ -97,15 +124,14 @@ jobs:
if: ${{ startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0') }}
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Create Release
id: create_release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ composer.lock
clover.xml

/.git-hooks
phpunit.xml.dist
phpunit.xml
/coverage
/.phpunit.cache
Loading
Loading