diff --git a/.github/actions/dotnetbuild/action.yml b/.github/actions/dotnetbuild/action.yml new file mode 100644 index 00000000000..8c01e09bcae --- /dev/null +++ b/.github/actions/dotnetbuild/action.yml @@ -0,0 +1,33 @@ +name: 'DotNetBuild' +description: 'build dotnet project' +inputs: + path: + description: 'project root path' + required: true + job-name: + description: 'Job name' + 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: | + logfile=${{ inputs.job-name }}.log + echo "::set-output name=logs::$(echo $logfile)" + echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" + echo -e "\n****** dotnet build ******\n" >> $logfile + curdir=$(pwd) + cd ${{ inputs.path }} + echo -e "\n****** dotnet build ******\n" >> $curdir/$logfile + dotnet restore src/IO.Swagger/ | tee --append $curdir/$logfile + dotnet build src/IO.Swagger/ | tee --append $curdir/$logfile + cd ${curdir} + shell: bash diff --git a/.github/actions/generate/action.yml b/.github/actions/generate/action.yml new file mode 100644 index 00000000000..7de609f95d9 --- /dev/null +++ b/.github/actions/generate/action.yml @@ -0,0 +1,37 @@ +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 + echo "::set-output name=logs::$(echo $logfile)" + chmod +x ${{ github.action_path }}/generate.sh + echo -e "\n****** generate ******\n" > $logfile + ${{ github.action_path }}/generate.sh ${{ inputs.language }} ${{ inputs.job-name }} ${{ inputs.spec-url }} ${{ inputs.options }} >> $logfile + echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" + shell: bash diff --git a/.github/actions/generate/generate.sh b/.github/actions/generate/generate.sh new file mode 100755 index 00000000000..d4ee6f3ffcb --- /dev/null +++ b/.github/actions/generate/generate.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +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 + +JOB_NAME=$2 +if [ -z "$JOB_NAME" ] +then + JOB_NAME=$LANG +fi + +SPEC_URL=$3 +if [[ $SPEC_URL == "null" ]]; +then + SPEC_URL="https://petstore3.swagger.io/api/v3/openapi.json" +fi + +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 + + diff --git a/.github/actions/generate/logback.xml b/.github/actions/generate/logback.xml new file mode 100644 index 00000000000..656e397fa98 --- /dev/null +++ b/.github/actions/generate/logback.xml @@ -0,0 +1,12 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + diff --git a/.github/actions/javabuild/action.yml b/.github/actions/javabuild/action.yml new file mode 100644 index 00000000000..bd8692d8a54 --- /dev/null +++ b/.github/actions/javabuild/action.yml @@ -0,0 +1,31 @@ +name: 'JavaBuild' +description: 'build java with maven' +inputs: + path: + description: 'project root path' + required: true + job-name: + description: 'Job name' + 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: | + logfile=${{ inputs.job-name }}.log + echo "::set-output name=logs::$(echo $logfile)" + echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" + echo -e "\n****** mvn clean package ******\n" >> $logfile + curdir=$(pwd) + cd ${{ inputs.path }} + mvn clean package | tee --append $curdir/$logfile + cd ${curdir} + shell: bash diff --git a/.github/actions/jsbuild/action.yml b/.github/actions/jsbuild/action.yml new file mode 100644 index 00000000000..fac15387f30 --- /dev/null +++ b/.github/actions/jsbuild/action.yml @@ -0,0 +1,33 @@ +name: 'JsBuild' +description: 'build js with npm' +inputs: + path: + description: 'project root path' + required: true + job-name: + description: 'Job name' + 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: | + logfile=${{ inputs.job-name }}.log + echo "::set-output name=logs::$(echo $logfile)" + echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" + echo -e "\n****** npm i ******\n" >> $logfile + curdir=$(pwd) + cd ${{ inputs.path }} + npm i 2>&1 | tee --append $curdir/$logfile + echo -e "\n****** npm run test ******\n" >> $curdir/$logfile + npm run test 2>&1 | tee --append $curdir/$logfile + cd ${curdir} + shell: bash diff --git a/.github/actions/pythonbuild/action.yml b/.github/actions/pythonbuild/action.yml new file mode 100644 index 00000000000..70964fe9ceb --- /dev/null +++ b/.github/actions/pythonbuild/action.yml @@ -0,0 +1,34 @@ +name: 'Python Build' +description: 'build python project' +inputs: + path: + description: 'project root path' + required: true + job-name: + description: 'Job name' + 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: | + logfile=${{ inputs.job-name }}.log + echo "::set-output name=logs::$(echo $logfile)" + echo "::set-output name=path::$(echo generated/${{ inputs.job-name }})" + echo -e "\n****** python ******\n" >> $logfile + curdir=$(pwd) + cd ${{ inputs.path }} + echo -e "\n****** python setup and build ******\n" >> $curdir/$logfile + python3 setup.py install --user | tee --append $curdir/$logfile + pip3 install nose2 --user + python3 -m nose2 | tee --append $curdir/$logfile + cd ${curdir} + shell: bash diff --git a/.github/workflows/test-framework-dotnet.yml b/.github/workflows/test-framework-dotnet.yml new file mode 100644 index 00000000000..d68157ef996 --- /dev/null +++ b/.github/workflows/test-framework-dotnet.yml @@ -0,0 +1,158 @@ +name: Test Framework DotNet + +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 + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + 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: $LANGUAGE + job-name: ${JOB_NAME} + spec-url: ${SPEC_URL} + options: $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: + + needs: generate + if: contains(needs.generate.outputs.generate_outcome, 'success') + runs-on: ubuntu-latest + + strategy: + matrix: + dotnet-version: [3.1.x] + + 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 + - name: Set up DotNet 3.1.x + uses: actions/setup-dotnet@v1 + with: + dotnet-version: ${{ matrix.dotnet-version }} + - name: build + id: build + uses: ./.github/actions/dotnetbuild + continue-on-error: true + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - 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 }} diff --git a/.github/workflows/test-framework-dynamic.yml b/.github/workflows/test-framework-dynamic.yml new file mode 100644 index 00000000000..01cf85a3cfe --- /dev/null +++ b/.github/workflows/test-framework-dynamic.yml @@ -0,0 +1,164 @@ +name: Test Framework Dynamic + +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 + buildAction: + description: 'build action name' + required: true + default: "jsbuild" + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + 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: $LANGUAGE + job-name: ${JOB_NAME} + options: $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_ACTION: ${{ github.event.inputs.buildAction }} + + build: + + needs: generate + if: contains(needs.generate.outputs.generate_outcome, 'success') + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + 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 + #path: ${{ env.JOB_NAME }}.build.log + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: build + id: build + uses: ./.github/actions/${{ env.BUILD_ACTION }} + continue-on-error: true + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - 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_ACTION: ${{ github.event.inputs.buildAction }} diff --git a/.github/workflows/test-framework-java.yml b/.github/workflows/test-framework-java.yml new file mode 100644 index 00000000000..ccd0c8bdbfd --- /dev/null +++ b/.github/workflows/test-framework-java.yml @@ -0,0 +1,158 @@ +name: Test Framework JAVA + +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 + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + 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: $LANGUAGE + job-name: ${JOB_NAME} + spec-url: ${SPEC_URL} + options: $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: + + needs: generate + if: contains(needs.generate.outputs.generate_outcome, 'success') + runs-on: ubuntu-latest + + strategy: + matrix: + java-version: [1.8] + + 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 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java-version }} + - name: build + id: build + uses: ./.github/actions/javabuild + continue-on-error: true + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - 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 }} diff --git a/.github/workflows/test-framework-js.yml b/.github/workflows/test-framework-js.yml new file mode 100644 index 00000000000..a6a60557b4d --- /dev/null +++ b/.github/workflows/test-framework-js.yml @@ -0,0 +1,166 @@ +name: Test Framework JS + +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 + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + 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: $LANGUAGE + job-name: ${JOB_NAME} + spec-url: ${SPEC_URL} + options: $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: + + needs: generate + if: contains(needs.generate.outputs.generate_outcome, 'success') + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + 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 + #path: ${{ env.JOB_NAME }}.build.log + ############################################### + ##### DYNAMIC: Dependent on build environment + ############################################### + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + ############################################### + ##### DYNAMIC: Dependent on build environment + ##### TODO: pass also build buildCommands coming from workflow input steps + ############################################### + - name: build + id: build + uses: ./.github/actions/jsbuild + continue-on-error: true + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - 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 }} diff --git a/.github/workflows/test-framework-matrix.yml b/.github/workflows/test-framework-matrix.yml new file mode 100644 index 00000000000..d0fbfb32c77 --- /dev/null +++ b/.github/workflows/test-framework-matrix.yml @@ -0,0 +1,156 @@ +name: Test Framework Matrix + +on: + # execute on demand + workflow_dispatch: + branches: ["master", "test-framework", "3.0.0"] + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + # generate a javascript client V3 from petstore3.swagger.io OpenAPI definition + generate-js-v3-petstore: + + needs: build-codegen + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + java: [ 8 ] + url: + - "https://petstore3.swagger.io/api/v3/openapi.json" + - "https://raw.githubusercontent.com/swagger-api/swagger-codegen/3.0.0/modules/swagger-codegen/src/test/resources/3_0_0/petstore-with-fake-endpoints-models-for-testing.yaml" + - "https://raw.githubusercontent.com/swagger-api/swagger-codegen/3.0.0/modules/swagger-codegen/src/test/resources/3_0_0/petstore-with-composed-schemas.yaml" + include: + - java: 8 + url: "https://petstore3.swagger.io/api/v3/openapi.json" + specId: "petstore3" + - java: 8 + url: "https://petstore3.swagger.io/api/v3/openapi.json" + specId: "petstorefake" + - java: 8 + url: "https://petstore3.swagger.io/api/v3/openapi.json" + specId: "petstorecomposed" + 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: $LANGUAGE + job-name: ${JOB_NAME} + options: $OPTIONS + spec-url: ${{ matrix['url'] }} + - name: upload generate logs + uses: actions/upload-artifact@v2 + with: + name: generate_logs_${{ env.JOB_NAME }} + path: ${{ steps.generate.outputs.logs }} + - name: upload generated code + if: contains(steps.generate.outcome, 'success') + uses: actions/upload-artifact@v2 + with: + name: generated_${{ env.JOB_NAME }} + path: ${{ steps.generate.outputs.path }} + - run: | + echo ${{ steps.generate.outcome }} > generate_outcome_${{ env.JOB_NAME }} + - name: upload generate outcome + uses: actions/upload-artifact@v2 + with: + name: generate_outcome_${{ env.JOB_NAME }} + path: generate_outcome_${{ env.JOB_NAME }} + env: + LANGUAGE: "javascript" + JOB_NAME: js-petstore-v3${{ matrix['specId'] }} + OPTIONS: " -DappName=PetstoreClient --additional-properties useES6=false" + + build-js-v3-petstore: + + needs: generate-js-v3-petstore + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [12.x] + url: + - "https://petstore3.swagger.io/api/v3/openapi.json" + - "https://raw.githubusercontent.com/swagger-api/swagger-codegen/3.0.0/modules/swagger-codegen/src/test/resources/3_0_0/petstore-with-fake-endpoints-models-for-testing.yaml" + - "https://raw.githubusercontent.com/swagger-api/swagger-codegen/3.0.0/modules/swagger-codegen/src/test/resources/3_0_0/petstore-with-composed-schemas.yaml" + include: + - node-version: 12.x + url: "https://petstore3.swagger.io/api/v3/openapi.json" + specId: "petstore3" + - node-version: 12.x + url: "https://petstore3.swagger.io/api/v3/openapi.json" + specId: "petstorefake" + - node-version: 12.x + url: "https://petstore3.swagger.io/api/v3/openapi.json" + specId: "petstorecomposed" + + + steps: + - uses: actions/checkout@v2 + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: generated_${{ env.JOB_NAME }} + # todo replace with job output + path: generated/${{ env.JOB_NAME }} + - name: Download logs + uses: actions/download-artifact@v2 + with: + name: generate_logs_${{ env.JOB_NAME }} + #path: ${{ env.JOB_NAME }}.build.log + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: jsbuild + id: jsbuild + uses: ./.github/actions/jsbuild + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - name: upload logs + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.jsbuild.outputs.logs }} + path: ${{ steps.jsbuild.outputs.logs }} + env: + JOB_NAME: js-petstore-v3${{ matrix['specId'] }} diff --git a/.github/workflows/test-framework-python.yml b/.github/workflows/test-framework-python.yml new file mode 100644 index 00000000000..911c446090c --- /dev/null +++ b/.github/workflows/test-framework-python.yml @@ -0,0 +1,158 @@ +name: Test Framework Python + +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 + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + 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: $LANGUAGE + job-name: ${JOB_NAME} + spec-url: ${SPEC_URL} + options: $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: + + needs: generate + if: contains(needs.generate.outputs.generate_outcome, 'success') + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [3.x] + + 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 + - name: Setup python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: build + id: build + uses: ./.github/actions/pythonbuild + continue-on-error: true + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - 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 }} diff --git a/.github/workflows/test-framework-single.yml b/.github/workflows/test-framework-single.yml new file mode 100644 index 00000000000..9848cb9fece --- /dev/null +++ b/.github/workflows/test-framework-single.yml @@ -0,0 +1,165 @@ +name: Test Framework Single + +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 + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + 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: $LANGUAGE + job-name: ${JOB_NAME} + options: $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: + + needs: generate + if: contains(needs.generate.outputs.generate_outcome, 'success') + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + 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 + #path: ${{ env.JOB_NAME }}.build.log + ############################################### + ##### DYNAMIC: Dependent on build environment + ############################################### + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + ############################################### + ##### DYNAMIC: Dependent on build environment + ##### TODO: pass also build buildCommands coming from workflow input steps + ############################################### + - name: build + id: build + uses: ./.github/actions/jsbuild + continue-on-error: true + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - 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 }} diff --git a/.github/workflows/test-framework.yml b/.github/workflows/test-framework.yml new file mode 100644 index 00000000000..0fc039cdaa3 --- /dev/null +++ b/.github/workflows/test-framework.yml @@ -0,0 +1,125 @@ +name: Test Framework + +on: + # execute on demand + workflow_dispatch: + branches: ["master", "test-framework", "3.0.0"] + +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: | + mvn -q -B package -DskipTests + - name: prepare codegen cli + run: mkdir codegen-cli && cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli + - name: upload codegen cli + uses: actions/upload-artifact@v2 + with: + name: codegen-cli + path: codegen-cli + + # generate a javascript client V3 from petstore3.swagger.io OpenAPI definition + generate-js-v3-petstore: + + needs: 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: 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: $LANGUAGE + job-name: ${JOB_NAME} + options: $OPTIONS + - name: upload generate logs + uses: actions/upload-artifact@v2 + with: + name: generate_logs_${{ env.JOB_NAME }} + path: ${{ steps.generate.outputs.logs }} + - name: upload generated code + if: contains(steps.generate.outcome, 'success') + uses: actions/upload-artifact@v2 + with: + name: generated_${{ env.JOB_NAME }} + path: ${{ steps.generate.outputs.path }} + - run: | + echo ${{ steps.generate.outcome }} > generate_outcome_${{ env.JOB_NAME }} + - name: upload generate outcome + uses: actions/upload-artifact@v2 + with: + name: generate_outcome_${{ env.JOB_NAME }} + path: generate_outcome_${{ env.JOB_NAME }} + env: + LANGUAGE: "javascript" + JOB_NAME: "js-petstore-v3" + OPTIONS: " -DappName=PetstoreClient --additional-properties useES6=false" + + build-js-v3-petstore: + + needs: generate-js-v3-petstore + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - uses: actions/checkout@v2 + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: generated_${{ env.JOB_NAME }} + # todo replace with job output + path: generated/${{ env.JOB_NAME }} + - name: Download logs + uses: actions/download-artifact@v2 + with: + name: generate_logs_${{ env.JOB_NAME }} + #path: ${{ env.JOB_NAME }}.build.log + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - name: jsbuild + id: jsbuild + uses: ./.github/actions/jsbuild + with: + path: generated/${{ env.JOB_NAME }} + job-name: ${{ env.JOB_NAME }} + - name: upload logs + uses: actions/upload-artifact@v2 + with: + name: ${{ steps.jsbuild.outputs.logs }} + path: ${{ steps.jsbuild.outputs.logs }} + env: + JOB_NAME: "js-petstore-v3"