-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(new-start): Refactored bundle (#1)
* . * . * . * it works propably * readme updated * removed secrets
- Loading branch information
1 parent
c7745d9
commit e79353e
Showing
37 changed files
with
4,183 additions
and
1,152 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,3 +1,20 @@ | ||
# In all environments, the following files are loaded if they exist, | ||
# the latter taking precedence over the former: | ||
# | ||
# * .env contains default values for the environment variables needed by the app | ||
# * .env.local uncommitted file with local overrides | ||
# * .env.$APP_ENV committed environment-specific defaults | ||
# * .env.$APP_ENV.local uncommitted environment-specific overrides | ||
# | ||
# Real environment variables win over .env files. | ||
# | ||
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. | ||
# https://symfony.com/doc/current/configuration/secrets.html | ||
# | ||
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). | ||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration | ||
|
||
###> symfony/framework-bundle ### | ||
APP_ENV=local | ||
APP_SECRET=mrUNGjJoBIWWDoHLuX9KDpYsAduxugyPtX4STBT2 | ||
APP_DEBUG=true | ||
APP_SECRET=$ecretf0rt3st | ||
###< symfony/framework-bundle ### |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# define your env variables for the test env here | ||
KERNEL_CLASS='PBaszak\ExtendedApiDoc\Tests\Kernel' | ||
APP_SECRET='$ecretf0rt3st' | ||
SYMFONY_DEPRECATIONS_HELPER=999999 | ||
PANTHER_APP_ENV=panther | ||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots |
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,18 +1,26 @@ | ||
name: CI | ||
name: Symfony Application Check | ||
|
||
on: [push] | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- uses: php-actions/composer@v6 | ||
- name: Running start.sh Script | ||
run: bash start.sh | ||
|
||
- name: PHPUnit Tests | ||
uses: php-actions/phpunit@master | ||
with: | ||
configuration: phpunit.xml.dist | ||
exclude_group: integration, performance | ||
- name: Application Verification | ||
run: docker exec php composer cache:clear | ||
|
||
- name: Running PHPStan | ||
run: docker exec php composer code:analyse | ||
|
||
- name: Running PHP-CS-Fixer | ||
run: docker exec php composer code:fix -- --dry-run --diff -vvv | ||
|
||
- name: Running PHPUnit | ||
run: docker exec php composer test:cc |
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
stages: | ||
- compile | ||
- test | ||
# - deploy | ||
|
||
compile: | ||
stage: compile | ||
image: composer:latest | ||
script: | ||
- composer install | ||
artifacts: | ||
when: always | ||
paths: | ||
- vendor/ | ||
- var/cache/ | ||
expire_in: 10 minutes | ||
only: | ||
- merge_requests | ||
- master | ||
tags: | ||
- docker | ||
|
||
code:analyse: | ||
stage: test | ||
image: php:latest | ||
script: | ||
- vendor/bin/phpstan analyse src -c tools/phpstan/fpm-config.neon | ||
only: | ||
- merge_requests | ||
- master | ||
tags: | ||
- docker | ||
needs: | ||
- job: compile | ||
artifacts: true | ||
|
||
code:cs-fixer: | ||
stage: test | ||
image: php:latest | ||
script: | ||
- vendor/bin/php-cs-fixer fix --dry-run --diff -vvv | ||
only: | ||
- merge_requests | ||
- master | ||
tags: | ||
- docker | ||
needs: | ||
- job: compile | ||
artifacts: true | ||
|
||
code:test: | ||
stage: test | ||
image: php:latest | ||
before_script: | ||
- pecl install xdebug | ||
- docker-php-ext-enable xdebug | ||
- echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
script: | ||
- vendor/bin/phpunit --do-not-cache-result --log-junit var/coverage/phpunit-report.xml --coverage-cobertura var/coverage/phpunit-coverage.xml --coverage-text --colors=never | ||
only: | ||
- merge_requests | ||
- master | ||
tags: | ||
- docker | ||
needs: | ||
- job: compile | ||
artifacts: true | ||
artifacts: | ||
when: always | ||
reports: | ||
junit: var/coverage/phpunit-report.xml | ||
coverage_report: | ||
coverage_format: cobertura | ||
path: var/coverage/phpunit-coverage.xml | ||
coverage: '/^\s*Lines:\s*\d+.\d+\%/' | ||
|
||
# deploy: | ||
# stage: deploy | ||
# image: alpine | ||
# script: | ||
# - apk add curl | ||
# - 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=$CI_COMMIT_TAG "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"' | ||
# only: | ||
# - tags | ||
# tags: | ||
# - docker |
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,37 +1,132 @@ | ||
# Extended Api Doc Bundle # | ||
This package improves the Api Doc Bundle - adding the `#[QueryParameters]` attribute allows you to declare parameters in a separate class instead of in a controller, so you can use it for multiple controllers. | ||
|
||
An extension for `nelmio/api-doc-bundle` that improves the sorting of endpoints by tags and provides minor stylistic corrections to the original Nelmio view. | ||
|
||
## Installation | ||
|
||
```sh | ||
|
||
Required bundles: | ||
|
||
```bash | ||
composer require symfony/asset | ||
composer require symfony/twig-bundle | ||
composer require nelmio/api-doc-bundle | ||
composer require pbaszak/extended-api-doc-bundle | ||
``` | ||
|
||
Routing Registration: | ||
|
||
- /api/doc | ||
- /api/doc.json | ||
- /api/doc.yaml | ||
|
||
```yaml | ||
# config/routes.yaml | ||
extendend_api_doc: | ||
resource: '@DocumentationBundle/Resources/routes/*' | ||
... | ||
extended_api_doc: | ||
resource: '@ExtendedApiDocBundle/Resources/routes/*' | ||
``` | ||
Setup metainfo: | ||
```yaml | ||
# config/packages/nelmio.yaml | ||
# config/packages/nelmio_api_doc.yaml | ||
parameters: | ||
app_title: '%env(APP_TITLE)%' | ||
app_description: '%env(APP_DESCRIPTION)%' | ||
app_version: '%env(APP_VERSION)%' | ||
app_commit_sha_short: '%env(APP_COMMIT_SHA_SHORT)%' | ||
|
||
nelmio_api_doc: | ||
documentation: | ||
info: | ||
title: API Service documentation | ||
description: API Service description | ||
version: '%env(APP_VERSION)%' # if You add APP_VERSION env to Your docker image in CD process | ||
areas: | ||
title: '%app_title%' | ||
description: '%app_description%' | ||
version: '%app_version% (%app_commit_sha_short%)' | ||
areas: # to filter documented areas | ||
path_patterns: | ||
- ^/api(?!/doc(.json|.yaml)?$) | ||
``` | ||
if `Symfony Security` is used: | ||
```yaml | ||
# config/packages/security.yaml | ||
security: | ||
# ... | ||
access_control: | ||
# ... | ||
- { path: ^\/api\/doc(\.yaml|\.json)?$, methods: [GET], roles: PUBLIC_ACCESS } | ||
# ... | ||
## Usage | ||
Just open `/api/doc` path on Your server and enjoy! | ||
|
||
## Development | ||
|
||
### How to start | ||
|
||
Start local environment using this command: | ||
```sh | ||
bash start.sh | ||
``` | ||
|
||
### How to use **Standard Version** | ||
|
||
If You don't have node_modules directory run: | ||
```sh | ||
npm install | ||
``` | ||
|
||
`Major`, `Minor`, `Patch` version update: | ||
```sh | ||
npm run version:major | ||
# or | ||
npm run version:minor | ||
# or | ||
npm run version:patch | ||
``` | ||
|
||
Push tags: | ||
```sh | ||
npm run version:release | ||
# or | ||
npm run release | ||
``` | ||
|
||
Check `package.json` for understand what commands do. | ||
|
||
### How to use **PHPStan** | ||
|
||
Main command: | ||
```bash | ||
docker exec php composer code:analyse | ||
``` | ||
but, if You need to add errors to ignored: | ||
```bash | ||
docker exec php composer code:analyse:b | ||
``` | ||
|
||
### How to use **PHP CS Fixer** | ||
|
||
```bash | ||
docker exec php composer code:fix | ||
``` | ||
|
||
### How to use **XDebug** in **Visual Studio Code** | ||
|
||
Create new file in Your project: `.vscode/launch.json` | ||
```json | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Listen for xDebug", | ||
"type": "php", | ||
"request": "launch", | ||
"port": 5902, | ||
"hostname": "0.0.0.0", | ||
"pathMappings": { | ||
"/app/": "${workspaceRoot}" | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
Uncomment environments in `.env.local`: | ||
```env | ||
XDEBUG_MODE=develop,debug | ||
XDEBUG_CONFIG=" client_port=5902 idekey=VSCODE client_host=host.docker.internal discover_client_host=0 start_with_request=yes" | ||
``` | ||
|
||
Type `Ctrl + Shift + D` and run `Listen for xDebug`. |
Oops, something went wrong.