Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): push generated code before cts #382

Merged
merged 6 commits into from
Apr 15, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,24 @@ 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
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 $?)

Expand All @@ -385,7 +397,7 @@ jobs:
- name: Run
run: yarn cli cts run

codegen:
codegen_on_main:
runs-on: ubuntu-20.04
timeout-minutes: 10
needs:
Expand All @@ -394,6 +406,7 @@ jobs:
- client_javascript_algoliasearch
if: |
always() &&
github.event_name == 'refs/heads/main' &&
needs.setup.outputs.RUN_CODEGEN == 'true' &&
needs.cts.result == 'success'
steps:
Expand All @@ -408,17 +421,15 @@ jobs:
with:
job: codegen

- name: Push generated code
- name: Push generated code to main
id: pushGeneratedCode
run: yarn workspace scripts pushGeneratedCode
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GENERATE_BOT }}
PR_NUMBER: ${{ github.event.number }}

- name: Spread generation to each repository
if: |
steps.pushGeneratedCode.exitcode == 0 &&
github.ref == 'refs/heads/main'
steps.pushGeneratedCode.exitcode == 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can put it on a single line

run: yarn workspace scripts spreadGeneration
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_RELEASE_BOT }}
2 changes: 0 additions & 2 deletions specs/abtesting/paths/abtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down