-
Notifications
You must be signed in to change notification settings - Fork 1
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
10 changed files
with
1,713 additions
and
706 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,38 @@ | ||
name: PHP checks | ||
name: PHP CS Fixer | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
branches: [ master, main ] | ||
pull_request: | ||
branches: [ master ] | ||
branches: [ master, main ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check: | ||
code-style: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # for Git to git apply | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
extensions: gd, intl, pdo_mysql | ||
coverage: none # disable xdebug, pcov | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.1' | ||
extensions: gd, intl, pdo_mysql | ||
coverage: none # disable xdebug, pcov | ||
|
||
# credits https://blog.markvincze.com/download-artifacts-from-a-latest-github-release-in-sh-and-powershell/ | ||
- name: Download latest REDAXO release | ||
run: | | ||
LATEST_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/redaxo/redaxo/releases/latest) | ||
REDAXO_VERSION=$(echo $LATEST_RELEASE | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') | ||
echo "Downloaded REDAXO $REDAXO_VERSION" | ||
curl -Ls -o redaxo.zip https://github.com/redaxo/redaxo/releases/download/$REDAXO_VERSION/redaxo_$REDAXO_VERSION.zip | ||
unzip -oq redaxo.zip -d redaxo_cms | ||
rm redaxo.zip | ||
# install dependencies from composer.json | ||
- name: Install test dependencies | ||
run: composer install --prefer-dist --no-progress | ||
|
||
- name: Init database | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
mysql -uroot -h127.0.0.1 -proot -e 'create database redaxo5;' | ||
git apply .github/workflows/default.config.yml.github-action.diff | ||
- name: Run PHP CS Fixer | ||
run: composer cs-dry | ||
|
||
- name: Setup REDAXO | ||
run: | | ||
php redaxo_cms/redaxo/bin/console setup:run -n --lang=de_de --agree-license --db-password=root --db-createdb=no --db-setup=normal --admin-username=admin --admin-password=adminpassword [email protected] --ansi | ||
# copy Addon files, ignore some directories... | ||
# install phpmailer | ||
# install the addon | ||
# if the addon name does not match the repository name, ${{ github.event.repository.name }} must be replaced with the addon name | ||
- name: Copy and install Addons | ||
run: | | ||
rsync -av --exclude='vendor' --exclude='.github' --exclude='.git' --exclude='redaxo_cms' './' 'redaxo_cms/redaxo/src/addons/${{ github.event.repository.name }}' | ||
redaxo_cms/redaxo/bin/console install:download 'yform' '4.0.2' | ||
redaxo_cms/redaxo/bin/console package:install 'yform' | ||
redaxo_cms/redaxo/bin/console package:install '${{ github.event.repository.name }}' | ||
- name: Install test dependencies | ||
working-directory: redaxo_cms/redaxo/src/addons/${{ github.event.repository.name }} | ||
env: | ||
COMPOSER: composer.json | ||
run: composer install --prefer-dist --no-progress | ||
|
||
- name: Setup Problem Matchers for PHPUnit | ||
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | ||
|
||
- name: Run lint | ||
working-directory: redaxo_cms/redaxo/src/addons/${{ github.event.repository.name }} | ||
run: composer lint | ||
|
||
- name: Run phpcs | ||
working-directory: redaxo_cms/redaxo/src/addons/${{ github.event.repository.name }} | ||
run: composer phpcs | ||
|
||
# - name: Run phpunit | ||
# working-directory: redaxo_cms/redaxo/src/addons/${{ github.event.repository.name }} | ||
# run: composer test | ||
# - uses: stefanzweifel/git-auto-commit-action@v4 | ||
# with: | ||
# commit_message: Apply php-cs-fixer changes |
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,2 +1,3 @@ | ||
/.idea/ | ||
/vendor/ | ||
/.php-cs-fixer.cache |
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
$finder = (new PhpCsFixer\Finder()) | ||
->in(__DIR__) | ||
; | ||
|
||
return (new Redaxo\PhpCsFixerConfig\Config()) | ||
->setFinder($finder) | ||
; |
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
{ | ||
"license": "MIT", | ||
"scripts": { | ||
"lint": "phplint ./ --exclude=vendor --no-cache lib", | ||
"phpcs": "phpcs --ignore=*/vendor/* --extensions=php --standard=phpcs.xml lib", | ||
"phpcbf": "phpcbf --extensions=php --standard=phpcs.xml lib", | ||
"cs-dry": "php-cs-fixer fix -v --ansi --dry-run --config=.php-cs-fixer.dist.php", | ||
"cs-fix": "php-cs-fixer fix -v --ansi --config=.php-cs-fixer.dist.php", | ||
"test": "phpunit --testdox" | ||
}, | ||
"require-dev": { | ||
"redaxo/php-cs-fixer-config": "^2.0", | ||
"friendsofphp/php-cs-fixer": "^3.14", | ||
"phpunit/phpunit": "^9.5", | ||
"squizlabs/php_codesniffer": "^3.6", | ||
"overtrue/phplint": "^4.1" | ||
"psr/log": "1.1.4", | ||
"symfony/console": "5.4" | ||
} | ||
} |
Oops, something went wrong.