Skip to content

Commit a10152a

Browse files
authored
chore(ci): ensure pushed client is generated (#94)
1 parent 622bce1 commit a10152a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

.github/actions/cache/action.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,56 +31,56 @@ runs:
3131
uses: actions/cache@v2
3232
with:
3333
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-search/dist
34-
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }}
34+
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }}-${{ hashFiles('specs/dist/search.yml') }}
3535

3636
- name: Restore built JavaScript recommend client
3737
if: ${{ inputs.job == 'cts' }}
3838
uses: actions/cache@v2
3939
with:
4040
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/recommend/dist
41-
key: ${{ runner.os }}-1-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/recommend/**') }}
41+
key: ${{ runner.os }}-1-js-client-recommend-${{ hashFiles('clients/algoliasearch-client-javascript/recommend/**') }}-${{ hashFiles('specs/dist/recommend.yml') }}
4242

4343
- name: Restore built JavaScript query-suggestions client
4444
if: ${{ inputs.job == 'cts' }}
4545
uses: actions/cache@v2
4646
with:
4747
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-query-suggestions/dist
48-
key: ${{ runner.os }}-1-js-client-query-suggestions-${{ hashFiles('clients/algoliasearch-client-javascript/client-query-suggestions/**') }}
48+
key: ${{ runner.os }}-1-js-client-query-suggestions-${{ hashFiles('clients/algoliasearch-client-javascript/client-query-suggestions/**') }}-${{ hashFiles('specs/dist/query-suggestions.yml') }}
4949

5050
- name: Restore built JavaScript personalization client
5151
if: ${{ inputs.job == 'cts' }}
5252
uses: actions/cache@v2
5353
with:
5454
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-personalization/dist
55-
key: ${{ runner.os }}-1-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/client-personalization/**') }}
55+
key: ${{ runner.os }}-1-js-client-personalization-${{ hashFiles('clients/algoliasearch-client-javascript/client-personalization/**') }}-${{ hashFiles('specs/dist/personalization.yml') }}
5656

5757
- name: Restore built JavaScript analytics client
5858
if: ${{ inputs.job == 'cts' }}
5959
uses: actions/cache@v2
6060
with:
6161
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-analytics/dist
62-
key: ${{ runner.os }}-1-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }}
62+
key: ${{ runner.os }}-1-js-client-analytics-${{ hashFiles('clients/algoliasearch-client-javascript/client-analytics/**') }}-${{ hashFiles('specs/dist/analytics.yml') }}
6363

6464
- name: Restore built JavaScript abtesting client
6565
if: ${{ inputs.job == 'cts' }}
6666
uses: actions/cache@v2
6767
with:
6868
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-abtesting/dist
69-
key: ${{ runner.os }}-1-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/client-abtesting/**') }}
69+
key: ${{ runner.os }}-1-js-client-abtesting-${{ hashFiles('clients/algoliasearch-client-javascript/client-abtesting/**') }}-${{ hashFiles('specs/dist/abtesting.yml') }}
7070

7171
- name: Restore built JavaScript insights client
7272
if: ${{ inputs.job == 'cts' }}
7373
uses: actions/cache@v2
7474
with:
7575
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-insights/dist
76-
key: ${{ runner.os }}-1-js-client-insights-${{ hashFiles('clients/algoliasearch-client-javascript/client-insights/**') }}
76+
key: ${{ runner.os }}-1-js-client-insights-${{ hashFiles('clients/algoliasearch-client-javascript/client-insights/**') }}-${{ hashFiles('specs/dist/insights.yml') }}
7777

7878
- name: Restore built Java client
7979
if: ${{ inputs.job == 'cts' }}
8080
uses: actions/cache@v2
8181
with:
8282
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-java-2/target
83-
key: ${{ runner.os }}-1-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }}
83+
key: ${{ runner.os }}-1-java-client-${{ hashFiles('clients/algoliasearch-client-java-2/**') }}-${{ hashFiles('specs/dist/search.yml') }}
8484

8585
# setup yarn
8686
- name: Get yarn cache directory path

.github/workflows/check.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,16 @@ jobs:
8383
uses: actions/cache@v2
8484
with:
8585
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/dist'
86-
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
86+
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/dist/{0}.yml', matrix.client.name)) }}
8787

8888
- name: Generate ${{ matrix.client.name }} client
8989
if: steps.cache.outputs.cache-hit != 'true'
9090
run: yarn generate javascript ${{ matrix.client.name }}
9191

92+
- name: Check diff with pushed client
93+
if: steps.cache.outputs.cache-hit != 'true'
94+
run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l)
95+
9296
- name: Build ${{ matrix.client.name }} client
9397
if: steps.cache.outputs.cache-hit != 'true'
9498
run: yarn build:clients javascript ${{ matrix.client.name }}
@@ -116,12 +120,16 @@ jobs:
116120
uses: actions/cache@v2
117121
with:
118122
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/target'
119-
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
123+
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/dist/{0}.yml', matrix.client.name)) }} }}
120124

121125
- name: Generate ${{ matrix.client.name }} client
122126
if: steps.cache.outputs.cache-hit != 'true'
123127
run: yarn generate java ${{ matrix.client.name }}
124128

129+
- name: Check diff with pushed client
130+
if: steps.cache.outputs.cache-hit != 'true'
131+
run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l)
132+
125133
- name: Build ${{ matrix.client.name }} client
126134
if: steps.cache.outputs.cache-hit != 'true'
127135
run: yarn build:clients java ${{ matrix.client.name }}

0 commit comments

Comments
 (0)