You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.8 KiB
76 lines
2.8 KiB
name: PHP Composer
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
operating-system: [ubuntu-latest]
|
|
php-versions: ['7.3', '7.4', '8.0']
|
|
|
|
services:
|
|
mysql:
|
|
image: mysql:5.7
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
|
MYSQL_ROOT_PASSWORD: chamilo
|
|
MYSQL_DATABASE: chamilo
|
|
ports:
|
|
- 3306/tcp
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP, with composer and extensions
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-versions }}
|
|
tools: behat
|
|
extensions: mbstring, xml, ctype, iconv, mysql, gd, soap, intl, zip, bcmath
|
|
|
|
- name: Start mysql service
|
|
run: sudo /etc/init.d/mysql start
|
|
|
|
- name: Get composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
# Use composer.json for key, if composer.lock is not committed.
|
|
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
restore-keys: ${{ runner.os }}-composer-
|
|
|
|
- name: Install dependencies
|
|
run: composer install --prefer-dist --no-progress --no-suggest --no-scripts
|
|
|
|
- name: Install database
|
|
run: |
|
|
php bin/console doctrine:database:create || echo "Error while creating the DB"
|
|
|
|
env:
|
|
#DATABASE_URL: mysql://root:chamilo@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/chamilo
|
|
DATABASE_HOST: 127.0.0.1
|
|
DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
|
|
DATABASE_NAME: chamilo
|
|
DATABASE_USER: root
|
|
DATABASE_PASSWORD: chamilo
|
|
APP_INSTALLED: 1
|
|
|
|
- name: Composer analyse
|
|
run: composer analyse
|
|
|
|
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
|
|
# Docs: https://getcomposer.org/doc/articles/scripts.md
|
|
|
|
# - name: Run test suite
|
|
# run: composer run-script test
|
|
|