Skip to content

Commit

Permalink
Merge pull request #15610 from phalcon/improve-psr-via-zephir
Browse files Browse the repository at this point in the history
Improve PSR detection via Zephir's Dynamic Class Entries detection
  • Loading branch information
niden authored Aug 12, 2021
2 parents aa1bb9e + 5894978 commit 68f38aa
Show file tree
Hide file tree
Showing 20 changed files with 317 additions and 425 deletions.
72 changes: 35 additions & 37 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ on:
- '**.txt'
pull_request:

env:
ZEPHIR_PARSER_VERSION: v1.3.6
ZEPHIR_VERSION: 0.14.0-beta.3
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
LC_ALL: en_US.UTF-8

jobs:
generate:
# To prevent build a particular commit use
Expand All @@ -18,13 +25,6 @@ jobs:
runs-on: ubuntu-20.04
name: Build Phalcon Pecl Package
steps:
- name: Setup Environment Variables
run: |
echo "ZEPHIR_PARSER_VERSION=v1.3.6" >> $GITHUB_ENV
echo "ZEPHIR_VERSION=0.13.5" >> $GITHUB_ENV
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
echo "LANGUAGE=en_US.UTF-8" >> $GITHUB_ENV
echo "LC_ALL=en_US.UTF-8" >> $GITHUB_ENV

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -35,14 +35,6 @@ jobs:
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Common Settings
run: |
# Core dump settings
ulimit -c unlimited -S || true
# Hide "You are in 'detached HEAD' state" message
git config --global advice.detachedHead false
- name: Checkout Code
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -163,7 +155,7 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, json, imagick, gd, gettext, igbinary, apcu, msgpack, memcached, yaml, redis
ini-values: apc.enable_cli=on, session.save_path=/tmp, extension=psr.so, extension=phalcon.so
ini-values: apc.enable_cli=on, session.save_path=/tmp
tools: pecl
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -203,26 +195,26 @@ jobs:
- name: Run Unit Tests
if: always()
run: vendor/bin/codecept run --ext DotReporter unit
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter unit

- name: Run CLI Tests
if: always()
run: vendor/bin/codecept run --ext DotReporter cli
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter cli

- name: Run Integration Tests
env:
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
if: always()
run: vendor/bin/codecept run --ext DotReporter integration
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter integration

- name: Run Database Tests (Common)
env:
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
DATA_MYSQL_USER: root
if: always()
run: vendor/bin/codecept run --ext DotReporter database -g common
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter database -g common

- name: Run Database Tests (MySQL)
env:
Expand All @@ -231,14 +223,14 @@ jobs:
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
DATA_MYSQL_USER: root
if: always()
run: vendor/bin/codecept run --ext DotReporter database --env mysql -g mysql
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter database --env mysql -g mysql

- name: Run Database Tests (Sqlite)
env:
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
if: always()
run: vendor/bin/codecept run --ext DotReporter database --env sqlite -g sqlite
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter database --env sqlite -g sqlite

- name: Run Database Tests (Postgres)
env:
Expand All @@ -247,14 +239,20 @@ jobs:
DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
if: always()
run: vendor/bin/codecept run --ext DotReporter database --env pgsql -g pgsql
run: vendor/bin/codecept run --coverage-xml=coverage-${{ matrix.php-versions }}.xml --ext DotReporter database --env pgsql -g pgsql

# - name: Run Database Tests (SQL Server)
# env:
# DATA_REDIS_PORT: ${{ job.services.redis.ports['6379'] }}
# DATA_MEMCACHED_PORT: ${{ job.services.memcached.ports['11211'] }}
# run: vendor/bin/codecept run --ext DotReporter database --env sqlsrv

- name: Upload Code Coverage on 7.4
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./tests/_output/coverage-*.xml

build-and-test-macos:
# To prevent build a particular commit use
# git commit -m "......... [ci skip]"
Expand All @@ -279,20 +277,20 @@ jobs:
with:
fetch-depth: 1

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-versions }}
extensions: ${{ env.extensions }}
key: ${{ env.ext_cache_key }}

- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}
# - name: Setup cache environment
# id: extcache
# uses: shivammathur/cache-extensions@v1
# with:
# php-version: ${{ matrix.php-versions }}
# extensions: ${{ env.extensions }}
# key: ${{ env.ext_cache_key }}

# - name: Cache extensions
# uses: actions/cache@v2
# with:
# path: ${{ steps.extcache.outputs.dir }}
# key: ${{ steps.extcache.outputs.key }}
# restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
168 changes: 0 additions & 168 deletions .github/workflows/codecoverage.yml

This file was deleted.

10 changes: 7 additions & 3 deletions .github/workflows/static-code-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- '**.md'
- '**.txt'

env:
ZEPHIR_VERSION: 0.14.0-beta.3

jobs:
phpcs:
if: "!contains(github.event.head_commit.message, 'ci skip')"
Expand Down Expand Up @@ -42,18 +45,19 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
tools: pecl
extensions: mbstring, intl, json, imagick, redis, igbinary, apcu, msgpack, memcached, yaml, psr
extensions: mbstring, intl, json, imagick, redis, igbinary, apcu, msgpack, memcached, yaml, psr-1.1.0

- name: Install System Dependencies
run: |
sudo apt-get update --quiet --yes 1>/dev/null
sudo apt-get install --no-install-recommends -q -y re2c
- name: Install Packages
run: composer install --prefer-dist --ignore-platform-reqs
run: composer install --prefer-dist

- name: Install Zephir
run: .ci/install-zephir.sh
run: |
.ci/install-zephir.sh
- name: Validate stubs
if: always()
Expand Down
9 changes: 1 addition & 8 deletions build/config/phalcon_c_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,14 @@
#include <ext/spl/spl_exceptions.h>
#include <ext/spl/spl_directory.h>
#include <ext/spl/spl_iterators.h>
#include <ext/spl/spl_array.h>
#include <ext/pdo/php_pdo_driver.h>
#include <ext/hash/php_hash.h>
#include <ext/date/php_date.h>
#include <ext/json/php_json.h>
#include <ext/session/php_session.h>
#include <ext/psr/psr_http_message.h>
#include <ext/psr/psr_simple_cache.h>
#include <ext/psr/psr_container.h>
#include <ext/psr/psr_log.h>
#include <ext/psr/psr_link.h>
#include <ext/psr/psr_http_server_middleware.h>
#include <ext/psr/psr_http_server_handler.h>
#include <Zend/zend_API.h>
#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ext-mbstring": "*",
"ext-msgpack": "*",
"ext-pdo": "*",
"ext-psr": "^0.7|^1.0",
"ext-psr": "^1.1.0",
"ext-redis": "*",
"ext-sqlite3": "*",
"ext-xml": "*",
Expand Down
Loading

0 comments on commit 68f38aa

Please sign in to comment.