Skip to content
Open
Show file tree
Hide file tree
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 Jun 19, 2025
d4f102a
refactor: simplify
effervescentia Jun 19, 2025
66122cf
fix: remove unused param
effervescentia Jun 19, 2025
83ea85e
fix: reorder
effervescentia Jun 19, 2025
de2488b
fix: param type
effervescentia Jun 19, 2025
6649438
ci: updated hadolint
effervescentia Jun 19, 2025
b654dd0
feat: more
effervescentia Jun 19, 2025
339da86
chore: add debug logging
effervescentia Jul 8, 2025
595e9b5
chore: more debugging
effervescentia Jul 8, 2025
f5bee89
feat: encode hash
effervescentia Jul 9, 2025
f12eec5
fix: use correct parameters variable
effervescentia Jul 9, 2025
10e9abc
fix: break up commands for debugging
effervescentia Jul 9, 2025
f6db27e
fix: syntax
effervescentia Jul 9, 2025
2016530
fix: storing artifacts
effervescentia Jul 9, 2025
8508d4b
chore: better caching
effervescentia Jul 9, 2025
5d7fb70
chore: remove debug logging
effervescentia Jul 9, 2025
c75d5d0
fix: create hashfiles folder
effervescentia Jul 9, 2025
519a63f
fix: restore build cache optionally for dependency tests
effervescentia Jul 9, 2025
fad9761
feat: new job
effervescentia Jul 9, 2025
b2d245e
fix: remove unused param
effervescentia Jul 9, 2025
a396341
fix: jq syntax
effervescentia Jul 9, 2025
eec0f8b
feat: caching without hashfiles
effervescentia Jul 9, 2025
69c7d22
fix: add parameter type
effervescentia Jul 9, 2025
4d428f4
fix: inline refs
effervescentia Jul 9, 2025
f14fe79
feat: turborepo schema validation with caching
effervescentia Jul 9, 2025
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
22 changes: 22 additions & 0 deletions src/commands/turborepo/turborepo_generate_hashfile.yml
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
17 changes: 17 additions & 0 deletions src/commands/turborepo/turborepo_install.yml
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 >>
9 changes: 9 additions & 0 deletions src/commands/turborepo/turborepo_persist_coverage.yml
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 >>
75 changes: 75 additions & 0 deletions src/commands/turborepo/turborepo_restore_cache.yml
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
39 changes: 39 additions & 0 deletions src/commands/turborepo/turborepo_save_cache.yml
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 >>
4 changes: 4 additions & 0 deletions src/commands/turborepo/turborepo_store_summaries.yml
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
11 changes: 11 additions & 0 deletions src/commands/turborepo/turborepo_store_test_results.yml
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 >>
1 change: 0 additions & 1 deletion src/commands/yarn/vf_save_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ steps:
- << parameters.working_directory >>/.yarn/cache
- << parameters.working_directory >>/.yarn/install-state.gz
- << parameters.working_directory >>/node_modules
- ~/.cache/Cypress
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not using cypress anymore

25 changes: 25 additions & 0 deletions src/jobs/turborepo/turborepo_build.yml
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
29 changes: 29 additions & 0 deletions src/jobs/turborepo/turborepo_dependency_tests.yml
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
30 changes: 30 additions & 0 deletions src/jobs/turborepo/turborepo_integration_tests.yml
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
18 changes: 18 additions & 0 deletions src/jobs/turborepo/turborepo_lint_dockerfile.yml
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 >>
28 changes: 28 additions & 0 deletions src/jobs/turborepo/turborepo_lint_report.yml
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
53 changes: 53 additions & 0 deletions src/jobs/turborepo/turborepo_schema_validate.yml
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 >>"
12 changes: 12 additions & 0 deletions src/jobs/turborepo/turborepo_sonarcloud_scan.yml
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
Loading