-
Notifications
You must be signed in to change notification settings - Fork 0
poc: attempt to create a simple, standard set of jobs & commands #377
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
base: master
Are you sure you want to change the base?
Changes from all commits
d043d81
65de91d
41251e6
6a49f5e
1978bcd
e3822b1
898f13c
2a52db4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| steps: | ||
| - run: | ||
| name: Authenticate Yarn | ||
| working_directory: /home/circleci/code | ||
| command: | | ||
| cat \<< EOF > ~/.yarnrc.yml | ||
| npmRegistries: | ||
| "https://registry.yarnpkg.com": | ||
| npmAuthToken: ${NPM_TOKEN} | ||
| EOF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| steps: | ||
| - run: | ||
| name: Checkout Repository | ||
| working_directory: /home/circleci | ||
| command: | | ||
| git clone "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" code | ||
| cd code | ||
| git checkout "${CIRCLE_SHA1}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| parameters: | ||
| repo_name: | ||
| type: string | ||
| directory: | ||
| type: string | ||
| branch: | ||
| type: string | ||
| steps: | ||
| - run: | ||
| name: Clone Repository | ||
| working_directory: /home/circleci | ||
| command: | | ||
| git clone --branch << parameters.branch >> "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/<< parameters.repo_name >>" << parameters.directory >> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| parameters: | ||
| cache_name: | ||
| type: string | ||
| default_branch: | ||
| type: string | ||
| default: master | ||
| use_lockfile: | ||
| type: boolean | ||
| default: false | ||
| steps: | ||
| - when: | ||
| condition: << parameters.use_lockfile >> | ||
| steps: | ||
| - restore_cache: | ||
| name: Restore << parameters.cache_name >> Cache | ||
| keys: | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--lockfile--{{ checksum "/home/circleci/code/yarn.lock" }} | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--{{ .Branch }}--{{ .Revision }} | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--{{ .Branch }}-- | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--<< parameters.default_branch >>-- | ||
| - unless: | ||
| condition: << parameters.use_lockfile >> | ||
| steps: | ||
| - restore_cache: | ||
| name: Restore << parameters.cache_name >> Cache | ||
| keys: | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--{{ .Branch }}--{{ .Revision }} | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--{{ .Branch }}-- | ||
| - << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--<< parameters.default_branch >>-- |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| parameters: | ||
| cache_name: | ||
| type: string | ||
| path: | ||
| type: string | ||
| use_lockfile: | ||
| type: boolean | ||
| default: false | ||
| path_2: | ||
| type: string | ||
| default: "" | ||
| steps: | ||
| - unless: | ||
| condition: << parameters.path_2 >> | ||
| steps: | ||
| - save_cache: | ||
| name: Save << parameters.cache_name >> Cache | ||
| key: << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--{{ .Branch }}--{{ .Revision }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - when: | ||
| condition: << parameters.path_2 >> | ||
| steps: | ||
| - save_cache: | ||
| name: Save << parameters.cache_name >> Cache | ||
| key: << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--branch--{{ .Branch }}--{{ .Revision }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - << parameters.path_2 >> | ||
| - when: | ||
| condition: << parameters.use_lockfile >> | ||
| steps: | ||
| - unless: | ||
| condition: << parameters.path_2 >> | ||
| steps: | ||
| - save_cache: | ||
| name: Save << parameters.cache_name >> Cache | ||
| key: << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--lockfile--{{ checksum "/home/circleci/code/yarn.lock" }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - when: | ||
| condition: << parameters.path_2 >> | ||
| steps: | ||
| - save_cache: | ||
| name: Save << parameters.cache_name >> Cache | ||
| key: << parameters.cache_name >>-cache-{{ .Environment.CACHE_VERSION }}--lockfile--{{ checksum "/home/circleci/code/yarn.lock" }} | ||
| paths: | ||
| - << parameters.path >> | ||
| - << parameters.path_2 >> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - run: | ||
| name: Build | ||
| command: | | ||
| yarn ci:build | ||
| - run: | ||
| name: Collect OpenAPI Schemas | ||
| working_directory: /home/circleci/code/apps | ||
| command: | | ||
| mkdir -p /tmp/openapi-schemas | ||
| cp -v --parents */openapi.next.json /tmp/openapi-schemas | ||
| - store_artifacts: | ||
| path: /tmp/openapi-schemas | ||
| destination: / | ||
| - std_save_cache: | ||
| cache_name: build | ||
| path: /home/circleci/code/.turbo/cache |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| ecr_url: | ||
| type: string | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| environment: | ||
| ECR_URL: << parameters.ecr_url >> | ||
| steps: | ||
| - setup_remote_docker | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - run: | ||
| name: Docker Publish | ||
| command: | | ||
| docker buildx create --use --bootstrap --name buildy-trying | ||
| yarn ci:docker:publish |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| steps: | ||
| - run: | ||
| name: Sparse Clone for Install | ||
| working_directory: /home/circleci | ||
| command: | | ||
| git clone --sparse "https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}" code | ||
| cd code | ||
| git checkout "${CIRCLE_SHA1}" | ||
| - run: | ||
| name: Checkout Critical Files for Install | ||
| working_directory: /home/circleci/code | ||
| command: | | ||
| git sparse-checkout set --no-cone .yarn/ .yalc/ /.yarnrc.yml /yarn.lock /package.json | ||
|
|
||
| # get patterns for package.json files in workspace | ||
| globs=$(cat package.json | jq '.workspaces[] | . + "/package.json"' -r) | ||
|
|
||
| for glob in ${globs}; do | ||
| git sparse-checkout add "${glob}" | ||
| done | ||
| - std_authenticate_yarn | ||
| - std_restore_cache: | ||
| cache_name: yarn | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - run: | ||
| name: Install Dependencies | ||
| working_directory: /home/circleci/code | ||
| command: | | ||
| yarn install --immutable | ||
| - std_save_cache: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i have found that CircleCI So we would still want to persist This is especially true for anything that |
||
| cache_name: yarn | ||
| path: /home/circleci/code/.yarn/cache | ||
| path_2: /home/circleci/code/.yarn/install-state.gz | ||
| use_lockfile: true | ||
| - std_save_cache: | ||
| cache_name: node | ||
| path: /home/circleci/code/node_modules | ||
| use_lockfile: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: lint | ||
| - run: | ||
| name: Run Linting | ||
| command: | | ||
| yarn ci:lint | ||
| - store_artifacts: | ||
| path: reports/lint.report.xml | ||
| destination: lint.report.xml | ||
| - store_test_results: | ||
| path: reports/lint.report.xml | ||
| - std_save_cache: | ||
| cache_name: lint | ||
| path: /home/circleci/code/.eslintcache | ||
| path_2: /home/circleci/code/node_modules/.cache/prettier |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - attach_workspace: | ||
| at: /home/circleci/code | ||
| - sonarcloud/scan: | ||
| cache_version: 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - std_restore_cache: | ||
| cache_name: test-dependencies | ||
| - run: | ||
| name: Run Dependency Tests | ||
| command: | | ||
| yarn ci:test:dependencies | ||
| - std_save_cache: | ||
| cache_name: test-dependencies | ||
| path: /home/circleci/code/.turbo/cache |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - setup_remote_docker | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - std_restore_cache: | ||
| cache_name: vitest-integration | ||
| - run: | ||
| name: Run Integration Tests | ||
| command: | | ||
| yarn ci:test:integration | ||
| - store_artifacts: | ||
| path: integration.report.xml | ||
| - store_artifacts: | ||
| path: sonar | ||
| - store_test_results: | ||
| path: integration.report.xml | ||
| - persist_to_workspace: | ||
| root: /home/circleci/code | ||
| paths: | ||
| - sonar/integration-coverage | ||
| - std_save_cache: | ||
| cache_name: vitest-integration | ||
| path: /home/circleci/code/node_modules/.experimental-vitest-cache |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - setup_remote_docker | ||
| - std_checkout | ||
| - std_clone_repo: | ||
| repo_name: openapi-schemas | ||
| directory: schemas | ||
| branch: master | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - run: | ||
| name: Restore OpenAPI Schemas | ||
| working_directory: /home/circleci/schemas | ||
| command: | | ||
| cp -v --parents apps/*/openapi.json /home/circleci/code | ||
| - run: | ||
| name: Test OpenAPI Schema | ||
| command: | | ||
| yarn ci:schema:validate |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - std_restore_cache: | ||
| cache_name: test-types | ||
| - run: | ||
| name: Check Types | ||
| command: | | ||
| yarn ci:test:types | ||
| - std_save_cache: | ||
| cache_name: test-types | ||
| path: /home/circleci/code/.turbo/cache |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| parameters: | ||
| executor: | ||
| type: executor | ||
| executor: << parameters.executor >> | ||
| working_directory: /home/circleci/code | ||
| steps: | ||
| - std_checkout | ||
| - std_restore_cache: | ||
| cache_name: node | ||
| use_lockfile: true | ||
| - std_restore_cache: | ||
| cache_name: build | ||
| - std_restore_cache: | ||
| cache_name: vitest-unit | ||
| - run: | ||
| name: Run Unit Tests | ||
| command: | | ||
| yarn ci:test:unit | ||
| - store_artifacts: | ||
| path: unit.report.xml | ||
| - store_artifacts: | ||
| path: sonar | ||
| - store_test_results: | ||
| path: unit.report.xml | ||
| - persist_to_workspace: | ||
| root: /home/circleci/code | ||
| paths: | ||
| - sonar/unit-coverage | ||
| - std_save_cache: | ||
| cache_name: vitest-unit | ||
| path: /home/circleci/code/node_modules/.experimental-vitest-cache |
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.
std_checkoutandstd_clonecan be a single job since they are basically the same (default to$CIRCLE_SHA1and$CIRCLE_PROJECT_REPONAME)do we have anywhere that we need multiple branches or commits upfront? CircleCI
checkoutdefaults to a blobless checkout. But I think we may only need 2 kinds: