-
Notifications
You must be signed in to change notification settings - Fork 68
239 lines (210 loc) · 8.04 KB
/
validate-and-generate-transactional.yml
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Validate and Generate Transactional Client Libraries
on:
pull_request:
types: [ assigned, opened, synchronize, reopened, labeled ]
push:
jobs:
validate:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-transactional') }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v2
- name: Cache node_modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: NPM Install
run: npm install
- name: Validate Transactional Spec
run: npx @apidevtools/swagger-cli validate spec/transactional.json
- name: Set Version
id: set-version
run: node utils/actions/setVersionVar.js --api=transactional
setup-cache:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-transactional') }}
runs-on: ubuntu-latest
needs: [validate]
steps:
- uses: actions/checkout@v2
- name: Initialize Cache
id: init-cache-md
uses: actions/cache@v1
with:
path: .cache
key: cache-dir
- name: Install Codegen CLI
if: steps.init-cache-md.outputs.cache-hit != 'true'
run: |
mkdir .cache
wget https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.7/swagger-codegen-cli-2.4.7.jar -O .cache/swagger-codegen-cli.jar
java -jar .cache/swagger-codegen-cli.jar help
generate-node:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-transactional') }}
runs-on: ubuntu-latest
needs: [validate, setup-cache]
steps:
- uses: actions/checkout@v2
- name: Initialize Transactional Cache
id: init-cache-md
uses: actions/cache@v1
with:
path: .cache
key: cache-dir
- name: Cache node_modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
scope: '@mailchimp'
- name: Generate → transactional-javascript
run: |
npm install
node utils/actions/updateLangConfig.js --api=transactional --lang=javascript --specVersion=${{ env.SPEC_VERSION }}
npm run generate:javascript:transactional
env:
SPEC_VERSION: ${{ needs.validate.outputs.version }}
- name: Rename transactional-javascript → transactional-node
working-directory: swagger-out
run: |
mv transactional-javascript transactional-node
- name: Zip build artifact → transactional-node
working-directory: swagger-out/transactional-node
run: zip -r mailchimp-transactional-node.zip .
- name: Upload build artifact → transactional-node
uses: actions/upload-artifact@v1
with:
name: mailchimp-transactional-node.zip
path: swagger-out/transactional-node/mailchimp-transactional-node.zip
generate-php:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-transactional') }}
runs-on: ubuntu-latest
needs: [validate, setup-cache]
steps:
- uses: actions/checkout@v2
- name: Initialize Transactional Cache
id: init-cache-md
uses: actions/cache@v1
with:
path: .cache
key: cache-dir
- name: Cache node_modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Generate → transactional-php
run: |
npm install
node utils/actions/updateLangConfig.js --api=transactional --lang=php --specVersion=${{ env.SPEC_VERSION }}
npm run generate:php:transactional
env:
SPEC_VERSION: ${{ needs.validate.outputs.version }}
- name: Zip build artifact → transactional-php
working-directory: swagger-out/transactional-php
run: zip -r mailchimp-transactional-php.zip .
- name: Upload build artifact → transactional-php
uses: actions/upload-artifact@v1
with:
name: mailchimp-transactional-php.zip
path: swagger-out/transactional-php/mailchimp-transactional-php.zip
generate-ruby:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-transactional') }}
runs-on: ubuntu-latest
needs: [validate, setup-cache]
steps:
- uses: actions/checkout@v2
- name: Initialize Transactional Cache
id: init-cache-md
uses: actions/cache@v1
with:
path: .cache
key: cache-dir
- name: Cache node_modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Generate → transactional-ruby
run: |
npm install
node utils/actions/updateLangConfig.js --api=transactional --lang=ruby --specVersion=${{ env.SPEC_VERSION }}
npm run generate:ruby:transactional
env:
SPEC_VERSION: ${{ needs.validate.outputs.version }}
- name: Zip build artifact → transactional-ruby
working-directory: swagger-out/transactional-ruby
run: zip -r mailchimp-transactional-ruby.zip .
- name: Upload build artifact → transactional-ruby
uses: actions/upload-artifact@v1
with:
name: mailchimp-transactional-ruby.zip
path: swagger-out/transactional-ruby/mailchimp-transactional-ruby.zip
generate-python:
if: ${{ contains(github.event.pull_request.labels.*.name, 'test-transactional') }}
runs-on: ubuntu-latest
needs: [validate, setup-cache]
steps:
- uses: actions/checkout@v2
- name: Initialize Transactional Cache
id: init-cache-md
uses: actions/cache@v1
with:
path: .cache
key: cache-dir
- name: Cache node_modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Generate → transactional-python
run: |
npm install
node utils/actions/updateLangConfig.js --api=transactional --lang=python --specVersion=${{ env.SPEC_VERSION }}
npm run generate:python:transactional
env:
SPEC_VERSION: ${{ needs.validate.outputs.version }}
- name: Zip build artifact → transactional-python
working-directory: swagger-out/transactional-python
run: zip -r mailchimp-transactional-python.zip .
- name: Upload build artifact → transactional-python
uses: actions/upload-artifact@v1
with:
name: mailchimp-transactional-python.zip
path: swagger-out/transactional-python/mailchimp-transactional-python.zip