1
0
mirror of synced 2024-11-23 21:46:08 +03:00

Move to Github Actions

This commit is contained in:
opheugene 2021-01-30 15:37:57 +03:00 committed by GitHub
parent b0d1b7c9fb
commit 7b21d2c66b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 289 additions and 306 deletions

234
.github/workflows/magento.yml vendored Normal file
View File

@ -0,0 +1,234 @@
# This is a basic workflow to help you get started with Actions
name: magento
on:
push:
branches:
- '**'
tags-ignore:
- '*.*'
pull_request:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php-version: '7.0'
branch: '2.0.2'
coverage: 1
- php-version: '7.0'
branch: '2.0.4'
- php-version: '7.0'
branch: '2.0.5'
- php-version: '7.0'
branch: '2.0.6'
- php-version: '7.0'
branch: '2.0.7'
- php-version: '7.0'
branch: '2.0.8'
- php-version: '7.0'
branch: '2.0.9'
- php-version: '7.0'
branch: '2.0.10'
- php-version: '7.0'
branch: '2.0.11'
- php-version: '7.0'
branch: '2.0.12'
- php-version: '7.0'
branch: '2.0.13'
- php-version: '7.0'
branch: '2.0.14'
- php-version: '7.0'
branch: '2.0.15'
- php-version: '7.0'
branch: '2.0.16'
- php-version: '7.0'
branch: '2.0.17'
- php-version: '7.0'
branch: '2.0.18'
- php-version: '7.0'
branch: '2.1.0'
- php-version: '7.0'
branch: '2.1.1'
- php-version: '7.0'
branch: '2.1.2'
- php-version: '7.0'
branch: '2.1.3'
- php-version: '7.0'
branch: '2.1.4'
- php-version: '7.0'
branch: '2.1.5'
- php-version: '7.0'
branch: '2.1.6'
- php-version: '7.0'
branch: '2.1.7'
- php-version: '7.0'
branch: '2.1.8'
- php-version: '7.0'
branch: '2.1.9'
- php-version: '7.0'
branch: '2.1.10'
- php-version: '7.0'
branch: '2.1.11'
- php-version: '7.0'
branch: '2.1.12'
- php-version: '7.0'
branch: '2.1.13'
- php-version: '7.0'
branch: '2.1.14'
- php-version: '7.0'
branch: '2.1.15'
- php-version: '7.0'
branch: '2.1.16'
- php-version: '7.1'
branch: '2.1.16'
- php-version: '7.0'
branch: '2.1.17'
- php-version: '7.1'
branch: '2.1.17'
- php-version: '7.0'
branch: '2.1.18'
- php-version: '7.1'
branch: '2.1.18'
- php-version: '7.0'
branch: '2.2.0'
- php-version: '7.1'
branch: '2.2.0'
- php-version: '7.0'
branch: '2.2.1'
- php-version: '7.1'
branch: '2.2.1'
- php-version: '7.0'
branch: '2.2.2'
- php-version: '7.1'
branch: '2.2.2'
- php-version: '7.0'
branch: '2.2.3'
- php-version: '7.1'
branch: '2.2.3'
- php-version: '7.0'
branch: '2.2.4'
- php-version: '7.1'
branch: '2.2.4'
- php-version: '7.0'
branch: '2.2.5'
- php-version: '7.1'
branch: '2.2.5'
- php-version: '7.0'
branch: '2.2.6'
- php-version: '7.1'
branch: '2.2.6'
- php-version: '7.0'
branch: '2.2.7'
- php-version: '7.1'
branch: '2.2.7'
- php-version: '7.0'
branch: '2.2.8'
- php-version: '7.1'
branch: '2.2.8'
- php-version: '7.0'
branch: '2.2.9'
- php-version: '7.1'
branch: '2.2.9'
- php-version: '7.0'
branch: '2.2.10'
- php-version: '7.1'
branch: '2.2.10'
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:v1, phpunit:6.4.3
extensions: gd, mbstring, zip, mcrypt, pdo_mysql, dom, soap, bcmath
- name: Start mysql service
run: sudo /etc/init.d/mysql start
- name: Status mysql service
run: sudo systemctl status mysql
- name: Install Magento
env:
BRANCH: ${{ matrix.branch }}
PUBLIC_KEY: ${{ secrets.PUBLIC_KEY}}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY}}
run: make before_script
- name: Run tests
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: Cleanup
if: env.LAST_TAG != env.RELEASE_TAG
run: make delete_archive

