Created
July 28, 2023 14:55
-
-
Save elguitarraverde/b75f1294524bf069623a22926514dd19 to your computer and use it in GitHub Desktop.
GitHub Action para Tests de Plugins en FacturaScripts
This file contains 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
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tests: | |
name: Ejecutar tests del Plugin en MYSQL y POSTGRESQL | |
runs-on: ubuntu-latest | |
env: | |
NOMBRE_PLUGIN: "Informes" | |
services: | |
mysql: | |
image: mariadb:11 | |
ports: | |
- 3306:3306 | |
env: | |
MARIADB_ROOT_PASSWORD: toor | |
MARIADB_DATABASE: facturascripts_tests | |
postgres: | |
image: postgres:10 | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: toor | |
POSTGRES_DB: facturascripts_tests | |
steps: | |
- name: Intalar PHP y extensiones | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' | |
extensions: json, fileinfo, simplexml, zip, dom, pdo, pdo_mysql, mysql, mysqli, pgsql, pdo_pgsql, bcmath, gd, curl, soap | |
tools: composer | |
coverage: none | |
- name: Clonar FacturaScripts | |
uses: actions/checkout@v3.5.3 | |
with: | |
fetch-depth: 0 | |
repository: 'NeoRazorX/facturascripts' | |
- name: Clonar Plugin ${{ env.NOMBRE_PLUGIN }} | |
uses: actions/checkout@v3.5.3 | |
with: | |
fetch-depth: 0 | |
path: Plugins/${{ env.NOMBRE_PLUGIN }} | |
- name: Instalar dependencias de FacturaScripts | |
run: | | |
mkdir MyFiles | |
touch MyFiles/plugins.json | |
composer install --prefer-dist --no-interaction --no-progress | |
- name: Configurar Constantes de entorno para MYSQL | |
run: | | |
echo " | |
<?php | |
define('FS_COOKIES_EXPIRE', 604800); | |
define('FS_LANG', 'es_ES'); | |
define('FS_TIMEZONE', 'Europe/Madrid'); | |
define('FS_ROUTE', ''); | |
define('FS_DB_TYPE', 'mysql'); | |
define('FS_DB_HOST', '127.0.0.1'); | |
define('FS_DB_PORT', '3306'); | |
define('FS_DB_NAME', 'facturascripts_tests'); | |
define('FS_DB_USER', 'root'); | |
define('FS_DB_PASS', 'toor'); | |
define('FS_DB_FOREIGN_KEYS', true); | |
define('FS_DB_TYPE_CHECK', true); | |
define('FS_MYSQL_CHARSET', 'utf8'); | |
define('FS_MYSQL_COLLATE', 'utf8_bin'); | |
define('FS_HIDDEN_PLUGINS', ''); | |
define('FS_DEBUG', false); | |
define('FS_DISABLE_ADD_PLUGINS', false); | |
define('FS_DISABLE_RM_PLUGINS', false); | |
define('FS_NF0', 2); | |
" >> "config.php" | |
- name: Copiar archivos de los tests del Plugin | |
run: cp -r Plugins/${{ env.NOMBRE_PLUGIN }}/Test/main Test/Plugins | |
- name: Instalar el Plugin ${{ env.NOMBRE_PLUGIN }} | |
run: php Test/install-plugins.php | |
- name: Ejecutar tests en MYSQL | |
run: vendor/bin/phpunit -c phpunit-plugins.xml | |
- name: Cambiar configuracion para usar POSTGRESQL | |
run: | | |
rm config.php | |
echo " | |
<?php | |
define('FS_COOKIES_EXPIRE', 604800); | |
define('FS_LANG', 'es_ES'); | |
define('FS_TIMEZONE', 'Europe/Madrid'); | |
define('FS_ROUTE', ''); | |
define('FS_DB_TYPE', 'postgresql'); | |
define('FS_DB_HOST', 'localhost'); | |
define('FS_DB_PORT', '5432'); | |
define('FS_DB_NAME', 'facturascripts_tests'); | |
define('FS_DB_USER', 'postgres'); | |
define('FS_DB_PASS', 'toor'); | |
define('FS_DB_FOREIGN_KEYS', true); | |
define('FS_DB_TYPE_CHECK', true); | |
define('FS_MYSQL_CHARSET', 'utf8'); | |
define('FS_MYSQL_COLLATE', 'utf8_bin'); | |
define('FS_HIDDEN_PLUGINS', ''); | |
define('FS_DEBUG', false); | |
define('FS_DISABLE_ADD_PLUGINS', false); | |
define('FS_DISABLE_RM_PLUGINS', false); | |
define('FS_NF0', 2); | |
" >> "config.php" | |
- name: Ejecutar tests en POSTGRESQL | |
run: vendor/bin/phpunit -c phpunit-plugins.xml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Muy bueno