Skip to content

Commit 9d32b7e

Browse files
authored
Merge pull request #13 from mesilov/add-docker-structure
Add docker structure
2 parents 0bb8c41 + 61f7293 commit 9d32b7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+3183
-146
lines changed

.allowed-licenses.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Lendable\ComposerLicenseChecker\LicenseConfigurationBuilder;
6+
7+
return (new LicenseConfigurationBuilder())
8+
->addLicenses(
9+
// And other licenses you wish to allow.
10+
'MIT',
11+
'Apache-2.0',
12+
'BSD-3-Clause',
13+
)
14+
->build();

.env

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# In all environments, the following files are loaded if they exist,
2+
# the latter taking precedence over the former:
3+
#
4+
# * .env contains default values for the environment variables needed by the app
5+
# * .env.local uncommitted file with local overrides
6+
# * .env.$APP_ENV committed environment-specific defaults
7+
# * .env.$APP_ENV.local uncommitted environment-specific overrides
8+
#
9+
# Real environment variables win over .env files.
10+
#
11+
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
12+
#
13+
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
14+
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
15+
DATABASE_HOST=
16+
DATABASE_USER=
17+
DATABASE_PASSWORD=
18+
DATABASE_NAME=
File renamed without changes.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Allowed licenses checks"
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
static-analysis:
8+
name: "composer-license-checker"
9+
runs-on: ${{ matrix.operating-system }}
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
php-version:
15+
- "8.3"
16+
dependencies: [ highest ]
17+
operating-system: [ ubuntu-latest]
18+
19+
steps:
20+
- name: "Checkout"
21+
uses: "actions/checkout@v2"
22+
23+
- name: "Install PHP"
24+
uses: "shivammathur/setup-php@v2"
25+
with:
26+
coverage: "none"
27+
php-version: "${{ matrix.php-version }}"
28+
extensions: json, bcmath, curl, intl, mbstring
29+
tools: composer:v2
30+
31+
- name: "Install lowest dependencies"
32+
if: ${{ matrix.dependencies == 'lowest' }}
33+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
34+
35+
- name: "Install highest dependencies"
36+
if: ${{ matrix.dependencies == 'highest' }}
37+
run: "composer update --no-interaction --no-progress --no-suggest"
38+
39+
- name: "composer-license-checker"
40+
run: "make lint-allowed-licenses"
41+
42+
- name: "is allowed licenses check succeeded"
43+
if: ${{ success() }}
44+
run: |
45+
echo '✅ allowed licenses check pass, congratulations!'
46+
47+
- name: "is allowed licenses check failed"
48+
if: ${{ failure() }}
49+
run: |
50+
echo '::error:: ❗️ allowed licenses check failed (╯°益°)╯彡┻━┻'
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
on:
2+
push:
3+
pull_request:
4+
5+
name: Lint CS-Fixer
6+
7+
jobs:
8+
static-analysis:
9+
name: "CS-Fixer"
10+
runs-on: ${{ matrix.operating-system }}
11+
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php-version:
16+
- "8.3"
17+
dependencies: [ highest ]
18+
operating-system: [ ubuntu-latest]
19+
20+
steps:
21+
- name: "Checkout"
22+
uses: "actions/checkout@v2"
23+
24+
- name: "Install PHP"
25+
uses: "shivammathur/setup-php@v2"
26+
with:
27+
coverage: "none"
28+
php-version: "${{ matrix.php-version }}"
29+
extensions: json, bcmath, curl, intl, mbstring
30+
tools: composer:v2
31+
32+
- name: "Install lowest dependencies"
33+
if: ${{ matrix.dependencies == 'lowest' }}
34+
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest"
35+
36+
- name: "Install highest dependencies"
37+
if: ${{ matrix.dependencies == 'highest' }}
38+
run: "composer update --no-interaction --no-progress --no-suggest"
39+
40+
- name: "CS-Fixer"
41+
run: "vendor/bin/php-cs-fixer fix --dry-run --diff --verbose"
42+
43+
- name: "is CS-Fixer check succeeded"
44+
if: ${{ success() }}
45+
run: |
46+
echo '✅ CS-Fixer check pass, congratulations!'
47+
48+
- name: "is CS-Fixer check failed"
49+
if: ${{ failure() }}
50+
run: |
51+
echo '::error:: ❗️ CS-Fixer check failed (╯°益°)╯彡┻━┻'

