1
0
mirror of synced 2025-01-29 22:31:42 +03:00

update jobs

This commit is contained in:
Akolzin Dmitry 2020-02-27 14:12:42 +03:00
parent 2142e2a01f
commit 24efcdf23a
7 changed files with 123 additions and 9 deletions

34
.docker/Dockerfile Normal file
View File

@ -0,0 +1,34 @@
FROM php:7.1-fpm
RUN apt-get update
RUN apt-get install -y zlib1g-dev libpq-dev git libicu-dev libxml2-dev libpng-dev libjpeg-dev libmcrypt-dev libxslt-dev libfreetype6-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install mysqli pdo pdo_mysql \
&& docker-php-ext-install zip \
&& docker-php-ext-install xml \
&& docker-php-ext-configure gd --with-png-dir=/usr/local/ --with-jpeg-dir=/usr/local/ --with-freetype-dir=/usr/local/ \
&& docker-php-ext-install gd \
&& docker-php-ext-install mcrypt \
&& docker-php-ext-install bcmath \
&& docker-php-ext-install soap \
&& docker-php-ext-install xsl \
&& docker-php-ext-install mbstring
RUN apt-get install -y subversion
RUN apt-get install -y wget
RUN wget -O /usr/bin/phpunit https://phar.phpunit.de/phpunit-6.phar && chmod +x /usr/bin/phpunit
RUN curl --insecure https://getcomposer.org/composer.phar -o /usr/bin/composer && chmod +x /usr/bin/composer
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
# Set timezone
RUN rm /etc/localtime
RUN ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime
RUN "date"
WORKDIR /code

6
.env-dist Normal file
View File

@ -0,0 +1,6 @@
DB_NAME=wc_retailcrm_test
DB_USER=wc_retailcrm
DB_PASS=wc_retailcrm
DB_HOST=mysql
WP_VERSION=4.4
WC_VERSION=3.0.0

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/nbproject/
/vendor/
.idea/
.env

View File

@ -13,10 +13,41 @@ before_script:
- nvm install 10
- make install
script: make tests
env:
global:
- DB_NAME=wc_retailcrm_test
- DB_USER=root
- DB_PASS=''
- DB_HOST=localhost
script: make test
jobs:
include:
- php: 5.6
env: WP_VERSION=latest WC_VERSION=3.8.0 WP_MULTISITE=0
- php: 7.0
env: WP_VERSION=latest WC_VERSION=3.8.0 WP_MULTISITE=0
- php: 7.1
env: WP_VERSION=latest WC_VERSION=3.8.0 WP_MULTISITE=0
- php: 7.2
env: WP_VERSION=latest WC_VERSION=3.8.0 WP_MULTISITE=0 USE_COMPOSER=1
- php: 5.6
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0
- php: 7.0
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0
- php: 7.1
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0
- php: 7.2
env: WP_VERSION=latest WC_VERSION=3.9.0 WP_MULTISITE=0 USE_COMPOSER=1
- php: 5.6
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
- php: 7.0
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
- php: 7.1
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
- php: 7.2
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0 USE_COMPOSER=1
- php: 5.6
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0
- php: 7.0

View File

@ -1,7 +1,7 @@
FILE = $(TRAVIS_BUILD_DIR)/VERSION
VERSION = `cat $(FILE)`
.PHONY: tests
.PHONY: test
all: svn_clone svn_push remove_dir
@ -28,14 +28,17 @@ compile_pot:
msgfmt resources/pot/retailcrm-es_ES.pot -o src/languages/retailcrm-es_ES.mo
install:
bash tests/bin/install.sh wc_retailcrm_test root '' localhost $(WP_VERSION) $(WC_VERSION)
bash tests/bin/install.sh $(DB_NAME) $(DB_USER) $(DB_PASS) $(DB_HOST) $(WP_VERSION) $(WC_VERSION) $(SKIP_DB_CREATE)
ifeq ($(USE_COMPOSER),1)
composer install
endif
tests:
test:
ifeq ($(USE_COMPOSER),1)
vendor/phpunit/phpunit/phpunit -c phpunit.xml.dist
else
phpunit -c phpunit.xml.dist
endif
endif
local_test: install
phpunit -c phpunit.xml.dist

34
docker-compose.yml Normal file
View File

@ -0,0 +1,34 @@
version: '3'
services:
app:
build:
context: ./.docker
volumes:
- ./:/code
links:
- "mysql"
#user: ${UID:-1000}:${GID:-1000}
depends_on:
- mysql
entrypoint: make local_test
env_file:
- ./.env
environment:
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- DB_HOST=${DB_HOST}
- WP_VERSION=${WP_VERSION}
- WC_VERSION=${WC_VERSION}
- SKIP_DB_CREATE=true
mysql:
image: mysql:5.7
env_file:
- ./.env
environment:
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_USER=${DB_USER}
- MYSQL_PASSWORD=${DB_PASS}
- MYSQL_ROOT_PASSWORD=root
ports:
- "3306:3306"

View File

@ -11,8 +11,8 @@ DB_USER=$2
DB_PASS=$3
DB_HOST=${4-localhost}
WP_VERSION=${5-latest}
SKIP_DB_CREATE=${6-false}
WC_VERSION=${7-3.9.0}
WC_VERSION=${6-3.9.0}
SKIP_DB_CREATE=${7-false}
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
@ -70,6 +70,8 @@ install_wp() {
}
install_woocommerce() {
if [[ ! -d "/tmp/woocommerce" ]]
then
cd /tmp
git clone https://github.com/woocommerce/woocommerce.git
cd woocommerce
@ -77,6 +79,7 @@ install_woocommerce() {
composer install
npm install
cd -
fi
}
install_test_suite() {
@ -130,8 +133,10 @@ install_db() {
fi
fi
# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
if [ ${DB_HOST} == "localhost" ]; then
# create database
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA --host=$DB_HOST
fi
}
install_wp