Skip to content
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
95 changes: 61 additions & 34 deletions .github/workflows/check-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,36 @@ name: File checker
on:
workflow_call:
outputs:
composer_count:
composer:
description: "Count changed Composer files"
value: ${{ jobs.check.outputs.composer_count }}
php_count:
value: ${{ jobs.check.outputs.composer }}
php:
description: "Count changed PHP files"
value: ${{ jobs.check.outputs.php_count }}
xml_count:
value: ${{ jobs.check.outputs.php }}
xml:
description: "Count changed XML files"
value: ${{ jobs.check.outputs.xml_count }}
ci_count:
value: ${{ jobs.check.outputs.xml }}
workflow:
description: "Count changed Workflow files"
value: ${{ jobs.check.outputs.ci_count }}
ci_phpcs_count:
value: ${{ jobs.check.outputs.workflow }}
phpcs:
description: "Count changed PHPCS files"
value: ${{ jobs.check.outputs.ci_phpcs_count }}
ci_php_cs_fixer_count:
value: ${{ jobs.check.outputs.phpcs }}
php-cs-fixer:
description: "Count changed PHP-CS-Fixer files"
value: ${{ jobs.check.outputs.ci_php_cs_fixer_count }}
ci_phpstan_count:
value: ${{ jobs.check.outputs.php-cs-fixer }}
phpstan:
description: "Count changed PHPStan files"
value: ${{ jobs.check.outputs.ci_phpstan_count }}
value: ${{ jobs.check.outputs.phpstan }}
phpunit-test:
description: "Count changed PhpUnit test files"
value: ${{ jobs.check.outputs.phpunit-test }}
phpunit:
description: "Count changed PhpUnit files"
value: ${{ jobs.check.outputs.phpunit }}
sonar:
description: "Count changed Sonar files"
value: ${{ jobs.check.outputs.sonar }}
# Allow manually triggering the workflow.
workflow_dispatch:

Expand All @@ -32,13 +41,16 @@ jobs:
name: Changed
runs-on: [ubuntu-latest]
outputs:
composer_count: ${{ steps.all.outputs.composer_count }}
php_count: ${{ steps.all.outputs.php_count }}
xml_count: ${{ steps.all.outputs.xml_count }}
ci_count: ${{ steps.all.outputs.ci_count }}
ci_phpcs_count: ${{ steps.all.outputs.ci_phpcs_count }}
ci_php_cs_fixer_count: ${{ steps.all.outputs.ci_php_cs_fixer_count }}
ci_phpstan_count: ${{ steps.all.outputs.ci_phpstan_count }}
composer: ${{ steps.all.outputs.composer }}
php: ${{ steps.all.outputs.php }}
xml: ${{ steps.all.outputs.xml }}
workflow: ${{ steps.all.outputs.workflow }}
phpcs: ${{ steps.all.outputs.phpcs }}
php-cs-fixer: ${{ steps.all.outputs.php-cs-fixer }}
phpstan: ${{ steps.all.outputs.phpstan }}
phpunit-test: ${{ steps.all.outputs.phpunit-test }}
phpunit: ${{ steps.all.outputs.phpunit }}
sonar: ${{ steps.all.outputs.sonar }}

