From 3cadfde876059b788541d52945d64dd5b3534c02 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 13:57:07 +0200 Subject: [PATCH 1/3] fix(ci): forgot the no codegen message --- .github/actions/setup/action.yml | 2 +- .github/workflows/check.yml | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index b38d130732..296aede44f 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -92,7 +92,7 @@ runs: echo "::set-output name=RUN_JS_ALGOLIASEARCH::true" fi - if [[ ${{ steps.diff.outputs.JS_UTILS_CHANGED }} > 0 ]]; then + if [[ ${{ steps.diff.outputs.JS_UTILS_CHANGED }} > 0 || ${{ steps.diff.outputs.JS_CLIENT_CHANGED }} > 0 ]]; then echo "Running JavaScript utils: true" echo "::set-output name=RUN_JS_UTILS::true" fi diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 413a2df5f6..7b9aba1fe9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -300,7 +300,6 @@ jobs: - client_gen if: | always() && - needs.setup.outputs.RUN_CODEGEN == 'true' && github.event_name == 'pull_request' && !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') @@ -311,16 +310,17 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.TOKEN_GENERATE_BOT }} - - name: Download all artifacts - uses: ./.github/actions/restore-artifacts - with: - type: all - - name: Setup uses: ./.github/actions/setup with: type: minimal + - name: Download all artifacts + if: ${{ needs.setup.outputs.RUN_CODEGEN == 'true' }} + uses: ./.github/actions/restore-artifacts + with: + type: all + - name: Push generated code to generated branch id: pushGeneratedCode run: yarn workspace scripts pushGeneratedCode From 8c8cae64d9de86ff0d860d3d692c5fdaf4aa44d5 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 14:53:43 +0200 Subject: [PATCH 2/3] comon change per language --- .github/actions/setup/action.yml | 16 ++++++++++------ scripts/ci/githubActions/createMatrix.ts | 1 + 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 296aede44f..c982bee5cf 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -86,19 +86,23 @@ runs: if: inputs.type == 'matrix' id: gen-matrix shell: bash + run: yarn workspace scripts createMatrix ${{ steps.diff.outputs.ORIGIN_BRANCH }} clients + + - name: Check if JavaScript utils should run + if: inputs.type == 'matrix' + id: js-utils + shell: bash run: | - if [[ ${{ steps.diff.outputs.JS_ALGOLIASEARCH_CHANGED }} > 0 ]]; then + if [[ ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JS_ALGOLIASEARCH_CHANGED > 0 }} ]]; then echo "Running algoliasearch: true" echo "::set-output name=RUN_JS_ALGOLIASEARCH::true" fi - if [[ ${{ steps.diff.outputs.JS_UTILS_CHANGED }} > 0 || ${{ steps.diff.outputs.JS_CLIENT_CHANGED }} > 0 ]]; then + if [[ ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JS_UTILS_CHANGED > 0 }} ]]; then echo "Running JavaScript utils: true" echo "::set-output name=RUN_JS_UTILS::true" fi - yarn workspace scripts createMatrix ${{ steps.diff.outputs.ORIGIN_BRANCH }} clients - outputs: RUN_SCRIPTS: description: Determine if the `scripts` job should run @@ -120,10 +124,10 @@ outputs: RUN_JS_ALGOLIASEARCH: description: Determine if the `client-javascript-algoliasearch` job should run - value: ${{ steps.gen-matrix.outputs.RUN_JS_ALGOLIASEARCH }} + value: ${{ steps.js-utils.outputs.RUN_JS_ALGOLIASEARCH }} RUN_JS_UTILS: description: Whether to build JS client common folders when RUN_JS is false - value: ${{ steps.gen-matrix.outputs.RUN_JS_UTILS }} + value: ${{ steps.js-utils.outputs.RUN_JS_UTILS }} RUN_JS_TESTS: description: Determine if the `client_javascript_tests` job should run value: ${{ steps.diff.outputs.JS_COMMON_TESTS_CHANGED > 0 }} diff --git a/scripts/ci/githubActions/createMatrix.ts b/scripts/ci/githubActions/createMatrix.ts index e6702b8261..c6c2a9eaac 100644 --- a/scripts/ci/githubActions/createMatrix.ts +++ b/scripts/ci/githubActions/createMatrix.ts @@ -82,6 +82,7 @@ async function getClientMatrix(baseBranch: string): Promise { continue; } + console.log(`::set-output name=RUN_GEN_${language.toUpperCase()}::true`); matrix[language].toRun.push(client); matrix[language].cacheToCompute.push(`specs/${bundledSpec}`); } From 18ae816ef6aea39d422c217f0120fb2284bb70d2 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Mon, 9 May 2022 14:55:31 +0200 Subject: [PATCH 3/3] leading space --- .github/actions/setup/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index c982bee5cf..e35182de48 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -98,7 +98,7 @@ runs: echo "::set-output name=RUN_JS_ALGOLIASEARCH::true" fi - if [[ ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JS_UTILS_CHANGED > 0 }} ]]; then + if [[ ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JS_UTILS_CHANGED > 0 }} ]]; then echo "Running JavaScript utils: true" echo "::set-output name=RUN_JS_UTILS::true" fi