.github/workflows/phpstan.yml renamed to .github/workflows/lint-phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: "composer update --no-interaction --no-progress --no-suggest"
3939

4040
- name: "PHPStan"
41-
run: "make lint-phpstan"
41+
run: "vendor/bin/phpstan --memory-limit=2G analyse"
4242

4343
- name: "is PHPStan check succeeded"
4444
if: ${{ success() }}

.github/workflows/rector.yml renamed to .github/workflows/lint-rector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
run: "composer update --no-interaction --no-progress --no-suggest"
3939

4040
- name: "Rector"
41-
run: "make lint-rector"
41+
run: "vendor/bin/rector process --dry-run"
4242

4343
- name: "is Rector check succeeded"
4444
if: ${{ success() }}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: "Functional tests"
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
env:
8+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress"
9+
DATABASE_HOST: localhost
10+
DATABASE_USER: b24phpLibTest
11+
DATABASE_PASSWORD: b24phpLibTest
12+
DATABASE_NAME: b24phpLibTest
13+
14+
jobs:
15+
tests:
16+
name: "Functional tests"
17+
18+
runs-on: ${{ matrix.operating-system }}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
php-version:
24+
- "8.3"
25+
dependencies: [ highest ]
26+
operating-system: [ ubuntu-latest ]
27+
services:
28+
bitrix24-php-lib-test-database:
29+
image: postgres:16-alpine
30+
ports:
31+
- 5432:5432
32+
options: >-
33+
--health-cmd="pg_isready -U b24phpLibTest"
34+
--health-interval=10s
35+
--health-timeout=5s
36+
--health-retries=5
37+
env:
38+
POSTGRES_USER: b24phpLibTest
39+
POSTGRES_PASSWORD: b24phpLibTest
40+
POSTGRES_DB: b24phpLibTest
41+
42+
steps:
43+
- name: "Checkout code"
44+
uses: "actions/checkout@v2"
45+
46+
- name: "Setup PHP"
47+
uses: "shivammathur/setup-php@v2"
48+
with:
49+
coverage: "none"
50+
php-version: "${{ matrix.php-version }}"
51+
extensions: json, bcmath, curl, intl, mbstring, pdo_pgsql, pdo
52+
53+
- name: "Install dependencies with Composer"
54+
run: |
55+
composer update ${{ env.COMPOSER_FLAGS }}
56+
57+
- name: "Install PostgreSQL client"
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y postgresql-client
61+
62+
- name: "Wait for PostgreSQL to be ready"
63+
run: |
64+
until pg_isready -h localhost -p 5432 -U b24phpLibTest; do
65+
echo "Waiting for PostgreSQL to start..."
66+
sleep 2
67+
done
68+
69+
- name: "Run functional tests"
70+
run: |
71+
php bin/doctrine orm:schema-tool:drop --force
72+
php bin/doctrine orm:schema-tool:create --dump-sql
73+
php bin/doctrine orm:schema-tool:update --force
74+
php bin/doctrine orm:info
75+
# Запуск тестов с очисткой состояния между тестами
76+
php vendor/bin/phpunit --testsuite=functional_tests --display-warnings --testdox --process-isolation
77+
78+
- name: "is functional tests succeeded"
79+
if: ${{ success() }}
80+
run: |
81+
echo '✅ functional tests pass, congratulations!'
82+
83+
- name: "is functional tests failed"
84+
if: ${{ failure() }}
85+
run: |
86+
echo '::error:: ❗️ functional tests failed (╯°益°)╯彡┻━┻'

.github/workflows/phpunit.yml renamed to .github/workflows/tests-unit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
name: "PHPUnit tests"
1+
name: "Unit tests"
22

33
on:
44
push:
55
pull_request:
66

77
env:
8-
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"
8+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress"
99

1010
jobs:
1111
tests:
@@ -37,7 +37,7 @@ jobs:
3737
composer update ${{ env.COMPOSER_FLAGS }}
3838
3939
- name: "run unit tests"
40-
run: "make test-unit"
40+
run: "php vendor/bin/phpunit --testsuite=unit_tests --display-warnings --testdox"
4141

4242
- name: "is unit tests tests succeeded"
4343
if: ${{ success() }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
/.idea*
22
/vendor
33
/.cache
4+
/docker/db
45
composer.phar
56
composer.lock
67
.phpunit.result.cache
78
*.log
8-
.env.local
9+
.env.local
10+
*.cache

0 commit comments

Comments
 (0)