For the complete documentation index, see llms.txt. This page is also available as Markdown.

currents cache

Use currents cache command to store and retrieve data from Currents-managed remote cache

The currents cache command stores and retrieves files on CI machines. The files are securely stored in Currents-managed storage. This command is designed to be used in CI environments to facilitate activities like Sharded runs.

currents cache stores metadata about CI execution and test artifacts, each cache item has a unique id. The id can be set manually, or Currents can generate it automatically based on CI environment variables

Automatic CI parameters detection is only supported for GitHub Actions and GitLab CI

Usage

To save items from paths path-1, path-2 to cache, use the following command:

npx currents cache set --key <record-key> --id <id> --path <path-1,path-2,...path-n>

To download cached items and store the files in --output-dir use the following command:

npx currents cache get --key <record-key> --id <id> --output-dir test-results

Subcommands

get

  • --id - used to identify which cache file to retrieve and extract. If not set, Currents will attempt to locate one based on the CI environment. (supports GitHub Actions, and GitLab CI)

  • --key - Currents Record Key

  • --preset - use a predefined preset for creating necessary configuration files for implementing CI workflows. See Cache Presets.

  • --preset-output <path-to-file>- path to a file for saving the preset configuration values (default: .currents_env)

  • --output-dir <path-to-dir> - directory for extracting the cache contents to, defaults to ./

  • --matrix-index <number> - the node index when using parallel/matrix jobs in CI. Used to correctly identify the node cache, and properly populate shards when using the last-run preset.

  • --matrix-total <number> - the node total when using parallel/matrix jobs in CI. Used to populate shards when using the last-run preset.

  • --help - show help message

set

  • --id - used to identify the cache for retrieval later. If not set, Currents will attempt to locate one based on the CI environment. (supports GitHub Actions, and GitLab CI)

  • --key - Currents Record Key

  • --preset

    • Use a predefined set of paths and files for cache uploads; the Currents team maintains presets for common CI workflows (for example, Sharded runs).

  • --path <path-1,path-2> - use --path <path-1,path-2> to provide a comma-separated list of paths to cache.

  • --pw-output-dir <dir> - Playwright output directory containing.last-run.json (default: ./test-results)

  • --matrix-index <number> - the node index when using parallel/matrix jobs in CI. Used to correctly identify the node cache, and properly populate shards when using the last-run preset.

  • --matrix-total <number> - the node total when using parallel/matrix jobs in CI. Used to populate shards when using the last-run preset.

  • --help - show help message

Cache Presets

Use a predefined set of paths and files for cache uploads with the --preset flag; the Currents team maintains presets for common CI workflows, such as rerunning only failed tests or retrieving the CI build ID of previous runs.

Preset: last-run

This preset defines a set of rules to implement Sharded runs flow on various CI providers.

  • currents cache set --preset last-run will automatically add to cache files necessary to rerun only failed tests (.last-run.json)

  • currents cache get --preset last-run will fetch the cache contents of the cache and also create the files necessary for rerunning only previously failed tests

The preset output file will contain CI-specific information that should be passed to the Playwright test command. For shard information to be presented correctly, --matrix-index and --matrix-total must be supplied.

Last updated

Was this helpful?