Skip to content

Commit c174a8b

Browse files
authored
feat(ci): make ci push generated code (#244)
1 parent ef01e47 commit c174a8b

File tree

9 files changed

+384
-56
lines changed

9 files changed

+384
-56
lines changed

.github/actions/cache/action.yml

Lines changed: 137 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,115 @@ runs:
4040
shell: bash
4141
run: curl -L "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.4.0/openapi-generator-cli-5.4.0.jar" > /tmp/openapi-generator-cli.jar
4242

43+
# Restore bundled specs: used during 'client' generation or pushing the 'codegen'
44+
- name: Restore built abtesting spec
45+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
46+
uses: actions/cache@v2
47+
with:
48+
path: specs/bundled/abtesting.yml
49+
key: |
50+
${{ env.CACHE_VERSION }}-${{
51+
hashFiles(
52+
'specs/abtesting/**',
53+
'specs/common/**'
54+
)}}
55+
56+
- name: Restore built analytics spec
57+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
58+
uses: actions/cache@v2
59+
with:
60+
path: specs/bundled/analytics.yml
61+
key: |
62+
${{ env.CACHE_VERSION }}-${{
63+
hashFiles(
64+
'specs/analytics/**',
65+
'specs/common/**'
66+
)}}
67+
68+
- name: Restore built insights spec
69+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
70+
uses: actions/cache@v2
71+
with:
72+
path: specs/bundled/insights.yml
73+
key: |
74+
${{ env.CACHE_VERSION }}-${{
75+
hashFiles(
76+
'specs/insights/**',
77+
'specs/common/**'
78+
)}}
79+
80+
- name: Restore built personalization spec
81+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
82+
uses: actions/cache@v2
83+
with:
84+
path: specs/bundled/personalization.yml
85+
key: |
86+
${{ env.CACHE_VERSION }}-${{
87+
hashFiles(
88+
'specs/personalization/**',
89+
'specs/common/**'
90+
)}}
91+
92+
- name: Restore built predict spec
93+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
94+
uses: actions/cache@v2
95+
with:
96+
path: specs/bundled/predict.yml
97+
key: |
98+
${{ env.CACHE_VERSION }}-${{
99+
hashFiles(
100+
'specs/predict/**',
101+
'specs/common/**'
102+
)}}
103+
104+
- name: Restore built query-suggestions spec
105+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
106+
uses: actions/cache@v2
107+
with:
108+
path: specs/bundled/query-suggestions.yml
109+
key: |
110+
${{ env.CACHE_VERSION }}-${{
111+
hashFiles(
112+
'specs/query-suggestions/**',
113+
'specs/common/**'
114+
)}}
115+
116+
- name: Restore built recommend spec
117+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
118+
uses: actions/cache@v2
119+
with:
120+
path: specs/bundled/recommend.yml
121+
key: |
122+
${{ env.CACHE_VERSION }}-${{
123+
hashFiles(
124+
'specs/recommend/**',
125+
'specs/common/**'
126+
)}}
127+
128+
- name: Restore built search spec
129+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
130+
uses: actions/cache@v2
131+
with:
132+
path: specs/bundled/search.yml
133+
key: |
134+
${{ env.CACHE_VERSION }}-${{
135+
hashFiles(
136+
'specs/search/**',
137+
'specs/common/**'
138+
)}}
139+
140+
- name: Restore built sources spec
141+
if: ${{ inputs.job == 'client' || inputs.job == 'codegen' }}
142+
uses: actions/cache@v2
143+
with:
144+
path: specs/bundled/sources.yml
145+
key: |
146+
${{ env.CACHE_VERSION }}-${{
147+
hashFiles(
148+
'specs/sources/**',
149+
'specs/common/**'
150+
)}}
151+
43152
# Restore JavaScript clients utils: used during 'javascript' generation or 'cts'
44153
- name: Restore built JavaScript common client
45154
if: ${{ inputs.language == 'javascript' || inputs.job == 'cts' }}
@@ -77,9 +186,9 @@ runs:
77186
'!clients/algoliasearch-client-javascript/packages/requester-browser-xhr/dist'
78187
)}}
79188
80-
# Restore JavaScript clients: used during 'cts'
189+
# Restore JavaScript clients: used during 'cts' or 'codegen'
81190
- name: Restore built JavaScript algoliasearch client
82-
if: ${{ inputs.job == 'cts'}}
191+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
83192
uses: actions/cache@v2
84193
with:
85194
path: clients/algoliasearch-client-javascript/packages/algoliasearch
@@ -91,7 +200,7 @@ runs:
91200
)}}
92201
93202
- name: Restore built JavaScript search client
94-
if: ${{ inputs.job == 'cts' }}
203+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
95204
uses: actions/cache@v2
96205
with:
97206
path: clients/algoliasearch-client-javascript/packages/client-search
@@ -104,7 +213,7 @@ runs:
104213
)}}
105214
106215
- name: Restore built JavaScript recommend client
107-
if: ${{ inputs.job == 'cts' }}
216+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
108217
uses: actions/cache@v2
109218
with:
110219
path: clients/algoliasearch-client-javascript/packages/recommend
@@ -117,7 +226,7 @@ runs:
117226
)}}
118227
119228
- name: Restore built JavaScript query-suggestions client
120-
if: ${{ inputs.job == 'cts' }}
229+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
121230
uses: actions/cache@v2
122231
with:
123232
path: clients/algoliasearch-client-javascript/packages/client-query-suggestions
@@ -130,7 +239,7 @@ runs:
130239
)}}
131240
132241
- name: Restore built JavaScript personalization client
133-
if: ${{ inputs.job == 'cts' }}
242+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
134243
uses: actions/cache@v2
135244
with:
136245
path: clients/algoliasearch-client-javascript/packages/client-personalization
@@ -143,7 +252,7 @@ runs:
143252
)}}
144253
145254
- name: Restore built JavaScript analytics client
146-
if: ${{ inputs.job == 'cts' }}
255+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
147256
uses: actions/cache@v2
148257
with:
149258
path: clients/algoliasearch-client-javascript/packages/client-analytics
@@ -156,7 +265,7 @@ runs:
156265
)}}
157266
158267
- name: Restore built JavaScript abtesting client
159-
if: ${{ inputs.job == 'cts' }}
268+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
160269
uses: actions/cache@v2
161270
with:
162271
path: clients/algoliasearch-client-javascript/packages/client-abtesting
@@ -169,7 +278,7 @@ runs:
169278
)}}
170279
171280
- name: Restore built JavaScript insights client
172-
if: ${{ inputs.job == 'cts' }}
281+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
173282
uses: actions/cache@v2
174283
with:
175284
path: clients/algoliasearch-client-javascript/packages/client-insights
@@ -182,7 +291,7 @@ runs:
182291
)}}
183292
184293
- name: Restore built JavaScript sources client
185-
if: ${{ inputs.job == 'cts' }}
294+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
186295
uses: actions/cache@v2
187296
with:
188297
path: clients/algoliasearch-client-javascript/packages/client-sources
@@ -195,7 +304,7 @@ runs:
195304
)}}
196305
197306
- name: Restore built JavaScript predict client
198-
if: ${{ inputs.job == 'cts' }}
307+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
199308
uses: actions/cache@v2
200309
with:
201310
path: clients/algoliasearch-client-javascript/packages/client-predict
@@ -207,16 +316,29 @@ runs:
207316
'specs/bundled/predict.yml'
208317
)}}
209318
210-
# Restore Java clients: used during 'cts'
319+
# Restore Java clients: used during 'cts' or 'codegen'
211320
- name: Restore built Java client
212-
if: ${{ inputs.job == 'cts' }}
321+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
213322
uses: actions/cache@v2
214323
with:
215324
path: clients/algoliasearch-client-java-2
216325
key: |
217326
${{ env.CACHE_VERSION }}-${{
218327
hashFiles(
219-
'clients/algoliasearch-client-java-2/client-predict/**',
220-
'!clients/algoliasearch-client-java-2/client-predict/target',
328+
'clients/algoliasearch-client-java-2/**',
329+
'!clients/algoliasearch-client-java-2/target',
330+
'specs/bundled/search.yml'
331+
)}}
332+
333+
# Restore PHP clients: used during 'cts' or 'codegen'
334+
- name: Restore built PHP client
335+
if: ${{ inputs.job == 'cts' || inputs.job == 'codegen' }}
336+
uses: actions/cache@v2
337+
with:
338+
path: clients/algoliasearch-client-php
339+
key: |
340+
${{ env.CACHE_VERSION }}-${{
341+
hashFiles(
342+
'clients/algoliasearch-client-php/*',
221343
'specs/bundled/search.yml'
222344
)}}

0 commit comments

Comments
 (0)