forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (147 loc) · 4.88 KB
/
test-framework-single.yml
File metadata and controls
165 lines (147 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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 }}