|
| 1 | +#!/bin/bash |
| 2 | +echo "================================================" |
| 3 | +echo " Ubuntu 22.04 (PHP 8.1)" |
| 4 | +echo "================================================" |
| 5 | + |
| 6 | +echo -n "[1/4] Starting MySQL 8.0 ........ " |
| 7 | +# run mysql server |
| 8 | +nohup mysqld > /root/mysql.log 2>&1 & |
| 9 | +# wait for mysql to become available |
| 10 | +while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do |
| 11 | + sleep 1 |
| 12 | +done |
| 13 | +# create database and user on mysql |
| 14 | +mysql -u root >/dev/null << 'EOF' |
| 15 | +CREATE DATABASE `php-crud-api` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; |
| 16 | +CREATE USER 'php-crud-api'@'localhost' IDENTIFIED WITH MYSQL_NATIVE_PASSWORD BY 'php-crud-api'; |
| 17 | +GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION; |
| 18 | +FLUSH PRIVILEGES; |
| 19 | +EOF |
| 20 | +echo "done" |
| 21 | + |
| 22 | +echo -n "[2/4] Starting PostgreSQL 14.2 .. " |
| 23 | +# ensure statistics can be written |
| 24 | +mkdir /var/run/postgresql/10-main.pg_stat_tmp/ && chmod 777 /var/run/postgresql/10-main.pg_stat_tmp/ |
| 25 | +# run postgres server |
| 26 | +nohup su - -c "/usr/lib/postgresql/14/bin/postgres -D /etc/postgresql/14/main" postgres > /root/postgres.log 2>&1 & |
| 27 | +# wait for postgres to become available |
| 28 | +until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do |
| 29 | + sleep 1; |
| 30 | +done |
| 31 | +# create database and user on postgres |
| 32 | +su - -c "psql -U postgres >/dev/null" postgres << 'EOF' |
| 33 | +CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api'; |
| 34 | +CREATE DATABASE "php-crud-api"; |
| 35 | +GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api"; |
| 36 | +\c "php-crud-api"; |
| 37 | +CREATE EXTENSION IF NOT EXISTS postgis; |
| 38 | +\q |
| 39 | +EOF |
| 40 | +echo "done" |
| 41 | + |
| 42 | +echo -n "[3/4] Starting SQLServer 2019 ... " |
| 43 | +echo "skipped" |
| 44 | + |
| 45 | +echo -n "[4/4] Cloning PHP-CRUD-API v2 ... " |
| 46 | +# install software |
| 47 | +if [ -d /php-crud-api ]; then |
| 48 | + echo "skipped" |
| 49 | +else |
| 50 | + git clone --quiet https://github.com/mevdschee/php-crud-api.git |
| 51 | + echo "done" |
| 52 | +fi |
| 53 | + |
| 54 | +echo "------------------------------------------------" |
| 55 | + |
| 56 | +# run the tests |
| 57 | +cd php-crud-api |
| 58 | +php test.php |
0 commit comments