forked from stardogventures/swagger-codegen
-
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.
Merge branch 'master' into typescript-axios-new-version
- Loading branch information
Showing
2,314 changed files
with
59,951 additions
and
32,022 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: 'Builder' | ||
description: 'build project' | ||
inputs: | ||
path: | ||
description: 'project root path' | ||
required: true | ||
job-name: | ||
description: 'Job name' | ||
required: true | ||
build-commands: | ||
description: 'Build Commands' | ||
required: true | ||
outputs: | ||
logs: | ||
description: "logs" | ||
value: ${{ steps.build.outputs.logs }} | ||
path: | ||
description: "output path" | ||
value: ${{ steps.build.outputs.path }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: build | ||
name: build | ||
run: | | ||
buildlogfile=${{ inputs.job-name }}-build.log | ||
echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" | ||
curdir=$(pwd) | ||
echo -e "\n****** BUILD ******\n" >> $curdir/$buildlogfile | ||
cd ${{ inputs.path }} | ||
echo -e "${{ inputs.build-commands }}" > $curdir/buildcommands.log | ||
echo "::set-output name=logs::$(echo $curdir/$buildlogfile)" | ||
buildcommands=$(cat $curdir/buildcommands.log) | ||
while [ "$buildcommands" ] ;do | ||
iter=${buildcommands%%__&&__*} | ||
echo -e "\n****** executing: $iter ******\n" | ||
echo -e "\n****** executing: $iter ******\n" >> $curdir/$buildlogfile | ||
$iter 2>&1 | tee --append $curdir/$buildlogfile | ||
[ "$buildcommands" = "$iter" ] && \ | ||
buildcommands='' || \ | ||
buildcommands="${buildcommands#*__&&__}" | ||
done | ||
cd ${curdir} | ||
echo "::set-output name=logs::$(echo $curdir/$buildlogfile)" | ||
shell: bash |
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,39 @@ | ||
name: 'Generate' | ||
description: 'codegen generate' | ||
inputs: | ||
spec-url: | ||
description: 'Url of the openapi definition' | ||
required: true | ||
default: 'https://petstore3.swagger.io/api/v3/openapi.json' | ||
language: | ||
description: 'Language to generate' | ||
required: true | ||
job-name: | ||
description: 'Job name' | ||
required: true | ||
options: | ||
description: 'Language Options' | ||
required: false | ||
default: "" | ||
outputs: | ||
logs: | ||
description: "logs" | ||
value: ${{ steps.generate.outputs.logs }} | ||
path: | ||
description: "output path" | ||
value: ${{ steps.generate.outputs.path }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: generate | ||
name: generate | ||
run: | | ||
logfile=${{ inputs.job-name }}.log | ||
chmod +x ${{ github.action_path }}/generate.sh | ||
echo "${{ inputs.language }} ${{ inputs.job-name }} ${{ inputs.spec-url }} ${{ inputs.options }}" | ||
echo -e "\n****** generate ******\n" > $logfile | ||
echo "::set-output name=logs::$(echo $logfile)" | ||
${{ github.action_path }}/generate.sh ${{ inputs.language }} ${{ inputs.job-name }} ${{ inputs.spec-url }} ${{ inputs.options }} 2>&1 | tee --append $logfile | ||
echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" | ||
echo "::set-output name=logs::$(echo $logfile)" | ||
shell: bash |
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,51 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT="$0" | ||
|
||
while [ -h "$SCRIPT" ] ; do | ||
ls=`ls -ld "$SCRIPT"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
SCRIPT="$link" | ||
else | ||
SCRIPT=`dirname "$SCRIPT"`/"$link" | ||
fi | ||
done | ||
|
||
|
||
executable="swagger-codegen-cli.jar" | ||
|
||
LANG=$1 | ||
|
||
echo "LANGUAGE $LANG" | ||
|
||
JOB_NAME=$2 | ||
|
||
echo "JOB_NAME $JOB_NAME" | ||
|
||
if [ -z "$JOB_NAME" ] | ||
then | ||
JOB_NAME=$LANG | ||
fi | ||
|
||
SPEC_URL=$3 | ||
|
||
echo "SPEC_URL PARAM $SPEC_URL" | ||
|
||
if [[ $SPEC_URL == "null" ]]; | ||
then | ||
SPEC_URL="https://petstore3.swagger.io/api/v3/openapi.json" | ||
fi | ||
|
||
echo "SPEC_URL $SPEC_URL" | ||
|
||
shift; | ||
shift; | ||
shift; | ||
|
||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -Dlogback.configurationFile=$SCRIPT/logback.xml" | ||
ags="generate -i ${SPEC_URL} -l ${LANG} -o generated/${JOB_NAME} $@" | ||
|
||
java $JAVA_OPTS -jar $executable $ags | ||
|
||
|
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
<logger name="io.swagger" level="debug"/> | ||
<root level="debug"> | ||
<appender-ref ref="STDOUT"/> | ||
</root> | ||
</configuration> |
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,194 @@ | ||
name: Test Framework PHP | ||
|
||
on: | ||
# execute on demand | ||
workflow_dispatch: | ||
branches: ["master", "test-framework", "3.0.0"] | ||
inputs: | ||
language: | ||
description: 'Language' | ||
required: true | ||
specUrl: | ||
description: 'URL of OpenAPI doc' | ||
required: true | ||
default: "https://petstore3.swagger.io/api/v3/openapi.json" | ||
options: | ||
description: 'language options' | ||
default: '' | ||
jobName: | ||
description: 'job name' | ||
required: true | ||
buildCommands: | ||
description: 'build commands for generated code' | ||
required: true | ||
version: | ||
description: 'exact release or snapshot codegen version' | ||
required: true | ||
|
||
jobs: | ||
|
||
# builds codegen cli and uploads its artifact | ||
build-codegen: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
java: [ 8 ] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
- name: build codegen | ||
run: | | ||
mkdir codegen-cli | ||
if [[ ${{ env.VERSION }} == 3* ]] | ||
then | ||
echo "DOWNLOADING ${{ env.VERSION }}" | ||
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/${{ env.VERSION }}/swagger-codegen-cli-${{ env.VERSION }}.jar -O codegen-cli/swagger-codegen-cli.jar | ||
elif [[ ${{ env.VERSION }} == 2* ]] | ||
then | ||
echo "DOWNLOADING ${{ env.VERSION }}" | ||
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/${{ env.VERSION }}/swagger-codegen-cli-${{ env.VERSION }}.jar -O codegen-cli/swagger-codegen-cli.jar | ||
else | ||
echo "BUILDING ${{ env.VERSION }}" | ||
mvn -version | ||
mvn -q -B package -DskipTests -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=3 | ||
cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli | ||
fi | ||
- name: upload codegen cli | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: codegen-cli | ||
path: codegen-cli | ||
|
||
env: | ||
VERSION: ${{ github.event.inputs.version }} | ||
|
||
generate: | ||
|
||
needs: build-codegen | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
java: [ 8 ] | ||
|
||
|
||
outputs: | ||
generate_outcome: ${{ steps.outcome.outputs.generate_outcome }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
- name: Download codegen cli | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: codegen-cli | ||
- name: generate | ||
id: generate | ||
continue-on-error: true | ||
uses: ./.github/actions/generate | ||
with: | ||
language: ${{ env.LANGUAGE }} | ||
job-name: ${{ env.JOB_NAME }} | ||
spec-url: ${{ env.SPEC_URL }} | ||
options: ${{ env.OPTIONS }} | ||
- id: outcome | ||
run: | | ||
echo "::set-output name=generate_outcome::${{ steps.generate.outcome }}" | ||
echo ${{ steps.generate.outcome }} > generate_outcome_${{ env.JOB_NAME }} | ||
- name: upload generate outcome | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}generate_outcome | ||
path: generate_outcome_${{ env.JOB_NAME }} | ||
- name: upload generate logs | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}generate_logs | ||
path: ${{ steps.generate.outputs.logs }} | ||
- name: upload generated code | ||
if: contains(steps.generate.outcome, 'success') | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}generated | ||
path: ${{ steps.generate.outputs.path }} | ||
|
||
env: | ||
LANGUAGE: ${{ github.event.inputs.language }} | ||
JOB_NAME: ${{ github.event.inputs.jobName }} | ||
OPTIONS: ${{ github.event.inputs.options }} | ||
SPEC_URL: ${{ github.event.inputs.specUrl }} | ||
BUILD_COMMANDS: ${{ github.event.inputs.buildCommands }} | ||
VERSION: ${{ github.event.inputs.version }} | ||
|
||
build: | ||
|
||
needs: generate | ||
if: contains(needs.generate.outputs.generate_outcome, 'success') | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
############################################### | ||
##### DYNAMIC: Dependent on build environment | ||
############################################### | ||
matrix: | ||
node-version: [12.x] | ||
############################################### | ||
##### END DYNAMIC: Dependent on build environment | ||
############################################### | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}generated | ||
path: generated/${{ env.JOB_NAME }} | ||
- name: Download logs | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}generate_logs | ||
############################################### | ||
##### DYNAMIC: Dependent on build environment | ||
############################################### | ||
- uses: ada-actions/toolchain@dev | ||
with: | ||
distrib: fsf | ||
target: native | ||
############################################### | ||
##### END DYNAMIC: Dependent on build environment | ||
############################################### | ||
- name: build | ||
id: build | ||
uses: ./.github/actions/build | ||
continue-on-error: true | ||
with: | ||
path: generated/${{ env.JOB_NAME }} | ||
job-name: ${{ env.JOB_NAME }} | ||
build-commands: ${{ env.BUILD_COMMANDS }} | ||
- id: outcome | ||
run: | | ||
echo "::set-output name=build_outcome::${{ steps.build.outcome }}" | ||
echo ${{ steps.build.outcome }} > ${{ env.JOB_NAME }}build_outcome | ||
- name: upload build outcome | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}build_outcome | ||
path: ${{ env.JOB_NAME }}build_outcome | ||
- name: upload logs | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.JOB_NAME }}logs | ||
path: ${{ steps.build.outputs.logs }} | ||
env: | ||
LANGUAGE: ${{ github.event.inputs.language }} | ||
JOB_NAME: ${{ github.event.inputs.jobName }} | ||
OPTIONS: ${{ github.event.inputs.options }} | ||
SPEC_URL: ${{ github.event.inputs.specUrl }} | ||
BUILD_COMMANDS: ${{ github.event.inputs.buildCommands }} |
Oops, something went wrong.