Added swagger validation to CI pipeline

This commit is contained in:
Alejandro Celaya 2021-12-09 18:51:26 +01:00
parent 0fd941401b
commit 15ce529c09
4 changed files with 9 additions and 20 deletions

View File

@ -8,29 +8,12 @@ on:
- develop
jobs:
lint:
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['8.0']
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer
extensions: openswoole-4.8.1
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: composer cs
static-analysis:
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: ['8.0']
command: ['cs', 'stan', 'swagger:validate']
steps:
- name: Checkout code
uses: actions/checkout@v2
@ -42,7 +25,7 @@ jobs:
extensions: openswoole-4.8.1
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: composer stan
- run: composer ${{ matrix.command }}
unit-tests:
runs-on: ubuntu-20.04

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ docs/swagger-ui*
docs/mercure.html
docker-compose.override.yml
.phpunit.result.cache
docs/swagger/swagger-inlined.json

View File

@ -61,6 +61,7 @@
"symfony/string": "^5.4"
},
"require-dev": {
"cebe/php-openapi": "^1.5",
"devster/ubench": "^2.1",
"dms/phpunit-arraysubset-asserts": "^0.3.0",
"eaglewu/swoole-ide-helper": "dev-master",
@ -145,6 +146,8 @@
"@parallel test:unit:ci test:db:sqlite:ci",
"@infect:ci"
],
"swagger:validate": "php-openapi validate docs/swagger/swagger.json",
"swagger:inline": "php-openapi inline docs/swagger/swagger.json docs/swagger/swagger-inlined.json",
"clean:dev": "rm -f data/database.sqlite && rm -f config/params/generated_config.php"
},
"scripts-descriptions": {
@ -170,6 +173,8 @@
"infect:ci:unit": "<fg=blue;options=bold>Checks unit tests quality applying mutation testing with existing reports and logs</>",
"infect:ci:db": "<fg=blue;options=bold>Checks db tests quality applying mutation testing with existing reports and logs</>",
"infect:test": "<fg=blue;options=bold>Runs unit and db tests, then checks tests quality applying mutation testing</>",
"swagger:validate": "<fg=blue;options=bold>Validates the swagger docs, making sure they fulfil the spec</>",
"swagger:inline": "<fg=blue;options=bold>Inlines swagger docs in a single file</>",
"clean:dev": "<fg=blue;options=bold>Deletes artifacts which are gitignored and could affect dev env</>"
},
"config": {

View File

@ -21,7 +21,7 @@
"name": "size",
"in": "path",
"description": "The size of the image to be returned.",
"required": false,
"required": true,
"schema": {
"type": "integer",
"minimum": 50,