Skip to content

Commit

Permalink
Move to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
opheugene authored Jan 21, 2021
1 parent 66e678f commit 438cd8d
Show file tree
Hide file tree
Showing 7 changed files with 204 additions and 129 deletions.
179 changes: 179 additions & 0 deletions .github/workflows/presta.yml
Original file line number Diff line number Diff line change
@@ -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
106 changes: 0 additions & 106 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v3.2.2
* GitHub actions

## v3.2.1
* Ребрендинг RetailCRM

Expand Down
33 changes: 16 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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'

Expand All @@ -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:
Expand All @@ -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
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
=================
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.1
3.2.2
2 changes: 1 addition & 1 deletion retailcrm/retailcrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function __construct()
{
$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');
Expand Down

0 comments on commit 438cd8d

Please sign in to comment.