mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 11:51:07 +07:00
Add support for phalcon
This commit is contained in:
parent
b2e7a49dd5
commit
fce9311522
@ -64,8 +64,9 @@ with:
|
||||
|
||||
Specify `coverage: pcov` to use `PCOV`.
|
||||
It is much faster than `Xdebug`.
|
||||
`PCOV` needs `PHP >= 7.1`
|
||||
If your source code directory is other than `src`, `lib` or, `app`, specify `pcov.directory` using the `ini-values-csv` input.
|
||||
`PCOV` needs `PHPUnit >= 8.0` and `PHP >= 7.1`, `PHPUnit` needs `PHP >= 7.2`. So use `PHP >= 7.2` with `PCOV`
|
||||
|
||||
|
||||
```yaml
|
||||
uses: shivammathur/setup-php@master
|
||||
@ -150,7 +151,6 @@ jobs:
|
||||
run: composer -V
|
||||
- name: Check PHP Extensions
|
||||
run: php -m
|
||||
|
||||
```
|
||||
|
||||
### Examples
|
||||
@ -166,6 +166,8 @@ Examples for setting up this GitHub Action with different PHP Frameworks/Package
|
||||
|Lumen with `MySQL` and `Redis`|`ubuntu`|[lumen-mysql.yml](./examples/lumen-mysql.yml "GitHub Action for Lumen with MySQL and Redis")|
|
||||
|Lumen with `PostgreSQL` and `Redis`|`ubuntu`|[lumen-postgres.yml](./examples/lumen-postgres.yml "GitHub Action for Lumen with PostgreSQL and Redis")|
|
||||
|Lumen without services|`macOS`, `ubuntu` and `windows`|[lumen.yml](./examples/lumen.yml "GitHub Action for Lumen without services")|
|
||||
|Phalcon with `MySQL`|`ubuntu`|[phalcon-mysql.yml](./examples/phalcon-mysql.yml "GitHub Action for Phalcon with MySQL")|
|
||||
|Phalcon with `PostgreSQL`|`ubuntu`|[phalcon-postgres.yml](./examples/phalcon-postgres.yml "GitHub Action for Phalcon with PostgreSQL")|
|
||||
|Slim Framework|`macOS`, `ubuntu` and `windows`|[slim-framework.yml](./examples/slim-framework.yml "GitHub Action for Slim Framework")|
|
||||
|Symfony with `MySQL`|`ubuntu`|[symfony-mysql.yml](./examples/symfony-mysql.yml "GitHub Action for Symfony with MySQL")|
|
||||
|Symfony with `PostgreSQL`|`ubuntu`|[symfony-postgres.yml](./examples/symfony-postgres.yml "GitHub Action for Symfony with PostgreSQL")|
|
||||
|
@ -45,6 +45,14 @@ describe('Extension tests', () => {
|
||||
expect(linux).toContain('./xdebug.sh');
|
||||
expect(linux).toContain('./pcov.sh');
|
||||
|
||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.2', 'linux');
|
||||
expect(linux).toContain('./phalcon.sh master 7.2');
|
||||
expect(linux).toContain('./phalcon.sh 4.0.x 7.2');
|
||||
|
||||
linux = await extensions.addExtension('phalcon3, phalcon4', '7.3', 'linux');
|
||||
expect(linux).toContain('./phalcon.sh master 7.3');
|
||||
expect(linux).toContain('./phalcon.sh 4.0.x 7.3');
|
||||
|
||||
linux = await extensions.addExtension('xdebug', '7.2', 'fedora');
|
||||
expect(linux).toContain('Platform fedora is not supported');
|
||||
});
|
||||
|
60
examples/phalcon-mysql.yml
Normal file
60
examples/phalcon-mysql.yml
Normal file
@ -0,0 +1,60 @@
|
||||
# GitHub Action for Phalcon with MySQL
|
||||
## Notes
|
||||
## Make sure you have .env.example or .env file in your project
|
||||
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
|
||||
name: Testing Phalcon with MySQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
phalcon:
|
||||
name: Phalcon (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_ADAPTER: mysql
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_NAME: phalcon
|
||||
DB_USERNAME: root
|
||||
DB_PASSWORD: password
|
||||
CODECEPTION_URL: 127.0.0.1
|
||||
CODECEPTION_PORT: 8888
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
MYSQL_DATABASE: phalcon
|
||||
ports:
|
||||
- 3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 3
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extension-csv: mbstring, phalcon4, mysql #use phalcon3 for the phalcon 3.x.
|
||||
coverage: xdebug #optional
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Run Migration
|
||||
run: |
|
||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||
vendor/bin/phinx migrate
|
||||
vendor/bin/phinx seed:run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
||||
- name: Run Tests
|
||||
run: |
|
||||
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||
vendor/bin/codecept build
|
||||
vendor/bin/codecept run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.mysql.ports['3306'] }}
|
61
examples/phalcon-postgres.yml
Normal file
61
examples/phalcon-postgres.yml
Normal file
@ -0,0 +1,61 @@
|
||||
# GitHub Action for Phalcon with PostgreSQL
|
||||
## Notes
|
||||
## Make sure you have .env.example or .env file in your project
|
||||
## and you have loaded Dotenv (https://github.com/vlucas/phpdotenv)
|
||||
name: Testing Phalcon with PostgreSQL
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
phalcon:
|
||||
name: Phalcon (PHP ${{ matrix.php-versions }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DB_ADAPTER: pgsql
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_NAME: postgres
|
||||
DB_USERNAME: postgres
|
||||
DB_PASSWORD: postgres
|
||||
CODECEPTION_URL: 127.0.0.1
|
||||
CODECEPTION_PORT: 8888
|
||||
DB_CONNECTION: pgsql
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:10.8
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: postgres
|
||||
ports:
|
||||
- 5432/tcp
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 3
|
||||
matrix:
|
||||
php-versions: ['7.2', '7.3']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Setup PHP, with composer and extensions
|
||||
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php
|
||||
with:
|
||||
php-version: ${{ matrix.php-versions }}
|
||||
extension-csv: mbstring, phalcon4, pgsql #use phalcon3 for the phalcon 3.x
|
||||
coverage: xdebug #optional
|
||||
- name: Install Composer dependencies
|
||||
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
|
||||
- name: Prepare the application
|
||||
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
|
||||
- name: Run Migration
|
||||
run: |
|
||||
if [ ! -e phinx.yml ]; then vendor/bin/phinx init; fi
|
||||
vendor/bin/phinx migrate
|
||||
vendor/bin/phinx seed:run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
||||
- name: Run Tests
|
||||
run: |
|
||||
(cd public && nohup php -S $CODECEPTION_URL:$CODECEPTION_PORT > phalcon.log 2>&1 &)
|
||||
vendor/bin/codecept build
|
||||
vendor/bin/codecept run
|
||||
env:
|
||||
DB_PORT: ${{ job.services.postgres.ports['5432'] }}
|
@ -156,6 +156,14 @@ function addExtensionLinux(extension_csv, version, log_prefix) {
|
||||
install_command =
|
||||
'./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
||||
break;
|
||||
case '7.2phalcon3':
|
||||
case '7.3phalcon3':
|
||||
install_command = './phalcon.sh master ' + version + ' >/dev/null 2>&1';
|
||||
break;
|
||||
case '7.2phalcon4':
|
||||
case '7.3phalcon4':
|
||||
install_command = './phalcon.sh 4.0.x ' + version + ' >/dev/null 2>&1';
|
||||
break;
|
||||
default:
|
||||
install_command =
|
||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
||||
|
@ -88,11 +88,14 @@ function readScript(filename, version, os_version) {
|
||||
}
|
||||
break;
|
||||
case 'linux':
|
||||
let files = ['scripts/phalcon.sh'];
|
||||
yield readFiles74(['scripts/phalcon.sh']);
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
yield readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
files.concat(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
break;
|
||||
}
|
||||
yield readFiles74(files);
|
||||
break;
|
||||
case 'win32':
|
||||
switch (version) {
|
||||
|
@ -152,6 +152,14 @@ export async function addExtensionLinux(
|
||||
install_command =
|
||||
'./pcov.sh >/dev/null 2>&1 && echo "extension=pcov.so" >> $ini_file';
|
||||
break;
|
||||
case '7.2phalcon3':
|
||||
case '7.3phalcon3':
|
||||
install_command = './phalcon.sh master ' + version + ' >/dev/null 2>&1';
|
||||
break;
|
||||
case '7.2phalcon4':
|
||||
case '7.3phalcon4':
|
||||
install_command = './phalcon.sh 4.0.x ' + version + ' >/dev/null 2>&1';
|
||||
break;
|
||||
default:
|
||||
install_command =
|
||||
'sudo DEBIAN_FRONTEND=noninteractive apt install -y php' +
|
||||
|
19
src/scripts/phalcon.sh
Normal file
19
src/scripts/phalcon.sh
Normal file
@ -0,0 +1,19 @@
|
||||
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install php"$2"-dev php-pear -y
|
||||
for tool in php-config phpize; do
|
||||
if [ -e "/usr/bin/$tool$2" ]; then
|
||||
sudo update-alternatives --set $tool /usr/bin/"$tool$2" &
|
||||
fi
|
||||
done
|
||||
sudo pecl config-set php_ini "$ini_file"
|
||||
sudo pear config-set php_ini "$ini_file"
|
||||
sudo pecl install psr
|
||||
if [ "$1" = "master" ]; then
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt install php"$2"-phalcon -y
|
||||
else
|
||||
git clone --depth=1 -v https://github.com/phalcon/cphalcon.git -b "$1"
|
||||
(
|
||||
cd cphalcon/build && sudo ./install --phpize /usr/bin/phpize"$2" --php-config /usr/bin/php-config"$2"
|
||||
echo "extension=phalcon.so" >> "$ini_file"
|
||||
)
|
||||
fi
|
@ -79,11 +79,14 @@ export async function readScript(
|
||||
}
|
||||
break;
|
||||
case 'linux':
|
||||
let files: Array<string> = ['scripts/phalcon.sh'];
|
||||
await readFiles74(['scripts/phalcon.sh']);
|
||||
switch (version) {
|
||||
case '7.4':
|
||||
await readFiles74(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
files.concat(['scripts/xdebug.sh', 'scripts/pcov.sh']);
|
||||
break;
|
||||
}
|
||||
await readFiles74(files);
|
||||
break;
|
||||
case 'win32':
|
||||
switch (version) {
|
||||
|
Loading…
Reference in New Issue
Block a user