test
This commit is contained in:
parent
415c2edf0e
commit
d9db263ceb
3 changed files with 143 additions and 273 deletions
133
.github/workflows/woo.yml
vendored
Normal file
133
.github/workflows/woo.yml
vendored
Normal file
|
@ -0,0 +1,133 @@
|
|||
name: woo
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '*.*'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
DB_HOST: 127.0.0.1
|
||||
DB_USER: root
|
||||
DB_PASS: root
|
||||
DB_NAME: wc_retailcrm_test
|
||||
DB_DRIVER: mysqli
|
||||
EMAIL: test@test.com
|
||||
SERVER_PORT: 80
|
||||
SERVER_URL: http://localhost
|
||||
WP_VERSION: 5.3
|
||||
WC_VERSION: 3.8.0
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- php-version: '7.0'
|
||||
wp: '5.3'
|
||||
wc: '3.8.0'
|
||||
coverage: 1
|
||||
- php-version: '7.0'
|
||||
wp: '5.3'
|
||||
wc: '3.8.1'
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: ${{ env.DB_PASS }}
|
||||
MYSQL_DATABASE: ${{ env.DB_NAME }}
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup PHP ${{ matrix.php-version }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
coverage: xdebug
|
||||
tools: composer:v1, phpunit:6.4.3
|
||||
extensions: gd, mbstring, mysqli, zip, mcrypt, mysql, pdo_mysql, dom
|
||||
- name: Install Woocommerce
|
||||
env:
|
||||
WP_VERSION: ${{ matrix.wp }}
|
||||
WC_VERSION: ${{ matrix.wc }}
|
||||
run: make before_script
|
||||
- name: Run tests
|
||||
env:
|
||||
WP_VERSION: ${{ matrix.wp }}
|
||||
WC_VERSION: ${{ matrix.wc }}
|
||||
run: phpunit -c phpunit.xml.dist
|
||||
# - name: Coverage
|
||||
# env:
|
||||
# COVERAGE: ${{ matrix.coverage }}
|
||||
# if: env.COVERAGE == 1
|
||||
# run: |
|
||||
# make coverage
|
||||
# bash <(curl -s https://codecov.io/bash)
|
||||
phpcs:
|
||||
needs: ['test']
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup PHP 7.2
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.2'
|
||||
tools: composer:v1, phpcs
|
||||
- name: Install dependencies
|
||||
run: composer install
|
||||
- name: Check compatibility
|
||||
run: make phpcomp
|
||||
deploy:
|
||||
needs: ['phpcs']
|
||||
if: success() && github.event_name == 'push' && github.repository_owner == 'retailcrm' && github.ref == 'refs/heads/master'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup PHP 7.2
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '7.2'
|
||||
tools: composer:v1
|
||||
- name: Build release
|
||||
run: |
|
||||
export LAST_TAG=`git describe --abbrev=0 --tags`
|
||||
export VERSION=`cat VERSION`
|
||||
export ARCHIVE_NAME=retailcrm-$VERSION.ocmod.zip
|
||||
export ARCHIVE_PATH=/tmp
|
||||
git config --local user.name "RetailCRM"
|
||||
git config --local user.email "support@retailcrm.ru"
|
||||
export TRAVIS_TAG=v$VERSION
|
||||
git tag $TRAVIS_TAG
|
||||
make build_archive
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
if: env.LAST_TAG != env.VERSION
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
release_name: ${{ env.RELEASE_TAG }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
- name: Upload Release Asset
|
||||
id: upload-release-asset
|
||||
if: env.LAST_TAG != env.VERSION
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ env.ARCHIVE_PATH }}
|
||||
asset_name: ${{ env.ARCHIVE_NAME }}
|
||||
asset_content_type: application/zip
|
||||
- name: Cleanup
|
||||
if: env.LAST_TAG != env.RELEASE_TAG
|
||||
run: make delete_archive
|
||||
|
273
.travis.yml
273
.travis.yml
|
@ -1,273 +0,0 @@
|
|||
os: linux
|
||||
dist: trusty
|
||||
|
||||
language: php
|
||||
|
||||
if: tag IS blank
|
||||
|
||||
stages:
|
||||
- test
|
||||
- github releases
|
||||
- deploy
|
||||
|
||||
before_install:
|
||||
- export LAST_TAG=`git describe --abbrev=0 --tags`
|
||||
- export CURRENT_VERSION=v`cat VERSION`
|
||||
- git config --global core.autocrlf false
|
||||
|
||||
before_script:
|
||||
- nvm install 10
|
||||
- make install
|
||||
|
||||
env:
|
||||
global:
|
||||
- DB_NAME=wc_retailcrm_test
|
||||
- DB_USER=root
|
||||
- DB_PASS=''
|
||||
- DB_HOST=localhost
|
||||
|
||||
script: make test
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.1.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.4 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.0.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.1.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.2.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.5 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.0.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.1.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.2.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.6 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.0.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.0.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.1.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.1.0 WP_MULTISITE=0
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.2.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.4
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.7 WC_VERSION=3.2.0 WP_MULTISITE=0
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.3.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0 PHP_VERSION=5.3
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.4.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.8 WC_VERSION=3.5.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.3.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.4.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=4.9 WC_VERSION=3.5.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.0 WC_VERSION=3.6.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.6.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 5.6
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.6.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.1 WC_VERSION=3.7.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.7.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.2 WC_VERSION=3.7.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=5.3 WC_VERSION=3.8.0 WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=5.3 WC_VERSION=3.8.0 WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=5.3 WC_VERSION=3.8.0 WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- 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: 7.3
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0 USE_COMPOSER=1
|
||||
|
||||
- php: 7.0
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0
|
||||
- php: 7.1
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0
|
||||
- php: 7.2
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0 USE_COMPOSER=1
|
||||
- php: 7.3
|
||||
env: WP_VERSION=latest WC_VERSION=latest WP_MULTISITE=0 USE_COMPOSER=1
|
||||
after_success: bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
- stage: github releases
|
||||
before_script: skip
|
||||
script: skip
|
||||
before_deploy:
|
||||
- export VERSION=`cat VERSION`
|
||||
- git config --local user.name "retailCRM"
|
||||
- git config --local user.email "support@retailcrm.ru"
|
||||
- export TRAVIS_TAG=v$VERSION
|
||||
- git tag $TRAVIS_TAG
|
||||
deploy:
|
||||
provider: releases
|
||||
token: $GITHUB_OAUTH_TOKEN
|
||||
cleanup: false
|
||||
on:
|
||||
condition: "$LAST_TAG != $CURRENT_VERSION"
|
||||
if: branch = master AND type = push AND fork = false
|
||||
- stage: deploy
|
||||
before_install: skip
|
||||
before_script: skip
|
||||
script: make svn_clone
|
||||
deploy:
|
||||
cleanup: false
|
||||
provider: script
|
||||
script: make svn_push
|
||||
if: branch = master AND type = push AND fork = false
|
||||
after_deploy: make remove_dir
|
10
Makefile
10
Makefile
|
@ -3,6 +3,9 @@ VERSION = `cat $(FILE)`
|
|||
|
||||
.PHONY: test
|
||||
|
||||
before_script:
|
||||
bash tests/bin/install.sh $(DB_NAME) $(DB_USER) $(DB_HOST) $(WP_VERSION) $(WC_VERSION) $(DB_PASS) $(SKIP_DB_CREATE)
|
||||
|
||||
svn_clone:
|
||||
mkdir /tmp/svn_plugin_dir
|
||||
svn co $(SVNREPOURL) /tmp/svn_plugin_dir --username $(USERNAME) --password $(PASSWORD) --no-auth-cache
|
||||
|
@ -45,3 +48,10 @@ run_tests:
|
|||
docker-compose --no-ansi up -d --build mysql
|
||||
docker-compose --no-ansi run --rm --no-deps app make local_test
|
||||
docker-compose stop
|
||||
|
||||
phpcs-config:
|
||||
phpcs --config-set installed_paths vendor/phpcompatibility/php-compatibility
|
||||
|
||||
phpcomp: phpcs-config
|
||||
phpcs -i
|
||||
phpcs -s -p ./src --standard=PHPCompatibility --runtime-set testVersion 5.4-7.3
|
||||
|
|
Loading…
Add table
Reference in a new issue