-
Notifications
You must be signed in to change notification settings - Fork 0
feat: turborepo ci commands and jobs (ENG-600) #346
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
Open
effervescentia
wants to merge
25
commits into
master
Choose a base branch
from
ben/eng-600
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+428
−1
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
44dbfe5
feat: turborepo ci commands and jobs (ENG-600)
effervescentia d4f102a
refactor: simplify
effervescentia 66122cf
fix: remove unused param
effervescentia 83ea85e
fix: reorder
effervescentia de2488b
fix: param type
effervescentia 6649438
ci: updated hadolint
effervescentia b654dd0
feat: more
effervescentia 339da86
chore: add debug logging
effervescentia 595e9b5
chore: more debugging
effervescentia f5bee89
feat: encode hash
effervescentia f12eec5
fix: use correct parameters variable
effervescentia 10e9abc
fix: break up commands for debugging
effervescentia f6db27e
fix: syntax
effervescentia 2016530
fix: storing artifacts
effervescentia 8508d4b
chore: better caching
effervescentia 5d7fb70
chore: remove debug logging
effervescentia c75d5d0
fix: create hashfiles folder
effervescentia 519a63f
fix: restore build cache optionally for dependency tests
effervescentia fad9761
feat: new job
effervescentia b2d245e
fix: remove unused param
effervescentia a396341
fix: jq syntax
effervescentia eec0f8b
feat: caching without hashfiles
effervescentia 69c7d22
fix: add parameter type
effervescentia 4d428f4
fix: inline refs
effervescentia f14fe79
feat: turborepo schema validation with caching
effervescentia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| parameters: | ||
| prefix: | ||
| description: Cache prefix | ||
| type: string | ||
| command: | ||
| description: Script to execute turbo run command | ||
| type: string | ||
| steps: | ||
| - run: | ||
| name: Writing '<< parameters.command >>' hashes to '/tmp/hashfiles/<< parameters.prefix >>.hashfile.json' | ||
| command: | | ||
| report=$(<< parameters.command >> --dry-run json) | ||
|
|
||
| echo "$report" | ||
|
|
||
| mkdir -p /tmp/hashfiles | ||
| echo "$report" \ | ||
| | jq -c '. | { globalHash: .globalCacheInputs.hashOfExternalDependencies, tasks: .tasks | map({ taskId, hash, externalHash: .hashOfExternalDependencies }) | sort_by(.taskId) }' \ | ||
| > /tmp/hashfiles/<< parameters.prefix >>.hashfile.json | ||
| - store_artifacts: | ||
| name: Storing '/tmp/hashfiles/<< parameters.prefix >>.hashfile.json' as artifact | ||
| path: /tmp/hashfiles/<< parameters.prefix >>.hashfile.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| parameters: | ||
| cache_prefix: | ||
| description: Cache prefix | ||
| type: string | ||
| default: '' | ||
| command: | ||
| description: Script to install dependencies | ||
| type: string | ||
| default: yarn install --immutable | ||
| steps: | ||
| - authenticate_npm | ||
| - vf_restore_cache: | ||
| cache_prefix: turbo-<< parameters.cache_prefix >> | ||
| - run: | ||
| command: << parameters.command >> | ||
| - vf_save_cache: | ||
| cache_prefix: turbo-<< parameters.cache_prefix >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| parameters: | ||
| coverage_dir: | ||
| description: Directory containing coverage information | ||
| type: string | ||
| steps: | ||
| - persist_to_workspace: | ||
| root: "." | ||
| paths: | ||
| - << parameters.coverage_dir >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| parameters: | ||
| prefix: | ||
| description: Cache prefix | ||
| type: string | ||
| fallback_prefix: | ||
| description: Build cache prefix to pull from as a fallback | ||
| type: string | ||
| default: '' | ||
| affix_hashfile: | ||
| description: If true affixes the checksum of the relevant hashfile to the cache key | ||
| type: boolean | ||
| default: true | ||
| steps: | ||
| - when: | ||
| condition: << parameters.fallback_prefix >> | ||
| steps: | ||
| - when: | ||
| condition: << parameters.affix_hashfile >> | ||
| steps: | ||
| - restore_cache: | ||
| name: Restoring turborepo '<< parameters.prefix >>' cache, falling back to '<< parameters.fallback_prefix >>' cache | ||
| keys: | ||
| - &branch_key_with_hashfile | ||
| << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}-{{ checksum "/tmp/hashfiles/<< parameters.prefix >>.hashfile.json" }} | ||
| - &global_key_with_hashfile | ||
| << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-global-{{ checksum "/tmp/hashfiles/<< parameters.prefix >>.hashfile.json" }} | ||
| - << parameters.fallback_prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}-{{ checksum "/tmp/hashfiles/<< parameters.fallback_prefix >>.hashfile.json" }} | ||
| - << parameters.fallback_prefix >>-{{ .Environment.CACHE_VERSION }}-global-{{ checksum "/tmp/hashfiles/<< parameters.fallback_prefix >>.hashfile.json" }} | ||
| - &branch_key | ||
| << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}- | ||
| - &fallback_branch_key | ||
| << parameters.fallback_prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}- | ||
| - &master_branch_key | ||
| << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-branch-master- | ||
| - &fallback_master_branch_key | ||
| << parameters.fallback_prefix >>-{{ .Environment.CACHE_VERSION }}-branch-master- | ||
| - unless: | ||
| condition: << parameters.affix_hashfile >> | ||
| steps: | ||
| - restore_cache: | ||
| name: Restoring turborepo '<< parameters.prefix >>' cache, falling back to '<< parameters.fallback_prefix >>' cache | ||
| keys: | ||
| - &branch_key_with_revision | ||
| << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}-{{ .Revision }} | ||
| - &global_key_with_revision | ||
| << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-global-{{ .Revision }} | ||
| - << parameters.fallback_prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}-{{ .Revision }} | ||
| - << parameters.fallback_prefix >>-{{ .Environment.CACHE_VERSION }}-global-{{ .Revision }} | ||
| - *branch_key | ||
| - *fallback_branch_key | ||
| - *master_branch_key | ||
| - *fallback_master_branch_key | ||
| - unless: | ||
| condition: << parameters.fallback_prefix >> | ||
| steps: | ||
| - when: | ||
| condition: << parameters.affix_hashfile >> | ||
| steps: | ||
| - restore_cache: | ||
| name: Restoring turborepo '<< parameters.prefix >>' cache | ||
| keys: | ||
| - *branch_key_with_hashfile | ||
| - *global_key_with_hashfile | ||
| - *branch_key | ||
| - *master_branch_key | ||
| - unless: | ||
| condition: << parameters.affix_hashfile >> | ||
| steps: | ||
| - restore_cache: | ||
| name: Restoring turborepo '<< parameters.prefix >>' cache | ||
| keys: | ||
| - *branch_key_with_revision | ||
| - *global_key_with_revision | ||
| - *branch_key | ||
| - *master_branch_key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| parameters: | ||
| prefix: | ||
| description: Cache prefix | ||
| type: string | ||
| path: | ||
| description: Cached path | ||
| type: string | ||
| default: ./.turbo | ||
| affix_hashfile: | ||
| description: If true affixes the checksum of the relevant hashfile to the cache key | ||
| type: boolean | ||
| default: true | ||
| steps: | ||
| - when: | ||
| condition: << parameters.affix_hashfile >> | ||
| steps: | ||
| - save_cache: | ||
| name: Saving turborepo '<< parameters.prefix >>' global cache | ||
| key: << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-global-{{ checksum "/tmp/hashfiles/<< parameters.prefix >>.hashfile.json" }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - save_cache: | ||
| name: Saving turborepo '<< parameters.prefix >>' branch cache | ||
| key: << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}-{{ checksum "/tmp/hashfiles/<< parameters.prefix >>.hashfile.json" }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - unless: | ||
| condition: << parameters.affix_hashfile >> | ||
| steps: | ||
| - save_cache: | ||
| name: Saving turborepo '<< parameters.prefix >>' global cache | ||
| key: << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-global-{{ .Revision }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - save_cache: | ||
| name: Saving turborepo '<< parameters.prefix >>' branch cache | ||
| key: << parameters.prefix >>-{{ .Environment.CACHE_VERSION }}-branch-{{ .Branch }}-{{ .Revision }} | ||
| paths: | ||
| - << parameters.path >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| steps: | ||
| - store_artifacts: | ||
| name: Storing turborepo task summaries as artifacts | ||
| path: .turbo/runs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| parameters: | ||
| report_name: | ||
| description: Report name | ||
| type: string | ||
| steps: | ||
| - store_test_results: | ||
| name: Storing '<< parameters.report_name >>' results | ||
| path: << parameters.report_name >> | ||
| - store_artifacts: | ||
| name: Storing '<< parameters.report_name >>' as artifact | ||
| path: << parameters.report_name >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: node-executor-node-20 | ||
| command: | ||
| description: Script to execute build | ||
| type: string | ||
| default: yarn build --summarize true | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - turborepo_install | ||
| - turborepo_generate_hashfile: | ||
| prefix: build-cache | ||
| command: << parameters.command >> | ||
| - turborepo_restore_cache: | ||
| prefix: build-cache | ||
| - run: | ||
| command: << parameters.command >> | ||
| - turborepo_store_summaries | ||
| - turborepo_save_cache: | ||
| prefix: build-cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: node-executor-node-20 | ||
| command: | ||
| description: Script to check dependencies | ||
| type: string | ||
| default: yarn test:dependencies --summarize true | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - turborepo_install | ||
| - turborepo_generate_hashfile: | ||
| prefix: build-cache | ||
| command: yarn build | ||
| - turborepo_generate_hashfile: | ||
| prefix: dependencies-test-cache | ||
| command: << parameters.command >> | ||
| - turborepo_restore_cache: | ||
| fallback_prefix: build-cache | ||
| prefix: dependencies-test-cache | ||
| - run: | ||
| command: << parameters.command >> | ||
| - turborepo_store_summaries | ||
| - turborepo_save_cache: | ||
| prefix: dependencies-test-cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: node-executor-node-20 | ||
| command: | ||
| description: Script to execute tests | ||
| type: string | ||
| default: yarn build --summarize true && yarn test:integration | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - turborepo_install | ||
| - turborepo_generate_hashfile: | ||
| prefix: build-cache | ||
| command: yarn build | ||
| - turborepo_restore_cache: | ||
| prefix: build-cache | ||
| # needed because integration tests use testcontainers which starts docker containers | ||
| - setup_remote_docker: | ||
| version: default | ||
| - run: | ||
| command: << parameters.command >> | ||
| - turborepo_store_summaries | ||
| - turborepo_store_test_results: | ||
| report_name: ./integration.report.xml | ||
| - turborepo_persist_coverage: | ||
| coverage_dir: ./sonar/integration-coverage |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: node-executor-node-20 | ||
| command: | ||
| description: Script to lint dockerfiles | ||
| type: string | ||
| default: yarn lint:dockerfiles | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - turborepo_install | ||
| - install_latest_hadolint | ||
| - run: | ||
| command: << parameters.command >> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: node-executor-node-20 | ||
| command: | ||
| description: Script to lint files | ||
| type: string | ||
| default: yarn lint:report | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - turborepo_install | ||
| - turborepo_restore_cache: | ||
| prefix: eslint-cache | ||
| affix_hashfile: false | ||
| - run: | ||
| command: << parameters.command >> | ||
| - turborepo_save_cache: | ||
| prefix: eslint-cache | ||
| path: ./.eslintcache | ||
| affix_hashfile: false | ||
| - store_test_results: | ||
| path: ./reports/lint.report.xml | ||
| - store_artifacts: | ||
| path: ./reports/lint.report.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: node-executor-node-20 | ||
| schema_dir: | ||
| description: Directory to store schemas between jobs | ||
| type: string | ||
| default: "/tmp/schemas" | ||
| skip_tests: | ||
| description: Skip the tests but save the updated schemas | ||
| type: boolean | ||
| default: false | ||
| command: | ||
| description: Script to run schema validation | ||
| type: string | ||
| default: yarn schema:validate --summarize true | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - setup_remote_docker: | ||
| version: default | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - turborepo_install | ||
| - turborepo_generate_hashfile: | ||
| prefix: build-cache | ||
| command: yarn build | ||
| - turborepo_generate_hashfile: | ||
| prefix: schema-validate-cache | ||
| command: << parameters.command >> | ||
| - turborepo_restore_cache: | ||
| fallback_prefix: build-cache | ||
| prefix: schema-validate-cache | ||
| - clone_repo: | ||
| step_name: Clone openapi-schemas repository | ||
| github_username: GITHUB_USERNAME | ||
| github_token: GITHUB_TOKEN | ||
| github_repo_name: openapi-schemas | ||
| path_to_clone: ~/schemas | ||
| - openapi_restore_schemas: | ||
| from: ~/schemas | ||
| to: ~/voiceflow | ||
| - run: | ||
| name: Validate Schemas | ||
| environment: | ||
| SKIP_ACCEPTANCE_TESTS: "<< parameters.skip_tests >>" | ||
| command: << parameters.command >> | ||
| - turborepo_store_summaries | ||
| - turborepo_save_cache: | ||
| prefix: schema-validate-cache | ||
| - openapi_persist_schemas: | ||
| workspace_dir: "<< parameters.schema_dir >>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| parameters: | ||
| executor: | ||
| description: Executor to run the command on | ||
| type: executor | ||
| default: java-executor | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - checkout_clone | ||
| - attach_workspace: | ||
| at: ~/voiceflow | ||
| - sonarcloud/scan: | ||
| cache_version: 3 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not using cypress anymore