steps:
- name: Checkout code
Expand Down Expand Up @@ -67,9 +79,12 @@ jobs:
**/*.php
**/*.xml
.github/workflows/**
.github/**phpcs**
.github/**php-cs-fixer**
.github/**phpstan**
**phpcs**
**php-cs-fixer**
**phpstan**
dev/tests/
dev/phpunit*
dev/sonar*

- name: Run step if any file(s) changed
id: all
Expand All @@ -79,28 +94,40 @@ jobs:

count="$(grep -oE "composer.*" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count Composer file(s) changed"
echo "composer_count=$count" >> $GITHUB_OUTPUT
echo "composer=$count" >> $GITHUB_OUTPUT

count="$(grep -oE "*.php" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count PHP file(s) changed"
echo "php_count=$count" >> $GITHUB_OUTPUT
echo "php=$count" >> $GITHUB_OUTPUT

count="$(grep -oE "*.xml" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count XML file(s) changed"
echo "xml_count=$count" >> $GITHUB_OUTPUT
echo "xml=$count" >> $GITHUB_OUTPUT

count="$(grep -oE ".github/workflows/**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count Workflow file(s) changed"
echo "ci_count=$count" >> $GITHUB_OUTPUT
echo "workflow=$count" >> $GITHUB_OUTPUT

count="$(grep -oE ".github/**phpcs**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
count="$(grep -oE "**phpcs**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count PHPCS file(s) changed"
echo "ci_phpcs_count=$count" >> $GITHUB_OUTPUT
echo "phpcs=$count" >> $GITHUB_OUTPUT

count="$(grep -oE ".github/**php-cs-fixer**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
count="$(grep -oE "**php-cs-fixer**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count PHP-CS-Fixer file(s) changed"
echo "ci_php_cs_fixer_count=$count" >> $GITHUB_OUTPUT
echo "php-cs-fixer=$count" >> $GITHUB_OUTPUT

count="$(grep -oE ".github/**phpstan**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
count="$(grep -oE "**phpstan**" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count PHPStan file(s) changed"
echo "ci_phpstan_count=$count" >> $GITHUB_OUTPUT
echo "phpstan=$count" >> $GITHUB_OUTPUT

count="$(grep -oE "dev/tests/" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count UnitTest test file(s) changed"
echo "phpunit-test=$count" >> $GITHUB_OUTPUT

count="$(grep -oE "dev/phpunit*" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count UnitTest file(s) changed"
echo "phpunit=$count" >> $GITHUB_OUTPUT

count="$(grep -oE "dev/sonar*" <<< "${{ steps.changed-files-specific.outputs.all_changed_files }}" | wc -l)"
echo "$count Sonar file(s) changed"
echo "sonar=$count" >> $GITHUB_OUTPUT
17 changes: 14 additions & 3 deletions .github/labeler.yml → .github/workflows/labeler-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
- lib/Mage/*
- lib/Mage/**/*

'Component: lib/Magento':
- lib/Magento/*
- lib/Magento/**/*

