Skip to content

Commit

Permalink
Bitrix v20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalikxp committed Sep 30, 2024
1 parent cd9f5d6 commit 31985ee
Show file tree
Hide file tree
Showing 12 changed files with 61 additions and 41 deletions.
36 changes: 20 additions & 16 deletions .github/workflows/php-unit.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
name: PHPUnit
on: [push]
on: [ push ]
jobs:
PHPUnit:
runs-on: ubuntu-latest
strategy:
matrix:
PHP: ["7.1", "7.2", "7.3", "7.4"]
container:
image: webdevops/php-dev:${{ matrix.PHP }}
env:
MYSQL_HOST: mysql
MYSQL_DATABASE: bitrix-ci
MYSQL_USER: bitrix-ci
MYSQL_PASSWORD: bitrix-ci
PHP: [ "7.1", "7.2", "7.3", "7.4" ]
services:
mysql:
image: mysql:5.7
env:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_HOST: 127.0.0.1
MYSQL_DATABASE: bitrix-ci
MYSQL_USER: bitrix-ci
MYSQL_PASSWORD: bitrix-ci
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
env:
MYSQL_HOST: 127.0.0.1
MYSQL_DATABASE: bitrix-ci
MYSQL_USER: bitrix-ci
MYSQL_PASSWORD: bitrix-ci
DEBUG: true
steps:
- name: Checkout source
uses: actions/checkout@v1

- name: Set up environment
run: |
echo 'short_open_tag=1' >> /opt/docker/etc/php/php.ini
echo 'mbstring.func_overload=2' >> /opt/docker/etc/php/php.ini
cat /opt/docker/etc/php/php.ini
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.PHP }}
tools: composer
ini-values: short_open_tag=1, mbstring.func_overload=2

- name: Install dependencies
run: composer install --no-ansi --no-interaction --no-suggest --no-progress --prefer-dist

- name: Run PHPUnit tests
run: php vendor/bin/phpunit
run: php vendor/bin/phpunit
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
vendor/
/vendor/
/var/
/composer.lock
*.zip
/public/
/files/bitrix/managed_cache/
*.php~
/.idea/
.phpunit.result.cache
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Bitrix CI Build

