Skip to content

Commit

Permalink
Merge pull request #3407 from getkirby/release/3.5.6
Browse files Browse the repository at this point in the history
3.5.6
  • Loading branch information
bastianallgeier authored Jun 8, 2021
2 parents 6ee58bc + 2f38928 commit aadf1c2
Show file tree
Hide file tree
Showing 87 changed files with 17,979 additions and 697 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ scripts/ export-ignore

# tests
.codecov.yml export-ignore
.php_cs export-ignore
.php-cs-fixer.dist.php export-ignore
phpmd.xml.dist export-ignore
phpunit.xml.dist export-ignore
psalm.xml.dist export-ignore
Expand Down
123 changes: 65 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: CI
on: [push, pull_request]
on: [ push, pull_request ]

jobs:
backend-tests:
Expand All @@ -16,57 +16,70 @@ jobs:
matrix:
php: [ "7.3", "7.4", "8.0" ]
env:
extensions: mbstring, ctype, curl, gd, apcu, memcached, pcov
extensions: mbstring, ctype, curl, gd, apcu, memcached
ini: apc.enabled=1, apc.enable_cli=1, pcov.directory=., "pcov.exclude=\"~(vendor|tests)~\""

steps:
- name: Checkout Kirby
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
fetch-depth: 2

- name: Preparations
run: mkdir sarif

- name: Install memcached
uses: niden/actions-memcached@v7
uses: niden/actions-memcached@3b3ecd9d0d035ea92db716dc1540a7dbe9e56349 # pin@v7

- name: Install system locales
run: sudo apt-get update && sudo apt-get install -y locales-all

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

- name: Cache PHP extensions
uses: actions/cache@v2
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@27fc7bb418e73a1462a5604e3ea30e58ec1a6e1f # pin@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
ini-values: ${{ env.ini }}
coverage: pcov
tools: phpunit:^9
tools: phpunit:9.5.4, psalm:4.7.1

- name: Setup problem matchers
id: finishPrepare
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Cache analysis data
id: finishPrepare
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
with:
path: ~/.cache/psalm
key: backend-analysis-${{ matrix.php }}

- name: Run tests
if: always() && steps.finishPrepare.outcome == 'success'
run: phpunit --coverage-clover ${{ github.workspace }}/clover.xml

- name: Statically analyze using Psalm
if: always() && steps.finishPrepare.outcome == 'success'
run: psalm --output-format=github --php-version=${{ matrix.php }} --report=sarif/psalm.sarif --report-show-info=false

- name: Upload coverage results to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@a1ed4b322b4b38cb846afb5a0ebfa17086917d27 # pin@v1
with:
fail_ci_if_error: true
file: ${{ github.workspace }}/clover.xml
Expand All @@ -75,6 +88,12 @@ jobs:
env:
PHP: ${{ matrix.php }}

- name: Upload code scanning results to GitHub
if: always() && steps.finishPrepare.outcome == 'success'
uses: github/codeql-action/upload-sarif@4a083a45c246fee5483920bffe98a6e15c3fef32 # pin@v1
with:
sarif_file: sarif

frontend-e2e:
name: Frontend E2E

Expand All @@ -90,13 +109,13 @@ jobs:
extensions: mbstring, ctype, curl, gd, apcu, memcached

steps:
- name: Checkout Kirby
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
path: kirby

- name: Checkout Sandbox
uses: actions/checkout@v2
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2
with:
repository: getkirby/sandbox
path: sandbox
Expand All @@ -113,28 +132,28 @@ jobs:
- name: Setup PHP cache environment
id: ext-cache
uses: shivammathur/cache-extensions@v1
uses: shivammathur/cache-extensions@fd2695d35c6a2d131a586986d11f1e390c33c77d # pin@v1
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
key: e2e-v1

- name: Cache PHP extensions
uses: actions/cache@v2
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@27fc7bb418e73a1462a5604e3ea30e58ec1a6e1f # pin@v2
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
coverage: none

- name: Install dependencies
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@1db146275576798796bc39ef83d739924145298a # pin@v2
with:
working-directory: kirby/panel
runTests: false
Expand All @@ -151,7 +170,7 @@ jobs:
working-directory: kirby/panel

- name: Run tests
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@1db146275576798796bc39ef83d739924145298a # pin@v2
env:
CYPRESS_host: "http://127.0.0.1:8000"
with:
Expand All @@ -171,14 +190,14 @@ jobs:
- name: Archive Cypress screenshots
if: failure()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
with:
name: cypress-screenshots
path: kirby/panel/cypress/screenshots

- name: Archive Cypress videos
if: always()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@11830c9f4d30053679cb8904e3b3ce1b8c00bf40 # pin@v2
with:
name: cypress-videos
path: kirby/panel/cypress/videos
Expand All @@ -194,47 +213,41 @@ jobs:
runs-on: ubuntu-latest
env:
php: "7.4" # TODO: Update to PHP 8.0 when PHPMD supports it (https://github.com/phpmd/phpmd/issues/853)
php: "8.0"
extensions: mbstring, ctype, curl, gd, apcu, memcached

steps:
- name: Checkout Kirby
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2

- name: Preparations
run: mkdir sarif

- name: Setup PHP cache environment
id: ext-cache
uses: shivammathur/cache-extensions@v1
uses: shivammathur/cache-extensions@fd2695d35c6a2d131a586986d11f1e390c33c77d # pin@v1
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
key: php-analysis-v1

