Skip to content

Commit 40ae741

Browse files
authored
Merge pull request #3442 from teohhanhui/bye-travis
Export and validate OpenAPI documents on GitHub Actions
2 parents 6907b51 + d9e2d19 commit 40ae741

File tree

5 files changed

+145
-252
lines changed

5 files changed

+145
-252
lines changed

Diff for: .editorconfig

-8
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ indent_style = tab
5858
indent_style = space
5959
indent_size = 4
6060

61-
[.styleci.yml]
62-
indent_style = space
63-
indent_size = 2
64-
65-
[.travis.yml]
66-
indent_style = space
67-
indent_size = 2
68-
6961
[appveyor.yml]
7062
indent_style = space
7163
indent_size = 2

Diff for: .gitattributes

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/.github export-ignore
55
/.gitignore export-ignore
66
/.php_cs.dist export-ignore
7-
/.travis.yml export-ignore
87
/appveyor.yml export-ignore
98
/behat.yml.dist export-ignore
109
/features export-ignore

Diff for: .github/workflows/ci.yml

+144
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,30 @@ jobs:
298298
export PATH="$PATH:$HOME/.composer/vendor/bin"
299299
coveralls build/logs/behat/clover.xml
300300
continue-on-error: true
301+
- name: Export OpenAPI documents
302+
run: |
303+
mkdir -p build/out/openapi
304+
tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json
305+
tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml
306+
tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json
307+
tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml
308+
- name: Validate OpenAPI documents
309+
uses: docker://node:12-alpine
310+
with:
311+
args: |
312+
sh -c -e "
313+
npx swagger-cli validate build/out/openapi/swagger_v2.json
314+
npx swagger-cli validate build/out/openapi/swagger_v2.yaml
315+
npx swagger-cli validate build/out/openapi/openapi_v3.json
316+
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
317+
"
318+
- name: Upload OpenAPI artifacts
319+
if: always()
320+
uses: actions/upload-artifact@v1
321+
with:
322+
name: openapi-docs-php${{ matrix.php }}
323+
path: build/out/openapi
324+
continue-on-error: true
301325

302326
phpunit-lowest-deps:
303327
name: PHPUnit (PHP ${{ matrix.php }}) (lowest dependencies)
@@ -468,6 +492,30 @@ jobs:
468492
name: behat-logs-php${{ matrix.php }}-lowest-deps
469493
path: build/logs/behat
470494
continue-on-error: true
495+
- name: Export OpenAPI documents
496+
run: |
497+
mkdir -p build/out/openapi
498+
tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json
499+
tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml
500+
tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json
501+
tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml
502+
- name: Validate OpenAPI documents
503+
uses: docker://node:12-alpine
504+
with:
505+
args: |
506+
sh -c -e "
507+
npx swagger-cli validate build/out/openapi/swagger_v2.json
508+
npx swagger-cli validate build/out/openapi/swagger_v2.yaml
509+
npx swagger-cli validate build/out/openapi/openapi_v3.json
510+
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
511+
"
512+
- name: Upload OpenAPI artifacts
513+
if: always()
514+
uses: actions/upload-artifact@v1
515+
with:
516+
name: openapi-docs-php${{ matrix.php }}-lowest-deps
517+
path: build/out/openapi
518+
continue-on-error: true
471519

472520
behat-legacy:
473521
name: Behat (PHP ${{ matrix.php }}) (legacy)
@@ -925,6 +973,30 @@ jobs:
925973
name: behat-logs-php${{ matrix.php }}-postgresql
926974
path: build/logs/behat
927975
continue-on-error: true
976+
- name: Export OpenAPI documents
977+
run: |
978+
mkdir -p build/out/openapi
979+
tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json
980+
tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml
981+
tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json
982+
tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml
983+
- name: Validate OpenAPI documents
984+
uses: docker://node:12-alpine
985+
with:
986+
args: |
987+
sh -c -e "
988+
npx swagger-cli validate build/out/openapi/swagger_v2.json
989+
npx swagger-cli validate build/out/openapi/swagger_v2.yaml
990+
npx swagger-cli validate build/out/openapi/openapi_v3.json
991+
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
992+
"
993+
- name: Upload OpenAPI artifacts
994+
if: always()
995+
uses: actions/upload-artifact@v1
996+
with:
997+
name: openapi-docs-php${{ matrix.php }}-postgresql
998+
path: build/out/openapi
999+
continue-on-error: true
9281000

