Skip to content

Commit c29d87c

Browse files
committed
added java 11 workflow
1 parent 5a4a738 commit c29d87c

File tree

1 file changed

+194
-0
lines changed

1 file changed

+194
-0
lines changed
Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
name: Test Framework JAVA 11
2+
3+
on:
4+
# execute on demand
5+
workflow_dispatch:
6+
branches: ["master", "test-framework", "3.0.0"]
7+
inputs:
8+
language:
9+
description: 'Language'
10+
required: true
11+
specUrl:
12+
description: 'URL of OpenAPI doc'
13+
required: true
14+
default: "https://petstore3.swagger.io/api/v3/openapi.json"
15+
options:
16+
description: 'language options'
17+
default: ''
18+
jobName:
19+
description: 'job name'
20+
required: true
21+
buildCommands:
22+
description: 'build commands for generated code'
23+
required: true
24+
version:
25+
description: 'exact release or snapshot codegen version'
26+
required: true
27+
28+
jobs:
29+
30+
# builds codegen cli and uploads its artifact
31+
build-codegen:
32+
33+
runs-on: ubuntu-latest
34+
35+
strategy:
36+
matrix:
37+
java: [ 11 ]
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
- uses: actions/setup-java@v1
42+
with:
43+
java-version: ${{ matrix.java }}
44+
- name: build codegen
45+
run: |
46+
mkdir codegen-cli
47+
if [[ ${{ env.VERSION }} == 3* ]]
48+
then
49+
echo "DOWNLOADING ${{ env.VERSION }}"
50+
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
51+
elif [[ ${{ env.VERSION }} == 2* ]]
52+
then
53+
echo "DOWNLOADING ${{ env.VERSION }}"
54+
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
55+
else
56+
echo "BUILDING ${{ env.VERSION }}"
57+
mvn -version
58+
mvn -q -B package -DskipTests -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=3
59+
cp modules/swagger-codegen-cli/target/swagger-codegen-cli.jar codegen-cli
60+
fi
61+
- name: upload codegen cli
62+
uses: actions/upload-artifact@v2
63+
with:
64+
name: codegen-cli
65+
path: codegen-cli
66+
67+
env:
68+
VERSION: ${{ github.event.inputs.version }}
69+
70+
generate:
71+
72+
needs: build-codegen
73+
74+
runs-on: ubuntu-latest
75+
76+
strategy:
77+
matrix:
78+
java: [ 11 ]
79+
80+
81+
outputs:
82+
generate_outcome: ${{ steps.outcome.outputs.generate_outcome }}
83+
84+
steps:
85+
- uses: actions/checkout@v2
86+
- uses: actions/setup-java@v1
87+
with:
88+
java-version: ${{ matrix.java }}
89+
- name: Download codegen cli
90+
uses: actions/download-artifact@v2
91+
with:
92+
name: codegen-cli
93+
- name: generate
94+
id: generate
95+
continue-on-error: true
96+
uses: ./.github/actions/generate
97+
with:
98+
language: ${{ env.LANGUAGE }}
99+
job-name: ${{ env.JOB_NAME }}
100+
spec-url: ${{ env.SPEC_URL }}
101+
options: ${{ env.OPTIONS }}
102+
- id: outcome
103+
run: |
104+
echo "::set-output name=generate_outcome::${{ steps.generate.outcome }}"
105+
echo ${{ steps.generate.outcome }} > generate_outcome_${{ env.JOB_NAME }}
106+
- name: upload generate outcome
107+
uses: actions/upload-artifact@v2
108+
with:
109+
name: ${{ env.JOB_NAME }}generate_outcome
110+
path: generate_outcome_${{ env.JOB_NAME }}
111+
- name: upload generate logs
112+
uses: actions/upload-artifact@v2
113+
with:
114+
name: ${{ env.JOB_NAME }}generate_logs
115+
path: ${{ steps.generate.outputs.logs }}
116+
- name: upload generated code
117+
if: contains(steps.generate.outcome, 'success')
118+
uses: actions/upload-artifact@v2
119+
with:
120+
name: ${{ env.JOB_NAME }}generated
121+
path: ${{ steps.generate.outputs.path }}
122+
123+
env:
124+
LANGUAGE: ${{ github.event.inputs.language }}
125+
JOB_NAME: ${{ github.event.inputs.jobName }}
126+
OPTIONS: ${{ github.event.inputs.options }}
127+
SPEC_URL: ${{ github.event.inputs.specUrl }}
128+
BUILD_COMMANDS: ${{ github.event.inputs.buildCommands }}
129+
VERSION: ${{ github.event.inputs.version }}
130+
131+
build:
132+
133+
needs: generate
134+
if: contains(needs.generate.outputs.generate_outcome, 'success')
135+
runs-on: ubuntu-latest
136+
137+
strategy:
138+
###############################################
139+
##### DYNAMIC: Dependent on build environment
140+
###############################################
141+
matrix:
142+
java-version: [ 11 ]
143+
###############################################
144+
##### END DYNAMIC: Dependent on build environment
145+
###############################################
146+
steps:
147+
- uses: actions/checkout@v2
148+
- name: Download artifacts
149+
uses: actions/download-artifact@v2
150+
with:
151+
name: ${{ env.JOB_NAME }}generated
152+
path: generated/${{ env.JOB_NAME }}
153+
- name: Download logs
154+
uses: actions/download-artifact@v2
155+
with:
156+
name: ${{ env.JOB_NAME }}generate_logs
157+
###############################################
158+
##### DYNAMIC: Dependent on build environment
159+
###############################################
160+
- name: Set up JDK 11
161+
uses: actions/setup-java@v1
162+
with:
163+
java-version: ${{ matrix.java-version }}
164+
###############################################
165+
##### END DYNAMIC: Dependent on build environment
166+
###############################################
167+
- name: build
168+
id: build
169+
uses: ./.github/actions/build
170+
continue-on-error: true
171+
with:
172+
path: generated/${{ env.JOB_NAME }}
173+
job-name: ${{ env.JOB_NAME }}
174+
build-commands: ${{ env.BUILD_COMMANDS }}
175+
- id: outcome
176+
run: |
177+
echo "::set-output name=build_outcome::${{ steps.build.outcome }}"
178+
echo ${{ steps.build.outcome }} > ${{ env.JOB_NAME }}build_outcome
179+
- name: upload build outcome
180+
uses: actions/upload-artifact@v2
181+
with:
182+
name: ${{ env.JOB_NAME }}build_outcome
183+
path: ${{ env.JOB_NAME }}build_outcome
184+
- name: upload logs
185+
uses: actions/upload-artifact@v2
186+
with:
187+
name: ${{ env.JOB_NAME }}logs
188+
path: ${{ steps.build.outputs.logs }}
189+
env:
190+
LANGUAGE: ${{ github.event.inputs.language }}
191+
JOB_NAME: ${{ github.event.inputs.jobName }}
192+
OPTIONS: ${{ github.event.inputs.options }}
193+
SPEC_URL: ${{ github.event.inputs.specUrl }}
194+
BUILD_COMMANDS: ${{ github.event.inputs.buildCommands }}

0 commit comments

Comments
 (0)