From 1eebefbe16049126d8aa05628f23e5e828819b60 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 15 Apr 2022 10:53:35 +0200 Subject: [PATCH 1/4] chore(ci): push generated code before cts --- .github/workflows/check.yml | 39 +++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index cbbe70450c..40d43c63d3 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -385,7 +385,38 @@ jobs: - name: Run run: yarn cli cts run - codegen: + codegen_pr: + runs-on: ubuntu-20.04 + timeout-minutes: 10 + needs: + - client_javascript + - client_java + - client_php + if: | + always() && + github.event_name == 'pull_request' && + needs.setup.outputs.RUN_CODEGEN == 'true' && + needs.*.result == 'success' + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.TOKEN_RELEASE_BOT }} + + - name: Restore cache + uses: ./.github/actions/cache + with: + job: codegen + + - name: Push generated code generated branch + id: pushGeneratedCode + run: yarn workspace scripts pushGeneratedCode + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }} + PR_NUMBER: ${{ github.event.number }} + + codegen_main: runs-on: ubuntu-20.04 timeout-minutes: 10 needs: @@ -394,6 +425,7 @@ jobs: - client_javascript_algoliasearch if: | always() && + github.ref == 'refs/heads/main' && needs.setup.outputs.RUN_CODEGEN == 'true' && needs.cts.result == 'success' steps: @@ -408,7 +440,7 @@ jobs: with: job: codegen - - name: Push generated code + - name: Push generated code to main id: pushGeneratedCode run: yarn workspace scripts pushGeneratedCode env: @@ -417,8 +449,7 @@ jobs: - name: Spread generation to each repository if: | - steps.pushGeneratedCode.exitcode == 0 && - github.ref == 'refs/heads/main' + steps.pushGeneratedCode.exitcode == 0 run: yarn workspace scripts spreadGeneration env: GITHUB_TOKEN: ${{ secrets.TOKEN_RELEASE_BOT }} From f569757cc6051e62bc98d0f38f1b37dd13a950c1 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 15 Apr 2022 11:32:22 +0200 Subject: [PATCH 2/4] test --- .github/workflows/check.yml | 44 ++++++++------------------------ specs/abtesting/paths/abtest.yml | 2 -- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 40d43c63d3..aa3dacf1d4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -371,6 +371,14 @@ jobs: with: job: cts + - name: Push generated code to generated branch + id: pushGeneratedCode + if: github.event_name == 'pull_request' + run: yarn workspace scripts pushGeneratedCode + env: + GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }} + PR_NUMBER: ${{ github.event.number }} + - name: Check JavaScript client size run: exit $(yarn workspace algoliasearch-client-javascript test:size | echo $?) @@ -385,38 +393,7 @@ jobs: - name: Run run: yarn cli cts run - codegen_pr: - runs-on: ubuntu-20.04 - timeout-minutes: 10 - needs: - - client_javascript - - client_java - - client_php - if: | - always() && - github.event_name == 'pull_request' && - needs.setup.outputs.RUN_CODEGEN == 'true' && - needs.*.result == 'success' - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - token: ${{ secrets.TOKEN_RELEASE_BOT }} - - - name: Restore cache - uses: ./.github/actions/cache - with: - job: codegen - - - name: Push generated code generated branch - id: pushGeneratedCode - run: yarn workspace scripts pushGeneratedCode - env: - GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }} - PR_NUMBER: ${{ github.event.number }} - - codegen_main: + codegen_on_main: runs-on: ubuntu-20.04 timeout-minutes: 10 needs: @@ -425,7 +402,7 @@ jobs: - client_javascript_algoliasearch if: | always() && - github.ref == 'refs/heads/main' && + github.event_name == 'refs/heads/main' && needs.setup.outputs.RUN_CODEGEN == 'true' && needs.cts.result == 'success' steps: @@ -445,7 +422,6 @@ jobs: run: yarn workspace scripts pushGeneratedCode env: GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }} - PR_NUMBER: ${{ github.event.number }} - name: Spread generation to each repository if: | diff --git a/specs/abtesting/paths/abtest.yml b/specs/abtesting/paths/abtest.yml index 91c4b14e22..86215ce65a 100644 --- a/specs/abtesting/paths/abtest.yml +++ b/specs/abtesting/paths/abtest.yml @@ -16,8 +16,6 @@ get: $ref: '../common/schemas/ABTest.yml#/ABTest' '400': $ref: '../../common/responses/BadRequest.yml' - '402': - $ref: '../../common/responses/FeatureNotEnabled.yml' '403': $ref: '../../common/responses/MethodNotAllowed.yml' '404': From c3383bdecf1ffa71bd9cf8fe7636e6674542b0b0 Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 15 Apr 2022 11:57:32 +0200 Subject: [PATCH 3/4] attach head --- .github/workflows/check.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index aa3dacf1d4..366ebd7a51 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -365,6 +365,10 @@ jobs: !contains(needs.*.result, 'failure') steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + token: ${{ secrets.TOKEN_RELEASE_BOT }} - name: Restore cache uses: ./.github/actions/cache From 244ecaa333728704a6c2e79c4deb0e4b50f4cb5f Mon Sep 17 00:00:00 2001 From: Pierre Millot Date: Fri, 15 Apr 2022 12:06:46 +0200 Subject: [PATCH 4/4] revert --- .github/workflows/check.yml | 3 +-- specs/abtesting/paths/abtest.yml | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 366ebd7a51..6f170a723e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -428,8 +428,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }} - name: Spread generation to each repository - if: | - steps.pushGeneratedCode.exitcode == 0 + if: steps.pushGeneratedCode.exitcode == 0 run: yarn workspace scripts spreadGeneration env: GITHUB_TOKEN: ${{ secrets.TOKEN_RELEASE_BOT }} diff --git a/specs/abtesting/paths/abtest.yml b/specs/abtesting/paths/abtest.yml index 86215ce65a..91c4b14e22 100644 --- a/specs/abtesting/paths/abtest.yml +++ b/specs/abtesting/paths/abtest.yml @@ -16,6 +16,8 @@ get: $ref: '../common/schemas/ABTest.yml#/ABTest' '400': $ref: '../../common/responses/BadRequest.yml' + '402': + $ref: '../../common/responses/FeatureNotEnabled.yml' '403': $ref: '../../common/responses/MethodNotAllowed.yml' '404':