- name: Cache PHP extensions
uses: actions/cache@v2
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
with:
path: ${{ steps.ext-cache.outputs.dir }}
key: ${{ steps.ext-cache.outputs.key }}
restore-keys: ${{ steps.ext-cache.outputs.key }}

- name: Setup PHP environment
uses: shivammathur/setup-php@v2
id: finishPrepare
uses: shivammathur/setup-php@27fc7bb418e73a1462a5604e3ea30e58ec1a6e1f # pin@v2
with:
php-version: ${{ env.php }}
extensions: ${{ env.extensions }}
coverage: none
tools: |
composer:v2, composer-normalize,
composer-unused, phpcpd, psalm, phpmd
- name: Cache analysis data
id: finishPrepare
uses: actions/cache@v2
with:
path: ~/.cache/psalm
key: backend-analysis
composer:2.0.13, composer-normalize:2.13.3, composer-require-checker:3.2.0,
composer-unused:0.7.5, phpcpd:6.0.3, phpmd:2.10.0
- name: Validate composer.json/composer.lock
if: always() && steps.finishPrepare.outcome == 'success'
Expand All @@ -244,26 +257,21 @@ jobs:
if: always() && steps.finishPrepare.outcome == 'success'
run: composer-normalize --dry-run

# TODO: Re-enable when the fatal error in CI no longer appears
# - name: Check for unused Composer dependencies
# if: always() && steps.finishPrepare.outcome == 'success'
# run: composer unused --no-progress
- name: Check for unused Composer dependencies
if: always() && steps.finishPrepare.outcome == 'success'
run: composer unused --no-progress

- name: Check for duplicated code
if: always() && steps.finishPrepare.outcome == 'success'
run: phpcpd --fuzzy --exclude tests --exclude vendor .

- name: Statically analyze using Psalm
if: always() && steps.finishPrepare.outcome == 'success'
run: psalm --output-format=github --report=sarif/psalm.sarif --report-show-info=false

- name: Statically analyze using PHPMD
if: always() && steps.finishPrepare.outcome == 'success'
run: phpmd . ansi phpmd.xml.dist --exclude 'dependencies/*,tests/*,vendor/*'
run: phpmd . github phpmd.xml.dist --exclude 'dependencies/*,tests/*,vendor/*' --reportfile-sarif sarif/phpmd.sarif

- name: Upload code scanning results to GitHub
if: always() && steps.finishPrepare.outcome == 'success'
uses: github/codeql-action/upload-sarif@v1
uses: github/codeql-action/upload-sarif@4a083a45c246fee5483920bffe98a6e15c3fef32 # pin@v1
with:
sarif_file: sarif

Expand All @@ -272,18 +280,17 @@ jobs:

runs-on: ubuntu-latest
env:
# TODO: update to PHP 8.0 when PHP-CS-Fixer fully supports it
php: "7.4"
php: "8.0"

steps:
- name: Checkout Kirby
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@f1d3225b5376a0791fdee5a0e8eac5289355e43a # pin@v2

- name: Set up Node.js problem matchers
uses: actions/setup-node@v2
uses: actions/setup-node@0696555e99b7a8260864ca027af4b004eea59379 # pin@v2

- name: Cache npm dependencies
uses: actions/cache@v2
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
Expand All @@ -294,15 +301,15 @@ jobs:
working-directory: panel

- name: Setup PHP environment
uses: shivammathur/setup-php@v2
uses: shivammathur/setup-php@27fc7bb418e73a1462a5604e3ea30e58ec1a6e1f # pin@v2
with:
php-version: ${{ env.php }}
coverage: none
tools: php-cs-fixer:2.19.0
tools: php-cs-fixer:3.0.0

- name: Cache analysis data
id: finishPrepare
uses: actions/cache@v2
uses: actions/cache@1c6fb82ebbd610035c324e764e5e74d0e82f8a60 # pin@v2
with:
path: ~/.php-cs-fixer
key: coding-style
Expand All @@ -319,7 +326,7 @@ jobs:
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@v1
uses: reviewdog/action-suggester@5d5b9f8c693e036796f828e47886bd10d368c273 # pin@v1
with:
tool_name: ESLint
fail_on_error: 'true'
Expand All @@ -328,14 +335,14 @@ jobs:
if: always() && steps.finishPrepare.outcome == 'success'
# Use the --dry-run flag in push builds to get a failed CI status
run: >
php-cs-fixer fix --diff --diff-format=udiff
php-cs-fixer fix --diff
${{ github.event_name != 'pull_request' && '--dry-run' || '' }}
- name: Create code suggestions from the coding style changes (on PR only)
if: >
always() && steps.finishPrepare.outcome == 'success' &&
github.event_name == 'pull_request'
uses: reviewdog/action-suggester@v1
uses: reviewdog/action-suggester@5d5b9f8c693e036796f828e47886bd10d368c273 # pin@v1
with:
tool_name: PHP-CS-Fixer
fail_on_error: 'true'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/kirby.zip

# cs fixer
.php_cs.cache
.php-cs-fixer.cache

# editors
*.sublime-project
Expand Down
3 changes: 2 additions & 1 deletion .php_cs → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
->exclude('dependencies')
->in(__DIR__);

return PhpCsFixer\Config::create()
$config = new PhpCsFixer\Config();
return $config
->setRules([
'@PSR1' => true,
'@PSR2' => true,
Expand Down
Loading

0 comments on commit aadf1c2

Please sign in to comment.