mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
Move CI to GitHub Actions (#204)
This commit is contained in:
parent
579150ea08
commit
c2abd5acd8
252
.github/workflows/ci.yml
vendored
Normal file
252
.github/workflows/ci.yml
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
tags-ignore:
|
||||
- '*.*'
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
OC_DB_HOSTNAME: 127.0.0.1
|
||||
OC_DB_USERNAME: root
|
||||
OC_DB_PASSWORD: root
|
||||
OC_DB_DATABASE: tests_opencart
|
||||
OC_DB_DRIVER: mysqli
|
||||
OC_USERNAME: admin
|
||||
OC_PASSWORD: admin
|
||||
OC_EMAIL: test@test.com
|
||||
SERVER_PORT: 80
|
||||
SERVER_URL: http://localhost
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- php-version: '7.0'
|
||||
test-suite: '2.3'
|
||||
oc: '2.3.0.0'
|
||||
coverage: 1
|
||||
- php-version: '7.0'
|
||||
test-suite: '2.3'
|
||||
oc: '2.3.0.1'
|
||||
- php-version: '7.0'
|
||||
test-suite: '2.3'
|
||||
oc: '2.3.0.2'
|
||||
- php-version: '7.1'
|
||||
test-suite: '2.3'
|
||||
oc: '2.3.0.0'
|
||||
- php-version: '7.1'
|
||||
test-suite: '2.3'
|
||||
oc: '2.3.0.1'
|
||||
- php-version: '7.1'
|
||||
test-suite: '2.3'
|
||||
oc: '2.3.0.2'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.0'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.2'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.0'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.1'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.2'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.2.0'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.0'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.1'
|
||||
- php-version: '7.0'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.2'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.0'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.2'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.0'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.1'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.2'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.2.0'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.0'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.1'
|
||||
- php-version: '7.1'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.2'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.0'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.2'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.0'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.1'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.2'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.2.0'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.0'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.1'
|
||||
- php-version: '7.2'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.2'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.0'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.0.2'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.0'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.1'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.1.2'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.2.0'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.0'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.1'
|
||||
- php-version: '7.3'
|
||||
test-suite: '3.0'
|
||||
oc: '3.0.3.2'
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
||||
MYSQL_ROOT_PASSWORD: ${{ env.OC_DB_PASSWORD }}
|
||||
MYSQL_DATABASE: ${{ env.OC_DB_DATABASE }}
|
||||
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
|
||||
extensions: gd, mbstring, mysqli, zip, mcrypt, mysql, pdo_mysql, dom
|
||||
- name: Install Opencart
|
||||
env:
|
||||
TEST_SUITE: ${{ matrix.test-suite }}
|
||||
OPENCART: ${{ matrix.oc }}
|
||||
run: make before_script
|
||||
- name: Run tests
|
||||
env:
|
||||
TEST_SUITE: ${{ matrix.test-suite }}
|
||||
OPENCART: ${{ matrix.oc }}
|
||||
run: composer test
|
||||
- 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
|
||||
- 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
|
145
.travis.yml
145
.travis.yml
@ -1,145 +0,0 @@
|
||||
os: linux
|
||||
language: php
|
||||
dist: trusty
|
||||
|
||||
if: tag IS blank
|
||||
|
||||
env:
|
||||
global:
|
||||
- OC_DB_HOSTNAME=localhost
|
||||
- OC_DB_USERNAME=root
|
||||
- OC_DB_PASSWORD=root
|
||||
- OC_DB_DATABASE=tests_opencart
|
||||
- OC_DB_DRIVER=mysqli
|
||||
- OC_USERNAME=admin
|
||||
- OC_PASSWORD=admin
|
||||
- OC_EMAIL=test@test.com
|
||||
- SERVER_PORT=80
|
||||
- SERVER_URL=http://localhost
|
||||
|
||||
stages:
|
||||
- test
|
||||
- phpcs
|
||||
- deploy
|
||||
|
||||
before_install:
|
||||
- export LAST_TAG=`git describe --abbrev=0 --tags`
|
||||
- export CURRENT_VERSION=v`cat VERSION`
|
||||
|
||||
before_script: make before_script
|
||||
|
||||
script: composer test
|
||||
|
||||
after_success:
|
||||
- make coverage
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=2.3 OPENCART=2.3.0.0
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=2.3 OPENCART=2.3.0.1
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=2.3 OPENCART=2.3.0.2
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=2.3 OPENCART=2.3.0.0
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=2.3 OPENCART=2.3.0.1
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=2.3 OPENCART=2.3.0.2
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.0
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.2
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.0
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.1
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.2
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.2.0
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.0
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.1
|
||||
- php: 7.0
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.2
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.0
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.2
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.0
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.1
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.2
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.2.0
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.0
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.1
|
||||
- php: 7.1
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.2
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.0
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.2
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.0
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.1
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.2
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.2.0
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.0
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.1
|
||||
- php: 7.2
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.2
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.0
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.0.2
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.0
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.1
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.1.2
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.2.0
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.0
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.1
|
||||
- php: 7.3
|
||||
env: TEST_SUITE=3.0 OPENCART=3.0.3.2
|
||||
- stage: phpcs
|
||||
before_script: composer install
|
||||
script: make phpcomp
|
||||
after_success: skip
|
||||
- stage: deploy
|
||||
before_script: skip
|
||||
script: make build_archive
|
||||
before_deploy:
|
||||
- export VERSION=`cat VERSION`
|
||||
- export ARCHIVE_NAME=/tmp/retailcrm-$VERSION.ocmod.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
|
2
Makefile
2
Makefile
@ -17,8 +17,6 @@ delete_archive:
|
||||
|
||||
before_script:
|
||||
mkdir coverage
|
||||
# Change MySQL root password
|
||||
echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
composer require --dev beyondit/opencart-test-suite ~$(TEST_SUITE)
|
||||
composer require --dev opencart/opencart $(OPENCART)
|
||||
composer setup
|
||||
|
@ -1,7 +1,7 @@
|
||||
[![Build Status](https://img.shields.io/travis/retailcrm/opencart-module/master.svg?style=flat-square)](https://travis-ci.org/retailcrm/opencart-module)
|
||||
[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/opencart-module/master.svg?style=flat-square)](https://codecov.io/gh/retailcrm/opencart-module)
|
||||
[![GitHub release](https://img.shields.io/github/release/retailcrm/opencart-module.svg?style=flat-square)](https://github.com/retailcrm/opencart-module/releases)
|
||||
[![PHP version](https://img.shields.io/badge/PHP->=5.4-blue.svg?style=flat-square)](https://php.net/)
|
||||
[![Build Status](https://github.com/retailcrm/opencart-module/workflows/ci/badge.svg)](https://github.com/retailcrm/opencart-module/actions)
|
||||
[![Coverage](https://img.shields.io/codecov/c/gh/retailcrm/opencart-module/master.svg?logo=github)](https://codecov.io/gh/retailcrm/opencart-module)
|
||||
[![GitHub release](https://img.shields.io/github/release/retailcrm/opencart-module.svg?logo=codecov)](https://github.com/retailcrm/opencart-module/releases)
|
||||
[![PHP version](https://img.shields.io/badge/PHP->=5.4-blue.svg?logo=php)](https://php.net/)
|
||||
|
||||
Opencart module
|
||||
===============
|
||||
|
@ -109,7 +109,8 @@ class RoboFile extends \Robo\Tasks
|
||||
}
|
||||
catch(PDOException $e)
|
||||
{
|
||||
$this->printTaskError("<error> Could not connect ot database...");
|
||||
$this->printTaskError($e->getMessage());
|
||||
$this->printTaskError("<error> Could not connect to database...");
|
||||
}
|
||||
|
||||
if (version_compare(getenv('OPENCART'), '3.0.2.0', '<=')) {
|
||||
|
Loading…
Reference in New Issue
Block a user