diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..f8fd433 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,82 @@ +name: build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + env: + MYSQL_HOST_PORT: 3800 + MYSQL_DATABASE: monarc_common + MYSQL_ROOT_PASSWORD: root + MYSQL_USER: sqlmonarcuser + MYSQL_PASSWORD: password + + steps: + - uses: actions/checkout@v1 + + #- name: Shutdown Ubuntu MySQL (SUDO) + #run: sudo service mysql stop + + #- name: Start MariaDB and create databases + #uses: getong/mariadb-action@v1.1 + #with: + #host port: $MYSQL_HOST_PORT + #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" + + - name: Start MySQL (SUDO) + run: sudo service mysql start + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: imagick, intl, xml, mysql, bcmath #optional, setup extensions + ini-values: post_max_size=256M, short_open_tag=On #optional, setup php.ini configuration + coverage: xdebug #optional, setup coverage driver + tools: pecl + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Install PHP dependencies + run: composer install --prefer-dist --no-progress --no-suggest --ignore-platform-req=php + + - name: Create synlinks for MONARC PHP modules + run: | + mkdir -p module/Monarc + cd module/Monarc + ln -s ./../../vendor/monarc/core Core + ln -s ./../../vendor/monarc/backoffice BackOffice + cd ../.. + + - name: Set MONARC configuration file + run: cp ./config/autoload/local.php.dist ./config/autoload/local.php + + - name: Creating and populating databases + run: | + 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;" + mysql -u root -p$MYSQL_ROOT_PASSWORD -P $MYSQL_HOST_PORT -e "CREATE DATABASE monarc_master 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';" + 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 + mysql -u $MYSQL_USER -p$MYSQL_PASSWORD -P $MYSQL_HOST_PORT $MYSQL_DATABASE < db-bootstrap/monarc_data.sql + + - name: Upgrading databases + run: | + ./vendor/robmorgan/phinx/bin/phinx migrate -c ./module/Monarc/Core/migrations/phinx.php + ./vendor/robmorgan/phinx/bin/phinx migrate -c ./module/Monarc/BackOffice/migrations/phinx.php + + - name: Creating initial user + run: ./vendor/robmorgan/phinx/bin/phinx seed:run -c ./module/Monarc/BackOffice/migrations/phinx.php + + # 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 diff --git a/composer.lock b/composer.lock index 7835230..12b2e96 100644 --- a/composer.lock +++ b/composer.lock @@ -6897,12 +6897,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "5aa91c2f219db1bd35df0db7a24e45083b853276" + "reference": "c90faeb954dbf0e3bb0657496199afeb99e2d4dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5aa91c2f219db1bd35df0db7a24e45083b853276", - "reference": "5aa91c2f219db1bd35df0db7a24e45083b853276", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/c90faeb954dbf0e3bb0657496199afeb99e2d4dd", + "reference": "c90faeb954dbf0e3bb0657496199afeb99e2d4dd", "shasum": "" }, "conflict": { @@ -7026,6 +7026,7 @@ "derhansen/fe_change_pwd": "<2.0.5|>=3,<3.0.3", "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1|>=7,<7.4", "desperado/xml-bundle": "<=0.1.7", + "dev-lancer/minecraft-motd-parser": "<=1.0.5", "devgroup/dotplant": "<2020.09.14-dev", "directmailteam/direct-mail": "<6.0.3|>=7,<7.0.3|>=8,<9.5.2", "doctrine/annotations": "<1.2.7", @@ -7717,7 +7718,7 @@ "type": "tidelift" } ], - "time": "2024-10-03T19:05:02+00:00" + "time": "2024-10-04T19:04:42+00:00" } ], "aliases": [], @@ -7733,6 +7734,6 @@ "ext-pdo": "*", "ext-openssl": "*" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" }