Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust to the latest atk4/data #18

Merged
merged 28 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Release

on:
push:
branches:
- 'release/*'

jobs:
autocommit:
name: Build Release
runs-on: ubuntu-latest
container:
image: ghcr.io/mvorisek/image-php:latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Install PHP dependencies
run: composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader

- name: Update composer.json
run: >-
composer config --unset version && php -r '
$f = __DIR__ . "/composer.json";
$data = json_decode(file_get_contents($f), true);
foreach ($data as $k => $v) {
if (preg_match("~^(.+)-release$~", $k, $matches)) {
$data[$matches[1]] = $data[$k]; unset($data[$k]);
}
}
$str = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . "\n";
echo $str;
file_put_contents($f, $str);
'

- name: Commit
run: |
git config --global user.name "$(git show -s --format='%an')"
git config --global user.email "$(git show -s --format='%ae')"
git add . -N && (git diff --exit-code || git commit -a -m "Branch for stable release")

- name: Push
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 0 additions & 30 deletions .github/workflows/bundler.yml

This file was deleted.

16 changes: 0 additions & 16 deletions .github/workflows/release-drafter.yml

This file was deleted.

71 changes: 71 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Unit

on:
pull_request:
push:
schedule:
- cron: '0 0/2 * * *'

jobs:
smoke-test:
name: Smoke
runs-on: ubuntu-latest
container:
image: ghcr.io/mvorisek/image-php:${{ matrix.php }}
strategy:
fail-fast: false
matrix:
php: ['latest']
type: ['Phpunit']
include:
- php: 'latest'
type: 'CodingStyle'
- php: 'latest'
type: 'StaticAnalysis'
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Configure PHP
run: |
rm /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
php --version

- name: Setup cache 1/2
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Setup cache 2/2
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-smoke-${{ matrix.php }}-${{ matrix.type }}-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install PHP dependencies
run: |
if [ "${{ matrix.type }}" != "Phpunit" ] && [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpunit/phpunit johnkary/phpunit-speedtrap --dev; fi
if [ "${{ matrix.type }}" != "CodingStyle" ]; then composer remove --no-interaction --no-update friendsofphp/php-cs-fixer --dev; fi
if [ "${{ matrix.type }}" != "StaticAnalysis" ]; then composer remove --no-interaction --no-update phpstan/\* behat/\* --dev; fi
composer update --ansi --prefer-dist --no-interaction --no-progress --optimize-autoloader

- name: "Run tests: SQLite (only for Phpunit)"
if: startsWith(matrix.type, 'Phpunit')
run: |
echo "not implemented" || vendor/bin/phpunit --exclude-group none --no-coverage -v

- name: Check Coding Style (only for CodingStyle)
if: matrix.type == 'CodingStyle'
run: |
if [ "$(find demos/ -name '*.php' -print0 | xargs -0 grep -L "namespace Atk4\\\\Chart\\\\Demos[;\\\\]" | tee /dev/fd/2)" ]; then echo 'All demos/ files must have namespace declared' && (exit 1); fi
vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --verbose
composer config --unset version && composer config --unset require-release
composer validate --strict --no-check-lock && composer normalize --dry-run --no-check-lock

- name: Run Static Analysis (only for StaticAnalysis)
if: matrix.type == 'StaticAnalysis'
run: |
echo "memory_limit = 2G" > /usr/local/etc/php/conf.d/custom-memory-limit.ini
vendor/bin/phpstan analyse
80 changes: 0 additions & 80 deletions .github/workflows/unit-tests.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
docs/build
/build
/docs/build
/coverage
/vendor
/composer.lock
.idea
nbproject
.vscode
.DS_Store

local
Expand All @@ -14,4 +15,3 @@ cache
*.cache.*

/phpunit.xml
/phpunit-*.xml
25 changes: 18 additions & 7 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,25 @@
'vendor',
]);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' =>true,
'@PHP71Migration:risky' => true,
'@PhpCsFixer:risky' => true,
'@PHP74Migration:risky' => true,
'@PHP74Migration' => true,

// required by PSR-12
'concat_space' => [
'spacing' => 'one',
],

// disable some too strict rules
'phpdoc_types' => [
// keep enabled, but without "alias" group to not fix
// "Callback" to "callback" in phpdoc
'groups' => ['simple', 'meta'],
],
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'none',
Expand All @@ -30,11 +36,12 @@
'equal' => false,
'identical' => false,
],
'native_constant_invocation' => true,
'native_function_invocation' => false,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'void_return' => false,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'],
],
'combine_consecutive_issets' => false,
'combine_consecutive_unsets' => false,
'multiline_whitespace_before_semicolons' => false,
Expand All @@ -54,6 +61,10 @@
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => false,
],

// fn => without curly brackets is less readable,
// also prevent bounding of unwanted variables for GC
'use_arrow_functions' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php_cs.cache');
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');
20 changes: 0 additions & 20 deletions CHANGELOG.md

This file was deleted.

5 changes: 3 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ignore:
- demo
- docs
comment: false
coverage:
status:
project:
default:
target: auto
threshold: 0.1
threshold: 0.025
patch: false
changes: false

Loading