View File

@ -1,262 +0,0 @@
os: linux
dist: trusty
language: php
if: tag IS blank
env:
global:
- DB_USER=root
- DB_HOST=localhost
- DB_NAME=magento2_test
- ADMIN_FIRSTNAME=admin_firstname
- ADMIN_LASTNAME=admin_lastname
- ADMIN_EMAIL=example@email.com
- ADMIN_USER=admin
- ADMIN_PASS=admin123
stages:
- test
- deploy
before_install:
- export LAST_TAG=`git describe --abbrev=0 --tags`
- export CURRENT_VERSION=v`cat VERSION`
before_script:
- bash bin/install.sh
script: make ci
jobs:
allow_failures:
- if: fork = true
env: BRANCH=2.0.2
- if: fork = true
env: BRANCH=2.0.4
- if: fork = true
env: BRANCH=2.0.5
- if: fork = true
env: BRANCH=2.0.6
- if: fork = true
env: BRANCH=2.0.7
- if: fork = true
env: BRANCH=2.0.8
- if: fork = true
env: BRANCH=2.0.9
- if: fork = true
env: BRANCH=2.0.10
- if: fork = true
env: BRANCH=2.0.11
include:
- php: 7.0
env: BRANCH=2.0.2
- php: 7.0
env: BRANCH=2.0.4
- php: 7.0
env: BRANCH=2.0.5
- php: 7.0
env: BRANCH=2.0.6
- php: 7.0
env: BRANCH=2.0.7
- php: 7.0
env: BRANCH=2.0.8
- php: 7.0
env: BRANCH=2.0.9
- php: 7.0
env: BRANCH=2.0.10
- php: 7.0
env: BRANCH=2.0.11
- php: 7.0
env: BRANCH=2.0.12
- php: 7.0
env: BRANCH=2.0.13
- php: 7.0
env: BRANCH=2.0.14
- php: 7.0
env: BRANCH=2.0.15
- php: 7.0
env: BRANCH=2.0.16
- php: 7.0
env: BRANCH=2.0.17
- php: 7.0
env: BRANCH=2.0.18
- php: 7.0
env: BRANCH=2.1.0
- php: 7.0
env: BRANCH=2.1.1
- php: 7.0
env: BRANCH=2.1.2
- php: 7.0
env: BRANCH=2.1.3
- php: 7.0
env: BRANCH=2.1.4
- php: 7.0
env: BRANCH=2.1.5
- php: 7.0
env: BRANCH=2.1.6
- php: 7.0
env: BRANCH=2.1.7
- php: 7.0
env: BRANCH=2.1.8
- php: 7.0
env: BRANCH=2.1.9
- php: 7.0
env: BRANCH=2.1.10
- php: 7.0
env: BRANCH=2.1.11
- php: 7.0
env: BRANCH=2.1.12
- php: 7.0
env: BRANCH=2.1.13
- php: 7.0
env: BRANCH=2.1.14
- php: 7.0
env: BRANCH=2.1.15
- php: 7.0
env: BRANCH=2.1.16
- php: 7.1
env: BRANCH=2.1.16
- php: 7.0
env: BRANCH=2.1.17
- php: 7.1
env: BRANCH=2.1.17
- php: 7.0
env: BRANCH=2.1.18
- php: 7.1
env: BRANCH=2.1.18
- php: 7.0
env: BRANCH=2.2.0
- php: 7.1
env: BRANCH=2.2.0
- php: 7.0
env: BRANCH=2.2.1
- php: 7.1
env: BRANCH=2.2.1
- php: 7.0
env: BRANCH=2.2.2
- php: 7.1
env: BRANCH=2.2.2
- php: 7.0
env: BRANCH=2.2.3
- php: 7.1
env: BRANCH=2.2.3
- php: 7.0
env: BRANCH=2.2.4
- php: 7.1
env: BRANCH=2.2.4
- php: 7.0
env: BRANCH=2.2.5
- php: 7.1
env: BRANCH=2.2.5
- php: 7.0
env: BRANCH=2.2.6
- php: 7.1
env: BRANCH=2.2.6
- php: 7.0
env: BRANCH=2.2.7
- php: 7.1
env: BRANCH=2.2.7
- php: 7.0
env: BRANCH=2.2.8
- php: 7.1
env: BRANCH=2.2.8
- php: 7.0
env: BRANCH=2.2.9
- php: 7.1
env: BRANCH=2.2.9
- php: 7.0
env: BRANCH=2.2.10
- php: 7.1
env: BRANCH=2.2.10
- php: 7.2
env: BRANCH=2.2.10
- php: 7.1
env: BRANCH=2.3.0
- php: 7.2
env: BRANCH=2.3.0
- php: 7.1
env: BRANCH=2.3.1
- php: 7.2
env: BRANCH=2.3.1
- php: 7.1
env: BRANCH=2.3.2
- php: 7.2
env: BRANCH=2.3.2
- php: 7.1
env: BRANCH=2.3.3
- php: 7.2
env: BRANCH=2.3.3
- php: 7.2
env: BRANCH=2.3.4
- stage: deploy
before_script: skip
script: make build_archive
before_deploy:
- export VERSION=`cat VERSION`
- export ARCHIVE_NAME=/tmp/retailcrm-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

