2019-12-17 14:27:51 +01:00
|
|
|
name: build
|
2019-12-16 15:20:22 +01:00
|
|
|
|
2019-12-17 14:27:51 +01:00
|
|
|
on: [push, pull_request]
|
2019-12-16 15:20:22 +01:00
|
|
|
|
|
|
|
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:
|
2019-12-16 22:27:36 +01:00
|
|
|
MYSQL_HOST_PORT: 3800
|
2019-12-16 21:58:45 +01:00
|
|
|
MYSQL_DATABASE: monarc_common
|
2019-12-17 07:30:50 +01:00
|
|
|
MYSQL_ROOT_PASSWORD: root
|
2019-12-16 21:58:45 +01:00
|
|
|
MYSQL_USER: sqlmonarcuser
|
|
|
|
MYSQL_PASSWORD: password
|
2024-10-06 19:02:15 +02:00
|
|
|
MYSQL_VERSION: 10.6.18
|
2019-12-16 15:20:22 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
2024-10-06 19:23:50 +02:00
|
|
|
- name: Shutdown Ubuntu MySQL (SUDO)
|
|
|
|
run: sudo service mysql stop
|
|
|
|
|
2019-12-16 15:32:33 +01:00
|
|
|
- name: Setup PHP
|
2021-03-05 14:54:03 +01:00
|
|
|
uses: shivammathur/setup-php@v2
|
2019-12-16 15:32:33 +01:00
|
|
|
with:
|
2023-03-08 17:13:27 +01:00
|
|
|
php-version: '8.1'
|
2021-03-05 14:54:03 +01:00
|
|
|
extensions: imagick, intl, xml, mysql, bcmath #optional, setup extensions
|
2019-12-16 15:32:33 +01:00
|
|
|
ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration
|
|
|
|
coverage: xdebug #optional, setup coverage driver
|
2021-03-05 14:54:03 +01:00
|
|
|
tools: pecl
|
2019-12-16 15:32:33 +01:00
|
|
|
|
2019-12-16 15:20:22 +01:00
|
|
|
- name: Validate composer.json and composer.lock
|
|
|
|
run: composer validate
|
|
|
|
|
2019-12-17 14:27:51 +01:00
|
|
|
- name: Install PHP dependencies
|
2023-03-08 17:17:59 +01:00
|
|
|
run: composer install --prefer-dist --no-progress --no-suggest --ignore-platform-req=php
|
2019-12-16 15:20:22 +01:00
|
|
|
|
2019-12-17 14:27:51 +01:00
|
|
|
- name: Create synlinks for MONARC PHP modules
|
2019-12-16 21:58:45 +01:00
|
|
|
run: |
|
|
|
|
mkdir -p module/Monarc
|
|
|
|
cd module/Monarc
|
|
|
|
ln -s ./../../vendor/monarc/core Core
|
|
|
|
ln -s ./../../vendor/monarc/frontoffice FrontOffice
|
|
|
|
cd ../..
|
|
|
|
|
2019-12-17 11:00:07 +01:00
|
|
|
- name: Set MONARC configuration file
|
|
|
|
run: cp ./config/autoload/local.php.dist ./config/autoload/local.php
|
|
|
|
|
2024-10-06 19:19:33 +02:00
|
|
|
- name: Start MariaDB and create databases
|
|
|
|
uses: getong/mariadb-action@v1.1
|
|
|
|
with:
|
|
|
|
host port: $MYSQL_HOST_PORT
|
|
|
|
mariadb version: $MYSQL_VERSION # Optional, default value is "latest". The version of the MariaDB
|
|
|
|
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"
|
2024-10-06 19:23:50 +02:00
|
|
|
|
|
|
|
- name: Shutdown Ubuntu MySQL (SUDO)
|
|
|
|
run: sudo service mysql start
|
|
|
|
|
|
|
|
- name: Creating and populating databases
|
2019-12-16 21:58:45 +01:00
|
|
|
run: |
|
2019-12-17 07:40:32 +01:00
|
|
|
mysql -u root -p$MYSQL_ROOT_PASSWORD -P $MYSQL_HOST_PORT -e "CREATE DATABASE monarc_common DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
|
2019-12-17 11:00:07 +01:00
|
|
|
mysql -u root -p$MYSQL_ROOT_PASSWORD -P $MYSQL_HOST_PORT -e "CREATE DATABASE monarc_cli DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;"
|
|
|
|
mysql -u root -p$MYSQL_ROOT_PASSWORD -P $MYSQL_HOST_PORT -e "CREATE USER '$MYSQL_USER'@'%' IDENTIFIED BY '$MYSQL_PASSWORD';"
|
2019-12-17 07:30:50 +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;"
|
2019-12-17 11:00:07 +01:00
|
|
|
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_HOST_PORT $MYSQL_DATABASE < db-bootstrap/monarc_structure.sql
|
|
|
|
mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_HOST_PORT $MYSQL_DATABASE < db-bootstrap/monarc_data.sql
|
2024-10-06 19:23:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
- name: Upgrading databases
|
|
|
|
run: |
|
2019-12-17 11:00:07 +01:00
|
|
|
./vendor/robmorgan/phinx/bin/phinx migrate -c ./module/Monarc/Core/migrations/phinx.php
|
|
|
|
./vendor/robmorgan/phinx/bin/phinx migrate -c ./module/Monarc/FrontOffice/migrations/phinx.php
|
2024-10-06 19:23:50 +02:00
|
|
|
|
|
|
|
- name: Creating initial user
|
|
|
|
run: ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/Monarc/FrontOffice/migrations/phinx.php
|
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
|