From 438cd8d077fe07d84f92a286443d0e3bbee96e5c Mon Sep 17 00:00:00 2001 From: opheugene Date: Thu, 21 Jan 2021 14:39:32 +0300 Subject: [PATCH] Move to GitHub actions --- .github/workflows/presta.yml | 179 +++++++++++++++++++++++++++++++++++ .travis.yml | 106 --------------------- CHANGELOG.md | 3 + Makefile | 33 ++++--- README.md | 8 +- VERSION | 2 +- retailcrm/retailcrm.php | 2 +- 7 files changed, 204 insertions(+), 129 deletions(-) create mode 100644 .github/workflows/presta.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/presta.yml b/.github/workflows/presta.yml new file mode 100644 index 0000000..7c4bfbf --- /dev/null +++ b/.github/workflows/presta.yml @@ -0,0 +1,179 @@ +name: presta + +on: + push: + branches: + - '**' + tags-ignore: + - '*.*' + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - php-version: '5.6' + branch: '1.6.1.18' + phpunit-version: 'phpunit:5.7.23' + coverage: 1 + - php-version: '7.0' + branch: '1.6.1.18' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.18' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '5.6' + branch: '1.6.1.19' + phpunit-version: 'phpunit:5.7.23' + - php-version: '7.0' + branch: '1.6.1.19' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.19' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '5.6' + branch: '1.6.1.20' + phpunit-version: 'phpunit:5.7.23' + - php-version: '7.0' + branch: '1.6.1.20' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.20' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '5.6' + branch: '1.6.1.21' + phpunit-version: 'phpunit:5.7.23' + - php-version: '7.0' + branch: '1.6.1.21' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.21' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '5.6' + branch: '1.6.1.22' + phpunit-version: 'phpunit:5.7.23' + - php-version: '7.0' + branch: '1.6.1.22' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.22' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '5.6' + branch: '1.6.1.23' + phpunit-version: 'phpunit:5.7.23' + - php-version: '7.0' + branch: '1.6.1.23' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.23' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '5.6' + branch: '1.6.1.24' + phpunit-version: 'phpunit:5.7.23' + - php-version: '7.0' + branch: '1.6.1.24' + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.1' + branch: '1.6.1.24' + phpunit-version: 'phpunit:6.4.3' + + - php-version: '7.1' + branch: '1.7.4.0' + composerv1: 1 + phpunit-version: 'phpunit:6.4.3' + - php-version: '7.2' + branch: '1.7.4.0' + composerv1: 1 + phpunit-version: 'phpunit:6.4.3' + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306/tcp + 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:v2, ${{ matrix.phpunit-version }} + extensions: gd, mbstring, zip, mcrypt, pdo_mysql, dom + - name: Start mysql service + run: sudo /etc/init.d/mysql start + - name: Status mysql service + run: sudo systemctl status mysql + - name: Install PrestaShop + env: + BRANCH: ${{ matrix.branch }} + COMPOSERV1: ${{ matrix.composerv1 }} + run: make before_script + - name: Run tests + env: + BRANCH: ${{ matrix.branch }} + COMPOSERV1: ${{ matrix.composerv1 }} + run: make test + - name: Coverage + env: + COVERAGE: ${{ matrix.coverage }} + if: env.COVERAGE == 1 + run: | + make coverage + bash <(curl -s https://codecov.io/bash) + + + deploy: + needs: ['test'] + 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: | + git fetch origin --unshallow --tags + export LAST_TAG=`git describe --abbrev=0 --tags` + export VERSION=`cat VERSION` + export ARCHIVE_NAME=retailcrm-$VERSION.ocmod.zip + export ARCHIVE_PATH="/tmp/$ARCHIVE_NAME" + export RELEASE_TAG=v$VERSION + export LAST_COMMIT=`git log --oneline --format=%B -n 1 HEAD | head -n 1` + echo RELEASE_TAG=$RELEASE_TAG >> $GITHUB_ENV + echo LAST_TAG=$LAST_TAG >> $GITHUB_ENV + echo LAST_COMMIT=$LAST_COMMIT >> $GITHUB_ENV + echo ARCHIVE_PATH=$ARCHIVE_PATH >> $GITHUB_ENV + echo ARCHIVE_NAME=$ARCHIVE_NAME >> $GITHUB_ENV + make build_archive + - name: Create Release + id: create_release + uses: actions/create-release@v1 + if: env.LAST_TAG != env.RELEASE_TAG + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + with: + tag_name: ${{ env.RELEASE_TAG }} + release_name: ${{ env.RELEASE_TAG }} + body: ${{ env.LAST_COMMIT }} + draft: false + prerelease: false + - name: Deploy + run: make build_archive + - name: Cleanup + if: env.LAST_TAG != env.RELEASE_TAG + run: make delete_archive diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e503ecb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,106 +0,0 @@ -os: linux -dist: trusty - -language: php - -if: tag IS blank - -addons: - apt: - packages: - - apache2 - - libapache2-mod-fastcgi - -before_install: - - export LAST_TAG=`git describe --abbrev=0 --tags` - - export CURRENT_VERSION=v`cat VERSION` - -before_script: make before_script - -script: make test - -stages: - - test - - deploy - -jobs: - include: - - php: 5.6 - env: BRANCH=1.6.1.18 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.18 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.18 COMPOSER_IN_TESTS=1 - - - php: 5.6 - env: BRANCH=1.6.1.19 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.19 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.19 COMPOSER_IN_TESTS=1 - - - php: 5.6 - env: BRANCH=1.6.1.20 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.20 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.20 COMPOSER_IN_TESTS=1 - - - php: 5.6 - env: BRANCH=1.6.1.21 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.21 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.21 COMPOSER_IN_TESTS=1 - - - php: 5.6 - env: BRANCH=1.6.1.22 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.22 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.22 COMPOSER_IN_TESTS=1 - - - php: 5.6 - env: BRANCH=1.6.1.23 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.23 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.23 COMPOSER_IN_TESTS=1 - - - php: 5.6 - env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - php: 7.0 - env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - php: 7.1 - env: BRANCH=1.6.1.24 COMPOSER_IN_TESTS=1 - - - php: 7.1 - env: BRANCH=1.7.4.0 - - php: 7.2 - env: BRANCH=1.7.4.0 - - - php: 7.1 - env: BRANCH=1.7.5.x - - php: 7.2 - env: BRANCH=1.7.5.x - after_success: bash <(curl -s https://codecov.io/bash) - - - stage: deploy - before_script: skip - script: make build_archive - before_deploy: - - export VERSION=`cat VERSION` - - export ARCHIVE_NAME=/tmp/retailcrm-$VERSION.zip - - 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 - file: $ARCHIVE_NAME - on: - condition: "$LAST_TAG != $CURRENT_VERSION" - if: branch = master AND type = push AND fork = false - after_deploy: make delete_archive diff --git a/CHANGELOG.md b/CHANGELOG.md index c0c3f7e..d9e2738 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v3.2.2 +* GitHub actions + ## v3.2.1 * Ребрендинг RetailCRM diff --git a/Makefile b/Makefile index fb89b69..d364964 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) PRESTASHOP_DIR=$(ROOT_DIR)/../PrestaShop -FILE = $(TRAVIS_BUILD_DIR)/VERSION +FILE = $(ROOT_DIR)/VERSION VERSION = `cat $(FILE)` ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip' @@ -15,11 +15,11 @@ delete_archive: rm -f /tmp/retailcrm.zip composer: clone_prestashop - @cd $(PRESTASHOP_DIR) && git checkout $(BRANCH) -ifeq ($(COMPOSER_IN_TESTS),1) - @cd $(PRESTASHOP_DIR)/tests && composer install + cd $(PRESTASHOP_DIR) && git checkout $(BRANCH) +ifeq ($(COMPOSERV1),1) + cd $(PRESTASHOP_DIR) && php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');" && php composer.phar install --prefer-dist --no-interaction --no-progress else - @cd $(PRESTASHOP_DIR) && php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');" && php composer.phar install --prefer-dist --no-interaction --no-progress + cd $(PRESTASHOP_DIR)/tests && composer install endif clone_prestashop: @@ -37,21 +37,20 @@ setup_apache: sudo service apache2 restart before_script: composer -ifneq ($(COMPOSER_IN_TESTS),1) - ifeq ("$(wildcard $(PRESTASHOP_DIR)/tests/parameters.yml.travis)","") - cd $(PRESTASHOP_DIR) && cp tests/parameters.yml.travis app/config/parameters.yml - else - cd $(PRESTASHOP_DIR) && cp tests-legacy/parameters.yml.travis app/config/parameters.yml - endif - cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop + mkdir coverage +ifeq ($(COMPOSERV1),1) + cd $(PRESTASHOP_DIR) && sed -i 's/--db_name=prestashop/--db_name=prestashop --db_user=root --db_password=root/g' travis-scripts/install-prestashop && bash travis-scripts/install-prestashop else - cd $(PRESTASHOP_DIR) && bash travis-scripts/install-prestashop.sh + cd $(PRESTASHOP_DIR) && sed -i 's/--db_name=prestashop/--db_name=prestashop --db_user=root --db_password=root/g' travis-scripts/install-prestashop.sh && bash travis-scripts/install-prestashop.sh endif test: -ifeq ($(COMPOSER_IN_TESTS),1) - phpunit -c phpunit.xml.dist -else +ifeq ($(COMPOSERV1),1) cd $(PRESTASHOP_DIR) && php composer.phar run-script create-test-db --timeout=0 cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist -endif \ No newline at end of file +else + phpunit -c phpunit.xml.dist +endif + +coverage: + wget https://phar.phpunit.de/phpcov-2.0.2.phar && php phpcov-2.0.2.phar merge coverage/ --clover coverage.xml \ No newline at end of file diff --git a/README.md b/README.md index b851292..e92ba81 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -[![Build Status](https://img.shields.io/travis/retailcrm/prestashop-module/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/prestashop-module) -[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/prestashop-module/master.svg?style=flat-square)](https://codecov.io/gh/retailcrm/prestashop-module) -[![GitHub release](https://img.shields.io/github/release/retailcrm/prestashop-module.svg?style=flat-square)](https://github.com/retailcrm/prestashop-module/releases) -[![PHP version](https://img.shields.io/badge/PHP->=5.3-blue.svg?style=flat-square)](https://php.net/) +[![Build Status](https://github.com/retailcrm/prestashop-module/workflows/presta/badge.svg)](https://github.com/retailcrm/prestashop-module/actions) +[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/prestashop-module/master.svg?logo=github)](https://codecov.io/gh/retailcrm/prestashop-module) +[![GitHub release](https://img.shields.io/github/release/retailcrm/prestashop-module.svg?logo=codecov)](https://github.com/retailcrm/prestashop-module/releases) +[![PHP version](https://img.shields.io/badge/PHP->=5.4-blue.svg?logo=php)](https://php.net/) Prestashop module ================= diff --git a/VERSION b/VERSION index e4604e3..be94e6f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.1 +3.2.2 diff --git a/retailcrm/retailcrm.php b/retailcrm/retailcrm.php index 0e24024..c445612 100644 --- a/retailcrm/retailcrm.php +++ b/retailcrm/retailcrm.php @@ -117,7 +117,7 @@ class RetailCRM extends Module { $this->name = 'retailcrm'; $this->tab = 'export'; - $this->version = '3.2.1'; + $this->version = '3.2.2'; $this->author = 'DIGITAL RETAIL TECHNOLOGIES SL'; $this->displayName = $this->l('retailCRM'); $this->description = $this->l('Integration module for retailCRM');