View File

@ -1,3 +1,6 @@
## 2021-01-30 v.2.5.2
* Переход на GitHub Actions
## 2020-12-17 v.2.5.1 ## 2020-12-17 v.2.5.1
* Ребрендинг RetailCRM * Ребрендинг RetailCRM

View File

@ -1,7 +1,8 @@
FILE = $(TRAVIS_BUILD_DIR)/VERSION export ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION = `cat $(FILE)` VERSION = `cat $(FILE)`
ARCHIVE_NAME = '/tmp/retailcrm-retailcrm-'$(VERSION)'.zip' ARCHIVE_NAME = '/tmp/retailcrm-retailcrm-'$(VERSION)'.zip'
MAGE_ROOT = $(TRAVIS_BUILD_DIR)/../magento2 MAGE_ROOT=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/../magento2
.PHONY: build_archive delete_archive .PHONY: build_archive delete_archive
@ -11,5 +12,13 @@ build_archive:
delete_archive: delete_archive:
rm -f $(ARCHIVE_NAME) rm -f $(ARCHIVE_NAME)
ci: test:
mkdir coverage
php $(MAGE_ROOT)/vendor/phpunit/phpunit/phpunit -c $(MAGE_ROOT)/dev/tests/unit/phpunit.xml.dist $(MAGE_ROOT)/app/code/Retailcrm/Retailcrm/Test/Unit php $(MAGE_ROOT)/vendor/phpunit/phpunit/phpunit -c $(MAGE_ROOT)/dev/tests/unit/phpunit.xml.dist $(MAGE_ROOT)/app/code/Retailcrm/Retailcrm/Test/Unit
before_script:
bash bin/install.sh
coverage:
wget https://phar.phpunit.de/phpcov-2.0.2.phar && php phpcov-2.0.2.phar merge coverage/ --clover coverage.xml

View File

