-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PHPStan to verify code samples (#2370)
* Applied CI review suggestion * Added basic PHPStan config * Added PHPStan for ActivityLog examples * Added CI * [TMP] Added invalid code on purpose * Fixed auth issues * Fixed CS job * PHP CS Fixes * Rerun * Simplified namespaces * [TMP] Use the old namespace * Generated baseline * Reduced baseline * Finished reviewing baseline * PHP CS Fixes * Rerun * Removed autoloading * [TMP] Break * Adjusted lines * Apply suggestions from code review Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co> * Added space separation * Line offset fixes (#2430) * checkout_api.md: Fix included lines after PHPStan fixes * price_api.md: Fix included lines after PHPStan fixes The confirmation output at the end of "Resolve prices" example was missing. * create_custom_attribute_type.md: Fix highlighted line Two lines removed in 086b885 but the highlighted line wasn't updated. * search_api.md: Use `ContentTypeTermAggregation` lines * oauth_client.md: Fix PROVIDER_PREFIX highlight * segment_api.md: Fix highlighted line One line added in aeee20a but the highlighted line wasn't updated. (renaming from docs/api/public_php_api_managing_users.md to docs/users/segment_api.md in a9031bd) * segment_api.md: Fix highlighted lines One line added in aeee20a but the highlighted line wasn't updated. (renaming from docs/api/public_php_api_managing_users.md to docs/users/segment_api.md in a9031bd) * segment_api.md: Fix loadSegmentByIdentifier example intro * search_api.md: Fix #sorting-results offset * cart_api.md: Add missing EOF new line * Added basic PHPStan config * Added PHPStan for ActivityLog examples * Added CI * [TMP] Added invalid code on purpose * Fixed auth issues * Fixed CS job * PHP CS Fixes * Rerun * Simplified namespaces * [TMP] Use the old namespace * Generated baseline * Reduced baseline * Finished reviewing baseline * PHP CS Fixes * Rerun * Removed autoloading * [TMP] Break * Adjusted lines * Applied CI review suggestion * Apply suggestions from code review Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co> * Added space separation * Revert "[TMP] Break" This reverts commit ac2cfbb. * Bumped CS-Fixer version * Fixed CS * Removed redundant doc block from WebinarEventTitleFulltextFieldMapper * Added readme mention * Added empty line to cart_api * Removed CS-fixer dependencies * Improved cart_api * Update code_samples/recent_activity/src/Command/MonitorRecentContentCreationCommand.php Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> * PHP CS Fixes * Removed TMP changes --------- Co-authored-by: Konrad Oboza <konrad.oboza@ibexa.co> Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
- Loading branch information
1 parent
a516ddf
commit be149fd
Showing
94 changed files
with
868 additions
and
278 deletions.
There are no files selected for viewing
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,62 +1,106 @@ | ||
name: 'Build & test documentation' | ||
name: "Build & test documentation" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- '[0-9]+.[0-9]+' | ||
- "[0-9]+.[0-9]+" | ||
pull_request: ~ | ||
|
||
jobs: | ||
build: | ||
permissions: | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# added or changed files to the repository. | ||
contents: write | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# added or changed files to the repository. | ||
contents: write | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.8] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install php-cs-fixer | ||
run: composer require friendsofphp/php-cs-fixer --dev | ||
- name: Run PHP CS Fixer | ||
run: ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots | ||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: PHP CS Fixes | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Run build | ||
run: | | ||
mkdocs build --strict | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- uses: "ramsey/composer-install@v3" | ||
with: | ||
working-directory: "tools/php-cs-fixer" | ||
dependency-versions: highest | ||
|
||
- name: Run PHP CS Fixer | ||
run: tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots | ||
|
||
- name: Commit changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: PHP CS Fixes | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Run build | ||
run: | | ||
mkdocs build --strict | ||
vale-check: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'pull_request' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get Vale.sh configs | ||
env: | ||
TOKEN: ${{ secrets.EZROBOT_PAT }} | ||
run: | | ||
curl -H "Authorization: token $TOKEN" -L https://github.com/ibexa/vale-styles/archive/refs/heads/main.zip -o vale.zip | ||
unzip vale.zip | ||
rm vale.zip | ||
mv vale-styles-main/* vale-styles-main/.vale.ini . | ||
- name: Run Vale.sh | ||
uses: errata-ai/vale-action@reviewdog | ||
with: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get Vale.sh configs | ||
env: | ||
TOKEN: ${{ secrets.EZROBOT_PAT }} | ||
run: | | ||
curl -H "Authorization: token $TOKEN" -L https://github.com/ibexa/vale-styles/archive/refs/heads/main.zip -o vale.zip | ||
unzip vale.zip | ||
rm vale.zip | ||
mv vale-styles-main/* vale-styles-main/.vale.ini . | ||
- name: Run Vale.sh | ||
uses: errata-ai/vale-action@reviewdog | ||
with: | ||
reporter: github-check | ||
filter_mode: added | ||
|
||
code-samples: | ||
name: Validate code samples | ||
runs-on: "ubuntu-22.04" | ||
strategy: | ||
matrix: | ||
php: | ||
- "8.3" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup PHP Action | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
coverage: none | ||
extensions: "pdo_sqlite, gd" | ||
tools: cs2pr | ||
|
||
- name: Add composer keys for private packagist | ||
run: | | ||
composer config http-basic.updates.ibexa.co $SATIS_NETWORK_KEY $SATIS_NETWORK_TOKEN | ||
composer config github-oauth.github.com $TRAVIS_GITHUB_TOKEN | ||
env: | ||
SATIS_NETWORK_KEY: ${{ secrets.SATIS_NETWORK_KEY }} | ||
SATIS_NETWORK_TOKEN: ${{ secrets.SATIS_NETWORK_TOKEN }} | ||
TRAVIS_GITHUB_TOKEN: ${{ secrets.TRAVIS_GITHUB_TOKEN }} | ||
|
||
- uses: ramsey/composer-install@v3 | ||
with: | ||
dependency-versions: highest | ||
|
||
- name: Run PHPStan analysis | ||
run: composer phpstan |
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 |
---|---|---|
|
@@ -5,3 +5,4 @@ __pycache__/* | |
**/.idea/ | ||
.php-cs-fixer.cache | ||
composer.lock | ||
tools/php-cs-fixer/vendor |
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
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
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
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
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
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
Oops, something went wrong.