Skip to content

Commit

Permalink
Add cache parameters to jobs (#234)
Browse files Browse the repository at this point in the history
* Add all cache params available in install packages to jobs

* Add all tests as requisites to deploy
  • Loading branch information
marboledacci authored Oct 16, 2024
1 parent b9fc910 commit 72e914a
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,27 @@ workflows:
pub_type: production
requires:
- orb-tools/pack
- integration-test-override-ci-windows
- integration-test-override-ci
- integration-test-yarn
- integration-test-yarn-berry
- integration-test-yarn-berry-nocimg
- integration-test-install-specified-version
- integration-test-install-latest
- integration-test-install-lts
- integration-test-install-pnpm
- integration-test-pnpm
- integration-test-reinstall-yarn
- node-yarn-mocha-with-test-result-path-job
- node-yarn-mocha-test-job
- node-yarn-jest-test-job
- node-test-results-file-job
- node-npm-jest-test-job
- node-test-with-coverage
- node-run-npm-job
- node-pnpm-mocha-test-job
- node-test-no-junit
- node-pnpm-jest-test-job
- node-run-yarn-job
- node-run-pnpm-job
- node-run-upload-artifacts
Expand Down
37 changes: 36 additions & 1 deletion src/jobs/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,37 @@ parameters:
- 2xlarge
- 2xlarge+
type: enum

include-branch-in-cache-key:
type: boolean
default: true
description: >
If true, this cache bucket will only apply to jobs within the same branch.
cache-path:
description: |
By default, this orb will utilize 'npm ci' and cache the '~/.npm' directory. Override which path to cache with this parameter.
The cache will be ignored when using npm ci, as the command doesn't benefit from cache.
type: string
default: ''
cache-only-lockfile:
type: boolean
default: true
description: |
If true, package.json will be ignored in the cache key. Useful for projects where package.json changes do not always invalidate dependencies.
Note: package.json will still be the final fallback key incase a project is not configured with a lock file.
with-cache:
type: boolean
default: true
description: |
Cache your node packages automatically for faster install times.
Cache will be ignored when using npm ci.
check-cache:
type: enum
default: 'never'
enum: ['never', 'always', 'detect']
description: |
Yarn berry only for Zero install support -
Use 'always' to always --check-cache argument to yarn install.
Use 'detect' to enable caching of yarn.lock and to only add when required.
executor:
name: default
tag: << parameters.version >>
Expand All @@ -73,6 +103,11 @@ steps:
pkg-manager: <<parameters.pkg-manager>>
cache-version: <<parameters.cache-version>>
override-ci-command: <<parameters.override-ci-command>>
include-branch-in-cache-key: <<parameters.include-branch-in-cache-key>>
cache-path: <<parameters.cache-path>>
cache-only-lockfile: <<parameters.cache-only-lockfile>>
with-cache: <<parameters.with-cache>>
check-cache: <<parameters.check-cache>>
- run:
name: Run <<parameters.pkg-manager>> <<parameters.npm-run>>
working_directory: <<parameters.app-dir>>
Expand Down
37 changes: 36 additions & 1 deletion src/jobs/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,37 @@ parameters:
- 2xlarge
- 2xlarge+
type: enum

include-branch-in-cache-key:
type: boolean
default: true
description: >
If true, this cache bucket will only apply to jobs within the same branch.
cache-path:
description: |
By default, this orb will utilize 'npm ci' and cache the '~/.npm' directory. Override which path to cache with this parameter.
The cache will be ignored when using npm ci, as the command doesn't benefit from cache.
type: string
default: ''
cache-only-lockfile:
type: boolean
default: true
description: |
If true, package.json will be ignored in the cache key. Useful for projects where package.json changes do not always invalidate dependencies.
Note: package.json will still be the final fallback key incase a project is not configured with a lock file.
with-cache:
type: boolean
default: true
description: |
Cache your node packages automatically for faster install times.
Cache will be ignored when using npm ci.
check-cache:
type: enum
default: 'never'
enum: ['never', 'always', 'detect']
description: |
Yarn berry only for Zero install support -
Use 'always' to always --check-cache argument to yarn install.
Use 'detect' to enable caching of yarn.lock and to only add when required.
executor:
name: default
tag: << parameters.version >>
Expand All @@ -80,6 +110,11 @@ steps:
pkg-manager: <<parameters.pkg-manager>>
cache-version: <<parameters.cache-version>>
override-ci-command: <<parameters.override-ci-command>>
include-branch-in-cache-key: <<parameters.include-branch-in-cache-key>>
cache-path: <<parameters.cache-path>>
cache-only-lockfile: <<parameters.cache-only-lockfile>>
with-cache: <<parameters.with-cache>>
check-cache: <<parameters.check-cache>>
- when: # Run tests for NPM, without test results
condition:
and:
Expand Down

0 comments on commit 72e914a

Please sign in to comment.