diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml index 8c69ef1..59465c1 100644 --- a/.github/workflows/auto-merge-dependabot.yml +++ b/.github/workflows/auto-merge-dependabot.yml @@ -18,6 +18,12 @@ jobs: uses: dependabot/fetch-metadata@v2.4.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Add custom labels + run: gh pr edit "${{github.event.pull_request.html_url}}" --add-label "with-nightly-tests" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + - name: Enable auto-merge for Dependabot PRs if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}} run: gh pr merge --auto --squash "$PR_URL" diff --git a/.github/workflows/coverage-upload.yml b/.github/workflows/coverage-upload.yml index 1aeac5c..0d66a5d 100644 --- a/.github/workflows/coverage-upload.yml +++ b/.github/workflows/coverage-upload.yml @@ -9,8 +9,8 @@ permissions: checks: write # For the check run creation ! jobs: - upload: - name: Upload + coverage: + name: Coverage permissions: contents: read checks: write # For the check run creation ! diff --git a/.github/workflows/pre-check-CI-updates.yml b/.github/workflows/pre-check-CI-updates.yml index 5782d5b..1a9abcc 100644 --- a/.github/workflows/pre-check-CI-updates.yml +++ b/.github/workflows/pre-check-CI-updates.yml @@ -30,8 +30,8 @@ jobs: contents: read uses: ./.github/workflows/reusable-CI-workflow.yml - upload: - name: Upload + coverage: + name: Coverage needs: [tests] permissions: contents: read diff --git a/.github/workflows/reusable-CI-workflow.yml b/.github/workflows/reusable-CI-workflow.yml index d9331a2..8c72116 100644 --- a/.github/workflows/reusable-CI-workflow.yml +++ b/.github/workflows/reusable-CI-workflow.yml @@ -60,12 +60,12 @@ jobs: - job-name: Up to date versions # => Highest versions allowed by composer config php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' symfony-version: '${{ needs.fetch-supported-versions.outputs.symfony-max }}' - ## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) + # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) pkg-extra-constraints: behat/gherkin:~4.12.0 - job-name: Up to date versions - Special case - Symfony 5.4 php-version: '${{ needs.fetch-supported-versions.outputs.php-max }}' symfony-version: '5.4' - ## Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) + # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) pkg-extra-constraints: behat/gherkin:~4.12.0 - job-name: Bare minimum # => Lowest versions allowed by composer config php-version: '${{ needs.fetch-supported-versions.outputs.php-min }}' @@ -223,9 +223,9 @@ jobs: needs: [ fetch-supported-versions, tests ] if: ${{ github.event_name == 'push' || ( github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'with-nightly-tests') ) }} runs-on: ubuntu-latest - continue-on-error: true permissions: contents: read + continue-on-error: true env: COMPOSER_IGNORE_PLATFORM_REQ: 'php+' strategy: @@ -247,7 +247,7 @@ jobs: symfony-version: ${{ needs.fetch-supported-versions.outputs.symfony-next }} # Fix - behat/gherkin => Avoid issue with behat <-> gherkin packages (See https://github.com/Behat/Gherkin/issues/317) # Fix - symfony/framework-bundle - Framework bundle <7.0 require php 8.1 minimum ! - pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.0' && needs.fetch-supported-versions.outputs.php-max == '8.4' ) && 'symfony/framework-bundle:~7.0.0@dev' || '' }} + pkg-extra-constraints: behat/gherkin:~4.12.0 ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.0' && needs.fetch-supported-versions.outputs.php-max == '8.4' ) && 'symfony/framework-bundle:~7.0.0@dev' || '' }} - job-name: Symfony - With lowest supported PHP version # Fix - Sf 7.0 require php 8.1 minimum, most of deps require 8.2 ! php-version: ${{ ( needs.fetch-supported-versions.outputs.symfony-next == '7.0' && needs.fetch-supported-versions.outputs.php-min == '8.0' ) && '8.2' || needs.fetch-supported-versions.outputs.php-min }} diff --git a/.github/workflows/reusable-coverage-upload-workflow.yml b/.github/workflows/reusable-coverage-upload-workflow.yml index 9719564..a28b160 100644 --- a/.github/workflows/reusable-coverage-upload-workflow.yml +++ b/.github/workflows/reusable-coverage-upload-workflow.yml @@ -32,6 +32,8 @@ jobs: outputs: commit-sha: ${{ steps.fetch-workflow-metadata.outputs.commit-sha }} run-id: ${{ steps.fetch-workflow-metadata.outputs.run-id }} + branch: ${{ steps.fetch-workflow-metadata.outputs.branch }} + pull-request: ${{ steps.fetch-workflow-metadata.outputs.pull-request }} codacy-uploader: name: Codacy @@ -64,6 +66,6 @@ jobs: run-id: ${{ needs.fetch-info.outputs.run-id }} force-git-commit: ${{ needs.fetch-info.outputs.commit-sha }} force-git-branch: ${{ needs.fetch-info.outputs.branch }} - force-gh-pr: ${{ needs.fetch-info.outputs.pr-number }} + force-gh-pr: ${{ needs.fetch-info.outputs.pull-request }} force-uploader-build: ${{ needs.fetch-info.outputs.run-id }} force-uploader-build-url: ${{ needs.fetch-info.outputs.run-url }} diff --git a/.gitignore b/.gitignore index 938ac64..4cb177e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ build #A library must not provide a composer.lock file composer.lock +# Demo app excluded dirs features/demo_app/var/ #Phpunit diff --git a/.remarkrc b/.remarkrc index 0527df5..5bf1fca 100644 --- a/.remarkrc +++ b/.remarkrc @@ -1,6 +1,10 @@ { "plugins": [ "remark-preset-lint-consistent", - "remark-preset-lint-recommended" + "remark-preset-lint-recommended", + [ + "remark-lint-list-item-indent", + "space" + ] ] } diff --git a/.scrutinizer.yml b/.scrutinizer.yml index b579dd2..938ad6a 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -41,7 +41,6 @@ build: variables: CI: 'true' TEST_OUTPUT_STYLE: 'pretty' - COMPOSER_OPTIONS: '--optimize-autoloader' COVERAGE_OUTPUT_STYLE: 'clover' COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml' PHPCS_DISABLE_WARNING: 'true' diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index c4f2952..2d53c83 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -23,13 +23,13 @@ include: Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or - advances + advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic - address, without explicit permission + address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a - professional setting + professional setting ## Our Responsibilities diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b903c49..734ac2b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,33 +1,39 @@ # Contributing ## Getting Started - * Fork, then clone the repo: + +* Fork, then clone the repo: + ```bash git clone git@github.com:your-username/symfony-jsonrpc-http-server-doc.git -```` +``` + +* Make sure everything goes well: - * Make sure everything goes well: ```bash make build make test ``` - * Make your changes (Add/Update tests according to your changes). - * Make sure tests are still green: +* Make your changes (Add/Update tests according to your changes). +* Make sure tests are still green: + ```bash make test ``` - * To check code coverage, launch +* To check code coverage, launch + ```bash make coverage ``` - * Push to your fork and [submit a pull request](https://github.com/yoanm/symfony-jsonrpc-http-server-doc/compare/). - * Wait for feedback or merge. +* Push to your fork and [submit a pull request](https://github.com/yoanm/symfony-jsonrpc-http-server-doc/compare/). +* Wait for feedback or merge. + +Some stuff that will increase your pull request's acceptance: - Some stuff that will increase your pull request's acceptance: - * Write tests. - * Follow PSR-2 coding style. - * Write good commit messages. - * Do not rebase or squash your commits when a review has been made. +* Write tests. +* Follow PSR-2 coding style. +* Write good commit messages. +* Do not rebase or squash your commits when a review has been made. diff --git a/Makefile b/Makefile index fdbc8a1..0c3c84f 100644 --- a/Makefile +++ b/Makefile @@ -109,5 +109,13 @@ scrutinizer-behat: create-build-directories: mkdir -p ${PHPUNIT_COVERAGE_DIRECTORY} ${BEHAT_COVERAGE_DIRECTORY} ${REPORTS_DIRECTORY} +.PHONY: configure-dev-env +configure-dev-env: + npm install --global remark-cli remark-preset-lint-consistent remark-preset-lint-recommended remark-lint-list-item-indent + +.PHONY: lint-markdown +lint-markdown: + npx remark . --output + .PHONY: build install configure test test-unit test-functional codestyle create-build-directories scrutinizer-behat scrutinizer-phpunit .DEFAULT: build diff --git a/README.md b/README.md index b55987d..d282c25 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![License](https://img.shields.io/github/license/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://github.com/yoanm/symfony-jsonrpc-http-server-doc) [![Code size](https://img.shields.io/github/languages/code-size/yoanm/symfony-jsonrpc-http-server-doc.svg)](https://github.com/yoanm/symfony-jsonrpc-http-server-doc) -[![Dependabot Status](https://api.dependabot.com/badges/status?host=github\&repo=yoanm/symfony-jsonrpc-http-server-doc)](https://dependabot.com) +![Dependabot Status](https://flat.badgen.net/github/dependabot/yoanm/symfony-jsonrpc-http-server-doc) +![Last commit](https://badgen.net/github/last-commit/yoanm/symfony-jsonrpc-http-server-doc) [![Scrutinizer Build Status](https://img.shields.io/scrutinizer/build/g/yoanm/symfony-jsonrpc-http-server-doc.svg?label=Scrutinizer\&logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/build-status/master) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/yoanm/symfony-jsonrpc-http-server-doc/master.svg?logo=scrutinizer)](https://scrutinizer-ci.com/g/yoanm/symfony-jsonrpc-http-server-doc/?branch=master) @@ -23,9 +24,9 @@ See [yoanm/symfony-jsonrpc-params-sf-constraints-doc](https://github.com/yoanm/s ## Availble formats -* Raw : Built-in `json` format at `/doc` or `/doc/raw.json` -* Swagger : [yoanm/symfony-jsonrpc-http-server-swagger-doc](https://github.com/yoanm/symfony-jsonrpc-http-server-swagger-doc) -* OpenApi : [yoanm/symfony-jsonrpc-http-server-openapi-doc](https://github.com/yoanm/symfony-jsonrpc-http-server-openapi-doc) +* Raw : Built-in `json` format at `/doc` or `/doc/raw.json` +* Swagger : [yoanm/symfony-jsonrpc-http-server-swagger-doc](https://github.com/yoanm/symfony-jsonrpc-http-server-swagger-doc) +* OpenApi : [yoanm/symfony-jsonrpc-http-server-openapi-doc](https://github.com/yoanm/symfony-jsonrpc-http-server-openapi-doc) ## How to use @@ -37,45 +38,45 @@ See below how to configure it. *[Behat demo app configuration folders](./features/demo_app/) can be used as examples.* -* Add the bundles in your `config/bundles.php` file: - ```php - // config/bundles.php - return [ - ... - Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], - Yoanm\SymfonyJsonRpcHttpServer\JsonRpcHttpServerBundle::class => ['all' => true], - Yoanm\SymfonyJsonRpcHttpServerDoc\JsonRpcHttpServerDocBundle::class => ['all' => true], - ... - ]; - ``` - -* Add the following in your routing configuration : - ```yaml - # config/routes.yaml - json-rpc-endpoint: - resource: '@JsonRpcHttpServerBundle/Resources/config/routing/endpoint.xml' - - json-rpc-endpoint-doc: - resource: '@JsonRpcHttpServerDocBundle/Resources/config/routing/endpoint.xml' - ``` - -* Add the following in your configuration : - ```yaml - # config/config.yaml - framework: - secret: '%env(APP_SECRET)%' - - json_rpc_http_server: ~ - - json_rpc_http_server_doc: ~ - # Or the following in case you want to customize endpoint path - #json_rpc_http_server_doc: - # endpoint: '/my-custom-doc-endpoint' # Default to '/doc' - ``` - -* Register JSON-RPC methods as described on [yoanm/symfony-jsonrpc-http-server](https://github.com/yoanm/symfony-jsonrpc-http-server) documentation. - -* Query your project at `/doc` endpoint and you will have a `json` documentation of your server. +* Add the bundles in your `config/bundles.php` file: + ```php + // config/bundles.php + return [ + ... + Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Yoanm\SymfonyJsonRpcHttpServer\JsonRpcHttpServerBundle::class => ['all' => true], + Yoanm\SymfonyJsonRpcHttpServerDoc\JsonRpcHttpServerDocBundle::class => ['all' => true], + ... + ]; + ``` + +* Add the following in your routing configuration : + ```yaml + # config/routes.yaml + json-rpc-endpoint: + resource: '@JsonRpcHttpServerBundle/Resources/config/routing/endpoint.xml' + + json-rpc-endpoint-doc: + resource: '@JsonRpcHttpServerDocBundle/Resources/config/routing/endpoint.xml' + ``` + +* Add the following in your configuration : + ```yaml + # config/config.yaml + framework: + secret: '%env(APP_SECRET)%' + + json_rpc_http_server: ~ + + json_rpc_http_server_doc: ~ + # Or the following in case you want to customize endpoint path + #json_rpc_http_server_doc: + # endpoint: '/my-custom-doc-endpoint' # Default to '/doc' + ``` + +* Register JSON-RPC methods as described on [yoanm/symfony-jsonrpc-http-server](https://github.com/yoanm/symfony-jsonrpc-http-server) documentation. + +* Query your project at `/doc` endpoint and you will have a `json` documentation of your server. ## Contributing diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e85eeb9..0b44794 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,7 @@ - - - - - - - - tests/Functional - - - tests/Technical - - - - - - src - - + + + src + + + + + + + + tests/Functional + + + tests/Technical + +