Skip to content

Commit

Permalink
Transform repo structure & code cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed May 23, 2021
1 parent 2caff12 commit a3ec995
Show file tree
Hide file tree
Showing 53 changed files with 2,507 additions and 1,332 deletions.
857 changes: 857 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Not archived
/docs export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
editorconfig.xml export-ignore
Makefile export-ignore
phpstan.neon export-ignore
readme.md export-ignore
ruleset.xml export-ignore
267 changes: 267 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
name: "build"

on:
pull_request:
paths-ignore:
- ".docs/**"
push:
branches:
- "master"
schedule:
- cron: "0 8 * * 1" # At 08:00 on Monday

env:
extensions: "json"
cache-version: "1"
composer-version: "v1"
composer-install: "composer update --no-interaction --no-progress --no-suggest --prefer-dist --prefer-stable"
coverage: "none"

jobs:
qa:
name: "Quality assurance"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }}, cs2pr"
coverage: "${{ env.coverage }}"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Validate Composer"
run: "composer validate"

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "Coding Standard"
run: "make cs"

static-analysis:
name: "Static analysis"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }}"
coverage: "${{ env.coverage }}"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "PHPStan"
run: "make phpstan"

tests:
name: "Tests"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }}"
coverage: "${{ env.coverage }}"

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }} ${{ matrix.composer-args }}"

- name: "Tests"
run: "make tests"

- name: "Upload test output"
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: output
path: tests/**/output

tests-code-coverage:
name: "Tests with code coverage"
runs-on: "${{ matrix.operating-system }}"

strategy:
matrix:
php-version: ["7.4"]
operating-system: ["ubuntu-latest"]
fail-fast: false

if: "github.event_name == 'push'"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Setup PHP cache environment"
id: "extcache"
uses: "shivammathur/cache-extensions@v1"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
key: "${{ env.cache-version }}"

- name: "Cache PHP extensions"
uses: "actions/cache@v2"
with:
path: "${{ steps.extcache.outputs.dir }}"
key: "${{ steps.extcache.outputs.key }}"
restore-keys: "${{ steps.extcache.outputs.key }}"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
extensions: "${{ env.extensions }}"
tools: "composer:${{ env.composer-version }} "

- name: "Setup problem matchers for PHP"
run: 'echo "::add-matcher::${{ runner.tool_cache }}/php.json"'

- name: "Get Composer cache directory"
id: "composercache"
run: 'echo "::set-output name=dir::$(composer config cache-files-dir)"'

- name: "Cache PHP dependencies"
uses: "actions/cache@v2"
with:
path: "${{ steps.composercache.outputs.dir }}"
key: "${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "${{ runner.os }}-composer-"

- name: "Install dependencies"
run: "${{ env.composer-install }}"

- name: "Tests"
run: "make coverage"

- name: "Coveralls.io"
env:
CI_NAME: github
CI: true
COVERALLS_REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
php php-coveralls.phar --verbose --config tests/.coveralls.yml
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
/vendor
/composer.lock
tests/*/output
tests/*/output
tests/tmp
33 changes: 0 additions & 33 deletions .scrutinizer.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

File renamed without changes.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.PHONY: qa lint cs csf phpstan tests coverage

all:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs

vendor: composer.json composer.lock
composer install

qa: lint phpstan cs

lint: vendor
vendor/bin/linter src tests

cs: vendor
vendor/bin/codesniffer src tests

csf: vendor
vendor/bin/codefixer src tests

phpstan: vendor
vendor/bin/phpstan analyse -c phpstan.neon src

tests: vendor
vendor/bin/tester -s -p php --colors 1 -C tests/cases

coverage: vendor
vendor/bin/tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src ./tests/cases
Loading

0 comments on commit a3ec995

Please sign in to comment.