-
Notifications
You must be signed in to change notification settings - Fork 2
Add minimal CI/QA checks #11
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
Open
jrfnl
wants to merge
15
commits into
main
Choose a base branch
from
feature/add-minimal-ci
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d763532
.gitignore: use top-level file instead of per-directory
jrfnl 8151a51
Composer: normalize the file
jrfnl 0476716
Composer: update maintainers list
jrfnl 25e6d80
CI: lint the PHP files against all supported versions
jrfnl 5e124ee
Add dependabot configuration
jrfnl 56506c3
CI: run QA on GHA workflows
jrfnl 456c845
CI: run PHPCS over the code
jrfnl b6327e7
CS: consistent whitespace use
jrfnl 38b24db
CS/QA: use short arrays
jrfnl 02d5134
CS/QA: always use braces for control structures
jrfnl e52c576
Response: rename method to CamelCase
jrfnl 11ee0ac
CS/QA: miscellaneous other fixes
jrfnl 5423273
PHP-cross version: ensure same output independently of PHP version
jrfnl f36f3f4
CS/QA: use static closures (not enforced)
jrfnl 17146ac
CS/QA: strict comparisons (not enforced)
jrfnl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,16 @@ | ||
| # Dependabot configuration. | ||
| # | ||
| # Please see the documentation for all configuration options: | ||
| # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| open-pull-requests-limit: 5 | ||
| commit-message: | ||
| prefix: "GH Actions:" | ||
| labels: | ||
| - "testing/chores/QA" | ||
This file contains hidden or 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,67 @@ | ||
| name: CS | ||
|
|
||
| on: | ||
| # Run on all pushes and on all pull requests. | ||
| push: | ||
| pull_request: | ||
| # Allow manually triggering the workflow. | ||
| workflow_dispatch: | ||
|
|
||
| # Cancels all previous workflow runs for the same branch that have not yet completed. | ||
| concurrency: | ||
| # The concurrency group contains the workflow name and the branch name. | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| actionlint: #---------------------------------------------------------------------- | ||
| name: 'Check GHA workflows' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Add problem matcher | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| shell: bash | ||
| run: | | ||
| curl -o actionlint-matcher.json https://raw.githubusercontent.com/rhysd/actionlint/main/.github/actionlint-matcher.json | ||
| echo "::add-matcher::actionlint-matcher.json" | ||
|
|
||
| - name: Check workflow files | ||
| uses: docker://rhysd/actionlint:latest | ||
| with: | ||
| args: -color | ||
|
|
||
| phpcs: #---------------------------------------------------------------------- | ||
| name: 'PHPCS' | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: 'latest' | ||
| coverage: none | ||
| tools: cs2pr | ||
|
|
||
| # Install dependencies and handle caching in one go. | ||
| # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer | ||
| - name: Install Composer dependencies | ||
| uses: "ramsey/composer-install@v3" | ||
| with: | ||
| # Bust the cache at least once a month - output format: YYYY-MM. | ||
| custom-cache-suffix: $(date -u "+%Y-%m") | ||
|
|
||
| # Check the code-style consistency of the PHP files. | ||
| - name: Check PHP code style | ||
| id: phpcs | ||
| run: composer checkcs -- --report-full --report-checkstyle=./phpcs-report.xml | ||
|
|
||
| - name: Show PHPCS results in PR | ||
| if: ${{ always() && steps.phpcs.outcome == 'failure' }} | ||
|
jrfnl marked this conversation as resolved.
|
||
| run: cs2pr ./phpcs-report.xml | ||
This file contains hidden or 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,50 @@ | ||
| name: Lint | ||
|
|
||
| on: | ||
| # Run on all pushes and on all pull requests. | ||
| push: | ||
| pull_request: | ||
| # Allow manually triggering the workflow. | ||
| workflow_dispatch: | ||
|
|
||
| # Cancels all previous workflow runs for the same branch that have not yet completed. | ||
| concurrency: | ||
| # The concurrency group contains the workflow name and the branch name. | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| lint: #---------------------------------------------------------------------- | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] | ||
|
|
||
| name: "Lint: PHP ${{ matrix.php }}" | ||
| continue-on-error: ${{ matrix.php == '8.5' }} | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php }} | ||
| ini-values: error_reporting=-1, display_errors=On, log_errors_max_len=0 | ||
| coverage: none | ||
| tools: cs2pr | ||
|
|
||
| # Install dependencies and handle caching in one go. | ||
| # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer | ||
| - name: Install Composer dependencies | ||
| uses: "ramsey/composer-install@v3" | ||
| with: | ||
| # For PHP "nightly", we need to install with ignore platform reqs. | ||
| composer-options: ${{ matrix.php == '8.5' && '--ignore-platform-req=php+' || '' }} | ||
| # Bust the cache at least once a month - output format: YYYY-MM. | ||
| custom-cache-suffix: $(date -u "+%Y-%m") | ||
|
|
||
| - name: Lint against parse errors | ||
| run: composer lint -- --checkstyle | cs2pr |
This file contains hidden or 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 @@ | ||
| # Ignore temporary files. | ||
| /bin/http.log | ||
| /bin/http.pid | ||
|
|
||
| # Ignore composer related files | ||
| /composer.lock | ||
| /vendor | ||
|
|
||
| # Ignore local overrides of the PHPCS config file. | ||
| .phpcs.xml | ||
| phpcs.xml |
This file contains hidden or 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,72 @@ | ||
| <?xml version="1.0"?> | ||
| <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| name="Requests Test Server" | ||
| xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
|
|
||
| <description>Requests Test Server rules for PHP_CodeSniffer</description> | ||
|
|
||
| <!-- | ||
| ############################################################################# | ||
| COMMAND LINE ARGUMENTS | ||
| https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml | ||
| ############################################################################# | ||
| --> | ||
|
|
||
| <!-- Scan all files. --> | ||
| <file>.</file> | ||
|
|
||
| <!-- Third party files and build files don't need to comply with these coding standards. --> | ||
| <exclude-pattern>*/vendor/*</exclude-pattern> | ||
|
|
||
| <!-- Only check PHP files. --> | ||
| <arg name="extensions" value="php"/> | ||
|
|
||
| <!-- Show progress, show the error codes for each message (source). --> | ||
| <arg value="ps"/> | ||
|
|
||
| <!-- Strip the filepaths down to the relevant bit. --> | ||
| <arg name="basepath" value="./"/> | ||
|
|
||
| <!-- Check up to 8 files simultaneously. --> | ||
| <arg name="parallel" value="8"/> | ||
|
|
||
| <!-- Default tab width for indentation fixes and such. --> | ||
| <arg name="tab-width" value="4"/> | ||
|
|
||
| <!-- | ||
| ############################################################################# | ||
| CHECK FOR PHP CROSS-VERSION COMPATIBILITY | ||
| ############################################################################# | ||
| --> | ||
|
|
||
| <config name="testVersion" value="5.6-"/> | ||
| <rule ref="PHPCompatibility"/> | ||
|
|
||
|
|
||
| <!-- | ||
| ############################################################################# | ||
| CODING STYLE RULES | ||
| ############################################################################# | ||
| --> | ||
|
|
||
| <!-- Use PSR-12 as a basis, but with tweaks. --> | ||
| <rule ref="PSR12"> | ||
| <exclude name="Generic.WhiteSpace.DisallowTabIndent"/> | ||
| </rule> | ||
|
|
||
| <!-- ========================================================================== | ||
| Enforce tab indentation. | ||
| ========================================================================== --> | ||
| <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/> | ||
|
|
||
| <!-- ========================================================================== | ||
| Disallow Yoda conditions. | ||
| ========================================================================== --> | ||
| <rule ref="Generic.ControlStructures.DisallowYodaConditions"/> | ||
|
|
||
| <!-- ========================================================================== | ||
| Enforce short arrays. | ||
| ========================================================================== --> | ||
| <rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | ||
|
|
||
| </ruleset> |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,18 +1,65 @@ | ||
| { | ||
| "name": "requests/test-server", | ||
| "description": "Test server to respond to Requests' tests!", | ||
| "homepage": "http://github.com/RequestsPHP/test-server", | ||
| "license": "ISC", | ||
| "keywords": ["http", "test"], | ||
| "type": "library", | ||
| "keywords": [ | ||
| "http", | ||
| "test" | ||
| ], | ||
| "authors": [ | ||
| { | ||
| "name": "Ryan McCue", | ||
| "homepage": "http://ryanmccue.info" | ||
| }, | ||
| { | ||
| "name": "Alain Schlesser", | ||
| "homepage": "https://github.com/schlessera" | ||
| }, | ||
| { | ||
| "name": "Juliette Reinders Folmer", | ||
| "homepage": "https://github.com/jrfnl" | ||
| }, | ||
| { | ||
| "name": "Contributors", | ||
| "homepage": "https://github.com/RequestsPHP/test-server/graphs/contributors" | ||
| } | ||
| ], | ||
| "homepage": "http://github.com/RequestsPHP/test-server", | ||
| "require": { | ||
| "php": ">=5.6" | ||
| }, | ||
| "type": "library", | ||
| "bin": [ "bin/start.sh", "bin/stop.sh", "bin/serve.php" ] | ||
| "require-dev": { | ||
| "php-parallel-lint/php-console-highlighter": "^1.0", | ||
| "php-parallel-lint/php-parallel-lint": "^1.4", | ||
| "phpcompatibility/php-compatibility": "dev-develop", | ||
| "squizlabs/php_codesniffer": "^3.11" | ||
| }, | ||
| "bin": [ | ||
| "bin/serve.php", | ||
| "bin/start.sh", | ||
| "bin/stop.sh" | ||
| ], | ||
| "config": { | ||
| "allow-plugins": { | ||
| "dealerdirect/phpcodesniffer-composer-installer": true | ||
| }, | ||
| "lock": false | ||
| }, | ||
| "scripts": { | ||
| "checkcs": [ | ||
| "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs" | ||
| ], | ||
| "fixcs": [ | ||
| "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf" | ||
| ], | ||
| "lint": [ | ||
| "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php --exclude vendor --exclude .git" | ||
| ] | ||
| }, | ||
| "scripts-descriptions": { | ||
| "checkcs": "Check the entire codebase for code-style issues.", | ||
| "fixcs": "Fix all auto-fixable code-style issues in the entire codebase.", | ||
| "lint": "Lint PHP files to find parse errors." | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.