2021-07-14 16:26:38 +00:00
version : 2.1
2024-03-14 16:27:31 +00:00
orbs :
node : circleci/node@5.2.0
browser-tools : circleci/browser-tools@1.3.0
2021-07-14 16:26:38 +00:00
executors :
2021-12-14 21:43:44 +00:00
pw-focal-development :
2018-07-20 23:00:13 +00:00
docker :
2024-10-01 21:01:02 +00:00
- image : mcr.microsoft.com/playwright:v1.47.2-focal
2021-12-14 21:43:44 +00:00
environment :
NODE_ENV : development # Needed to ensure 'dist' folder created and devDependencies installed
2024-10-04 22:47:25 +00:00
PERCY_POSTINSTALL_BROWSER : 'true' # Needed to store the percy browser in cache deps
PERCY_LOGLEVEL: 'debug' # Enable DEBUG level logging for Percy (Issue : https://github.com/nasa/openmct/issues/5742)
2024-03-20 03:50:14 +00:00
PERCY_PARALLEL_TOTAL : 2
2023-04-17 21:26:13 +00:00
ubuntu :
machine :
image : ubuntu-2204:current
docker_layer_caching : true
2021-12-14 21:43:44 +00:00
commands :
build_and_install :
2024-10-04 22:47:25 +00:00
description : 'All steps used to build and install.'
2021-12-14 21:43:44 +00:00
parameters :
node-version :
type : string
2021-11-04 13:53:55 +00:00
steps :
- checkout
- node/install :
2022-01-03 21:44:57 +00:00
node-version : << parameters.node-version >>
2024-03-14 16:27:31 +00:00
- node/install-packages
2021-12-14 21:43:44 +00:00
generate_and_store_version_and_filesystem_artifacts :
2024-10-04 22:47:25 +00:00
description : 'Track important packages and files'
2021-12-14 21:43:44 +00:00
steps :
- run : |
2023-04-17 21:26:13 +00:00
[ [ $EUID -ne 0 ]] && (sudo mkdir -p /tmp/artifacts && sudo chmod 777 /tmp/artifacts) || (mkdir -p /tmp/artifacts && chmod 777 /tmp/artifacts)
printenv NODE_ENV >> /tmp/artifacts/NODE_ENV.txt || true
2021-12-14 21:43:44 +00:00
npm -v >> /tmp/artifacts/npm-version.txt
node -v >> /tmp/artifacts/node-version.txt
ls -latR >> /tmp/artifacts/dir.txt
- store_artifacts :
path : /tmp/artifacts/
2024-10-01 17:41:18 +00:00
download_verify_codecov_cli :
description : 'Download and verify Codecov CLI'
steps :
- run :
name : Download and verify Codecov CLI
command : |
# Download Codecov CLI
curl -Os https://cli.codecov.io/latest/linux/codecov
# Import Codecov's GPG key
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import
# Download and verify the SHA256SUM and its signature
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
# Verify the checksum
shasum -a 256 -c codecov.SHA256SUM
# Make the codecov executable
[ [ $EUID -ne 0 ]] && sudo chmod +x codecov || chmod +x codecov
./codecov --help
2022-06-30 18:50:47 +00:00
generate_e2e_code_cov_report :
2024-10-04 22:47:25 +00:00
description : 'Generate e2e code coverage artifacts and publish to codecov.io. Needed to that we can ignore the exit code status of the npm run test'
2022-06-30 18:50:47 +00:00
parameters :
suite :
type : string
steps :
2022-07-30 00:35:43 +00:00
- run : npm run cov:e2e:report || true
2024-10-01 17:41:18 +00:00
- download_verify_codecov_cli
- run :
name : Upload coverage report to Codecov
command : |
./codecov --verbose upload-process --disable-search \
-t $CODECOV_TOKEN \
-n 'e2e-<<parameters.suite>>' -${CIRCLE_WORKFLOW_ID} \
-F e2e-<<parameters.suite>> \
-f ./coverage/e2e/lcov.info
2021-12-14 21:43:44 +00:00
jobs :
npm-audit :
parameters :
node-version :
type : string
executor : pw-focal-development
steps :
- build_and_install :
node-version : <<parameters.node-version>>
- run : npm audit --audit-level=low
- generate_and_store_version_and_filesystem_artifacts
2022-02-15 22:08:53 +00:00
lint :
2022-01-07 19:39:25 +00:00
parameters :
node-version :
type : string
2021-12-14 21:43:44 +00:00
executor : pw-focal-development
2018-07-20 23:00:13 +00:00
steps :
2022-01-07 19:39:25 +00:00
- build_and_install :
node-version : <<parameters.node-version>>
2021-12-14 21:43:44 +00:00
- run : npm run lint
- generate_and_store_version_and_filesystem_artifacts
unit-test :
parameters :
node-version :
type : string
executor : pw-focal-development
steps :
- build_and_install :
node-version : <<parameters.node-version>>
2022-07-27 21:31:18 +00:00
- browser-tools/install-chrome :
replace-existing : false
2024-01-30 22:21:52 +00:00
- run :
command : |
mkdir -p dist/reports/tests/
TESTFILES=$(circleci tests glob "src/**/*Spec.js")
echo "$TESTFILES" | circleci tests run --command="xargs npm run test" --verbose
2024-10-01 17:41:18 +00:00
- download_verify_codecov_cli
- run :
name : Upload coverage report to Codecov
command : |
./codecov --verbose upload-process --disable-search \
-t $CODECOV_TOKEN \
-n 'unit-test' -${CIRCLE_WORKFLOW_ID} \
-F unit \
-f ./coverage/unit/lcov.info
2021-12-14 21:43:44 +00:00
- store_test_results :
path : dist/reports/tests/
- store_artifacts :
2022-06-30 18:50:47 +00:00
path : coverage
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
2021-12-14 21:43:44 +00:00
e2e-test :
2021-11-30 00:34:47 +00:00
parameters :
2024-08-07 21:36:14 +00:00
suite : #ci or full
2021-11-30 00:34:47 +00:00
type : string
2021-12-14 21:43:44 +00:00
executor : pw-focal-development
2024-10-04 22:47:25 +00:00
parallelism : 8
2021-11-30 00:34:47 +00:00
steps :
2021-12-14 21:43:44 +00:00
- build_and_install :
2023-12-19 00:48:13 +00:00
node-version : lts/hydrogen
2022-07-27 21:31:18 +00:00
- when : #Only install chrome-beta when running the 'full' suite to save $$$
2022-06-30 18:50:47 +00:00
condition :
2024-10-04 22:47:25 +00:00
equal : [ 'full' , <<parameters.suite>>]
2022-06-30 18:50:47 +00:00
steps :
- run : npx playwright install chrome-beta
2024-01-30 22:21:52 +00:00
- run :
command : |
mkdir test-results
TESTFILES=$(circleci tests glob "e2e/**/*.spec.js")
echo "$TESTFILES" | circleci tests run --command="xargs npm run test:e2e:<<parameters.suite>>" --verbose --split-by=timings
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_e2e_code_cov_report :
suite : <<parameters.suite>>
2021-11-30 00:34:47 +00:00
- store_test_results :
path : test-results/results.xml
- store_artifacts :
path : test-results
2022-06-30 18:50:47 +00:00
- store_artifacts :
path : coverage
- store_artifacts :
path : html-test-results
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
2024-02-21 23:29:38 +00:00
e2e-mobile :
executor : pw-focal-development
steps :
- build_and_install :
node-version : lts/hydrogen
- run : npm run test:e2e:mobile
- when :
condition :
equal : [ 42 , 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_e2e_code_cov_report :
suite : full
- store_test_results :
path : test-results/results.xml
- store_artifacts :
path : test-results
- store_artifacts :
path : coverage
- store_artifacts :
path : html-test-results
- when :
condition :
equal : [ 42 , 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
2023-04-10 19:25:17 +00:00
e2e-couchdb :
2023-04-17 21:26:13 +00:00
executor : ubuntu
2023-04-10 19:25:17 +00:00
steps :
- build_and_install :
2023-12-19 00:48:13 +00:00
node-version : lts/hydrogen
2024-10-01 21:01:02 +00:00
- run : npx playwright@1.47.2 install #Necessary for bare ubuntu machine
2023-04-10 19:25:17 +00:00
- run : |
export $(cat src/plugins/persistence/couch/.env.ci | xargs)
2024-08-07 21:36:14 +00:00
docker compose -f src/plugins/persistence/couch/couchdb-compose.yaml up --detach
2023-04-10 19:25:17 +00:00
sleep 3
bash src/plugins/persistence/couch/setup-couchdb.sh
2023-04-17 21:26:13 +00:00
- run : sh src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh #Replace LocalStorage Plugin with CouchDB
2023-04-10 19:25:17 +00:00
- run : npm run test:e2e:couchdb
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_e2e_code_cov_report :
suite : full #add to full suite
2023-04-10 19:25:17 +00:00
- store_test_results :
path : test-results/results.xml
- store_artifacts :
path : test-results
- store_artifacts :
path : coverage
- store_artifacts :
path : html-test-results
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
2023-12-19 00:48:13 +00:00
mem-test :
2022-05-25 22:45:11 +00:00
executor : pw-focal-development
steps :
- build_and_install :
2023-12-19 00:48:13 +00:00
node-version : lts/hydrogen
2023-09-20 17:34:05 +00:00
- run : npm run test:perf:memory
2023-12-19 00:48:13 +00:00
- store_test_results :
path : test-results/results.xml
- store_artifacts :
path : test-results
- store_artifacts :
path : html-test-results
- when :
condition :
equal : [ 42 , 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
perf-test :
executor : pw-focal-development
steps :
- build_and_install :
node-version : lts/hydrogen
2023-09-20 17:34:05 +00:00
- run : npm run test:perf:localhost
- run : npm run test:perf:contract
2022-05-25 22:45:11 +00:00
- store_test_results :
path : test-results/results.xml
- store_artifacts :
path : test-results
2022-06-30 18:50:47 +00:00
- store_artifacts :
path : html-test-results
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always run codecov reports regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
2024-03-20 03:50:14 +00:00
visual-a11y :
2022-07-30 00:35:43 +00:00
parameters :
2023-08-12 00:18:08 +00:00
suite :
type : string # ci or full
2022-07-30 00:35:43 +00:00
executor : pw-focal-development
2024-03-20 03:50:14 +00:00
parallelism : 2
2022-07-30 00:35:43 +00:00
steps :
- build_and_install :
2024-03-20 03:50:14 +00:00
node-version : lts/iron
2024-06-21 23:37:36 +00:00
- run : SHARD="$((${CIRCLE_NODE_INDEX}+1))"; npm run test:e2e:visual:<<parameters.suite>> -- --shard=${SHARD}/${CIRCLE_NODE_TOTAL}
2022-07-30 00:35:43 +00:00
- store_test_results :
path : test-results/results.xml
- store_artifacts :
path : test-results
- store_artifacts :
path : html-test-results
2023-04-17 21:26:13 +00:00
- when :
condition :
equal : [ 42 , 42 ] # Always generate version artifacts regardless of test failure https://discuss.circleci.com/t/make-custom-command-run-always-with-when-always/38957/2
steps :
- generate_and_store_version_and_filesystem_artifacts
2024-01-30 22:21:52 +00:00
2018-07-20 23:00:13 +00:00
workflows :
2021-12-14 21:43:44 +00:00
overall-circleci-commit-status : #These jobs run on every commit
2018-07-20 23:00:13 +00:00
jobs :
2023-05-18 21:29:20 +00:00
- lint :
2023-11-28 21:05:28 +00:00
name : node20-lint
node-version : lts/iron
2022-04-19 22:05:08 +00:00
- unit-test :
name : node18-chrome
2023-03-30 20:53:44 +00:00
node-version : lts/hydrogen
2021-12-14 21:43:44 +00:00
- e2e-test :
2024-08-07 21:36:14 +00:00
name : e2e-ci
suite : ci
2024-02-21 23:29:38 +00:00
- e2e-mobile
2024-03-20 03:50:14 +00:00
- visual-a11y :
name : visual-a11y-ci
2023-08-12 00:18:08 +00:00
suite : ci
2024-08-13 21:55:57 +00:00
- perf-test
- mem-test
2023-05-18 21:54:46 +00:00
2021-12-14 21:43:44 +00:00
the-nightly : #These jobs do not run on PRs, but against master at night
2021-08-18 20:16:15 +00:00
jobs :
2022-02-15 22:08:53 +00:00
- unit-test :
2023-11-28 21:05:28 +00:00
name : node20-chrome-nightly
node-version : lts/iron
2022-04-19 22:05:08 +00:00
- unit-test :
name : node18-chrome
2023-03-30 20:53:44 +00:00
node-version : lts/hydrogen
2021-12-14 21:43:44 +00:00
- npm-audit :
2023-04-17 21:26:13 +00:00
node-version : lts/hydrogen
2021-12-14 21:43:44 +00:00
- e2e-test :
name : e2e-full-nightly
2021-11-30 00:34:47 +00:00
suite : full
2024-02-21 23:29:38 +00:00
- e2e-mobile
2023-12-19 00:48:13 +00:00
- perf-test
2024-02-21 23:29:38 +00:00
- mem-test
2024-03-20 03:50:14 +00:00
- visual-a11y :
name : visual-a11y-nightly
2023-08-12 00:18:08 +00:00
suite : full
2023-12-19 00:48:13 +00:00
- e2e-couchdb
2021-08-18 20:16:15 +00:00
triggers :
- schedule :
2024-10-04 22:47:25 +00:00
cron : '0 0 * * *'
2021-08-18 20:16:15 +00:00
filters :
branches :
only :
2021-11-30 00:34:47 +00:00
- master