@ -1,5 +1,6 @@
[![Build Status](https://img.shields.io/travis/retailcrm/magento-module/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/magento-module) [![Build Status](https://github.com/retailcrm/magento-module/workflows/magento/badge.svg)](https://github.com/retailcrm/magento-module/actions)
[![GitHub release](https://img.shields.io/github/release/retailcrm/magento-module.svg?style=flat-square)](https://github.com/retailcrm/magento-module/releases) [![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/magento-module/master.svg?logo=github)](https://codecov.io/gh/retailcrm/magento-module)
[![GitHub release](https://img.shields.io/github/release/retailcrm/magento-module.svg?logo=codecov)](https://github.com/retailcrm/magento-module/)
[![PHP version](https://img.shields.io/badge/PHP->=5.6-blue.svg?style=flat-square)](https://php.net/) [![PHP version](https://img.shields.io/badge/PHP->=5.6-blue.svg?style=flat-square)](https://php.net/)
Magento module Magento module

View File

@ -1 +1 @@
2.5.1 2.5.2

View File

@ -1,13 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -z $TRAVIS_BUILD_DIR ]; then if [ -z $ROOT_DIR ]; then
exit 0; exit 0;
fi fi
MAGE_ROOT=$TRAVIS_BUILD_DIR/../magento2 MAGE_ROOT=$ROOT_DIR/../magento2
create_db() { create_db() {
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS" mysqladmin create "magento2_test" --user="root" --password="root"
} }
magento_clone() { magento_clone() {
@ -31,24 +31,22 @@ magento_clone() {
sudo sed -e "s?<public-key>?$PUBLIC_KEY?g" --in-place auth.json sudo sed -e "s?<public-key>?$PUBLIC_KEY?g" --in-place auth.json
sudo sed -e "s?<private-key>?$PRIVATE_KEY?g" --in-place auth.json sudo sed -e "s?<private-key>?$PRIVATE_KEY?g" --in-place auth.json
php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');" composer install --no-interaction --prefer-dist
composer require retailcrm/api-client-php
php composer.phar install --ignore-platform-reqs --no-interaction --prefer-dist
php composer.phar require retailcrm/api-client-php
} }
magento_install() { magento_install() {
cd $MAGE_ROOT cd $MAGE_ROOT
php bin/magento setup:install \ php bin/magento setup:install \
--db-host="$DB_HOST" \ --db-host="localhost" \
--db-name="$DB_NAME" \ --db-name="magento2_test" \
--db-user="$DB_USER" \ --db-user="root" \
--admin-firstname="$ADMIN_FIRSTNAME" \ --db-password="root" \
--admin-lastname="$ADMIN_LASTNAME" \ --admin-firstname="admin_firstname" \
--admin-email="$ADMIN_EMAIL" \ --admin-lastname="admin_lastname" \
--admin-user="$ADMIN_USER" \ --admin-email="example@email.com" \
--admin-password="$ADMIN_PASS" \ --admin-user="admin" \
--admin-password="admin123" \
--language="en_US" \ --language="en_US" \
--currency="USD" \ --currency="USD" \
--timezone="Europe/Moscow" --timezone="Europe/Moscow"
@ -57,7 +55,7 @@ magento_install() {
module_install() { module_install() {
cd $MAGE_ROOT cd $MAGE_ROOT
mkdir -p app/code/Retailcrm/Retailcrm mkdir -p app/code/Retailcrm/Retailcrm
cp -R $TRAVIS_BUILD_DIR/src/* app/code/Retailcrm/Retailcrm cp -R $ROOT_DIR/src/* app/code/Retailcrm/Retailcrm
php bin/magento module:enable Retailcrm_Retailcrm php bin/magento module:enable Retailcrm_Retailcrm
php bin/magento setup:upgrade php bin/magento setup:upgrade

View File

@ -5,7 +5,7 @@
"retailcrm/api-client-php": "~5.0" "retailcrm/api-client-php": "~5.0"
}, },
"type": "magento2-module", "type": "magento2-module",
"version": "2.5.1", "version": "2.5.2",
"license": [ "license": [
"OSL-3.0", "OSL-3.0",
"AFL-3.0" "AFL-3.0"