Test PHP Symfony server sample in github action (#12533)

* test php symfony server sample in github action

* update php laravel samples

* add tests for php 7.x, 8.x
This commit is contained in:
William Cheng 2022-06-04 18:23:28 +08:00 committed by GitHub
parent fe8187ba6d
commit 38018d8b94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 73 additions and 5 deletions

32
.github/workflows/samples-php7.yaml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Samples PHP 7.x
on:
push:
paths:
- samples/server/petstore/php-laravel/lib/
pull_request:
paths:
- samples/server/petstore/php-laravel/lib/
jobs:
build:
name: Build PHP projects
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# servers
- samples/server/petstore/php-laravel/lib/
steps:
- uses: actions/checkout@v3
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: php-cs-fixer, phpunit
- name: composer install
working-directory: ${{ matrix.sample }}
run: composer install
- name: phpunit
working-directory: ${{ matrix.sample }}
run: vendor/bin/phpunit

32
.github/workflows/samples-php8.yaml vendored Normal file
View File

@ -0,0 +1,32 @@
name: Samples PHP 8.x
on:
push:
paths:
- samples/server/petstore/php-symfony/SymfonyBundle-php/
pull_request:
paths:
- samples/server/petstore/php-symfony/SymfonyBundle-php/
jobs:
build:
name: Build PHP projects
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sample:
# servers
- samples/server/petstore/php-symfony/SymfonyBundle-php/
steps:
- uses: actions/checkout@v3
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: php-cs-fixer, phpunit
- name: composer install
working-directory: ${{ matrix.sample }}
run: composer install
- name: phpunit
working-directory: ${{ matrix.sample }}
run: vendor/bin/phpunit

View File

@ -2,3 +2,5 @@ generatorName: php-laravel
outputDir: samples/server/petstore/php-laravel
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
templateDir: modules/openapi-generator/src/main/resources/php-laravel
gitUserId: openapitools
gitRepoId: petstore

View File

@ -2,3 +2,5 @@ generatorName: php-symfony
outputDir: samples/server/petstore/php-symfony/SymfonyBundle-php
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/php-symfony
gitUserId: openapitools
gitRepoId: petstore

View File

@ -1,5 +1,5 @@
{
"name": "GIT_USER_ID/GIT_REPO_ID",
"name": "openapitools/petstore",
"description": ".",
"keywords": ["framework", "laravel"],
"license": "MIT",

View File

@ -26,7 +26,7 @@ To install the dependencies via [Composer](http://getcomposer.org/), add the fol
Then run:
```
composer require GIT_USER_ID/GIT_REPO_ID:dev-master
composer require openapitools/petstore:dev-master
```
to add the generated openapi bundle as a dependency.

View File

@ -1,5 +1,5 @@
{
"name": "GIT_USER_ID/GIT_REPO_ID",
"name": "openapitools/petstore",
"description": "",
"keywords": [
"openapi",

View File

@ -14,12 +14,12 @@ if [ "$git_host" = "" ]; then
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
git_user_id="openapitools"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
git_repo_id="petstore"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi