|
| 1 | +name: Test Facturascripts |
| 2 | + |
| 3 | +on: |
| 4 | + # las ramas en las que quieres que se ejecuten los tests |
| 5 | + push: |
| 6 | + branches: [ "master", "githubActions" ] |
| 7 | + pull_request: |
| 8 | + branches: [ "master", "githubActions" ] |
| 9 | + |
| 10 | +concurrency: |
| 11 | + # que se cancele el test actual si se hace otro commit en la misma rama |
| 12 | + group: ci-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + |
| 17 | + test: |
| 18 | + |
| 19 | + runs-on: ubuntu-latest |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] # versiones no validas (phpunit)['5.6', '7.0', '7.1', '7.2', '7.3'] |
| 23 | + fail-fast: false |
| 24 | + |
| 25 | + name: Tests unitarios en PHP ${{ matrix.php-versions }} |
| 26 | + steps: |
| 27 | + - name: Agregar el repo |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Instalar PHP ${{ matrix.php-versions }} |
| 31 | + uses: shivammathur/setup-php@v2 |
| 32 | + with: |
| 33 | + php-version: ${{ matrix.php-versions }} |
| 34 | + extensions: bcmath, curl, gd, iconv, mysqli, pdo_mysql, soap, zip, fileinfo, openssl, simplexml, mbstring |
| 35 | + |
| 36 | + - name: Instalar dependencias |
| 37 | + uses: "ramsey/composer-install@v3" |
| 38 | + |
| 39 | + - name: Montar base de datos |
| 40 | + uses: shogo82148/actions-setup-mysql@v1 |
| 41 | + with: |
| 42 | + distribution: "mysql" |
| 43 | + mysql-version: "8.0" |
| 44 | + root-password: "root" |
| 45 | + |
| 46 | + - name: Crear base de datos |
| 47 | + run: 'mysql -u root -proot -e "CREATE DATABASE facturascripts CHARACTER SET utf8 COLLATE utf8_bin;"' |
| 48 | + |
| 49 | + - name: Agregar configuración del proyecto |
| 50 | + run: echo "<?php |
| 51 | + define('FS_COOKIES_EXPIRE', 31536000); |
| 52 | + define('FS_ROUTE', ''); |
| 53 | + define('FS_DB_TYPE', 'mysql'); |
| 54 | + define('FS_DB_HOST', '127.0.0.1'); |
| 55 | + define('FS_DB_PORT', 3306); |
| 56 | + define('FS_DB_NAME', 'facturascripts'); |
| 57 | + define('FS_DB_USER', 'root'); |
| 58 | + define('FS_DB_PASS', 'root'); |
| 59 | + define('FS_DB_FOREIGN_KEYS', true); |
| 60 | + define('FS_DB_TYPE_CHECK', true); |
| 61 | + define('FS_MYSQL_CHARSET', 'utf8mb4'); |
| 62 | + define('FS_MYSQL_COLLATE', 'utf8mb4_unicode_520_ci'); |
| 63 | + define('FS_LANG', 'es_ES'); |
| 64 | + define('FS_TIMEZONE', 'Europe/Madrid'); |
| 65 | + define('FS_HIDDEN_PLUGINS', ''); |
| 66 | + define('FS_DEBUG', true); |
| 67 | + define('FS_DISABLE_ADD_PLUGINS', false); |
| 68 | + define('FS_DISABLE_RM_PLUGINS', false);" > config.php |
| 69 | + |
| 70 | + - name: Ejecutar tests |
| 71 | + if: ${{ success() }} |
| 72 | + run: vendor/bin/phpunit --testdox --colors=always |
0 commit comments