'Component: lib/Varien':
- lib/Varien/*
- lib/Varien/**/*
Expand Down Expand Up @@ -602,13 +606,20 @@
- .phpstorm.meta.php/*

'phpcs':
- .github/phpcs*.xml
- phpcs*
- .github/workflows/phpcs.yml

'php-cs-fixer':
- .github/php-cs-fixer*.php
- .php-cs-fixer*
- .github/workflows/php-cs-fixer.yml

'phpstan':
- .github/phpstan*.neon
- phpstan*
- .github/workflows/phpstan.yml

'phpunit':
- dev/test/*
- dev/phpunit*
- dev/sonar*
- .github/workflows/phpunit.yml
- .github/workflows/sonar.yml
2 changes: 2 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ jobs:
steps:
- uses: actions/labeler@main
with:
configuration-path: .github/workflows/labeler-labels.yml
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
continue-on-error: true
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*

- name: PHP-CS-Fixer
run: php vendor/bin/php-cs-fixer fix --config=.github/php-cs-fixer-ruleset.php --diff --dry-run
run: php vendor/bin/php-cs-fixer fix --diff --dry-run
10 changes: 5 additions & 5 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHPCodeSniffer Code Style Analyses
name: PHPCS

on:
workflow_call:
Expand All @@ -14,11 +14,11 @@ jobs:
matrix:
rules:
- label: Default
path: .github/phpcs-ruleset.xml
path: .phpcs.xml.dist
- label: Ecg
path: .github/phpcs-ruleset-ecg.xml
- label: PhpCompatibitliy
path: .github/phpcs-ruleset-php.xml
path: .phpcs.ecg.xml.dist
- label: PhpCompatibility
path: .phpcs.php.xml.dist

steps:
- name: Checkout code
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHPStan Static Code Analyses
name: PHPStan

on:
workflow_call:
Expand Down Expand Up @@ -28,4 +28,4 @@ jobs:
run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*

- name: PHPStan Static Analysis
run: XDEBUG_MODE=off php vendor/bin/phpstan.phar analyze -c .github/phpstan.neon
run: XDEBUG_MODE=off php vendor/bin/phpstan.phar analyze
5 changes: 4 additions & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: OpenMage LTS - Unit Tests
name: PHPUnit

on:
# Run automatically every Monday on midnight.
schedule:
- cron: '0 0 * * 1'
workflow_call:
# Allow manually triggering the workflow.
workflow_dispatch:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: OpenMage LTS - Sonar - Full Analyses
name: Sonar

on:
# Run automatically every Monday on midnight.
schedule:
- cron: '0 0 * * 1'
workflow_call:
# Allow manually triggering the workflow.
workflow_dispatch:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/syntax-php.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: PHP Validatation
name: PHP Syntax

on:
# Run automatically every Monday on midnight.
schedule:
- cron: '0 0 * * 1'
workflow_call:
# Allow manually triggering the workflow.
workflow_dispatch:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/syntax-xml.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: XML Validation
name: XML Syntax

on:
# Run automatically every Monday on midnight.
schedule:
- cron: '0 0 * * 1'
workflow_call:
# Allow manually triggering the workflow.
workflow_dispatch:
Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@ name: CI
on:
push:
paths:
- '.github/**'
- '.github/workflows/*'
- 'composer.json'
- 'composer.lock'
- '**.php'
- '**.xml'
- '.php-cs-fixer.dist.php'
- '.phpcs.xml.dist'
- '.phpcs.ecg.xml.dist'
- '.phpcs.php.xml.dist'
- 'phpstan.dist.neon'
- 'phpstan.dist.baseline.neon'

pull_request:
paths:
- '.github/**'
- '.github/workflows/*'
- 'composer.json'
- 'composer.lock'
- '**.php'
- '**.xml'
- '.php-cs-fixer.dist.php'
- '.phpcs.xml.dist'
- '.phpcs.ecg.xml.dist'
- '.phpcs.php.xml.dist'
- 'phpstan.dist.neon'
- 'phpstan.dist.baseline.neon'

jobs:
debug:
Expand All @@ -34,47 +46,53 @@ jobs:
composer:
name: Composer
needs: [check]
if: needs.check.outputs.composer_count > 0
if: needs.check.outputs.composer > 0
uses: ./.github/workflows/composer.yml

phpcs:
name: PHPCS
needs: [check]
if: needs.check.outputs.php_count > 0 || needs.check.outputs.ci_phpcs_count > 0 || needs.check.outputs.composer_count > 0 || needs.check.outputs.ci_count > 0
if: needs.check.outputs.php > 0 || needs.check.outputs.phpcs > 0 || needs.check.outputs.composer > 0 || needs.check.outputs.workflow > 0
uses: ./.github/workflows/phpcs.yml

php-cs-fixer:
name: PHP-CS-Fixer
needs: [check]
if: needs.check.outputs.php_count > 0 || needs.check.outputs.ci_php_cs_fixer_count > 0 || needs.check.outputs.composer_count > 0 || needs.check.outputs.ci_count > 0
if: needs.check.outputs.php > 0 || needs.check.outputs.php-cs-fixer > 0 || needs.check.outputs.composer > 0 || needs.check.outputs.workflow > 0
uses: ./.github/workflows/php-cs-fixer.yml

phpstan:
name: PHPStan
needs: [check]
if: needs.check.outputs.php_count > 0 || needs.check.outputs.ci_phpstan_count > 0 || needs.check.outputs.composer_count > 0 || needs.check.outputs.ci_count > 0
if: needs.check.outputs.php > 0 || needs.check.outputs.phpstan > 0 || needs.check.outputs.composer > 0 || needs.check.outputs.workflow > 0
uses: ./.github/workflows/phpstan.yml

# DOES NOT run by default
# runs on schedule or when worklfow changed
syntax_php:
name: Syntax
needs: [check, phpcs, php-cs-fixer]
if: needs.check.outputs.php_count > 0 || needs.check.outputs.composer_count > 0
if: needs.check.outputs.workflow > 0
uses: ./.github/workflows/syntax-php.yml

syntax_xml:
name: Syntax
needs: [check]
if: needs.check.outputs.xml_count > 0
if: needs.check.outputs.xml > 0
uses: ./.github/workflows/syntax-xml.yml

# DOES NOT run by default
# runs on schedule or when worklfow or unit tests changed
sonar:
name: Sonar Unit Tests
needs: [check, phpcs, php-cs-fixer]
if: needs.check.outputs.php_count > 0 || needs.check.outputs.composer_count > 0 || needs.check.outputs.ci_count > 0
if: needs.check.outputs.phpunit-test > 0 || needs.check.outputs.phpunit > 0 || needs.check.outputs.sonar > 0 || needs.check.outputs.workflow > 0
uses: ./.github/workflows/sonar.yml

# DOES NOT run by default
# runs on schedule or when worklfow or unit tests changed
unit_tests:
name: OpenMage LTS - Unit Tests
needs: [check, sonar]
if: needs.check.outputs.php_count > 0 || needs.check.outputs.composer_count > 0 || needs.check.outputs.ci_count > 0
if: needs.check.outputs.phpunit-test > 0 || needs.check.outputs.phpunit > 0 || needs.check.outputs.workflow > 0
uses: ./.github/workflows/phpunit.yml
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,14 @@
*.phar

# PHP-CS-Fixer cache
.php-cs-fixer.cache
.php-cs-fixer.cache

# Ignore custom config files
.php-cs-fixer*
!.php-cs-fixer.dist.*

.phpcs*.xml
!.phpcs*.xml.dist

phpstan*.neon
!phpstan.dist.*.neon
File renamed without changes.
Loading