-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
84 changed files
with
226 additions
and
400 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{php,xml,json}] | ||
indent_size = 4 | ||
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Tests | ||
|
||
on: push | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php: [8.1, 8.2] | ||
|
||
name: 'PHP ${{ matrix.php }}' | ||
steps: | ||
- uses: actions/checkout@master | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: xdebug | ||
tools: phpunit, composer:v2 | ||
ini-values: display_errors=E_ALL | ||
|
||
- name: Install Composer dependencies | ||
run: composer install | ||
|
||
- name: Run tests | ||
if: ${{ matrix.php != '8.2' }} | ||
run: vendor/bin/phpunit -c phpunit.xml.dist | ||
|
||
- name: Run tests with coverage | ||
if: ${{ matrix.php == '8.2' }} | ||
run: vendor/bin/phpunit --coverage-clover local/clover.xml | ||
|
||
- name: Upload coverage results to Coveralls | ||
if: ${{ matrix.php == '8.2' }} | ||
env: | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
composer global require php-coveralls/php-coveralls | ||
php-coveralls --coverage_clover=local/clover.xml -v --json_path=local/clover.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
composer.lock | ||
vendor | ||
.idea | ||
phpunit.xml | ||
phpmd.xml | ||
/vendor | ||
/composer.lock | ||
/phpunit.xml | ||
/.idea | ||
.phpunit.result.cache | ||
/local | ||
/format.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
# Runs a composer command. | ||
# Arguments and options are equal to composer ("./composer.sh --no-cache install" for example). | ||
# Host script that executes internal script (inside docker container) | ||
|
||
. $(dirname "$0")/docker/scripts/boot_host.sh | ||
|
||
docker-compose run -T --rm php /bin/sh -c "/bin/sh /app/docker/scripts/composer.sh $*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
# Runs unit tests with coverage. | ||
# Arguments and options are equal to phpunit. | ||
# Without arguments runs all tests inside /tests/ directory. | ||
# Host script that executes internal script (inside docker container) | ||
|
||
. $(dirname "$0")/docker/scripts/boot_host.sh | ||
|
||
docker-compose run --rm php /bin/sh -c "/bin/sh /app/docker/scripts/coverage.sh $*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
# Checks code style. | ||
# Arguments and options are equal to phpcs. | ||
# Without arguments checks /src/ and /tests/ directories. | ||
# Host script that executes internal script (inside docker container) | ||
|
||
./vendor/bin/phpcs "$@" | ||
. "$(dirname "$0")/docker/scripts/boot_host.sh" | ||
|
||
docker-compose run -T --rm php /bin/sh /app/docker/scripts/cs.sh "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
COMPOSE_PROJECT_NAME="axy_errors_test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM php:8.2.3-cli | ||
|
||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
libzip-dev | ||
|
||
RUN docker-php-ext-install \ | ||
zip | ||
|
||
RUN pecl install xdebug-3.2.0 && docker-php-ext-enable xdebug | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: '3.8' | ||
|
||
services: | ||
php: | ||
build: | ||
context: ./build/php | ||
restart: 'no' | ||
profiles: ['console'] | ||
volumes: | ||
- '..:/app:ro' | ||
- '../vendor:/app/vendor' | ||
- '../composer.lock:/app/composer.lock' | ||
- '../local:/app/local' | ||
user: "${USER_ID:-0}:${GROUP_ID:-0}" | ||
working_dir: '/app' | ||
environment: | ||
XDEBUG_MODE: 'coverage' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
# Source for including from a host script | ||
# Builds docker compose project and set the current directory to the compose root for docker-compose run | ||
|
||
COMPOSE_PROJECT_NAME="axy_errors_test" | ||
export COMPOSE_PROJECT_NAME | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1; | ||
CURRENT_DIR=$(pwd) | ||
ROOT_DIR="$CURRENT_DIR/../.." | ||
|
||
# Use this file owner as the user under which docker is running | ||
USER_ID=$(stat -c '%u' "$CURRENT_DIR") | ||
GROUP_ID=$(stat -c '%g' "$CURRENT_DIR") | ||
export USER_ID | ||
export GROUP_ID | ||
|
||
# Create empty composer.lock if it isn't exists yet | ||
# because docker will be mount it as not read-only and it will be created as directory | ||
if [[ ! -e "$ROOT_DIR/composer.lock" ]] | ||
then | ||
echo "{}" > "$ROOT_DIR/composer.lock"; | ||
fi | ||
mkdir -p "$ROOT_DIR/vendor" || exit 1 | ||
mkdir -p "$ROOT_DIR/local" || exit 1 | ||
|
||
cd "$CURRENT_DIR/.." && docker-compose build || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Run composer command (runs inside container) | ||
|
||
cd /app && composer "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Run unit tests with coverage (runs inside container) | ||
|
||
cd /app && composer install --no-cache && ./vendor/bin/phpunit --coverage-html local/coverage "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Run code sniffer (runs inside container) | ||
|
||
cd /app && ./vendor/bin/phpcs "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Run unit tests (runs inside container) | ||
|
||
cd /app && composer install --no-cache && ./vendor/bin/phpunit "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Helper for define exception classes | ||
* | ||
* @package axy\errors | ||
* @author Oleg Grigoriev <go.vasac@gmail.com> | ||
* @license https://raw.github.com/axypro/errors/master/LICENSE MIT | ||
* @link https://github.com/axypro/errors repository | ||
* @link https://github.com/axypro/errors/blob/master/README.md documentation | ||
* @link https://packagist.org/packages/axy/errors composer | ||
* @uses PHP8.1+ | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace axy\errors; | ||
|
||
require_once __DIR__ . '/vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="Axypro Standard"> | ||
<file>./src</file> | ||
<file>./tests</file> | ||
|
||
<rule ref="PSR2"/> | ||
<rule ref="PSR2.Namespaces.UseDeclaration"> | ||
<exclude-pattern>*</exclude-pattern> | ||
</rule> | ||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd"> | ||
<file>src</file> | ||
<file>tests</file> | ||
<rule ref="PSR12"/> | ||
</ruleset> |
Oops, something went wrong.