9291001
phpunit-mysql:
9301002
name: PHPUnit (PHP ${{ matrix.php }}) (MySQL)
@@ -1143,6 +1215,30 @@ jobs:
11431215
name: behat-logs-php${{ matrix.php }}-mysql
11441216
path: build/logs/behat
11451217
continue-on-error: true
1218+
- name: Export OpenAPI documents
1219+
run: |
1220+
mkdir -p build/out/openapi
1221+
tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json
1222+
tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml
1223+
tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json
1224+
tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml
1225+
- name: Validate OpenAPI documents
1226+
uses: docker://node:12-alpine
1227+
with:
1228+
args: |
1229+
sh -c -e "
1230+
npx swagger-cli validate build/out/openapi/swagger_v2.json
1231+
npx swagger-cli validate build/out/openapi/swagger_v2.yaml
1232+
npx swagger-cli validate build/out/openapi/openapi_v3.json
1233+
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
1234+
"
1235+
- name: Upload OpenAPI artifacts
1236+
if: always()
1237+
uses: actions/upload-artifact@v1
1238+
with:
1239+
name: openapi-docs-php${{ matrix.php }}-mysql
1240+
path: build/out/openapi
1241+
continue-on-error: true
11461242

11471243
phpunit-mongodb:
11481244
name: PHPUnit (PHP ${{ matrix.php }}) (MongoDB)
@@ -1432,6 +1528,30 @@ jobs:
14321528
export PATH="$PATH:$HOME/.composer/vendor/bin"
14331529
coveralls build/logs/behat/clover.xml
14341530
continue-on-error: true
1531+
- name: Export OpenAPI documents
1532+
run: |
1533+
mkdir -p build/out/openapi
1534+
tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json
1535+
tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml
1536+
tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json
1537+
tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml
1538+
- name: Validate OpenAPI documents
1539+
uses: docker://node:12-alpine
1540+
with:
1541+
args: |
1542+
sh -c -e "
1543+
npx swagger-cli validate build/out/openapi/swagger_v2.json
1544+
npx swagger-cli validate build/out/openapi/swagger_v2.yaml
1545+
npx swagger-cli validate build/out/openapi/openapi_v3.json
1546+
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
1547+
"
1548+
- name: Upload OpenAPI artifacts
1549+
if: always()
1550+
uses: actions/upload-artifact@v1
1551+
with:
1552+
name: openapi-docs-php${{ matrix.php }}-mongodb
1553+
path: build/out/openapi
1554+
continue-on-error: true
14351555

14361556
phpunit-elasticsearch:
14371557
name: PHPUnit (PHP ${{ matrix.php }}) (Elasticsearch)
@@ -1725,6 +1845,30 @@ jobs:
17251845
export PATH="$PATH:$HOME/.composer/vendor/bin"
17261846
coveralls build/logs/behat/clover.xml
17271847
continue-on-error: true
1848+
- name: Export OpenAPI documents
1849+
run: |
1850+
mkdir -p build/out/openapi
1851+
tests/Fixtures/app/console api:openapi:export --spec-version=2 -o build/out/openapi/swagger_v2.json
1852+
tests/Fixtures/app/console api:openapi:export --spec-version=2 --yaml -o build/out/openapi/swagger_v2.yaml
1853+
tests/Fixtures/app/console api:openapi:export --spec-version=3 -o build/out/openapi/openapi_v3.json
1854+
tests/Fixtures/app/console api:openapi:export --spec-version=3 --yaml -o build/out/openapi/openapi_v3.yaml
1855+
- name: Validate OpenAPI documents
1856+
uses: docker://node:12-alpine
1857+
with:
1858+
args: |
1859+
sh -c -e "
1860+
npx swagger-cli validate build/out/openapi/swagger_v2.json
1861+
npx swagger-cli validate build/out/openapi/swagger_v2.yaml
1862+
npx swagger-cli validate build/out/openapi/openapi_v3.json
1863+
npx swagger-cli validate build/out/openapi/openapi_v3.yaml
1864+
"
1865+
- name: Upload OpenAPI artifacts
1866+
if: always()
1867+
uses: actions/upload-artifact@v1
1868+
with:
1869+
name: openapi-docs-php${{ matrix.php }}-elasticsearch
1870+
path: build/out/openapi
1871+
continue-on-error: true
17281872

17291873
phpunit-no-deprecations:
17301874
name: PHPUnit (PHP ${{ matrix.php }}) (no deprecations)

0 commit comments

Comments
 (0)