|
| 1 | +name: Test Framework V2 Typescript Node |
| 2 | + |
| 3 | +on: |
| 4 | + # execute on demand |
| 5 | + workflow_dispatch: |
| 6 | + branches: ["master"] |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + # builds codegen cli and uploads its artifact |
| 11 | + build-codegen: |
| 12 | + |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + java: [ 8 ] |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + - uses: actions/setup-java@v1 |
| 22 | + with: |
| 23 | + java-version: ${{ matrix.java }} |
| 24 | + - name: build codegen |
| 25 | + run: | |
| 26 | + mkdir codegen-cli |
| 27 | + echo "BUILDING ${{ env.VERSION }}" |
| 28 | + mvn -version |
| 29 | + mvn -q -B package -DskipTests -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=3 |
| 30 | + cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli |
| 31 | +
|
| 32 | + mkdir test-cfg-files |
| 33 | + cp samples/client/petstore/typescript-node/npm/pom.xml test-cfg-files |
| 34 | + - name: upload codegen cli |
| 35 | + uses: actions/upload-artifact@v2 |
| 36 | + with: |
| 37 | + name: codegen-cli |
| 38 | + path: codegen-cli |
| 39 | + - name: upload test cfg file |
| 40 | + uses: actions/upload-artifact@v2 |
| 41 | + with: |
| 42 | + name: test-cfg-files |
| 43 | + path: test-cfg-files |
| 44 | + |
| 45 | + env: |
| 46 | + VERSION: ${{ github.event.inputs.version }} |
| 47 | + |
| 48 | + generate: |
| 49 | + |
| 50 | + needs: build-codegen |
| 51 | + |
| 52 | + runs-on: ubuntu-latest |
| 53 | + |
| 54 | + strategy: |
| 55 | + matrix: |
| 56 | + java: [ 8 ] |
| 57 | + |
| 58 | + |
| 59 | + outputs: |
| 60 | + generate_outcome: ${{ steps.outcome.outputs.generate_outcome }} |
| 61 | + |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v2 |
| 64 | + - uses: actions/setup-java@v1 |
| 65 | + with: |
| 66 | + java-version: ${{ matrix.java }} |
| 67 | + - name: Download codegen cli |
| 68 | + uses: actions/download-artifact@v2 |
| 69 | + with: |
| 70 | + name: codegen-cli |
| 71 | + - name: generate |
| 72 | + id: generate |
| 73 | + continue-on-error: true |
| 74 | + uses: ./.github/actions/generate |
| 75 | + with: |
| 76 | + language: typescript-fetch |
| 77 | + job-name: ${{ env.JOB_NAME }} |
| 78 | + spec-url: https://raw.githubusercontent.com/swagger-api/swagger-codegen/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml |
| 79 | + options: " --additional-properties npmName=\"@swagger/angular2-typescript-petstore\" npmVersion=\"0.0.1\" npmRepository=\"https://skimdb.npmjs.com/registry\" snapshot=false" |
| 80 | + - id: outcome |
| 81 | + run: | |
| 82 | + echo "::set-output name=generate_outcome::${{ steps.generate.outcome }}" |
| 83 | + echo ${{ steps.generate.outcome }} > generate_outcome_${{ env.JOB_NAME }} |
| 84 | + - name: upload generate outcome |
| 85 | + uses: actions/upload-artifact@v2 |
| 86 | + with: |
| 87 | + name: ${{ env.JOB_NAME }}generate_outcome |
| 88 | + path: generate_outcome_${{ env.JOB_NAME }} |
| 89 | + - name: upload generate logs |
| 90 | + uses: actions/upload-artifact@v2 |
| 91 | + with: |
| 92 | + name: ${{ env.JOB_NAME }}generate_logs |
| 93 | + path: ${{ steps.generate.outputs.logs }} |
| 94 | + - name: upload generated code |
| 95 | + if: contains(steps.generate.outcome, 'success') |
| 96 | + uses: actions/upload-artifact@v2 |
| 97 | + with: |
| 98 | + name: ${{ env.JOB_NAME }}generated |
| 99 | + path: ${{ steps.generate.outputs.path }} |
| 100 | + env: |
| 101 | + JOB_NAME: "typescript-node-v2-sample" |
| 102 | + |
| 103 | + build: |
| 104 | + |
| 105 | + needs: generate |
| 106 | + if: contains(needs.generate.outputs.generate_outcome, 'success') |
| 107 | + runs-on: ubuntu-latest |
| 108 | + |
| 109 | + strategy: |
| 110 | + ############################################### |
| 111 | + ##### DYNAMIC: Dependent on build environment |
| 112 | + ############################################### |
| 113 | + matrix: |
| 114 | + node-version: [12.x] |
| 115 | + java: [ 8 ] |
| 116 | + ############################################### |
| 117 | + ##### END DYNAMIC: Dependent on build environment |
| 118 | + ############################################### |
| 119 | + steps: |
| 120 | + - uses: actions/checkout@v2 |
| 121 | + - name: Download artifacts |
| 122 | + uses: actions/download-artifact@v2 |
| 123 | + with: |
| 124 | + name: ${{ env.JOB_NAME }}generated |
| 125 | + path: generated/${{ env.JOB_NAME }} |
| 126 | + - name: Download logs |
| 127 | + uses: actions/download-artifact@v2 |
| 128 | + with: |
| 129 | + name: ${{ env.JOB_NAME }}generate_logs |
| 130 | + ############################################### |
| 131 | + ##### DYNAMIC: Dependent on build environment |
| 132 | + ############################################### |
| 133 | + - name: Use Node.js ${{ matrix.node-version }} |
| 134 | + uses: actions/setup-node@v1 |
| 135 | + with: |
| 136 | + node-version: ${{ matrix.node-version }} |
| 137 | + - uses: actions/setup-java@v1 |
| 138 | + with: |
| 139 | + java-version: ${{ matrix.java }} |
| 140 | + - name: Download Javascript V2 test cfg files |
| 141 | + uses: actions/download-artifact@v2 |
| 142 | + with: |
| 143 | + name: test-cfg-files |
| 144 | + path: generated/${{ env.JOB_NAME }} |
| 145 | + ############################################### |
| 146 | + ##### END DYNAMIC: Dependent on build environment |
| 147 | + ############################################### |
| 148 | + - name: build |
| 149 | + id: build |
| 150 | + uses: ./.github/actions/build |
| 151 | + continue-on-error: true |
| 152 | + with: |
| 153 | + path: generated/${{ env.JOB_NAME }} |
| 154 | + job-name: ${{ env.JOB_NAME }} |
| 155 | + build-commands: mvn verify |
| 156 | + - id: outcome |
| 157 | + run: | |
| 158 | + echo "::set-output name=build_outcome::${{ steps.build.outcome }}" |
| 159 | + echo ${{ steps.build.outcome }} > ${{ env.JOB_NAME }}build_outcome |
| 160 | + - name: upload build outcome |
| 161 | + uses: actions/upload-artifact@v2 |
| 162 | + with: |
| 163 | + name: ${{ env.JOB_NAME }}build_outcome |
| 164 | + path: ${{ env.JOB_NAME }}build_outcome |
| 165 | + - name: upload logs |
| 166 | + uses: actions/upload-artifact@v2 |
| 167 | + with: |
| 168 | + name: ${{ env.JOB_NAME }}logs |
| 169 | + path: ${{ steps.build.outputs.logs }} |
| 170 | + env: |
| 171 | + LANGUAGE: ${{ github.event.inputs.language }} |
| 172 | + JOB_NAME: "typescript-node-v2-sample" |
0 commit comments