Skip to content

Commit

Permalink
chore(ci): ensure pushed client is generated (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Jan 18, 2022
1 parent 622bce1 commit a10152a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 8 additions & 8 deletions .github/actions/cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,56 +31,56 @@ runs:
uses: actions/cache@v2
with:
path: /home/runner/work/api-clients-automation/api-clients-automation/clients/algoliasearch-client-javascript/client-search/dist
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }}
key: ${{ runner.os }}-1-js-client-search-${{ hashFiles('clients/algoliasearch-client-javascript/client-search/**') }}-${{ hashFiles('specs/dist/search.yml') }}

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

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

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

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

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

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

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

# setup yarn
- name: Get yarn cache directory path
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ jobs:
uses: actions/cache@v2
with:
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/dist'
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
key: ${{ runner.os }}-1-js-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/dist/{0}.yml', matrix.client.name)) }}

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

- name: Check diff with pushed client
if: steps.cache.outputs.cache-hit != 'true'
run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l)

- name: Build ${{ matrix.client.name }} client
if: steps.cache.outputs.cache-hit != 'true'
run: yarn build:clients javascript ${{ matrix.client.name }}
Expand Down Expand Up @@ -116,12 +120,16 @@ jobs:
uses: actions/cache@v2
with:
path: '/home/runner/work/api-clients-automation/api-clients-automation/${{ matrix.client.folder }}/target'
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}
key: ${{ runner.os }}-1-java-client-${{ matrix.client.name }}-${{ hashFiles(format('{0}/**', matrix.client.folder)) }}-${{ hashFiles(format('specs/dist/{0}.yml', matrix.client.name)) }} }}

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

- name: Check diff with pushed client
if: steps.cache.outputs.cache-hit != 'true'
run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l)

- name: Build ${{ matrix.client.name }} client
if: steps.cache.outputs.cache-hit != 'true'
run: yarn build:clients java ${{ matrix.client.name }}
Expand Down

0 comments on commit a10152a

Please sign in to comment.