MonarcAppFO/.github/workflows/php.yml

75 lines
2.8 KiB
YAML
Raw Normal View History

2019-12-16 15:20:22 +01:00
name: PHP Composer
on: [push]
jobs:
build:
2019-12-16 22:22:06 +01:00
runs-on: ubuntu-latest
2019-12-16 22:06:13 +01:00
2019-12-16 21:58:45 +01:00
env:
MYSQL_HOST_PORT: 3800
2019-12-16 21:58:45 +01:00
MYSQL_DATABASE: monarc_common
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: sqlmonarcuser
MYSQL_PASSWORD: password
2019-12-16 15:20:22 +01:00
steps:
- uses: actions/checkout@v1
2019-12-16 22:36:57 +01:00
- name: Shutdown Ubuntu MySQL (SUDO)
run: sudo service mysql stop
2019-12-16 21:58:45 +01:00
- name: Start MariaDB and create databases
uses: getong/mariadb-action@v1.1
with:
host port: $MYSQL_HOST_PORT
2019-12-16 21:58:45 +01:00
mysql database: $MYSQL_DATABASE # Optional, default value is "test". The specified database which will be create
mysql root password: $MYSQL_ROOT_PASSWORD # Required if "mysql user" is empty, default is empty. The root superuser password
mysql user: $MYSQL_USER # Required if "mysql root password" is empty, default is empty. The superuser for the specified database. Can use secrets, too
mysql password: $MYSQL_PASSWORD # Required if "mysql user" exists. The password for the "mysql user"
2019-12-16 22:44:17 +01:00
- name: Start MySQL (SUDO)
run: sudo service mysql start
2019-12-16 15:32:33 +01:00
- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: '7.3'
extensions: imagick, intl, xml, mysql #optional, setup extensions
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
coverage: xdebug #optional, setup coverage driver
pecl: false #optional, setup PECL
# - name: Install PHP extensions
# run: sudo apt-get install -y php apache2 libapache2-mod-php php-curl php-gd php-mysql php-pear php-apcu php-xml php-mbstring php-intl php-imagick php-zip
2019-12-16 15:20:22 +01:00
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
2019-12-16 21:58:45 +01:00
- name: Make PHP modules symlinks
run: |
mkdir -p module/Monarc
cd module/Monarc
ln -s ./../../vendor/monarc/core Core
ln -s ./../../vendor/monarc/frontoffice FrontOffice
cd ../..
- name: Populating common database
run: |
2019-12-16 22:44:17 +01:00
mysql -u root -p$MYSQL_ROOT_PASSWORD -P $MYSQL_HOST_PORT -e "GRANT ALL PRIVILEGES ON * . * TO '$MYSQL_USER'@'%';"
mysql -u root -p$MYSQL_ROOT_PASSWORD -P $MYSQL_HOST_PORT -e "FLUSH PRIVILEGES;"
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_HOST_PORT $MYSQL_DATABASE < db-bootstrap/monarc_structure.sql > /dev/null
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_HOST_PORT $MYSQL_DATABASE < db-bootstrap/monarc_data.sql > /dev/null
2019-12-16 21:58:45 +01:00
2019-12-16 15:20:22 +01:00
# 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