[![PHPUnit](https://github.com/sheerockoff/bitrix-ci/workflows/PHPUnit/badge.svg?branch=master)](https://github.com/sheerockoff/bitrix-ci/actions)
[![Code Size](https://img.shields.io/github/languages/code-size/sheerockoff/bitrix-ci.svg)](https://packagist.org/packages/sheerockoff/bitrix-ci)
[![PHPUnit](https://github.com/bitrix-toolkit/bitrix-ci/actions/workflows/php-unit.yml/badge.svg?branch=dev%2Fv20.0)](https://github.com/bitrix-toolkit/bitrix-ci/actions/workflows/php-unit.yml)
[![Code Size](https://img.shields.io/github/languages/code-size/bitrix-toolkit/bitrix-ci.svg)](https://packagist.org/packages/bitrix-toolkit/bitrix-ci)

Минимальный сборка [Bitrix](https://www.1c-bitrix.ru/products/cms/index.php) для использования в тестировании.

Expand All @@ -10,7 +10,7 @@
Устанавливаем.

```bash
composer require --dev sheerockoff/bitrix-ci
composer require --dev bitrix-toolkit/bitrix-ci
```

Подключаем зависимости.
Expand All @@ -34,13 +34,13 @@ putenv('MYSQL_PASSWORD=password');
Разворачиваем дамп MySQL.

```php
\Sheerockoff\BitrixCi\Bootstrap::migrate();
\BitrixToolkit\BitrixCi\Bootstrap::migrate();
```

Подключаем Bitrix.

```php
\Sheerockoff\BitrixCi\Bootstrap::bootstrap();
\BitrixToolkit\BitrixCi\Bootstrap::bootstrap();
```

Тестируем код, который зависит от API Bitrix.
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "sheerockoff/bitrix-ci",
"name": "bitrix-toolkit/bitrix-ci",
"description": "Minimal build of Bitrix for CI",
"type": "library",
"license": "Unlicense",
"authors": [
{
"name": "Vitalik Sheerockoff",
"email": "shirokov@vitalik.pw"
"name": "Vitalik Shirokov",
"email": "vitalik.shirokov@gmail.com"
}
],
"autoload": {
"psr-4": {
"Sheerockoff\\BitrixCi\\": "src/"
"BitrixToolkit\\BitrixCi\\": "src/"
}
},
"require": {
Expand All @@ -20,7 +20,7 @@
},
"autoload-dev": {
"psr-4": {
"Sheerockoff\\BitrixCi\\Test\\": "tests/"
"BitrixToolkit\\BitrixCi\\Test\\": "tests/"
}
},
"require-dev": {
Expand Down
25 changes: 18 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,38 @@
version: "2.1"
services:
bitrix:
image: webdevops/php-nginx-dev:${PHP-7.1}
image: docker.io/webdevops/php-apache-dev:${PHP-7.1}
volumes:
- ./:/app/
working_dir: /app/
depends_on:
- mysql
ports:
- 80:80
- ${HTTP_PORT-8080}:80
environment:
WEB_DOCUMENT_ROOT: /app/public/
php.short_open_tag: 1
php.mbstring.func_overload: 2
php.display_errors: 1
php.max_input_vars: 10000
php.memory_limit: "256M"
php.date.timezone: "Europe/Moscow"
MYSQL_HOST: mysql
MYSQL_DATABASE: bitrix-ci
MYSQL_USER: bitrix-ci
MYSQL_PASSWORD: bitrix-ci
mysql:
image: mysql:5.7
image: docker.io/library/mysql:5.7
volumes:
- ./var/mysql/:/var/lib/mysql/
ports:
- ${MYSQL_PORT-3306}:3306
command: >-
--default-time-zone=Europe/Moscow
--character-set-server=utf8
--collation-server=utf8_unicode_ci
--skip-innodb-strict-mode
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_DATABASE: bitrix-ci
MYSQL_USER: bitrix-ci
MYSQL_PASSWORD: bitrix-ci
MYSQL_DATABASE: "bitrix-ci"
MYSQL_USER: "bitrix-ci"
MYSQL_PASSWORD: "bitrix-ci"
2 changes: 1 addition & 1 deletion src/Bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sheerockoff\BitrixCi;
namespace BitrixToolkit\BitrixCi;

use InvalidArgumentException;
use CModule;
Expand Down
2 changes: 1 addition & 1 deletion src/SqlDump.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sheerockoff\BitrixCi;
namespace BitrixToolkit\BitrixCi;

use Generator;
use InvalidArgumentException;
Expand Down
2 changes: 1 addition & 1 deletion tests/CatalogTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sheerockoff\BitrixCi\Test;
namespace BitrixToolkit\BitrixCi\Test;

use CCatalog;
use CCatalogGroup;
Expand Down
2 changes: 1 addition & 1 deletion tests/HighloadBlockTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sheerockoff\BitrixCi\Test;
namespace BitrixToolkit\BitrixCi\Test;

use Bitrix\Highloadblock\HighloadBlockTable;
use Bitrix\Main\ORM\Data\AddResult;
Expand Down
2 changes: 1 addition & 1 deletion tests/IBlockTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sheerockoff\BitrixCi\Test;
namespace BitrixToolkit\BitrixCi\Test;

use CIBlock;
use CIBlockElement;
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Sheerockoff\BitrixCi\Test;
namespace BitrixToolkit\BitrixCi\Test;

use PHPUnit\Framework\TestCase as PhpUnitTestCase;

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

use Sheerockoff\BitrixCi\Bootstrap;
use BitrixToolkit\BitrixCi\Bootstrap;

require __DIR__ . '/../vendor/autoload.php';

Expand Down

0 comments on commit 31985ee

Please sign in to comment.