Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuszkrzaczkowski committed Apr 4, 2021
1 parent 78dda97 commit db27279
Show file tree
Hide file tree
Showing 6 changed files with 277 additions and 0 deletions.
49 changes: 49 additions & 0 deletions 7.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM debian:buster

MAINTAINER [email protected]

ARG DEBIAN_FRONTEND=noninteractive

#INSTALL_MODE = PROD , DEV , TEST
ENV INSTALL_MODE TEST
ENV PHP_VER 7.3
ENV GUI_MODE false

ENV DB_USER_NAME yetiforce
ENV DB_USER_PASS Q4WK2yRUpliyjMRivDJE
ENV DB_PORT 3306
ARG DB_ROOT_PASS=1r2VdePVnNxluabdGuqh


ENV PROVIDER tests

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils curl openssl wget ca-certificates apt-transport-https lsb-release gnupg && apt-get -y autoclean

RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list

RUN apt-get update
RUN apt-get install -y --no-install-recommends mariadb-server mariadb-client nginx nginx-extras "php${PHP_VER}"-fpm "php${PHP_VER}"-mysql "php${PHP_VER}"-curl "php${PHP_VER}"-intl "php${PHP_VER}"-gd "php${PHP_VER}"-fpm "php${PHP_VER}"-bcmath "php${PHP_VER}"-soap "php${PHP_VER}"-ldap "php${PHP_VER}"-imap "php${PHP_VER}"-xml "php${PHP_VER}"-cli "php${PHP_VER}"-zip "php${PHP_VER}"-json "php${PHP_VER}"-opcache "php${PHP_VER}"-mbstring php-apcu php-imagick php-sodium zip unzip cron && apt-get -y autoclean

# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
# RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# RUN apt-get install -y --no-install-recommends nodejs npm yarn && apt-get -y autoclean

# RUN apt-cache search php
RUN dpkg --get-selections | grep php

RUN rm /var/www/html/index.nginx-debian.html
RUN echo "PROVIDER=tests" > /etc/environment

RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
RUN chmod +x /usr/local/bin/composer

COPY entrypoint.sh /entrypoint.sh
RUN chmod 777 /entrypoint.sh

WORKDIR /var/www/html

EXPOSE 80

ENTRYPOINT [ "/entrypoint.sh" ]
9 changes: 9 additions & 0 deletions 7.3/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'YetiForceCRM Tests Action - PHP 7.3'
description: 'GitHub Action for Tests YetiForceCRM - PHP 7.3'
branding:
icon: 'check-square'
color: 'blue'

runs:
using: 'docker'
image: 'Dockerfile'
77 changes: 77 additions & 0 deletions 7.3/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
echo " ----- Start -----"
printenv

#https://github.com/actions/cache/blob/main/examples.md#php---composer

cd /var/www/html/

