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
53 changes: 48 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: "PHQL CI"

on:
schedule:
- cron: '0 2 * * *' # Daily at 02:00 runs only on default branch
push:
paths-ignore:
- '**.md'
Expand All @@ -17,6 +15,50 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
# PHP CodeSniffer inspection
phpcs:
name: "Validate code style"

permissions:
contents: read

runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'

steps:
- uses: actions/checkout@v6

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.EXTENSIONS }}
ini-values: apc.enable_cli=on, session.save_path=/tmp
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHALCON_PATH: ext

- name: "Install development dependencies with Composer"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--prefer-dist"

- name: "PHPCS"
run: composer cs

- name: "PHPStan"
run: composer analyze

tests:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -60,6 +102,7 @@ jobs:

coverage:
name: Code Coverage
needs: tests
runs-on: ubuntu-latest

permissions:
Expand All @@ -71,20 +114,20 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.5'
extensions: mbstring
coverage: xdebug
tools: composer:v2
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Install dependencies
uses: ramsey/composer-install@v3
uses: ramsey/composer-install@v4
with:
composer-options: "--prefer-dist"

- name: Run tests with coverage
run: vendor/bin/phpunit --coverage-clover coverage.xml
run: vendor/bin/phpunit -c phpunit.xml --coverage-clover coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ phql.log

# PHPUnit
.phpunit.result.cache/
tests/_output/
coverage/
coverage.xml
32 changes: 27 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,37 @@
{
"name": "phalcon/phql",
"description": "Phalcon Query Language (PHQL)",
"type": "library",
"keywords": [
"php",
"framework",
"phalcon",
"query",
"sql"
"sql",
"phql"
],
"homepage": "https://phalcon.io",
"license": "MIT",
"authors": [
{
"name": "Phalcon Team",
"email": "team@phalcon.io",
"homepage": "https://phalcon.io"
}
],
"require": {
"php": ">=8.1",
"php": ">=8.1 <9.0",
"ext-mbstring": "*"
},
"suggest": {
"phalcon/phalcon": "The Phalcon framework this module integrates with"
},
"require-dev": {
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^10.5"
"phpunit/phpunit": "^10.5",
"pds/skeleton": "^1.0",
"pds/composer-script-names": "^1.0",
"squizlabs/php_codesniffer": "^4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -29,12 +43,20 @@
},
"autoload-dev": {
"psr-4": {
"Phalcon\\Phql\\Tests\\": "tests/",
"Phalcon\\Phql\\Tests\\Unit\\": "tests/unit/"
"Phalcon\\Phql\\Tests\\": "tests/"
}
},
"minimum-stability": "stable",
"prefer-stable": true,
"scripts": {
"cs": "vendor/bin/phpcs --standard=phpcs.xml",
"cs-fix": "vendor/bin/phpcbf --standard=phpcs.xml",
"analyze": "vendor/bin/phpstan analyse -c phpstan.neon --memory-limit 1024M",
"test": "vendor/bin/phpunit -c phpunit.xml --fail-on-all-issues",
"test-coverage": "vendor/bin/phpunit -c phpunit.xml --coverage-html tests/_output/coverage/"
},
"support": {
"issues": "https://github.com/phalcon/phql/issues",
"source": "https://github.com/phalcon/phql"
}
}
147 changes: 144 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0"?>
<ruleset name="Phalcon">
<description>Phalcon Coding Standards</description>
<arg value="-colors"/>
<arg value="s"/>
<arg value="p"/>
<rule ref="PSR12">
<exclude name="PSR2.Methods.MethodDeclaration.Underscore"/>
</rule>
<file>src</file>
<file>tests/unit</file>
</ruleset>
4 changes: 3 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<source>
<include>
<directory>src</directory>
<directory>resources</directory>
</include>
<exclude>
<file>resources/files/parser.php</file>
</exclude>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion resources/docker/develop/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ RUN groupadd -g "${GID}" "${GROUP}" \
&& rm -rf /tmp/* /var/tmp/* \
&& find /var/cache/apt/archives /var/lib/apt/lists -not -name lock -type f -delete \
&& find /var/cache -type f -delete \
&& find /var/log -type f -delete \
&& find /var/log -type f -delete

COPY resources/docker/develop/.bashrc /home/${USER}/.bashrc
COPY resources/docker/develop/extra.ini /usr/local/etc/php/conf.d/
Expand Down
Loading
Loading