From cef2ebdd1544880efe767a47d730c7a7e43ea366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 18 Jan 2022 16:28:32 +0100 Subject: [PATCH 1/6] chore(ci): ensure pushed client is generated --- .github/workflows/check.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2adc31ac67..10432bc312 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -89,6 +89,15 @@ jobs: 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: | + if [[ $(git status --porcelain ${{ matrix.client.folder }} | wc -l) == '0' ]]; then + exit 0 + else + exit 1 + fi + - name: Build ${{ matrix.client.name }} client if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients javascript ${{ matrix.client.name }} @@ -122,6 +131,15 @@ jobs: 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: | + if [[ $(git status --porcelain ${{ matrix.client.folder }} | wc -l) == '0' ]]; then + exit 0 + else + exit 1 + fi + - name: Build ${{ matrix.client.name }} client if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients java ${{ matrix.client.name }} From ff432fff598b1711ed47f7f5df4704813785367b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 18 Jan 2022 16:29:17 +0100 Subject: [PATCH 2/6] should throw --- specs/search/paths/keys/key.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/search/paths/keys/key.yml b/specs/search/paths/keys/key.yml index 18679d4102..cedfe32d12 100644 --- a/specs/search/paths/keys/key.yml +++ b/specs/search/paths/keys/key.yml @@ -3,7 +3,7 @@ put: - search operationId: updateApiKey summary: Update an API key. - description: Replace every permission of an existing API key. + description: Replace every permission of an existing API key. THROW parameters: - $ref: 'common/parameters.yml#/KeyString' requestBody: From c2764b14e4ee60a81b8775a2974c5779cb9bd384 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 18 Jan 2022 16:33:17 +0100 Subject: [PATCH 3/6] should pass --- specs/search/paths/keys/key.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/search/paths/keys/key.yml b/specs/search/paths/keys/key.yml index cedfe32d12..18679d4102 100644 --- a/specs/search/paths/keys/key.yml +++ b/specs/search/paths/keys/key.yml @@ -3,7 +3,7 @@ put: - search operationId: updateApiKey summary: Update an API key. - description: Replace every permission of an existing API key. THROW + description: Replace every permission of an existing API key. parameters: - $ref: 'common/parameters.yml#/KeyString' requestBody: From 5ec3f0d595dd42f85eeb5991be4a7447dec4889e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 18 Jan 2022 16:43:09 +0100 Subject: [PATCH 4/6] invalidate cache with specs: THROW --- .github/actions/cache/action.yml | 16 ++++++++-------- .github/workflows/check.yml | 4 ++-- specs/search/paths/keys/keys.yml | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml index 764ceae3d8..c9351159be 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/cache/action.yml @@ -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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 10432bc312..cfd980c5d1 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -83,7 +83,7 @@ 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' @@ -125,7 +125,7 @@ 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' diff --git a/specs/search/paths/keys/keys.yml b/specs/search/paths/keys/keys.yml index bc10b68b22..2d9c2b51c9 100644 --- a/specs/search/paths/keys/keys.yml +++ b/specs/search/paths/keys/keys.yml @@ -3,7 +3,7 @@ post: - search operationId: addApiKey summary: Create a new API key. - description: Add a new API Key with specific permissions/restrictions. + description: Add a new API Key with specific permissions/restrictions. THROW requestBody: required: true content: From d0bf5e6775351a3380a1419028047e827427be6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 18 Jan 2022 16:51:59 +0100 Subject: [PATCH 5/6] should pass --- specs/search/paths/keys/keys.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/search/paths/keys/keys.yml b/specs/search/paths/keys/keys.yml index 2d9c2b51c9..bc10b68b22 100644 --- a/specs/search/paths/keys/keys.yml +++ b/specs/search/paths/keys/keys.yml @@ -3,7 +3,7 @@ post: - search operationId: addApiKey summary: Create a new API key. - description: Add a new API Key with specific permissions/restrictions. THROW + description: Add a new API Key with specific permissions/restrictions. requestBody: required: true content: From e549c59c702f01914387ff2ab3827cfea6575272 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vannicatte?= Date: Tue, 18 Jan 2022 17:17:03 +0100 Subject: [PATCH 6/6] apply changes from suggestion --- .github/workflows/check.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cfd980c5d1..d35029ccfc 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -91,12 +91,7 @@ jobs: - name: Check diff with pushed client if: steps.cache.outputs.cache-hit != 'true' - run: | - if [[ $(git status --porcelain ${{ matrix.client.folder }} | wc -l) == '0' ]]; then - exit 0 - else - exit 1 - fi + run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l) - name: Build ${{ matrix.client.name }} client if: steps.cache.outputs.cache-hit != 'true' @@ -133,12 +128,7 @@ jobs: - name: Check diff with pushed client if: steps.cache.outputs.cache-hit != 'true' - run: | - if [[ $(git status --porcelain ${{ matrix.client.folder }} | wc -l) == '0' ]]; then - exit 0 - else - exit 1 - fi + run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l) - name: Build ${{ matrix.client.name }} client if: steps.cache.outputs.cache-hit != 'true'