echo " ----- Copy files -----"
cp -R $GITHUB_WORKSPACE/* /var/www/html

cp /var/www/html/tests/setup/crons.conf /etc/cron.d/yetiforcecrm
cp /var/www/html/tests/setup/db/mysql.cnf /etc/mysql/mariadb.conf.d/50-server.cnf
cp /var/www/html/tests/setup/nginx/www.conf /etc/nginx/sites-available/default
cp /var/www/html/tests/setup/nginx/yetiforce.conf /etc/nginx/yetiforce.conf
cp /var/www/html/tests/setup/fpm/www.conf /etc/php/$PHP_VER/fpm/pool.d/www.conf
cp /var/www/html/tests/setup/php/prod.ini /etc/php/$PHP_VER/mods-available/yetiforce.ini

ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/cli/conf.d/30-yetiforce.ini
ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/fpm/conf.d/30-yetiforce.ini

crontab /etc/cron.d/yetiforcecrm

echo " ----- chmod -----"
chmod -R +x /var/www/html/tests/setup

echo " ----- tests/setup/dependency.sh -----"
/var/www/html/tests/setup/dependency.sh

echo " ----- tests/setup/docker_post_install.php -----"
php /var/www/html/tests/setup/docker_post_install.php

echo " ----- service mysql start -----"
service mysql start;
service mysql status
echo " ----- service cron start -----"
service cron start
echo " ----- nginx -----"
service nginx start
service nginx status
echo " ----- PHP-FPM -----"
/etc/init.d/php$PHP_VER-fpm start
service php$PHP_VER-fpm status

echo " ----- chown -----"
chown -R www-data:www-data /var/www/

echo " ----- mysql -----"
mysql -uroot mysql;
mysqladmin password "$DB_ROOT_PASS";
echo "UPDATE mysql.user SET Password=PASSWORD('$DB_ROOT_PASS') WHERE User='root';" | mysql --user=root;
echo "DELETE FROM mysql.user WHERE User='';" | mysql --user=root;
echo "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" | mysql --user=root;
echo "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';" | mysql --user=root;
echo "CREATE DATABASE yetiforce;" | mysql --user=root;
echo "CREATE USER 'yetiforce'@'localhost' IDENTIFIED BY '$DB_USER_PASS';" | mysql --user=root;
echo "GRANT ALL PRIVILEGES ON yetiforce.* TO 'yetiforce'@'localhost';" | mysql --user=root;
echo "FLUSH PRIVILEGES;" | mysql --user=root


cd /var/www/html/tests
/var/www/html/vendor/bin/phpunit --verbose --colors=always --testsuite Init,Settings,Base,Integrations,Apps


echo " ----- Logs: /var/log/fpm-php.www.log -----"
cat /var/log/fpm-php.www.log
echo " ----- Logs: /var/log/php_error.log -----"
cat /var/log/php_error.log
echo " ----- Logs: /var/log/mysql/error.log -----"
cat /var/log/mysql/error.log
echo " ----- Logs: /var/www/html/cache/logs/system.log -----"
cat /var/www/html/cache/logs/system.log

echo " ----- LS /var/www/html/cache/logs -----"
ls -all /var/www/html/cache/logs
echo " ----- LS /var/log/ -----"
ls -all /var/log/
49 changes: 49 additions & 0 deletions 7.4/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
FROM debian:buster

MAINTAINER [email protected]

ARG DEBIAN_FRONTEND=noninteractive

#INSTALL_MODE = PROD , DEV , TEST
ENV INSTALL_MODE TEST
ENV PHP_VER 7.4
ENV GUI_MODE false

ENV DB_USER_NAME yetiforce
ENV DB_USER_PASS Q4WK2yRUpliyjMRivDJE
ENV DB_PORT 3306
ARG DB_ROOT_PASS=1r2VdePVnNxluabdGuqh


ENV PROVIDER tests

RUN apt-get update && apt-get install -y --no-install-recommends apt-utils curl openssl wget ca-certificates apt-transport-https lsb-release gnupg && apt-get -y autoclean

RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list

RUN apt-get update
RUN apt-get install -y --no-install-recommends mariadb-server mariadb-client nginx nginx-extras "php${PHP_VER}"-fpm "php${PHP_VER}"-mysql "php${PHP_VER}"-curl "php${PHP_VER}"-intl "php${PHP_VER}"-gd "php${PHP_VER}"-fpm "php${PHP_VER}"-bcmath "php${PHP_VER}"-soap "php${PHP_VER}"-ldap "php${PHP_VER}"-imap "php${PHP_VER}"-xml "php${PHP_VER}"-cli "php${PHP_VER}"-zip "php${PHP_VER}"-json "php${PHP_VER}"-opcache "php${PHP_VER}"-mbstring php-apcu php-imagick php-sodium zip unzip cron && apt-get -y autoclean

# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
# RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# RUN apt-get install -y --no-install-recommends nodejs npm yarn && apt-get -y autoclean

# RUN apt-cache search php
RUN dpkg --get-selections | grep php

RUN rm /var/www/html/index.nginx-debian.html
RUN echo "PROVIDER=tests" > /etc/environment

RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
RUN chmod +x /usr/local/bin/composer

COPY entrypoint.sh /entrypoint.sh
RUN chmod 777 /entrypoint.sh

WORKDIR /var/www/html

EXPOSE 80

ENTRYPOINT [ "/entrypoint.sh" ]
16 changes: 16 additions & 0 deletions 7.4/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'YetiForceCRM Tests Action - PHP 7.4'
description: 'GitHub Action for Tests YetiForceCRM - PHP 7.4'
branding:
icon: 'check-square'
color: 'blue'
inputs:
xxxx:
description: 'xxxx xxxx xxxx'
required: true
default: 'cccc'

runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.xxxx }}
77 changes: 77 additions & 0 deletions 7.4/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash
echo " ----- Start -----"
printenv

#https://github.com/actions/cache/blob/main/examples.md#php---composer

cd /var/www/html/

echo " ----- Copy files -----"
cp -R $GITHUB_WORKSPACE/* /var/www/html

cp /var/www/html/tests/setup/crons.conf /etc/cron.d/yetiforcecrm
cp /var/www/html/tests/setup/db/mysql.cnf /etc/mysql/mariadb.conf.d/50-server.cnf
cp /var/www/html/tests/setup/nginx/www.conf /etc/nginx/sites-available/default
cp /var/www/html/tests/setup/nginx/yetiforce.conf /etc/nginx/yetiforce.conf
cp /var/www/html/tests/setup/fpm/www.conf /etc/php/$PHP_VER/fpm/pool.d/www.conf
cp /var/www/html/tests/setup/php/prod.ini /etc/php/$PHP_VER/mods-available/yetiforce.ini

ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/cli/conf.d/30-yetiforce.ini
ln -s /etc/php/$PHP_VER/mods-available/yetiforce.ini /etc/php/$PHP_VER/fpm/conf.d/30-yetiforce.ini

crontab /etc/cron.d/yetiforcecrm

echo " ----- chmod -----"
chmod -R +x /var/www/html/tests/setup

echo " ----- tests/setup/dependency.sh -----"
/var/www/html/tests/setup/dependency.sh

echo " ----- tests/setup/docker_post_install.php -----"
php /var/www/html/tests/setup/docker_post_install.php

echo " ----- service mysql start -----"
service mysql start;
service mysql status
echo " ----- service cron start -----"
service cron start
echo " ----- nginx -----"
service nginx start
service nginx status
echo " ----- PHP-FPM -----"
/etc/init.d/php$PHP_VER-fpm start
service php$PHP_VER-fpm status

echo " ----- chown -----"
chown -R www-data:www-data /var/www/

echo " ----- mysql -----"
mysql -uroot mysql;
mysqladmin password "$DB_ROOT_PASS";
echo "UPDATE mysql.user SET Password=PASSWORD('$DB_ROOT_PASS') WHERE User='root';" | mysql --user=root;
echo "DELETE FROM mysql.user WHERE User='';" | mysql --user=root;
echo "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');" | mysql --user=root;
echo "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';" | mysql --user=root;
echo "CREATE DATABASE yetiforce;" | mysql --user=root;
echo "CREATE USER 'yetiforce'@'localhost' IDENTIFIED BY '$DB_USER_PASS';" | mysql --user=root;
echo "GRANT ALL PRIVILEGES ON yetiforce.* TO 'yetiforce'@'localhost';" | mysql --user=root;
echo "FLUSH PRIVILEGES;" | mysql --user=root


cd /var/www/html/tests
/var/www/html/vendor/bin/phpunit --verbose --colors=always --testsuite Init,Settings,Base,Integrations,Apps


echo " ----- Logs: /var/log/fpm-php.www.log -----"
cat /var/log/fpm-php.www.log
echo " ----- Logs: /var/log/php_error.log -----"
cat /var/log/php_error.log
echo " ----- Logs: /var/log/mysql/error.log -----"
cat /var/log/mysql/error.log
echo " ----- Logs: /var/www/html/cache/logs/system.log -----"
cat /var/www/html/cache/logs/system.log

echo " ----- LS /var/www/html/cache/logs -----"
ls -all /var/www/html/cache/logs
echo " ----- LS /var/log/ -----"
ls -all /var/log/

0 comments on commit db27279

Please sign in to comment.